当前位置:网站首页>微信小程序用户拒绝授权地理位置信息再次调起授权窗口
微信小程序用户拒绝授权地理位置信息再次调起授权窗口
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
})
}
})
}
})
}
边栏推荐
- Differences between x86 and x64
- ThreadLocal thread variable
- Verilog splicing operation symbol
- P4769-[noi2018] bubble sort [combinatorics, tree array]
- Verilog reduction operator
- Dialogue | prospects and challenges of privacy computing in the digital age
- 微积分学习
- PointNet/Pointnet++训练及测试
- Let you know today that the passing rate of the PMP Exam is 97%, is it believable
- Standard | China payment and clearing Association releases the first privacy computing financial specification
猜你喜欢

工厂模式

Chengtong network disk imitation blue playing network disk source code with video tutorial

Carbon emission reduction of second-hand trading platform, with assessment standards

Calculus Learning

Déclaration de la variable Typescript - - assertion de type

Mysql使用union all统计多张表组合总数,并分别统计各表数量

Let you know today that the passing rate of the PMP Exam is 97%, is it believable

Matlab usage

2022年7月产品经理认证招生简章(NPDP)

工厂模式和策略模式的区别
随机推荐
How to recite words in tables
2022第六季完美童模 合肥賽區 决賽圓滿落幕
工厂模式和策略模式的区别
Verilog 拼接操作符号
verilog 归约操作符
uni-app获取当前页面路由url
编程语言
Compare homekit, MI family, and zhiting family cloud edition for what scene based experiences
单例模式的理解
航芯开发板&调试器
2022年7月产品经理认证招生简章(NPDP)
Batch processing of experimental contact angle data matlab analysis
MQTT第二话 -- emqx高可用集群实现
Did you really make things clear when you were promoted or reported?
MYSQL虚拟列
2022第六季完美童模 清远赛区 海选赛圆满落幕
Verilog 表达式
Chengtong network disk imitation blue playing network disk source code with video tutorial
2022年7月系统集成项目管理工程师认证招生简章
How to recover data loss of USB flash disk memory card