|
@@ -191,6 +191,7 @@ export default {
|
|
disableLoginBtnBecauseVCam: true,
|
|
disableLoginBtnBecauseVCam: true,
|
|
disableLoginBtnBecauseAppVersionChecker: false,
|
|
disableLoginBtnBecauseAppVersionChecker: false,
|
|
disableLoginBtnBecauseRefreshServiceWorker: false,
|
|
disableLoginBtnBecauseRefreshServiceWorker: false,
|
|
|
|
+ disableLoginBtnBecauseNotAllowedNative: true,
|
|
newVersionAvailable: false,
|
|
newVersionAvailable: false,
|
|
VUE_APP_GIT_REPO_VERSION: process.env.VUE_APP_GIT_REPO_VERSION,
|
|
VUE_APP_GIT_REPO_VERSION: process.env.VUE_APP_GIT_REPO_VERSION,
|
|
};
|
|
};
|
|
@@ -249,7 +250,10 @@ export default {
|
|
(this.disableLoginBtnBecauseRemoteApp ||
|
|
(this.disableLoginBtnBecauseRemoteApp ||
|
|
this.disableLoginBtnBecauseVCam)) ||
|
|
this.disableLoginBtnBecauseVCam)) ||
|
|
this.disableLoginBtnBecauseAppVersionChecker ||
|
|
this.disableLoginBtnBecauseAppVersionChecker ||
|
|
- this.disableLoginBtnBecauseRefreshServiceWorker
|
|
|
|
|
|
+ this.disableLoginBtnBecauseRefreshServiceWorker ||
|
|
|
|
+ (this.FE_FEATURE_ALLOW_CHECK
|
|
|
|
+ ? false
|
|
|
|
+ : this.disableLoginBtnBecauseNotAllowedNative)
|
|
);
|
|
);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -414,6 +418,7 @@ export default {
|
|
|
|
|
|
await this.checkElectronConfig();
|
|
await this.checkElectronConfig();
|
|
await this.checkVCam();
|
|
await this.checkVCam();
|
|
|
|
+ await this.checkAllowedClient();
|
|
|
|
|
|
if (
|
|
if (
|
|
this.allowLoginType.length === 1 &&
|
|
this.allowLoginType.length === 1 &&
|
|
@@ -800,6 +805,53 @@ export default {
|
|
this.disableLoginBtnBecauseVCam = false;
|
|
this.disableLoginBtnBecauseVCam = false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ async checkAllowedClient() {
|
|
|
|
+ if (!this.FE_FEATURE_ALLOW_CHECK) {
|
|
|
|
+ this.disableLoginBtnBecauseNotAllowedNative = false;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (this.QECSConfig.LOGIN_SUPPORT.includes("NATIVE")) {
|
|
|
|
+ // 检测是否是学生端。 检测是否有node。检测是否能node调用。
|
|
|
|
+ const hasShell = UA.getBrowser().name === "electron-exam-shell";
|
|
|
|
+ const hasNode = typeof nodeRequire !== "undefined";
|
|
|
|
+ let hasFs = false;
|
|
|
|
+ let hasReadFileSync = false;
|
|
|
|
+ if (hasShell && hasNode) {
|
|
|
|
+ const fs = window.nodeRequire("fs");
|
|
|
|
+ if (fs && typeof fs.readFileSync === "function") {
|
|
|
|
+ hasFs = true;
|
|
|
|
+ hasReadFileSync = true;
|
|
|
|
+ this.disableLoginBtnBecauseNotAllowedNative = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (this.disableLoginBtnBecauseNotAllowedNative) {
|
|
|
|
+ window._hmt.push([
|
|
|
|
+ "_trackEvent",
|
|
|
|
+ "登录页面",
|
|
|
|
+ "不允许访问-" +
|
|
|
|
+ JSON.stringify({
|
|
|
|
+ hasShell,
|
|
|
|
+ hasNode,
|
|
|
|
+ hasFs,
|
|
|
|
+ hasReadFileSync,
|
|
|
|
+ }),
|
|
|
|
+ ]);
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "请与学校申请最新的客户端,进行考试!",
|
|
|
|
+ duration: 2 * 24 * 60 * 60,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ } else if (this.QECSConfig.LOGIN_SUPPORT.includes("BROWSER")) {
|
|
|
|
+ // TODO: redirect to wap site
|
|
|
|
+ // if(chromeUA.major < "66") { } // 到移动端去判断
|
|
|
|
+ return;
|
|
|
|
+ } else {
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "设置错误!",
|
|
|
|
+ duration: 2 * 24 * 60 * 60,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
closeApp() {
|
|
closeApp() {
|
|
console.log("关闭应用");
|
|
console.log("关闭应用");
|
|
window.close();
|
|
window.close();
|