收藏
回答

小程序开发工具上午还能弹出登录授权,下午忽然不能调试了?

 <button class='button auth_btn_yeslang="zh_CNbindtap="onGotUserInfo"> 允许 </button>

    //微信授权登录
    onGotUserInfofunction (e{
      var that = this;
      wx.getUserProfile({
        desc'完善用户信息',
        success:function (resinfo{  //微信授权,获取客人信息
          wx.login({
            success:function (reslogin{  //微信登录
              var code = reslogin.code;
              if (code) {
                wx.request({
                  url: rootDocment + '/api/Logic/WxLogin', 
                  data:{code: code,nickname: resinfo.userInfo.nickName,avatar: resinfo.userInfo.avatarUrl},
                  method:'GET',
                  header:{},
                  success:function (res{
                    //console.log(res);
                    //console.log(resinfo.userInfo.avatarUrl);
                    if(res.data.success){
                        app.globalData.userInfo.openID = res.data.session_id,
                        app.globalData.userInfo.userID = res.data.user_id,
                        app.globalData.userInfo.session_key = res.data.session_key,
                        app.globalData.userInfo.mobile = res.data.mobile
                    }
                      app.globalData.userInfo.avatar = resinfo.userInfo.avatarUrl,
                      app.globalData.userInfo.nickName = resinfo.userInfo.nickName


                      wx.setStorageSync('UserInfo', app.globalData.userInfo);
                      wx.navigateBack();
                  }
                })
              } else {
                console.log('获取用户登录态失败!' + res2.errMsg)
              }
            },
          });
        }
      })
    },

点击允许按钮不弹出授权按钮,折腾了好一阵子没结果。为什么突然不能弹出来呢,什么东西会影响到呢
调试库:2.27.1
微信开发工具版本:1.06.2210310

回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容