用户登录时提示undefined is not an object?

小程序 文章 2021-01-29 17:01 0 12 全屏看文

用户登录时提示undefined is not an object?When the user logs in, it prompts undefined is not an object?

用户登录时提示undefined is not an object?

在测试版进行小程序测试时一个测试账号发生登录错误导致无法使用微信登陆,但其他账号是正常的

手机型号iphone 12 pro ios14.3

微信版本8.0.0

基础库版本2.15.0[502]

otherlogin:function(e){    let that = this;    // 获取用户信息    wx.getSetting({      success(res) {        if (res.authSetting['scope.userInfo']) {          wx.getUserInfo({            success(res) {              console.log(res)              that.setData({                nickName:res.userInfo.nickName,                avatarUrl:res.userInfo.avatarUrl              })              // 登录              wx.login({                success:(res)=>{                // console.log(res)                // 请求后台登录存储token                  wx.request({                    url: app.globalData.URL+'/api/user/third',                    method:'GET',                    data:{                      'platform':'微信',                      'code':res.code                    },                    header:{"content-type":"application/json"},                    success:(res)=>{                      console.log(res)                      wx.setStorageSync('token', res.data.data.userinfo.token)                      if(res.data.data.status==1){                        wx.request({                          url: app.globalData.URL+'/api/user/profile',                          method:'GET',                          data:{                            'avatar':that.data.avatarUrl,                            'nickname':that.data.nickName                          },                          header:{"content-type":"application/json",'token':res.data.data.userinfo.token},                          success:(res)=>{                            wx.reLaunch({                              url'../index/index',                            })                          }                        })                      }else if(res.data.data.status==0){                        wx.navigateTo({                          url'../choseposition/choseposition',                        })                      }                    }                  })                }              })            },            fail(res) {              console.log("获取用户信息失败", res)            }          })        } else {          console.log("未授权=====")          that.showSettingToast("请授权")        }      },      fail(res){        console.log(res)      }    })      },

During the test of small programs in the beta version, a login error occurred in one test account, which made it impossible to log in using wechat, but the other accounts were normal mobile phone models, iPhone 12 Pro IOS 14.3, wechat version 8.0.0, basic library version 2.15.0 [502] o therlogin:function (e){    let that = this; / / get user information wx.getSetting ({      success(res) {        if ( res.authSetting [' scope.userInfo ']) {           wx.getUserInfo ({            success(res) {               console.log (res)               that.setData ({                 nickName:res.userI nfo.nickName ,                  avatarUrl:res.userInfo.avatarUrl }) / / login wx.login ({                success:(res)=>{                //  console.log (RES) / / request background login to store token             wx.request ({                    url:  app.globalData.URL +'/ API / user / third', method: 'get', data: {platform ':'wechat',                       'code': res.code                     },                    header:{"content-type":"application/json"},                     success:(res)=>{                       console.log (res)                       wx.setStorageSync ('token',   res.data.data . userinfo.token )                      if( res.data.data .status==1){                         wx.request ({                          url:  app.globalData.URL +'/api/user/profile',                          method:'GET',                           data:{                            'avatar': that.data.avatarUrl ,                            'nickname': that.data.nickName                           },                           header:{"content-type":"application/json",'token': res.data.data . userinfo.token },                           success:(res)=>{                             wx.reLaunch ({                              url: '../index/index',                             })                          }                        })                      }else if( res.data.data .status==0){                         wx.navigateTo ({                           url: '../choseposition/choseposition',                        })                      }                    }                  })                }              })            },             fail(res) {               console.log ("failed to get user information", RES)})} else { console.log (unauthorized = = = =) that.showSettingToast ("please authorize")}},       fail(res){         console.log (res)      }    })      },

回答:

Ain:

怎么看都是你们数据的问题

跨商通:

undifined的调试只需要console.log(111,xxx),勤快点多写几句吧。

默认²⁰²⁰:

查下接口

-EOF-