最近一个项目需要手机号快速登录,但是需要两次唤起才可以成功登录,以下是解决方案
Page({
/**快速登陆 */
loginBtn(e) {
let that = this;
wx.checkSession({
success(res) {
utils.axios('XXXXXXX', 2, {
EncryptedData: e.detail.encryptedData,
iv: e.detail.iv,
code: that.data.code
}).then(res => {
console.log(res.data.data)
if (res.data.status == 1) {
}
})
},
fail(err) {
console.log(err)
}
})
console.log(e)
},
onLoad: function (options) {
let that = this;
wx.login({
success: res => {
that.data.code = res.code
}
})
},
})
网友评论