Pārlūkot izejas kodu

Merge branch 'master' of http://123.60.19.203:8088/szw123456/xiamen-sb-uniapp

408249787@qq.com 3 nedēļas atpakaļ
vecāks
revīzija
2889c72430
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. 9 1
      pages/setting/wechat-oauth.vue

+ 9 - 1
pages/setting/wechat-oauth.vue

@@ -37,7 +37,15 @@ export default {
     },
     onLoad(options) {
         this.openId = options.openId
-        uni.setStorageSync('openId', this.openId);
+        // 用户此时仍处于登录状态,立即调用绑定接口,而不是仅存缓存等下次密码登录才绑定
+        if (this.openId) {
+            uni.setStorageSync('openId', this.openId);
+            this.$Http.bindUserAndOpenId(this.openId).then(() => {
+                uni.removeStorageSync('openId');
+            }).catch(err => {
+                console.error('微信绑定失败', err);
+            });
+        }
     },
     methods: {
         // 退出登录