WeChat Mini Program Compatible with User Refusal to Obtain Location Permission User Refusal Permission Handling

 function getAuthor() {
wx.getSetting({
success(res) {
if (!res.authSetting['scope.userLocation']) {
wx.openSetting({
success: (res) =>{
console.log(res) if (!res.authSetting['scope.userLocation']) {
wx.showModal({
title: 'Reminder',
content: 'Need to get your location to use the mini program',
cancelText: 'Do not use',
confirmText: 'Get location',
success: function(res) {
if (res.confirm) {
getAuthor();
} else if (res.cancel) {
wx.showToast({
title: 'You can click the bottom left corner position button to get the location again',
icon: 'success',
duration: 3000
})
}
}
})
}
}
})
}
}
})
}