ソースを参照

fix 强制最新版登录的逻辑

Michael Wang 6 年 前
コミット
bb812a5ba0
1 ファイル変更18 行追加15 行削除
  1. 18 15
      src/features/Login/Login.vue

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

@@ -168,6 +168,24 @@ export default {
         process.env.NODE_ENV === "production" ? "" : "180613";
     }
 
+    if (
+      this.$route.path.includes("xjtu.ecs.qmth.com.cn") ||
+      this.$route.path.includes("snnu.ecs.qmth.com.cn")
+    ) {
+      this.disableLoginBtn = true;
+      if (
+        typeof nodeRequire == "undefined" ||
+        !window.nodeRequire("fs").existsSync("multiCamera.exe")
+      ) {
+        this.$Message.error({
+          content: "请与学校申请最新的客户端,进行考试!",
+          duration: 2 * 24 * 60 * 60
+        });
+
+        return; // 避免 disableLoginBtn 被覆盖
+      }
+    }
+
     if (typeof nodeRequire != "undefined") {
       var that = this;
       var fs = window.nodeRequire("fs");
@@ -219,21 +237,6 @@ export default {
     } else {
       this.disableLoginBtn = false;
     }
-
-    if (
-      this.$route.path.includes("xjtu.ecs.qmth.com.cn") ||
-      this.$route.path.includes("snnu.ecs.qmth.com.cn")
-    ) {
-      this.disableLoginBtn = true;
-      let fs = window.nodeRequire("fs");
-      if (!fs.existsSync("multiCamera.exe")) {
-        this.disableLoginBtn = false;
-        this.$Message.error({
-          content: "请使用最新版本的客户端进行考试!",
-          duration: 2 * 24 * 60 * 60
-        });
-      }
-    }
   },
   methods: {
     ...mapMutations(["updateUser", "updateTimeDifference"]),