柒零 1 жил өмнө
parent
commit
7abf632ab4

+ 23 - 11
componets/authorized-login-dialog/authorizedLoginDialog.js

@@ -71,21 +71,33 @@ Component({
       // this.setData({
       //   avatarUrl: avatarUrl,
       // })
-
+      // wx.showToast({ title: "进来了" })
       const that = this;
 
       this.setData({ tempAvatarUrl: avatarUrl });
-      // 下载头像图片
-      wx.downloadFile({
-        url: avatarUrl,
-        success(res) {
-          if (res.statusCode === 200) {
-            console.log('download success');
-            const tempFilePath = res.tempFilePath
-            that.uploadAvatar(tempFilePath);
+      if (avatarUrl.includes("wxfile://")) {
+        that.uploadAvatar(avatarUrl);
+      } else {
+        // 下载头像图片
+        wx.downloadFile({
+          url: avatarUrl,
+          success(res) {
+            if (res.statusCode === 200) {
+              console.log('download success');
+              const tempFilePath = res.tempFilePath
+              that.uploadAvatar(tempFilePath);
+            } else {
+              wx.showToast({ title: '上传失败' })
+              // wx.showToast({ title: JSON.stringify(res) })
+              // wx.showToast({ title: JSON.stringify(avatarUrl) })
+            }
+          }, fail: function (err) {
+            wx.showToast({ title: '上传失败' })
+            // wx.showToast({ title: JSON.stringify(err) })
+            // wx.showToast({ title: JSON.stringify(avatarUrl) })
           }
-        }
-      });
+        });
+      }
       this.checkHasUserInfo();
     },
 

+ 1 - 1
project.config.json

@@ -5,7 +5,7 @@
     "include": []
   },
   "setting": {
-    "urlCheck": false,
+    "urlCheck": true,
     "es6": true,
     "enhance": false,
     "postcss": true,

+ 1 - 1
project.private.config.json

@@ -82,5 +82,5 @@
       ]
     }
   },
-  "libVersion": "3.5.5"
+  "libVersion": "3.5.6"
 }