Browse Source

考生端限制登陆配置

Michael Wang 5 years ago
parent
commit
986f18bd14
1 changed files with 32 additions and 13 deletions
  1. 32 13
      src/features/Login/Login.vue

+ 32 - 13
src/features/Login/Login.vue

@@ -810,14 +810,19 @@ export default {
       //   this.disableLoginBtnBecauseNotAllowedNative = false;
       //   return;
       // }
-      if (
-        this.QECSConfig.LOGIN_SUPPORT.includes("BROWSER") &&
-        this.QECSConfig.LOGIN_SUPPORT.includes("NATIVE")
-      ) {
-        // FIXME: 暂时允许选择浏览器的可以在浏览器中访问,后期浏览器应该跳转到移动端
-        this.disableLoginBtnBecauseNotAllowedNative = false;
-        return;
-      } else if (this.QECSConfig.LOGIN_SUPPORT.includes("NATIVE")) {
+      /**
+       * 本应用仅处理学生端的请求。不做跳转,不管浏览器类型。
+       * 允许NATIVE/允许BROWSER,在以下场景中能访问:学生端/移动端浏览器
+       */
+      // if (
+      //   this.QECSConfig.LOGIN_SUPPORT.includes("BROWSER") &&
+      //   this.QECSConfig.LOGIN_SUPPORT.includes("NATIVE")
+      // ) {
+      //   // FIXME: 暂时允许选择浏览器的可以在浏览器中访问
+      //   this.disableLoginBtnBecauseNotAllowedNative = false;
+      //   return;
+      // } else
+      if (this.QECSConfig.LOGIN_SUPPORT.includes("NATIVE")) {
         // 检测是否是学生端。 检测是否有node。检测是否能node调用。
         const hasShell = UA.getBrowser().name === "electron-exam-shell";
         const hasNode = typeof nodeRequire !== "undefined";
@@ -848,13 +853,27 @@ export default {
             duration: 2 * 24 * 60 * 60,
           });
         }
-      } else if (this.QECSConfig.LOGIN_SUPPORT.includes("BROWSER")) {
-        // TODO: redirect to wap site
-        // if(chromeUA.major < "66") { } // 到移动端去判断
-        return;
+        // } else if (this.QECSConfig.LOGIN_SUPPORT.includes("BROWSER")) {
+        //   const hasShell = UA.getBrowser().name === "electron-exam-shell";
+        //   if (hasShell) {
+        //     if (this.disableLoginBtnBecauseNotAllowedNative) {
+        //       window._hmt.push([
+        //         "_trackEvent",
+        //         "登录页面",
+        //         "不允许访问-不允许在考生端中访问只设定移动端浏览器访问的设置",
+        //       ]);
+        //       this.$Message.error({
+        //         content: "本考试不支持在考生端中进行!",
+        //         duration: 2 * 24 * 60 * 60,
+        //       });
+        //     }
+        //   }
+        //   // TODO: redirect to wap site
+        //   // if(chromeUA.major < "66") { } // 到移动端去判断
+        //   return;
       } else {
         this.$Message.error({
-          content: "设置错误!",
+          content: "本考试不支持在考生端中进行!",
           duration: 2 * 24 * 60 * 60,
         });
       }