美文网首页前端之路
微信小程序手机号快速登录首次失败bug解决方案

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

作者: 择一城终老_3069 | 来源:发表于2019-06-15 15:53 被阅读0次

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

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
      }
    })
  },
})

相关文章

网友评论

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

    本文链接:https://www.haomeiwen.com/subject/qembfctx.html