Эх сурвалжийг харах

处理活体检测的网络状态

Michael Wang 6 жил өмнө
parent
commit
951bf3dd65

+ 8 - 14
src/features/OnlineExam/Examing/FaceId.vue

@@ -10,8 +10,7 @@
       </div>
     </div>
     <div id="faceIdDiv" style="position: relative;
-								   height:620px;
-								   background-color: #6e6f72!important;
+								  height:620px; background-color: #6e6f72!important;
   								background-image: radial-gradient(circle at 50% 0,#a9a9a9,#34363c);">
       <div v-show="!showIframe" width="100%" height="200px" style="text-align: center;line-height:100px;margin-top:5px;">
         <div style="color:white;font-weight: bold;font-size:20px;">
@@ -97,19 +96,10 @@ export default {
       const examRecordId = this.$route.params.examRecordDataId;
 
       this.timeCount = 60; //人脸检测倒计时60秒
-      var timeInterval = setInterval(() => {
-        if (!this.showIframe) {
-          clearInterval(timeInterval);
-          return;
-        }
+      var timeCountInterval = setInterval(() => {
         --this.timeCount;
         if (this.timeCount === 0) {
-          this.$Message.error({
-            content: "人脸检测超时,系统退出,请重新登录",
-            duration: 15
-          });
-          clearInterval(timeInterval);
-          this.logout();
+          clearInterval(timeCountInterval);
         }
       }, 1000);
 
@@ -130,6 +120,10 @@ export default {
               var receivedMsg = response.data;
               that.faceTestEnd(receivedMsg);
             }
+          })
+          .catch(() => {
+            clearInterval(timeCountInterval);
+            this.logout();
           });
       }, 60000); //60000
       /**
@@ -205,10 +199,10 @@ export default {
       ws.onmessage = response => {
         if (response.data.indexOf("verifyResult") > -1) {
           var receivedMsg = JSON.parse(response.data);
+          this.faceTestEnd(receivedMsg);
           clearTimeout(faceIdTime);
           this.$emit("closeFaceId");
           ws.close();
-          this.faceTestEnd(receivedMsg);
         }
       };
       ws.onclose = function() {

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

@@ -39,6 +39,9 @@ export default {
         if (this.remainTime === null) {
           // 仅当剩余考试时间没有被初始化才使用服务器时间。否则使用本机时间。
           this.remainTime = res.data;
+          if (res.data <= 0) {
+            this.setShouldSubmitPaper();
+          }
         }
         this.heartbeatErrorNum = 0;
       } else {