邓洁 : 提示定位框
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
searchPageNum: 1,
|
||||
shopListLength: '',
|
||||
shopSearchListLength: '',
|
||||
isAuth: false,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@@ -62,6 +63,33 @@
|
||||
this.open()
|
||||
this.getClassList()
|
||||
},
|
||||
onShow() {
|
||||
if (this.isAuth) {
|
||||
if (!uni.getStorageSync('city_code')) {
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
if (!res.locationEnabled || !res.locationAuthorized) {
|
||||
uni.showModal({
|
||||
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
|
||||
confirmText: "确认",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.getUserLocation();
|
||||
} else {
|
||||
console.log('取消');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.getUserLocation()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.chooseIndex == 0 && this.shopListLength !== 0) {
|
||||
this.shopPageNum++
|
||||
@@ -247,6 +275,7 @@
|
||||
uni.authorize({
|
||||
scope: 'scope.userFuzzyLocation',
|
||||
success: function() {
|
||||
this.isAuth = true
|
||||
console.log('授权成功');
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
|
||||
Reference in New Issue
Block a user