邓洁 : 定位框只显示确认按钮
This commit is contained in:
@@ -179,6 +179,32 @@
|
||||
},
|
||||
fail(err) {
|
||||
console.log("获取经纬度失败", err);
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
if (!res.locationEnabled || !res.locationAuthorized) {
|
||||
uni.showModal({
|
||||
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
|
||||
confirmText: "确认",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// uni.openSetting({
|
||||
// success: (res) => {
|
||||
// console.log(res);
|
||||
that.getUserLocation();
|
||||
// }
|
||||
// })
|
||||
} else {
|
||||
console.log('取消');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
that.getUserLocation()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
},
|
||||
@@ -189,20 +215,77 @@
|
||||
success: function(res) {
|
||||
if (res.authSetting['scope.userFuzzyLocation']) {
|
||||
console.log('用户已经授权定位权限');
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
if (!res.locationEnabled || !res.locationAuthorized) {
|
||||
uni.showModal({
|
||||
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
|
||||
confirmText: "确认",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// uni.openSetting({
|
||||
// success: (res) => {
|
||||
// console.log(res);
|
||||
that.getUserLocation();
|
||||
// }
|
||||
// })
|
||||
} else {
|
||||
console.log('取消');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
that.getUserLocation()
|
||||
}
|
||||
}
|
||||
})
|
||||
// that.getUserLocation()
|
||||
} else {
|
||||
console.log('用户未授权定位权限');
|
||||
uni.authorize({
|
||||
scope: 'scope.userFuzzyLocation',
|
||||
success: function() {
|
||||
console.log('授权成功');
|
||||
that.getUserLocation()
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
if (!res.locationEnabled || !res.locationAuthorized) {
|
||||
// uni.showToast({
|
||||
// title: '请确保手机系统定位已开启',
|
||||
// icon: 'none',
|
||||
// duration: 2000,
|
||||
// })
|
||||
uni.showModal({
|
||||
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
|
||||
confirmText: "确认",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// uni.openSetting({
|
||||
// success: (res) => {
|
||||
// console.log(res);
|
||||
that.getUserLocation();
|
||||
// }
|
||||
// })
|
||||
} else {
|
||||
console.log('取消');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
that.getUserLocation()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: function() {
|
||||
console.log('授权失败');
|
||||
uni.showModal({
|
||||
content: '检测到您没打开获取信息功能权限,是否去设置打开?',
|
||||
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
|
||||
confirmText: "确认",
|
||||
cancelText: '取消',
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.openSetting({
|
||||
|
||||
Reference in New Issue
Block a user