当前位置:网站首页>微信小程序用户拒绝授权地理位置信息再次调起授权窗口
微信小程序用户拒绝授权地理位置信息再次调起授权窗口
2022-06-29 08:26:00 【swag_特约男演员】
目的

注意

chooseLocation() {
let that = this
wx.chooseLocation({
latitude: '',
longitude: '',
success(res) {
console.log(res)
that.setData({
'query.dz': res.address,
'query.x': res.longitude,
'query.y': res.latitude
})
},
fail(res) {
console.log(res)
wx.getSetting({
success: function(res) {
var statu = res.authSetting
if (!statu['scope.userLocation']) {
wx.showModal({
title: '是否授权当前位置',
content: '需要获取您的地理位置,请确认授权,否则选择位置功能将无法使用',
success: function(tip) {
if (tip.confirm) {
wx.openSetting({
success: function(data) {
if (data.authSetting['scope.userLocation'] === true) {
wx.showToast({
title: '授权成功',
icon: 'success',
duration: 1000
})
//授权成功之后,再调用chooseLocation选择地方
wx.chooseLocation({
success(res) {
console.log(res)
that.setData({
'query.dz': res.address,
'query.x': res.longitude,
'query.y': res.latitude
})
}
})
} else {
wx.showToast({
title: '授权失败',
icon: 'error',
duration: 1000
})
}
}
})
}
}
})
}
},
fail: function(res) {
wx.showToast({
title: '调用授权窗口失败',
icon: 'error',
duration: 1000
})
}
})
}
})
}
边栏推荐
- ThinkPHP 6 使用 mongoDB
- 2022第六季完美童模 合肥赛区 决赛圆满落幕
- 51单片机中断与定时器计数器,基于普中科技HC6800-ESV2.0
- Standard | China payment and clearing Association releases the first privacy computing financial specification
- 首次触电,原来你是这样的龙蜥社区 | 龙蜥开发者说第8期
- 来个小总结吧
- Differences between x86 and x64
- [most complete] download and installation of various versions of PS and tutorial of small test ox knife (Photoshop CS3 ~ ~ Photoshop 2022)
- Core development board & debugger
- io流的总结
猜你喜欢
随机推荐
图解SOC中的Timer(一):系统里有哪些Timer?
Self attention mechanism
Wallpaper applet source code double ended wechat Tiktok applet
Is it safe for the top ten securities companies to open accounts? Is it reliable?
2022第六季完美童模 合肥賽區 决賽圓滿落幕
首次触电,原来你是这样的龙蜥社区 | 龙蜥开发者说第8期
在 golang 中是如何对 epoll 进行封装的?
July 2022 (advanced soft test) information system project manager certification enrollment Brochure
General multiplier design, verilog code
2022第六季完美童模 海口赛区 选拔赛圆满落幕
Pointnet的网络学习
宏,函数和内联函数
uniapp微信小程序报错 TypeError: Cannot read property ‘call‘ of undefined
2022第六季完美童模 清远赛区 海选赛圆满落幕
Activemq消息组件发布订阅ReDelivery消息重新投递
The return values of hostname -f and uname -n may be different
CDGA|交通行业做好数字化转型的核心是什么?
[most complete] download and installation of various versions of PS and tutorial of small test ox knife (Photoshop CS3 ~ ~ Photoshop 2022)
JS获取图片或base64的宽高等基本信息
Verilog shift operator








