Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于app.js isLogin异步的问题 #1

Open
15560099568 opened this issue Jan 5, 2021 · 4 comments
Open

关于app.js isLogin异步的问题 #1

15560099568 opened this issue Jan 5, 2021 · 4 comments

Comments

@15560099568
Copy link

wxGetSetting().then(res => {
      if (res.authSetting['scope.userInfo']) {
        wxGetUserInfo().then(res => {
          that.globalData.nickName = res.userInfo.nickName;
          that.globalData.userAvatar = res.userInfo.avatarUrl;
          // 确认所需全局变量正常 否则重新登录获取
          if (isAllStorageOk) {
            that.globalData.isLogin = true;
          }
          if (that.globalData.uid != "") {
            // put 更新用户信息
            let url = `${that.globalData.commonUrl}/user/${that.globalData.uid}`
            let data = res.userInfo;
            let header = {
              "content-type": "application/x-www-form-urlencoded",
              "Authorization": `Bearer ${that.globalData.token}`
            };
            requestUtils.doPUT(url, data, header).catch(res => {
              console.log("更新用户数据失败");
              console.log(res);
            });
          }
        });
      }

app.js里设置that.globalData.isLogin = true是异步操作,如果首次打开在个人页面的话,isLogin在页面onShow是false的。没有及时更新

@15560099568
Copy link
Author

能留个联系方式方便吗?

@peanut996
Copy link
Contributor

能留个联系方式方便吗?

QQ群:480811195

@15560099568
Copy link
Author

能留个联系方式方便吗?

QQ群:480811195

没有搜索到这个QQ群。只搜到了一个QQ号,名字叫╰★佪眸┅笑★╮

@peanut996
Copy link
Contributor

能留个联系方式方便吗?

QQ群:480811195

没有搜索到这个QQ群。只搜到了一个QQ号,名字叫╰★佪眸┅笑★╮

你加我qq 846471144

sunnysab pushed a commit that referenced this issue Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants