Sfoglia il codice sorgente

添加抓拍日志

Michael Wang 6 anni fa
parent
commit
7bed55f142
2 ha cambiato i file con 18 aggiunte e 9 eliminazioni
  1. 7 9
      src/features/OnlineExam/Examing/ExamingHome.vue
  2. 11 0
      src/main.js

+ 7 - 9
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -101,6 +101,7 @@ export default {
       if (!enoughTimeForFaceId) return;
 
       this.faceIdMsgTimeout = setTimeout(() => {
+        this.serverLog("debug/S-002001", "活体检测前抓拍");
         this.toggleSnapNow();
         this.$Message.info("30秒后开始活体检测");
       }, this.$route.query.faceVerifyMinute * 60 * 1000 - 30 * 1000); // 活体检测提醒
@@ -133,6 +134,7 @@ export default {
       this.faceEnable = true;
 
       setTimeout(() => {
+        this.serverLog("debug/S-002001", "进入考试后5秒抓拍");
         this.toggleSnapNow(); // 开启抓拍才在进入考试时抓拍一张
       }, 5 * 1000); // 5秒钟后抓拍
 
@@ -145,6 +147,10 @@ export default {
         if (snapshotInterval.data) {
           // 考务设置抓拍间隔
           this.snapInterval = setInterval(() => {
+            this.serverLog(
+              "debug/S-002001",
+              "根据抓拍间隔抓拍:抓拍间隔=" + snapshotInterval.data
+            );
             this.toggleSnapNow();
           }, snapshotInterval.data * 60 * 1000);
         }
@@ -184,15 +190,7 @@ export default {
             CameraInfo = CameraInfo.replace(/\r\n/g, "");
             CameraInfo = CameraInfo.replace(/\n/g, "");
             console.log(CameraInfo);
-            this.$http.post(
-              "/api/ecs_core/log/studentClient/debug/S-001001",
-              CameraInfo,
-              {
-                headers: {
-                  "Content-Type": "text/plain"
-                }
-              }
-            );
+            this.serverLog("debug/S-001001", CameraInfo);
           }
         });
       } catch (error) {

+ 11 - 0
src/main.js

@@ -85,6 +85,17 @@ Vue.mixin({
     });
   },
   methods: {
+    async serverLog(level, logText) {
+      await this.$http.post(
+        "/api/ecs_core/log/studentClient/" + level,
+        logText,
+        {
+          headers: {
+            "Content-Type": "text/plain"
+          }
+        }
+      );
+    },
     logout() {
       localStorage.removeItem("phoneVerified");
       this.$router.push("/login/" + localStorage.getItem("domain"));