app.getLocation(function(result) {
uni.getSetting({
success(res) {
if (!res.authSetting['scope.userLocation']) {
uni.authorize({
scope: 'scope.userLocation',
success() {
setTimeout(() => {
uni.chooseLocation({
success: function(res) {
}
});
}, 500)
},
fail() {
uni.showModal({
title: '需要位置权限',
content: '请在设置页面中允许小程序访问您的位置',
success(res) {
if (res.confirm) {
uni.openSetting({
success(settingRes) {
if (settingRes
.authSetting[
'scope.userLocation'
]) {
uni.chooseLocation({
success: function(
res
) {
setTimeout
(() => {
uni.chooseLocation({
success: function(
res
) {
}
});
},
500
)
}
});
}
}
});
}
}
});
}
});
} else {
setTimeout(() => {
uni.chooseLocation({
success: function(res) {
}
});
}, 500)
}
}
});
});
a***@163.com
错误回调有信息吗
2024-11-21 10:48