tencentyun / wafer

Wafer - 快速构建具备弹性能力的微信小程序
https://github.com/tencentyun/wafer
Other
2.16k stars 333 forks source link

重新发起授权。 #13

Open kainy opened 7 years ago

kainy commented 7 years ago

“会员机制是关联微信授权登录的,如果用户点击拒绝登录后,后边的流程无法继续走下去,当用户拒绝授权登陆后,如何重新发起授权呢?” 求教。

jacksplwxy commented 6 years ago

我是修改了login.js文件,拒绝后弹出重新授权模态框: fail: function (userError) { //用户拒绝授权后,打开设置,让用户进行授权 wx.showModal({ title: '登录失败!', content: '请允许获取您的公开信息', success: (res) => { wx.openSetting({ success: (res) => { if (res.authSetting['scope.userInfo']) { wx.getUserInfo({ success: function (userResult) { callback(null, { code: loginResult.code, encryptedData: userResult.encryptedData, iv: userResult.iv, userInfo: userResult.userInfo, }); }, }) } } }) } }) },