Explorar o código

getFaceVerifyToken 失败重试,不退出

Michael Wang %!s(int64=5) %!d(string=hai) anos
pai
achega
5a443e1308
Modificáronse 1 ficheiros con 24 adicións e 12 borrados
  1. 24 12
      src/features/OnlineExam/Examing/FaceId.vue

+ 24 - 12
src/features/OnlineExam/Examing/FaceId.vue

@@ -389,27 +389,39 @@ export default {
       this.redoBtnMsg = "正在进入人脸检测...";
 
       let response = null;
-      try {
-        if (this.faceVerifyId) {
+      if (this.faceVerifyId) {
+        try {
           response = await this.$http.get(
             "/api/ecs_oe_student/examFaceLivenessVerify/getFaceVerifyToken/" +
               this.faceVerifyId
           );
-        } else {
+        } catch (error) {
+          console.log(error);
+          this.showRedo("网络异常,请手动点击重试");
+          window._hmt.push([
+            "_trackEvent",
+            "活体检测弹出框",
+            "网络异常-getFaceVerifyToken",
+          ]);
+          return;
+        }
+      } else {
+        try {
           response = await this.$http.get(
             "/api/ecs_oe_student/examFaceLivenessVerify/startFaceVerify/" +
               this.examRecordId
           );
+          this.faceVerifyId = response.data.faceVerifyId;
+        } catch (error) {
+          console.log(error);
+          this.$Message.error({
+            content: "获取底照token失败,请重新登录!",
+            duration: 15,
+            closable: true,
+          });
+          this.logout("?LogoutReason=获取底照token失败,请重新登录!");
+          return;
         }
-        this.faceVerifyId = response.data.faceVerifyId;
-      } catch (error) {
-        this.$Message.error({
-          content: "获取底照token失败,请重新登录!",
-          duration: 15,
-          closable: true,
-        });
-        this.logout("?LogoutReason=获取底照token失败,请重新登录!");
-        return;
       }
 
       if (!response.data.success) {