|
@@ -140,57 +140,89 @@
|
|
|
title: '获取定位中',
|
|
|
mask: true
|
|
|
})
|
|
|
- uni.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
- geocode: true,
|
|
|
- success: res => {
|
|
|
- console.log('定位地址')
|
|
|
- console.log(res)
|
|
|
+ this.$helper.fUN_AmapLocation.start(
|
|
|
+ {
|
|
|
+ intervalTime: 1000*3,
|
|
|
+ isReport: false,
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ //见下方定位返回示例
|
|
|
+ console.log('====fUN_AmapLocation定位====', JSON.stringify(res));
|
|
|
if (res.latitude) {
|
|
|
this.detailData.carrierInfo.loadingAreaLongitude = res.longitude;
|
|
|
this.detailData.carrierInfo.loadingAreaLatitude = res.latitude;
|
|
|
- this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.address.city)
|
|
|
- this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res.address
|
|
|
+ this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.city)
|
|
|
+ this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res
|
|
|
.district);
|
|
|
console.log(this.detailData.carrierInfo.sendCity)
|
|
|
console.log(this.detailData.carrierInfo.sendArea)
|
|
|
this.$forceUpdate()
|
|
|
- uni.hideLoading()
|
|
|
- } else {
|
|
|
- if (uni.getSystemInfoSync().platform == 'android') {
|
|
|
- var context = plus.android.importClass("android.content.Context");
|
|
|
- var locationManager = plus.android.importClass(
|
|
|
- "android.location.LocationManager");
|
|
|
- var main = plus.android.runtimeMainActivity();
|
|
|
- var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
|
|
|
- this.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
|
|
|
- }
|
|
|
- if (this.bool === false) {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '请打开定位服务',
|
|
|
- success: ({
|
|
|
- confirm,
|
|
|
- cancel
|
|
|
- }) => {
|
|
|
- if (confirm) {
|
|
|
- if (uni.getSystemInfoSync().platform == 'android') {
|
|
|
- var Intent = plus.android.importClass(
|
|
|
- 'android.content.Intent');
|
|
|
- var Settings = plus.android.importClass(
|
|
|
- 'android.provider.Settings');
|
|
|
- var intent = new Intent(Settings
|
|
|
- .ACTION_LOCATION_SOURCE_SETTINGS);
|
|
|
- var main = plus.android.runtimeMainActivity();
|
|
|
- main.startActivity(intent); // 打开系统设置GPS服务页面
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
+ uni.hideLoading()
|
|
|
+
|
|
|
+ this.$helper.fUN_AmapLocation.stop({}, result => {
|
|
|
+ console.log('====fUN_AmapLocation定位stop====', JSON.stringify(result));
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+ );
|
|
|
+ // uni.getLocation({
|
|
|
+ // type: 'gcj02',
|
|
|
+ // geocode: true,
|
|
|
+ // success: res => {
|
|
|
+ // console.log('定位地址')
|
|
|
+ // console.log(res)
|
|
|
+ // if (res.latitude) {
|
|
|
+ // this.detailData.carrierInfo.loadingAreaLongitude = res.longitude;
|
|
|
+ // this.detailData.carrierInfo.loadingAreaLatitude = res.latitude;
|
|
|
+ // this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.address.city)
|
|
|
+ // this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res.address
|
|
|
+ // .district);
|
|
|
+ // console.log(this.detailData.carrierInfo.sendCity)
|
|
|
+ // console.log(this.detailData.carrierInfo.sendArea)
|
|
|
+ // this.$forceUpdate()
|
|
|
+ // uni.hideLoading()
|
|
|
+ // } else {
|
|
|
+ // if (uni.getSystemInfoSync().platform == 'android') {
|
|
|
+ // var context = plus.android.importClass("android.content.Context");
|
|
|
+ // var locationManager = plus.android.importClass(
|
|
|
+ // "android.location.LocationManager");
|
|
|
+ // var main = plus.android.runtimeMainActivity();
|
|
|
+ // var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
|
|
|
+ // this.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
|
|
|
+ // }
|
|
|
+ // if (this.bool === false) {
|
|
|
+ // uni.showModal({
|
|
|
+ // title: '提示',
|
|
|
+ // content: '请打开定位服务',
|
|
|
+ // success: ({
|
|
|
+ // confirm,
|
|
|
+ // cancel
|
|
|
+ // }) => {
|
|
|
+ // if (confirm) {
|
|
|
+ // if (uni.getSystemInfoSync().platform == 'android') {
|
|
|
+ // var Intent = plus.android.importClass(
|
|
|
+ // 'android.content.Intent');
|
|
|
+ // var Settings = plus.android.importClass(
|
|
|
+ // 'android.provider.Settings');
|
|
|
+ // var intent = new Intent(Settings
|
|
|
+ // .ACTION_LOCATION_SOURCE_SETTINGS);
|
|
|
+ // var main = plus.android.runtimeMainActivity();
|
|
|
+ // main.startActivity(intent); // 打开系统设置GPS服务页面
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // fail: res => {
|
|
|
+ // console.log('定位失败')
|
|
|
+ // console.log(res)
|
|
|
+
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
},
|
|
|
alertBtn() {
|
|
|
// uni.navigateTo({
|
|
@@ -276,6 +308,21 @@
|
|
|
} else {
|
|
|
_title = '提交成功!'
|
|
|
}
|
|
|
+ this.$helper.fUN_AmapLocation.start(
|
|
|
+ {
|
|
|
+ intervalTime: 1000*60,
|
|
|
+ isReport: true,
|
|
|
+ reportInterval: 5,
|
|
|
+ url: 'http://192.168.0.66/fun/open/test_json.do',
|
|
|
+ params: { a: 1, B: '测试', c: true },
|
|
|
+ headers: { a: '123', B: 'abcd' }
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ //见下方定位返回示例
|
|
|
+ console.log('====确认装车开启连续定位====', JSON.stringify(res));
|
|
|
+ //判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
|
|
|
+ }
|
|
|
+ );
|
|
|
this.$refs.uToast.show({
|
|
|
type: 'success',
|
|
|
message: _title,
|