Kaynağa Gözat

fix: modify user authorization judgment

wangyuan 2 yıl önce
ebeveyn
işleme
50678898fd
1 değiştirilmiş dosya ile 16 ekleme ve 14 silme
  1. 16 14
      pages/my/my.js

+ 16 - 14
pages/my/my.js

@@ -68,20 +68,22 @@ Page({
    * 获取用户信息
    */
   getUserProfile() {
-    var that = this;
-    wx.getUserProfile({
-      desc:"授权信息",
-      success:function(res){
-        if(res.userInfo){
-          that.setData({
-            name:res.userInfo.nickName,
-            avatarUrl:res.userInfo.avatarUrl,
-            pageLogin: true
-          })
-          app.globalData.userInfo.login = true
-        }
-      },
-    })
+    if (this.data.avatarUrl == '') {
+      var that = this;
+      wx.getUserProfile({
+        desc:"授权信息",
+        success:function(res){
+          if(res.userInfo){
+            that.setData({
+              name:res.userInfo.nickName,
+              avatarUrl:res.userInfo.avatarUrl,
+              pageLogin: true
+            })
+            app.globalData.userInfo.login = true
+          }
+        },
+      })
+    }
   },
 
   /**