7 回复
这代码感觉怪怪的
是不是要跟wx.openSetting配合使用?
return new Promise(async (resolve, reject) => {
let res = await wfun.openSetting()
if (res.authSetting[‘scope.userInfo’]) {
let userInfo = await this.addUser()
if (userInfo && userInfo[‘userid’]) {
getApp().setUser(userInfo)
resolve(userInfo)
} else {
resolve(’’)
}
} else {
resolve(’’)
}
})
openSetting: function() {
return new Promise((resolve, reject) => {
wx.openSetting({
success: res => {
resolve(res)
},
fail: res => {
resolve(res)
}
})
})
},