Browse Source

撤销 FaceID 接口的变动

Michael Wang 5 năm trước cách đây
mục cha
commit
35460bb4b2
1 tập tin đã thay đổi với 28 bổ sung52 xóa
  1. 28 52
      src/features/OnlineExam/Examing/FaceId.vue

+ 28 - 52
src/features/OnlineExam/Examing/FaceId.vue

@@ -250,59 +250,35 @@ export default {
     /**
      * 人脸检测结果返回后台处理
      */
-    async faceTestUploadResult(result) {
-      let endRes;
-      try {
-        for (let i = 0; i < 20; i++) {
-          endRes = await this.$http.get(
-            "/api/ecs_oe_student/examFaceLivenessVerify/faceLivenessVerifyEnd/" +
-              this.examRecordId +
-              "?result=" +
-              result
-          );
-          console.log(endRes);
-          if (endRes.data.code === "S-101000") {
-            await new Promise(resolve => setTimeout(() => resolve(), 3000));
-            continue;
-          } else if (endRes.data.code === "000000") {
-            break;
+    faceTestUploadResult(result) {
+      this.$http
+        .get(
+          "/api/ecs_oe_student/examFaceLivenessVerify/faceLivenessVerifyEnd/" +
+            this.examRecordId +
+            "?result=" +
+            result
+        )
+        .then(() => {
+          if (result != "SUCCESS") {
+            this.logout("?LogoutReason=活体检测失败");
+            window._hmt.push(["_trackEvent", "活体检测弹出框", "活体检测失败"]);
+          } else {
+            window._hmt.push(["_trackEvent", "活体检测弹出框", "活体检测成功"]);
           }
-        }
-      } catch {
-        this.$Message.error({
-          content: "上传人脸检测结果出错!",
-          duration: 15,
-          closable: true,
-        });
-        window._hmt.push([
-          "_trackEvent",
-          "活体检测弹出框",
-          "上传人脸检测结果出错!",
-        ]);
-        this.logout("?LogoutReason=上传人脸检测结果出错!");
-      }
-      if (endRes.data.code !== "000000") {
-        this.$Message.error({
-          content: "上传人脸检测结果出错!累积20次,未取到正确结果!",
-          duration: 15,
-          closable: true,
+        })
+        .catch(() => {
+          this.$Message.error({
+            content: "上传人脸检测结果出错!",
+            duration: 15,
+            closable: true,
+          });
+          window._hmt.push([
+            "_trackEvent",
+            "活体检测弹出框",
+            "上传人脸检测结果出错!",
+          ]);
+          this.logout("?LogoutReason=上传人脸检测结果出错!");
         });
-        window._hmt.push([
-          "_trackEvent",
-          "活体检测弹出框",
-          "上传人脸检测结果出错!累积20次,未取到正确结果!",
-        ]);
-        this.logout(
-          "?LogoutReason=上传人脸检测结果出错!累积20次,未取到正确结果!"
-        );
-      } else {
-        if (result != "SUCCESS") {
-          this.logout("?LogoutReason=活体检测失败");
-          window._hmt.push(["_trackEvent", "活体检测弹出框", "活体检测失败"]);
-        } else {
-          window._hmt.push(["_trackEvent", "活体检测弹出框", "活体检测成功"]);
-        }
-      }
     },
     iframeLoadSuccess() {
       window._hmt.push([
@@ -403,7 +379,7 @@ export default {
           iframeDomReady = true;
           console.log("faceid iframe dom ready");
           iframe.insertCSS(".copyright { display: none !important;}");
-          iframe.openDevTools();
+          // iframe.openDevTools();
         });
 
         iframe.addEventListener("ipc-message", event => {