소스 검색

补充考试流程日志

Michael Wang 5 년 전
부모
커밋
f8b470e6d5
2개의 변경된 파일25개의 추가작업 그리고 10개의 파일을 삭제
  1. 22 10
      src/components/FaceRecognition/FaceRecognition.vue
  2. 3 0
      src/features/OnlineExam/Examing/ExamingHome.vue

+ 22 - 10
src/components/FaceRecognition/FaceRecognition.vue

@@ -137,6 +137,10 @@ export default {
                 "摄像头打开耗时",
                 Math.floor((_openEndTime - _openStartTime) / 1000) + "秒",
               ]);
+              console.log(
+                "摄像头打开耗时",
+                Math.floor((_openEndTime - _openStartTime) / 1000) + "秒"
+              );
             } catch (error) {
               console.log("摄像头没有正常启用", error);
               this.$Message.error({
@@ -201,7 +205,7 @@ export default {
     async snapTimer() {
       try {
         const examRecordDataId = this.$route.params.examRecordDataId;
-        const captureBlob = await this.getSnapShot();
+        const captureBlob = await this.getSnapShot({ compareSync: false });
         this.videoStartPlay();
         console.log("抓拍照片的大小:" + captureBlob.size);
         if (captureBlob.size < 10 * 1024) {
@@ -223,6 +227,7 @@ export default {
           signIdentifier,
           examRecordDataId
         );
+        console.log("定时抓拍流程成功", signIdentifier);
       } catch (error) {
         console.log("定时抓拍流程失败", error);
         window._hmt.push([
@@ -269,7 +274,8 @@ export default {
         // return;
         // if(this.disableSnap) return; // 避免界面没有更新。
         this.msg = "拍照中...";
-        const captureBlob = await this.getSnapShot();
+        const captureBlob = await this.getSnapShot({ compareSync: true });
+        console.log("抓拍照片大小", captureBlob.size);
         if (captureBlob.size < 10 * 1024) {
           this.$Message.error({
             content: "抓拍照片太小!",
@@ -287,11 +293,14 @@ export default {
         }
         this.videoStartPlay();
         this.msg = "上传照片中...";
+        console.log(this.msg);
         const [captureFilePath, signIdentifier] = await this.uploadToServer(
           captureBlob
         );
         this.msg = "人脸比对中...";
+        console.log(this.msg);
         await this.faceCompareSync(captureFilePath, signIdentifier);
+        console.log("人脸比对成功");
       } catch (error) {
         console.log("同步照片比对流程失败");
         throw error;
@@ -301,7 +310,7 @@ export default {
         this.disableSnap = false;
       }
     },
-    async getSnapShot() {
+    async getSnapShot({ compareSync }) {
       return new Promise((resolve, reject) => {
         const video = this.$refs.video;
         if (video.readyState !== 4 || !video.srcObject.active) {
@@ -310,19 +319,22 @@ export default {
             duration: 5,
             closable: true,
           });
+
           window._hmt.push([
             "_trackEvent",
             "摄像头框",
             "摄像头状态",
-            "摄像头没有正常启用-退出" +
-              (this.lastSnapTime ? "(非初次抓拍)" : ""),
+            "摄像头没有正常启用" +
+              (!compareSync && this.lastSnapTime ? "-退出(非初次抓拍)" : ""),
           ]);
           reject("摄像头没有正常启用");
-          this.logout(
-            "?LogoutReason=" +
-              "摄像头没有正常启用-退出" +
-              (this.lastSnapTime ? "(非初次抓拍)" : "")
-          );
+          if (!compareSync) {
+            this.logout(
+              "?LogoutReason=" +
+                "摄像头没有正常启用" +
+                (!compareSync && this.lastSnapTime ? "-退出(非初次抓拍)" : "")
+            );
+          }
           return;
         }
         video.pause();

+ 3 - 0
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -225,6 +225,8 @@ export default {
       () => this.answerAllQuestions(),
       5 * 1000 // 10秒检查是否有更改需要提交答案
     );
+
+    console.log("考试开始 ", this.$route.params.examRecordDataId);
   },
   async mounted() {
     // iview bug: https://github.com/iview/iview/issues/4061
@@ -802,6 +804,7 @@ export default {
       }
       this.submitLock = false;
       this.$Spin.hide();
+      console.log("交卷成功");
     },
     examQuestion() {
       return (