瀏覽代碼

Revert "客户端版本允许范围后台控制"

This reverts commit e9a197a447bdd1afcc682e9f580f9a260f8221cf.
Michael Wang 5 年之前
父節點
當前提交
859513f4cd
共有 2 個文件被更改,包括 42 次插入60 次删除
  1. 41 47
      src/features/Login/Login.vue
  2. 1 13
      src/utils/ua.js

+ 41 - 47
src/features/Login/Login.vue

@@ -127,7 +127,7 @@ import { FACE_API_MODEL_PATH } from "@/constants/constants";
 import DevTools from "./DevTools.vue";
 import nativeExe from "@/utils/nativeExe";
 import { EPCC_DOMAIN } from "@/constants/constants";
-import UA, { isGreatThanEqual200 } from "@/utils/ua.js";
+import UA, { chromeUA } from "@/utils/ua.js";
 
 // 检测devtools.  仅在chrome 72+ 有效。
 let element = new Image();
@@ -351,28 +351,48 @@ export default {
         process.env.NODE_ENV === "production" ? "" : "180613";
     }
 
-    // if (
-    //   [
-    //     "xjtu.ecs.qmth.com.cn",
-    //     "ccnu.ecs.qmth.com.cn",
-    //     "snnu.ecs.qmth.com.cn",
-    //     "swjtu.ecs.qmth.com.cn",
-    //   ].includes(this.$route.params.domain)
-    // ) {
-    //   if (
-    //     typeof nodeRequire == "undefined" ||
-    //     !window.nodeRequire("fs").existsSync("multiCamera.exe")
-    //   ) {
-    //     this.disableLoginBtnBecauseAppVersionChecker = true;
-    //     this.$Message.error({
-    //       content: "请与学校申请最新的客户端,进行考试!",
-    //       duration: 2 * 24 * 60 * 60,
-    //     });
-    //   }
-    // }
+    if (
+      [
+        "xjtu.ecs.qmth.com.cn",
+        "ccnu.ecs.qmth.com.cn",
+        "snnu.ecs.qmth.com.cn",
+        "swjtu.ecs.qmth.com.cn",
+      ].includes(this.$route.params.domain)
+    ) {
+      if (
+        typeof nodeRequire == "undefined" ||
+        !window.nodeRequire("fs").existsSync("multiCamera.exe")
+      ) {
+        this.disableLoginBtnBecauseAppVersionChecker = true;
+        this.$Message.error({
+          content: "请与学校申请最新的客户端,进行考试!",
+          duration: 2 * 24 * 60 * 60,
+        });
+      }
+    }
+
+    if (
+      [
+        "cup.ecs.qmth.com.cn",
+        "cugr.ecs.qmth.com.cn",
+        "sdu.ecs.qmth.com.cn",
+      ].includes(this.$route.params.domain)
+    ) {
+      // console.log(UA.getBrowser(), chromeUA);
+      if (
+        UA.getBrowser().name !== "electron-exam-shell" ||
+        UA.getBrowser().major !== "2" ||
+        chromeUA.major < "76"
+      ) {
+        this.disableLoginBtnBecauseAppVersionChecker = true;
+        this.$Message.error({
+          content: "请与学校申请最新的客户端,进行考试!",
+          duration: 2 * 24 * 60 * 60,
+        });
+      }
+    }
 
     await this.checkElectronConfig();
-    await this.checkAppVersion();
     await this.checkVCam();
 
     if (
@@ -737,32 +757,6 @@ export default {
         this.disableLoginBtnBecauseVCam = false;
       }
     },
-    async checkAppVersion() {
-      // console.log(UA.getBrowser(), chromeUA);
-      const allowVer = this.QECSConfig.STUDENT_CLIENT_VERSION.split(",");
-      if (allowVer.includes("1.0.0")) {
-        // 包含 1.0.0 时所有都能进,包括浏览器
-        this.disableLoginBtnBecauseAppVersionChecker = false;
-      } else if (isGreatThanEqual200) {
-        // 判断是否为大于等于 2.0.0 的客户端
-        if (allowVer.includes(UA.getBrowser().version)) {
-          this.disableLoginBtnBecauseAppVersionChecker = false;
-        } else {
-          this.disableLoginBtnBecauseAppVersionChecker = true;
-          this.$Message.error({
-            content: "请与学校申请最新的客户端,进行考试!",
-            duration: 2 * 24 * 60 * 60,
-          });
-        }
-      } else {
-        // 此处表示当不选择1.0.0时,所有非2.0.0单独exe的包都不能进
-        this.disableLoginBtnBecauseAppVersionChecker = true;
-        this.$Message.error({
-          content: "请与学校申请最新的客户端,进行考试!",
-          duration: 2 * 24 * 60 * 60,
-        });
-      }
-    },
     closeApp() {
       window.close();
     },

+ 1 - 13
src/utils/ua.js

@@ -4,29 +4,17 @@ const examShellRegex = [
   [/(electron-exam-shell)\/([\w.]+)/i],
   [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION],
 ];
-const UA = new UAParser(
+export default new UAParser(
   navigator.userAgent,
   // "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) electron-exam-shell/2.0.0 Chrome/77.0.3865.120 Safari/537.36 ",
   { browser: examShellRegex }
 );
 
-export default UA;
-
 export const chromeUA = new UAParser(
   navigator.userAgent.replace("electron-exam-shell/", ""),
   null
 ).getBrowser();
 
-// export const is100 =
-//   UA.getBrowser().name !== "electron-exam-shell" ||
-//   UA.getBrowser().major !== "2" ||
-//   chromeUA.major < "76";
-
-export const isGreatThanEqual200 =
-  UA.getBrowser().name === "electron-exam-shell" &&
-  UA.getBrowser().major >= "2" &&
-  chromeUA.major >= "76";
-
 // const UA = new UAParser(
 //   // null,
 //   "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) electron-exam-shell/2.0.0 Chrome/76.0.3809.139 Electron/6.0.7 Safari/537.36",