|
@@ -224,12 +224,12 @@
|
|
|
},
|
|
|
onLoad() {
|
|
|
that = this
|
|
|
- this.checkOpenGPSServiceByAndroidIOS()
|
|
|
+ // this.checkOpenGPSServiceByAndroidIOS()
|
|
|
},
|
|
|
onHide() {
|
|
|
this.isdblclick = 0
|
|
|
},
|
|
|
- onShow() {
|
|
|
+ async onShow() {
|
|
|
if (this.scrollTop > 1200) {
|
|
|
uni.setTabBarItem({
|
|
|
index: 0,
|
|
@@ -245,21 +245,23 @@
|
|
|
selectedIconPath: 'static/images/common/dingdan@2x.png'
|
|
|
})
|
|
|
var that = this
|
|
|
- // var photol=await permision.checkSystemEnableLocation()
|
|
|
- // if (uni.getStorageSync('confirm_location')) {
|
|
|
- // // that.get_localtion_permission()
|
|
|
- // }
|
|
|
+
|
|
|
//获取上一次点击起装卸地
|
|
|
if (uni.getStorageSync('fPlaceObj')) {
|
|
|
that.startPlace = uni.getStorageSync('fPlaceObj');
|
|
|
} else {
|
|
|
- that.startPlace.selected = '北京'
|
|
|
- uni.setStorageSync('fPlaceObj', {
|
|
|
- fchoosearea: '全部',
|
|
|
- fchoosecity: '市辖区',
|
|
|
- fchooseprovince: '北京',
|
|
|
- selected: '北京'
|
|
|
- })
|
|
|
+ var photol=await permision.checkSystemEnableLocation()
|
|
|
+ if (uni.getStorageSync('confirm_location')||photol) {
|
|
|
+ this.getLngLat()
|
|
|
+ }else{
|
|
|
+ that.startPlace.selected = '北京'
|
|
|
+ uni.setStorageSync('fPlaceObj', {
|
|
|
+ fchoosearea: '全部',
|
|
|
+ fchoosecity: '市辖区',
|
|
|
+ fchooseprovince: '北京',
|
|
|
+ selected: '北京'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
if (uni.getStorageSync('sPlaceObj')) {
|
|
|
that.endPlace = uni.getStorageSync('sPlaceObj');
|
|
@@ -352,10 +354,11 @@
|
|
|
if (photol == true) {
|
|
|
this.getLngLat()
|
|
|
} else {
|
|
|
- that.$refs.uToast.show({
|
|
|
- type: 'error',
|
|
|
- message: "未获取定位权限!",
|
|
|
- })
|
|
|
+ // that.$refs.uToast.show({
|
|
|
+ // type: 'error',
|
|
|
+ // message: "未获取定位权限!",
|
|
|
+ // })
|
|
|
+ this.checkOpenGPSServiceByAndroidIOS()
|
|
|
}
|
|
|
},
|
|
|
async getLngLat() {
|
|
@@ -406,63 +409,65 @@
|
|
|
var main = plus.android.runtimeMainActivity();
|
|
|
var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
|
|
|
if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
|
|
|
- // uni.showModal({
|
|
|
- // title: '提示',
|
|
|
- // content: '请打开定位服务功能',
|
|
|
- // // showCancel: false, // 不显示取消按钮
|
|
|
- // success(res) {
|
|
|
- // if (res.confirm) {
|
|
|
- // uni.setStorageSync('confirm_location', 1)
|
|
|
- // if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
|
|
|
-
|
|
|
- // 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);
|
|
|
- // main.startActivity(intent); // 打开系统设置GPS服务页面
|
|
|
- // } else {
|
|
|
- // uni.setStorageSync('fPlaceObj', {
|
|
|
- // fchoosearea: '全部',
|
|
|
- // fchoosecity: '市辖区',
|
|
|
- // fchooseprovince: '北京',
|
|
|
- // selected: '东城'
|
|
|
- // })
|
|
|
- // uni.setStorageSync('sPlaceObj', {
|
|
|
- // schoosearea: '请选择区',
|
|
|
- // schoosecity: '请选择市',
|
|
|
- // schooseprovince: '全国',
|
|
|
- // selected: '全国'
|
|
|
- // })
|
|
|
- // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // uni.setStorageSync('fPlaceObj', {
|
|
|
- // fchoosearea: '全部',
|
|
|
- // fchoosecity: '市辖区',
|
|
|
- // fchooseprovince: '北京',
|
|
|
- // selected: '东城'
|
|
|
- // })
|
|
|
- // uni.setStorageSync('sPlaceObj', {
|
|
|
- // schoosearea: '请选择区',
|
|
|
- // schoosecity: '请选择市',
|
|
|
- // schooseprovince: '全国',
|
|
|
- // selected: '全国'
|
|
|
- // })
|
|
|
- // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- uni.setStorageSync('fPlaceObj', {
|
|
|
- fchoosearea: '全部',
|
|
|
- fchoosecity: '市辖区',
|
|
|
- fchooseprovince: '北京',
|
|
|
- selected: '东城'
|
|
|
- })
|
|
|
- uni.setStorageSync('sPlaceObj', {
|
|
|
- schoosearea: '请选择区',
|
|
|
- schoosecity: '请选择市',
|
|
|
- schooseprovince: '全国',
|
|
|
- selected: '全国'
|
|
|
- })
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '请打开定位服务功能',
|
|
|
+ // showCancel: false, // 不显示取消按钮
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.setStorageSync('confirm_location', 1)
|
|
|
+ if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
|
|
|
+
|
|
|
+ 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);
|
|
|
+ main.startActivity(intent); // 打开系统设置GPS服务页面
|
|
|
+ console.log()
|
|
|
+ }
|
|
|
+ // else {
|
|
|
+ // uni.setStorageSync('fPlaceObj', {
|
|
|
+ // fchoosearea: '全部',
|
|
|
+ // fchoosecity: '市辖区',
|
|
|
+ // fchooseprovince: '北京',
|
|
|
+ // selected: '东城'
|
|
|
+ // })
|
|
|
+ // uni.setStorageSync('sPlaceObj', {
|
|
|
+ // schoosearea: '请选择区',
|
|
|
+ // schoosecity: '请选择市',
|
|
|
+ // schooseprovince: '全国',
|
|
|
+ // selected: '全国'
|
|
|
+ // })
|
|
|
+ // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
|
|
|
+ // }
|
|
|
+ } else {
|
|
|
+ // uni.setStorageSync('fPlaceObj', {
|
|
|
+ // fchoosearea: '全部',
|
|
|
+ // fchoosecity: '市辖区',
|
|
|
+ // fchooseprovince: '北京',
|
|
|
+ // selected: '东城'
|
|
|
+ // })
|
|
|
+ // uni.setStorageSync('sPlaceObj', {
|
|
|
+ // schoosearea: '请选择区',
|
|
|
+ // schoosecity: '请选择市',
|
|
|
+ // schooseprovince: '全国',
|
|
|
+ // selected: '全国'
|
|
|
+ // })
|
|
|
+ // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // uni.setStorageSync('fPlaceObj', {
|
|
|
+ // fchoosearea: '全部',
|
|
|
+ // fchoosecity: '市辖区',
|
|
|
+ // fchooseprovince: '北京',
|
|
|
+ // selected: '东城'
|
|
|
+ // })
|
|
|
+ // uni.setStorageSync('sPlaceObj', {
|
|
|
+ // schoosearea: '请选择区',
|
|
|
+ // schoosecity: '请选择市',
|
|
|
+ // schooseprovince: '全国',
|
|
|
+ // selected: '全国'
|
|
|
+ // })
|
|
|
if (uni.getStorageSync('fPlaceObj')) {
|
|
|
that.startPlace = uni.getStorageSync('fPlaceObj');
|
|
|
}
|
|
@@ -957,11 +962,14 @@
|
|
|
async clickTab(val) {
|
|
|
console.log("val", val)
|
|
|
this.tabIndex = val.index
|
|
|
- if (val == '按距离') {
|
|
|
- var photol = await permision.checkSystemEnableLocation()
|
|
|
- if (uni.getStorageSync('confirm_location')) {
|
|
|
+ if (val.name == '按距离') {
|
|
|
+ console.log(1)
|
|
|
+ // this.checkOpenGPSServiceByAndroidIOS()
|
|
|
+ // var photol = await permision.checkSystemEnableLocation()
|
|
|
+ // console.log("photol",photol)
|
|
|
+ // if (!photol) {
|
|
|
that.get_localtion_permission()
|
|
|
- }
|
|
|
+ // }
|
|
|
} else {
|
|
|
this.upCallback({
|
|
|
size: 10,
|