瀏覽代碼

【代码修复】login.vue 微信登录绑定过慢,导致登录失败

YunaiV 9 月之前
父節點
當前提交
f67e6a7f54
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      pages/index/login.vue

+ 3 - 2
pages/index/login.vue

@@ -14,13 +14,14 @@
     new URLSearchParams(location.search).forEach((value, key) => {
     new URLSearchParams(location.search).forEach((value, key) => {
       options[key] = value;
       options[key] = value;
     });
     });
+    // 执行登录 or 绑定,注意需要 await 绑定
     const event = options.event;
     const event = options.event;
     const code = options.code;
     const code = options.code;
     const state = options.state;
     const state = options.state;
     if (event === 'login') { // 场景一:登录
     if (event === 'login') { // 场景一:登录
-      const res = await sheep.$platform.useProvider().login(code, state);
+      await sheep.$platform.useProvider().login(code, state);
     } else if (event === 'bind') { // 场景二:绑定
     } else if (event === 'bind') { // 场景二:绑定
-      sheep.$platform.useProvider().bind(code, state);
+      await sheep.$platform.useProvider().bind(code, state);
     }
     }
 
 
     // 检测 H5 登录回调
     // 检测 H5 登录回调