Переглянути джерело

节省service worker更新时的操作

Michael Wang 4 роки тому
батько
коміт
c0b43fc876
1 змінених файлів з 15 додано та 7 видалено
  1. 15 7
      src/features/Login/Login.vue

+ 15 - 7
src/features/Login/Login.vue

@@ -504,6 +504,14 @@ export default {
     async loginForuser() {
       // 供user点击的 login 方法。主要是保护 login 方法,不因为user重复点击,多个请求不按预期时间进行。
       createLog({ currentPage: "登录页面", action: "点击登录按钮" });
+
+      try {
+        const hasNewVersion = await this.checkNewVersion();
+        if (hasNewVersion) return;
+      } catch (error) {
+        console.log("检测新版本出错");
+      }
+
       if (this.loginBtnLoading) {
         return;
       }
@@ -570,13 +578,6 @@ export default {
         return;
       }
 
-      try {
-        const hasNewVersion = await this.checkNewVersion();
-        if (hasNewVersion) return;
-      } catch (error) {
-        console.log("检测新版本出错");
-      }
-
       let loginResponse;
       if (!this.isEPCC) {
         // https://www.cnblogs.com/weiqinl/p/6708993.html
@@ -621,6 +622,13 @@ export default {
           }
         );
       } else {
+        try {
+          const hasNewVersion = await this.checkNewVersion();
+          if (hasNewVersion) return;
+        } catch (error) {
+          console.log("检测新版本出错");
+        }
+
         loginResponse = await this.epccLogin();
         if (!loginResponse) {
           return;