فهرست منبع

fix 监考方法,不监考时,无操作

ChengYuXuan 5 سال پیش
والد
کامیت
54bdb3186e

+ 62 - 54
src/views/exam/ExamPane.vue

@@ -490,7 +490,9 @@ export default Vue.extend({
     },
 
     preventBlur(event: any) {
-      event.preventDefault()
+      if (this.examInfo.antiCheating) {
+        event.preventDefault()
+      }
     },
 
     changeFlagTo1() {
@@ -510,19 +512,21 @@ export default Vue.extend({
     },
 
     focusAuto() {
-      if ((InputFocus as any).cheatFlag == 1) {
-        ;(InputFocus as any).cheatFlag = 0
-        this.monitor()
-      }
-      const fo = this.$refs.focusOn
-      this.focusAutoInterval = setInterval(function() {
-        if (
-          (InputFocus as any).InputFlag == 1 &&
-          (InputFocus as any).codeFlag == 1
-        ) {
-          ;(fo as any).focus()
+      if (this.examInfo.antiCheating) {
+        if ((InputFocus as any).cheatFlag == 1) {
+          ;(InputFocus as any).cheatFlag = 0
+          this.monitor()
         }
-      }, 100)
+        const fo = this.$refs.focusOn
+        this.focusAutoInterval = setInterval(function() {
+          if (
+            (InputFocus as any).InputFlag == 1 &&
+            (InputFocus as any).codeFlag == 1
+          ) {
+            ;(fo as any).focus()
+          }
+        }, 100)
+      }
     },
 
     changeVisibleFalse() {
@@ -551,52 +555,56 @@ export default Vue.extend({
     },
 
     monitor() {
-      let _this = this
-      if (
-        this.allowNum < 1 &&
-        this.flag == 1 &&
-        this.vCardFlag == 1 &&
-        (InputFocus as any).InputFlag == 1
-      ) {
-        setTimeout(function() {
-          if ((InputFocus as any).codeFlag == 1) {
-            _this.flag = _this.flag - 1
-            _this.visible1 = true
-          }
-        }, 100)
-      } else if (
-        this.flag == 1 &&
-        this.vCardFlag == 1 &&
-        (InputFocus as any).InputFlag == 1
-      ) {
-        setTimeout(function() {
-          if ((InputFocus as any).codeFlag == 1) {
-            _this.allowNum = _this.allowNum - 1
-            //alert(y);
-            _this.visible = true
-            _this.changeFlagTo0()
-            _this.timeCount()
-          }
-        }, 100)
+      if (this.examInfo.antiCheating) {
+        let _this = this
+        if (
+          this.allowNum < 1 &&
+          this.flag == 1 &&
+          this.vCardFlag == 1 &&
+          (InputFocus as any).InputFlag == 1
+        ) {
+          setTimeout(function() {
+            if ((InputFocus as any).codeFlag == 1) {
+              _this.flag = _this.flag - 1
+              _this.visible1 = true
+            }
+          }, 100)
+        } else if (
+          this.flag == 1 &&
+          this.vCardFlag == 1 &&
+          (InputFocus as any).InputFlag == 1
+        ) {
+          setTimeout(function() {
+            if ((InputFocus as any).codeFlag == 1) {
+              _this.allowNum = _this.allowNum - 1
+              //alert(y);
+              _this.visible = true
+              _this.changeFlagTo0()
+              _this.timeCount()
+            }
+          }, 100)
+        }
+        //document.getElementById("demo").innerHTML = y;
       }
-      //document.getElementById("demo").innerHTML = y;
     },
 
     isFullScreen() {
-      if (window.outerHeight == screen.availHeight) {
-        if (window.outerWidth == screen.availWidth) {
-          this.stopTimeCount()
-          this.visible = false
-          this.flag = 1
-        }
-      } else {
-        this.flag = 0
-        if (this.allowNum < 1) {
-          this.visible1 = true
+      if (this.examInfo.antiCheating) {
+        if (window.outerHeight == screen.availHeight) {
+          if (window.outerWidth == screen.availWidth) {
+            this.stopTimeCount()
+            this.visible = false
+            this.flag = 1
+          }
         } else {
-          this.allowNum = this.allowNum - 1
-          this.visible = true
-          this.timeCount()
+          this.flag = 0
+          if (this.allowNum < 1) {
+            this.visible1 = true
+          } else {
+            this.allowNum = this.allowNum - 1
+            this.visible = true
+            this.timeCount()
+          }
         }
       }
     },

+ 0 - 4
src/views/exam/components/BlankPane.vue

@@ -51,10 +51,6 @@ export default Vue.extend({
     }
   },
   methods: {
-    test() {
-      alert('yes!')
-    },
-
     changeInputFlagTo0() {
       ;(InputFocus as any).InputFlag = 0
       //alert(InputFocus.InputFlag);

+ 0 - 5
src/views/exam/components/CodeEditor.vue

@@ -76,10 +76,6 @@ export default Vue.extend({
   },
 
   methods: {
-    test() {
-      alert('??')
-    },
-
     changeCodeFlagTo0() {
       ;(InputFocus as any).codeFlag = 0
       console.log('change to 0')
@@ -94,7 +90,6 @@ export default Vue.extend({
     },
 
     CodeMonitor() {
-      //this.test();
       let _this = this
       setTimeout(function() {
         if ((InputFocus as any).ExamFlag == 0) {

+ 7 - 2
src/views/exam/components/CodePane.vue

@@ -224,9 +224,14 @@
       "
       >提交失败</v-snackbar
     >
-    <v-dialog v-if="showCode" v-model="showCode" max-width="800">
+    <v-dialog v-if="showCode" v-model="showCode" max-width="800" persistent>
       <v-card class="pt-3">
-        <v-card-title>代码详情</v-card-title>
+        <v-card-title
+          >代码详情
+          <v-btn @click="showCode = false" x-small class="mx-2" tile plain
+            >CLOSE</v-btn
+          >
+        </v-card-title>
         <markdown-text :raw="codeDetailContent" class="mx-5"></markdown-text>
       </v-card>
     </v-dialog>

+ 2 - 2
vue.config.js

@@ -15,8 +15,8 @@ module.exports = {
         target: 'http://localhost:3000',
         // deploy target TODO
         ws: true,
-        changeOrigin: true,
-        pathRewrite: '/'
+        changeOrigin: true
+        // pathRewrite: '/'
       }
     },
     port: 8000