收藏
回答

TypeError: Cannot read property 'openid' of null?

有没有大佬救救我!这个我找了好多我都没搞明白咋回事!

    wx.cloud.callFunction({
      name"login",
    }).then(res => {
      if (res.errMsg == "cloud.callFunction:ok") {
        let _openid = res.result.openid;
        let userInfo = e.detail.userInfo;
        userInfo._openid = _openid;


        User.login(userInfo).then(res => {
          
          app.globalData.userInfo = res.userInfo;
          wx.setStorageSync('userInfo', res.userInfo);


          app.globalData.partnerInfo = res.partnerInfo;
          wx.setStorageSync('partnerInfo', res.partnerInfo);        


          this.hello.show(userInfo.nickname);


        }).catch((err) => {
          wx.showModal({
            title'错误',
            content"网络异常[0]",
            showCancelfalse
          });


          console.log(err);
          
        });
      } else {
        wx.showModal({
          title'错误',
          content"网络异常[1]",
          showCancelfalse
        });
      }
    }).catch((code, msg) => {
      console.log(code, msg);
      
      wx.showModal({
        title'错误',
        content"网络异常[2]",
        showCancelfalse
      });
    });
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签