前端之路

微信小程序手机号快速登录首次失败bug解决方案

2019-06-15  本文已影响0人  择一城终老_3069

最近一个项目需要手机号快速登录,但是需要两次唤起才可以成功登录,以下是解决方案

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
      }
    })
  },
})
上一篇下一篇

猜你喜欢

热点阅读