Pārlūkot izejas kodu

feat(福利go) 修改头像授权问题

xing.li 3 gadi atpakaļ
vecāks
revīzija
ad218f16dd
1 mainītis faili ar 19 papildinājumiem un 2 dzēšanām
  1. 19 2
      pages/welfareMall/personal/personal.js

+ 19 - 2
pages/welfareMall/personal/personal.js

@@ -162,16 +162,25 @@ Page({
       })
     this.getIndexList();
     let  userMobile = await activity.getMobileCache();
-    // console.log(userMobile)
     if (userMobile.length !== 0) {
+
       this.setData({
         isLogin: true,
         mobileTop: userMobile,
       })
+      
+    }
+    var userInfo = wx.getStorageSync("userInfo");
+    if (userInfo) {
+      this.setData({
+        userInfo: userInfo,
+        hasUserInfo:true
+      })
+      
     }
 
-    // let  info = await activity.getUserInfo();
 
+   
     if(this.data.isLogin){
       let nums = await this.getCountNum();
       this.setData({
@@ -213,7 +222,15 @@ Page({
         var mobile = getMobileCache();
         if(openId && mobile){
           activity.saveUser(openId,mobile,res.userInfo.avatarUrl,res.userInfo.nickName);
+
+          var userInfo = {
+            mobile:mobile,
+            avatarUrl:res.userInfo.avatarUrl,
+            nickName:res.userInfo.nickName,
+          }
+          wx.setStorageSync('userInfo',userInfo);
         }
+      
         this.setData({
           userInfo: res.userInfo,
           hasUserInfo: true