最近一個(gè)項(xiàng)目需要手機(jī)號(hào)快速登錄,但是需要兩次喚起才可以成功登錄,以下是解決方案
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
}
})
},
})