|
@@ -243,98 +243,7 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (typeof nodeRequire != "undefined") {
|
|
|
|
- var that = this;
|
|
|
|
- var fs = window.nodeRequire("fs");
|
|
|
|
- var config;
|
|
|
|
- try {
|
|
|
|
- config = fs.readFileSync(process.cwd() + "/" + "config.js", "utf-8");
|
|
|
|
- console.log("使用旧客户端");
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log("尝试使用新客户端");
|
|
|
|
- try {
|
|
|
|
- config = fs.readFileSync("config.js", "utf-8");
|
|
|
|
- } catch (error) {
|
|
|
|
- const appPath = window
|
|
|
|
- .nodeRequire("electron")
|
|
|
|
- .remote.app.getAppPath();
|
|
|
|
- try {
|
|
|
|
- console.log("尝试使用最新的appPath");
|
|
|
|
- config = fs.readFileSync(appPath + "/config.js", "utf-8");
|
|
|
|
- } catch (error) {
|
|
|
|
- this.$Message.error({
|
|
|
|
- content: "读取本地配置文件出错,请重新打开程序或联系老师!",
|
|
|
|
- duration: 15,
|
|
|
|
- closable: true,
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- var nameJson;
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- nameJson = JSON.parse(config);
|
|
|
|
- } catch (error) {
|
|
|
|
- this.$Message.error({
|
|
|
|
- content: "解析本地配置文件出错,请重新打开程序或联系老师!",
|
|
|
|
- duration: 15,
|
|
|
|
- closable: true,
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- let electronConfig = null;
|
|
|
|
- try {
|
|
|
|
- electronConfig = (await this.$http.get(
|
|
|
|
- "https://ecs.qmth.com.cn:8878/electron-config/" +
|
|
|
|
- nameJson.name +
|
|
|
|
- ".js"
|
|
|
|
- )).data;
|
|
|
|
- } catch (error) {
|
|
|
|
- this.$Message.error({
|
|
|
|
- content: "获取机构的客户端设置失败,请退出程序后重试!",
|
|
|
|
- duration: 15,
|
|
|
|
- closable: true,
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //如果配置中配置了 checkRemoteControl:true
|
|
|
|
- if (electronConfig.otherConfig.checkRemoteControl) {
|
|
|
|
- window.nodeRequire("node-cmd").get("Project1.exe", function() {
|
|
|
|
- var applicationNames;
|
|
|
|
- try {
|
|
|
|
- applicationNames = fs.readFileSync(
|
|
|
|
- "remoteApplication.txt",
|
|
|
|
- "utf-8"
|
|
|
|
- );
|
|
|
|
- } catch (error) {
|
|
|
|
- that.$Message.error({
|
|
|
|
- content: "系统检测出错,请退出程序后重试!",
|
|
|
|
- duration: 2 * 24 * 60 * 60,
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (applicationNames && applicationNames.trim()) {
|
|
|
|
- that.disableLoginBtn = true;
|
|
|
|
- that.$Message.info({
|
|
|
|
- content:
|
|
|
|
- "在考试期间,请关掉" +
|
|
|
|
- applicationNames.trim() +
|
|
|
|
- "软件,诚信考试。",
|
|
|
|
- duration: 2 * 24 * 60 * 60,
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- that.disableLoginBtn = false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- that.disableLoginBtn = false;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- this.disableLoginBtn = false;
|
|
|
|
- }
|
|
|
|
|
|
+ this.checkElectronConfig();
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
clearTimeout(this.loginTimeout);
|
|
clearTimeout(this.loginTimeout);
|
|
@@ -535,6 +444,67 @@ export default {
|
|
location.reload(true);
|
|
location.reload(true);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ checkElectronConfig() {
|
|
|
|
+ if (typeof nodeRequire != "undefined") {
|
|
|
|
+ this.checkQECSConfigTimes = this.checkQECSConfigTimes || 1;
|
|
|
|
+ if (this.checkQECSConfigTimes >= 10) {
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "解析本地配置文件出错,请重新打开程序或联系老师!",
|
|
|
|
+ duration: 15,
|
|
|
|
+ closable: true,
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!window.QECSConfig) {
|
|
|
|
+ this.checkQECSConfigTimes++;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.checkElectronConfig();
|
|
|
|
+ }, 1000);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ var that = this;
|
|
|
|
+ var fs = window.nodeRequire("fs");
|
|
|
|
+
|
|
|
|
+ //如果配置中配置了 checkRemoteControl:true
|
|
|
|
+ if (
|
|
|
|
+ window.QECSConfig.PREVENT_CHEATING_CONFIG.includes[
|
|
|
|
+ "DISABLE_REMOTE_ASSISTANCE"
|
|
|
|
+ ]
|
|
|
|
+ ) {
|
|
|
|
+ window.nodeRequire("node-cmd").get("Project1.exe", function() {
|
|
|
|
+ var applicationNames;
|
|
|
|
+ try {
|
|
|
|
+ applicationNames = fs.readFileSync(
|
|
|
|
+ "remoteApplication.txt",
|
|
|
|
+ "utf-8"
|
|
|
|
+ );
|
|
|
|
+ } catch (error) {
|
|
|
|
+ that.$Message.error({
|
|
|
|
+ content: "系统检测出错,请退出程序后重试!",
|
|
|
|
+ duration: 2 * 24 * 60 * 60,
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (applicationNames && applicationNames.trim()) {
|
|
|
|
+ that.disableLoginBtn = true;
|
|
|
|
+ that.$Message.info({
|
|
|
|
+ content:
|
|
|
|
+ "在考试期间,请关掉" +
|
|
|
|
+ applicationNames.trim() +
|
|
|
|
+ "软件,诚信考试。",
|
|
|
|
+ duration: 2 * 24 * 60 * 60,
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ that.disableLoginBtn = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ that.disableLoginBtn = false;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.disableLoginBtn = false;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
closeApp() {
|
|
closeApp() {
|
|
window.close();
|
|
window.close();
|
|
},
|
|
},
|