有什么方法可以解决呢,或者怎样可以重新获取用户授权。毕竟叫他们删了重来的话,这样的体验好像不大好。。。
方法:A:单击隐藏图章wx.openSetting(OBJECT) 重新调用小程序授权,文档现在已经有了【以下是文档内容】
wx.openSetting(OBJECT)
调起客户端小程序设置界面,返回用户设置的操作结果
Object 参数说明:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| success | Function | 否 | 接口调用成功的回调函数,返回内容详见返回参数说明。 |
| fail | Function | 否 | 接口调用失败的回调函数 |
| complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| authSetting | Object | 用户授权结果,其中 key 为 scope 值,value 为 Bool 值,表示用户是否允许授权,详见 scope 列表 |
示例代码:
wx.openSetting({ success: (res) = { /* * res.authSetting = { * "scope.userInfo": true, * "scope.userLocation": true * } */ }})wx.getSetting(OBJECT)
获取用户的当前设置
Object 参数说明:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| success | Function | 否 | 接口调用成功的回调函数,返回内容详见返回参数说明。 |
| fail | Function | 否 | 接口调用失败的回调函数 |
| complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| authSetting | Object | 用户授权结果,其中 key 为 scope 值,value 为 Bool 值,表示用户是否允许授权,详见 scope 列表 |
示例代码:
wx.getSetting({ success: (res) = { /* * res.authSetting = { * "scope.userInfo": true, * "scope.userLocation": true * } */ }})- Map:function(){
- wx.getLocation({
- type: 'gcj02',
- success: function(res){
- // success
- wx.openLocation({
- latitude: res.latitude,
- longitude: res.longitude,
- scale: 28,
- })},
-
- fail: function(res){
- // fail
- wx.openLocation({
- address:"获取授权失败 打开默认定位",
- //默认定位我就隐藏啦
- latitude: XX.XX,
- longitude: XX.XX,
- scale: 28,
- },
- wx.openSetting({
- //重新请求获取定位
- success: (res) = {}})
- )},
- })
- }













