wx.getSetting的api
https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html
我写的
wx.getSetting({
success: function(res) {
//接口调用成功的回调函数
console.log(res)
if (res.authSetting['scope.userInfo']) {
console.log("用户授权了");
} else {
//用户没有授权
console.log("用户没有授权");
}
},
})
函数返回情况
wx.getSetting({
withSubscriptions: true,
success (res) {
console.log(res.authSetting)
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
console.log(res.subscriptionsSetting)
// res.subscriptionsSetting = {
// mainSwitch: true, // 订阅消息总开关
// itemSettings: { // 每一项开关
// SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
// SYS_MSG_TYPE_RANK: 'accept'
// zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
// ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
// }
// }
}
})