- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
授权过res.authSetting['scope.userInfo']为false
wx.getSetting({
success: (res) => {
console.log(res.authSetting);
if (res.authSetting['scope.userInfo']) { //
if (mpvue.getStorageSync('wxUserInfo')) {
that.needUserInfo = 1;
that.login();
} else {
wx.getUserInfo({
success: (res) => {
mpvue.setStorageSync('wxUserInfo', res.userInfo);
that.needUserInfo = 1;
that.login();
}
});
}
} else {
console.log('没有token');
// 无用户权限先让授权
that.needUserInfo = 0;
}
}
});
wx.getSetting
在 未拒绝 和 未同意 状态下 ,success: (res) => {
} 的res.authSetting{}值是空的!
在getUserInfo()后,点击拒绝后 wx.getSetting的fail:(res)=>{}触发,
res.authSetting['scope.userInfo'] 的值是false ,表示scope.userInfo这个权限没有授权。在getUserInfo()后,点击同意后 wx.getSetting的
success:(res)=>{}触发,
res.authSetting['scope.userInfo'] 的值是true,表示scope.userInfo这个权限已经授权。说明你授权后又关闭了授权呗!~
用<button open-type='openSetting'>打开授权页面</button>看看是不是关闭状态。
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
在授权页面授权成功,跳转其他页面,使用wx.getSetting方式输出res.authSetting['scope.userInfo']为false,去到该小程序的设置页面显示“未使用您任何信息”。
微信版本号:6.7.1
系统版本号:11.3(15E216)
机型:ML7E2CH/A
序列号:FK3QG5WHGRY7
手机:iphone6s