App.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div
  3. id="app"
  4. onpaste="return false"
  5. oncopy="return false"
  6. oncut="return false"
  7. >
  8. <router-view></router-view>
  9. </div>
  10. </template>
  11. <script>
  12. import { mapState } from "vuex";
  13. export default {
  14. name: "APP",
  15. computed: {
  16. ...mapState(["QECSConfig"]),
  17. },
  18. watch: {
  19. QECSConfig() {
  20. // console.log(this.$store.state.QECSConfig.PREVENT_CHEATING_CONFIG);
  21. if (this.QECSConfig.PREVENT_CHEATING_CONFIG.includes("FULL_SCREEN_TOP")) {
  22. if (typeof nodeRequire == "undefined") {
  23. console.log("非考生端,不检测置顶状态");
  24. this.logger({
  25. action: "非考生端,不检测置顶状态",
  26. });
  27. return;
  28. }
  29. console.log("考生端,设置检测置顶状态");
  30. this.logger({
  31. action: "考生端,设置检测置顶状态",
  32. });
  33. let remote = window.nodeRequire("electron").remote;
  34. // const { electron, dialog } = remote;
  35. // console.log(remote);
  36. // Module to control application life.
  37. // const app = remote.app;
  38. // const dialog = remote.dialog;
  39. const mainWindow = remote.getCurrentWindow();
  40. const blurHandler = () => {
  41. // console.log("blur...");
  42. // dialog.showErrorBox("学生端不是置顶状态", "退出学生端!");
  43. // app.exit(0);
  44. this.logger({
  45. page: window.location.pathname,
  46. action: "学生端不是置顶状态",
  47. });
  48. window._hmt.push([
  49. "_trackEvent",
  50. window.location.pathname.replace(/\d+/g, ""),
  51. "学生端不是置顶状态",
  52. ]);
  53. if (this.$route.name === "OnlineExamingHome") {
  54. this.$http.post(
  55. "/api/ecs_oe_student/examControl/switchScreen?examRecordDataId=" +
  56. this.$route.params.examRecordDataId
  57. );
  58. }
  59. return;
  60. // const redirectUrl = sessionStorage.getItem("redirectUrl");
  61. // this.logger({
  62. // action: "学生端不是置顶状态--退出",
  63. // });
  64. // console.log(`学生端不是置顶状态--退出`);
  65. // this.$Modal.error({
  66. // title: "学生端不是置顶状态",
  67. // content: "退出考试",
  68. // onOk: () => {
  69. // if (redirectUrl) {
  70. // window.location = redirectUrl;
  71. // } else {
  72. // this.$router.push(
  73. // "/login/" +
  74. // localStorage.getItem("domain") +
  75. // "?LogoutReason=学生端不是置顶状态--退出"
  76. // );
  77. // }
  78. // },
  79. // });
  80. };
  81. mainWindow.removeListener("blur", blurHandler);
  82. mainWindow.on("blur", blurHandler);
  83. }
  84. },
  85. },
  86. };
  87. </script>
  88. <style>
  89. #app {
  90. font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
  91. "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  92. -webkit-font-smoothing: antialiased;
  93. -moz-osx-font-smoothing: grayscale;
  94. text-align: center;
  95. font-size: 14px;
  96. font-weight: normal;
  97. font-stretch: normal;
  98. /* line-height: 20px; */
  99. color: #777777;
  100. }
  101. </style>