wx.getLocation取消定位授权,再次调用直接返回失败?想要重新调起授权要怎么做?
wx.getLocation({
type: ‘gcj02’,
success(res) {},
fail(res) {
wx.getSetting({
success(res) {
if (!res.authSetting[‘scope.userLocation’]) {
wx.authorize({
scope: ‘scope.userLocation’,
success() {
console.log(“授权成功”)
},
fail() {
console.log(“授权失败”)
wx.showModal({
title: ‘提示’,
content: ‘您未授权地理位置,功能将无法使用’,
showCancel: true,
confirmText: “授权”,
success(res) {
if (res.confirm) {
wx.openSetting({
success: (res) => {
if (!res.authSetting[‘scope.userLocation’]) {
wx.showModal({
title: ‘提示’,
content: ‘您未授权地理位置,功能将无法使用’,
showCancel: false,
})
}
},
})
}
},
})
}
})
}
}
})
}
})