当前位置:网站首页>微信小程序用户拒绝授权地理位置信息再次调起授权窗口
微信小程序用户拒绝授权地理位置信息再次调起授权窗口
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
})
}
})
}
})
}
边栏推荐
- How to recite words in tables
- Let you know today that the passing rate of the PMP Exam is 97%, is it believable
- Verilog expression
- Leetcode(142)——环形链表 II
- P6772 [noi2020] gourmet (matrix fast power)
- [most complete] download and installation of various versions of PS and tutorial of small test ox knife (Photoshop CS3 ~ ~ Photoshop 2022)
- Dialogue | prospects and challenges of privacy computing in the digital age
- Chengtong network disk imitation blue playing network disk source code with video tutorial
- ActiveMQ message component publish subscribe redelivery message redelivery
- 积分商城运营要如何做才能获取到利润
猜你喜欢
随机推荐
宏,函数和内联函数
npm常用命令
人民链鲍大伟:打破壁垒,建立全域数据治理共享及应用平台
[untitled]
Oracle subquery
uni-app获取当前页面路由url
CDGA|交通行业做好数字化转型的核心是什么?
ThinkPHP 6 使用 mongoDB
闭关修炼(二十四)浅入了解跨域问题
(pytorch进阶之路三)encoder self attention mask
sql server 用 administrator 权限运行吗?还是以普通用户运行呢?
在 RedisTemplate 中使用 scan
laravel 8 实现 订单表按月份水平分表
【最全】PS各个版本下载安装及小试牛刀教程(PhotoShop CS3 ~~ PhotoShop 2022)
Open3D 隐藏点移除
cokkie和session的区别
TypeScript 變量聲明 —— 類型斷言
Enrollment brochure for system integration project management engineer certification in July 2022
图片格式-webp
Let's make a summary









