|
@@ -35,7 +35,7 @@
|
|
|
<div v-if="errorInfo !== ''">
|
|
|
<i-alert type="error" show-icon>{{errorInfo}}</i-alert>
|
|
|
</div>
|
|
|
- <i-button size="large" class="qm-primary-button" long @click="login('loginForm')">登录</i-button>
|
|
|
+ <i-button size="large" class="qm-primary-button" long :disabled="disableLoginBtn" @click="login('loginForm')">登录</i-button>
|
|
|
</i-form-item>
|
|
|
</i-form>
|
|
|
</div>
|
|
@@ -82,7 +82,8 @@ export default {
|
|
|
trigger: "blur"
|
|
|
}
|
|
|
]
|
|
|
- }
|
|
|
+ },
|
|
|
+ disableLoginBtn: true
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
@@ -108,10 +109,49 @@ export default {
|
|
|
this.loginForm.password =
|
|
|
process.env.NODE_ENV === "production" ? "" : "180613";
|
|
|
}
|
|
|
+
|
|
|
+ if (typeof nodeRequire != "undefined") {
|
|
|
+ var that = this;
|
|
|
+ var fs = nodeRequire("fs");
|
|
|
+ var config = fs.readFileSync(process.cwd() + "/" + "config.js", "utf-8");
|
|
|
+ var nameJson = JSON.parse(config);
|
|
|
+ const electronConfig = (await this.$http.get(
|
|
|
+ "https://ecs.qmth.com.cn:8878/electron-config/" + nameJson.name + ".js"
|
|
|
+ )).data;
|
|
|
+
|
|
|
+ //如果配置中配置了 checkRomateControl:true
|
|
|
+ if (electronConfig.otherConfig.checkRomateControl) {
|
|
|
+ nodeRequire("node-cmd").get("Project1.exe", function(data) {
|
|
|
+ var applicationNames = fs.readFileSync(
|
|
|
+ "remoteApplication.txt",
|
|
|
+ "utf-8"
|
|
|
+ );
|
|
|
+ if (applicationNames && applicationNames.trim()) {
|
|
|
+ that.disableLoginBtn = true;
|
|
|
+ that.$Message.info({
|
|
|
+ content:
|
|
|
+ "在考试期间,请关掉" +
|
|
|
+ applicationNames.trim() +
|
|
|
+ "软件,诚信考试。",
|
|
|
+ duration: 30
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.disableLoginBtn = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.disableLoginBtn = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.disableLoginBtn = false;
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations(["updateUser"]),
|
|
|
async login(name) {
|
|
|
+ if (this.loginButtonDisabled) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
const valid = await this.$refs[name].validate();
|
|
|
if (valid) {
|
|
|
console.log("form validated. start login...");
|