Browse Source

补充考试流程日志

Michael Wang 5 years ago
parent
commit
f8b470e6d5

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

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

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

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