|
@@ -10,8 +10,65 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { mapState } from "vuex";
|
|
|
+
|
|
|
export default {
|
|
|
name: "APP",
|
|
|
+ computed: {
|
|
|
+ ...mapState(["QECSConfig"]),
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ QECSConfig() {
|
|
|
+ // console.log(this.$store.state.QECSConfig.PREVENT_CHEATING_CONFIG);
|
|
|
+ if (this.QECSConfig.PREVENT_CHEATING_CONFIG.includes("FULL_SCREEN_TOP")) {
|
|
|
+ if (typeof nodeRequire == "undefined") {
|
|
|
+ console.log("非考生端,不检测置顶状态");
|
|
|
+ this.logger({
|
|
|
+ action: "非考生端,不检测置顶状态",
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log("考生端,设置检测置顶状态");
|
|
|
+ this.logger({
|
|
|
+ action: "考生端,设置检测置顶状态",
|
|
|
+ });
|
|
|
+ let remote = window.nodeRequire("electron").remote;
|
|
|
+ // const { electron, dialog } = remote;
|
|
|
+ // console.log(remote);
|
|
|
+ // Module to control application life.
|
|
|
+ // const app = remote.app;
|
|
|
+ // const dialog = remote.dialog;
|
|
|
+ const mainWindow = remote.getCurrentWindow();
|
|
|
+ const blurHandler = () => {
|
|
|
+ // console.log("blur...");
|
|
|
+ // dialog.showErrorBox("学生端不是置顶状态", "退出学生端!");
|
|
|
+ // app.exit(0);
|
|
|
+ const redirectUrl = sessionStorage.getItem("redirectUrl");
|
|
|
+ this.logger({
|
|
|
+ action: "学生端不是置顶状态--退出",
|
|
|
+ });
|
|
|
+ console.log(`学生端不是置顶状态--退出`);
|
|
|
+ this.$Modal.error({
|
|
|
+ title: "学生端不是置顶状态",
|
|
|
+ content: "退出考试",
|
|
|
+ onOk: () => {
|
|
|
+ if (redirectUrl) {
|
|
|
+ window.location = redirectUrl;
|
|
|
+ } else {
|
|
|
+ this.$router.push(
|
|
|
+ "/login/" +
|
|
|
+ localStorage.getItem("domain") +
|
|
|
+ "?LogoutReason=学生端不是置顶状态--退出"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+ mainWindow.removeListener("blur", blurHandler);
|
|
|
+ mainWindow.on("blur", blurHandler);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|