Bladeren bron

定时抓拍bug。消息duration设置。

Michael Wang 6 jaren geleden
bovenliggende
commit
961681ce2f

+ 1 - 1
src/components/FaceRecognition/FaceRecognition.vue

@@ -80,8 +80,8 @@ export default {
       const [fileName, captureFilePath] = await this.uploadToServer(
         captureBlob
       );
-      this.decreaseSnapCount();
       await this.faceCompare(fileName, captureFilePath);
+      this.decreaseSnapCount();
       const video = this.$refs.video;
       video && video.play();
     },

+ 6 - 6
src/features/OnlineExam/Examing/FaceId.vue

@@ -148,25 +148,25 @@ export default {
           if (receivedMsg.verifyResult == "TIME_OUT") {
             this.$Message.error({
               content: "第一次人脸检测超时,检测失败,系统退出,请重新登录",
-              duration: 15000
+              duration: 15
             });
             this.logout();
           } else if (receivedMsg.verifyResult == "VERIFY_FAILED") {
             this.$Message.error({
               content: "第一次人脸检测失败,系统退出,请重新登录",
-              duration: 15000
+              duration: 15
             });
             this.logout();
           } else if (receivedMsg.verifyResult == "NOT_ONESELF") {
             this.$Message.error({
               content: "人脸检测不合格,结束考试",
-              duration: 15000
+              duration: 15
             });
             this.faceTestEndHandle("FAILED");
           } else if (receivedMsg.verifyResult == "VERIFY_SUCCESS") {
             this.$Message.info({
               content: "人脸检测成功,请继续完成考试",
-              duration: 15000
+              duration: 15
             });
             this.faceTestEndHandle("SUCCESS");
           }
@@ -175,13 +175,13 @@ export default {
             // FIXME: 什么逻辑?
             this.$Message.info({
               content: "人脸检测成功,请继续完成考试",
-              duration: 15000
+              duration: 15
             });
             this.faceTestEndHandle("SUCCESS");
           } else {
             this.$Message.info({
               content: "人脸检测不合格,结束考试",
-              duration: 15000
+              duration: 15
             });
             this.faceTestEndHandle("FAILED");
           }

+ 24 - 7
src/features/OnlinePractice/OnlinePracticeRecordList.vue

@@ -8,9 +8,13 @@
 
     <div class="home">
 
-      <div>
-
+      <div style="display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 20px">
+        <div>批次: <span></span></div>
+        <div>科目: <span></span></div>
+        <div>平均正确率: <span>{{aveAccuracy}}</span></div>
+        <div>最高正确率: <span>{{maxAccuracy}}</span></div>
       </div>
+
       <div class="list">
         <table>
           <tbody class="list-row">
@@ -52,15 +56,15 @@
 </template>
 
 <script>
-import { createNamespacedHelpers } from "vuex";
+// import { createNamespacedHelpers } from "vuex";
 import moment from "moment";
-import { mapState as globalMapState } from "vuex";
-const { mapMutations } = createNamespacedHelpers("examHomeModule");
+// import { mapState as globalMapState } from "vuex";
+// const { mapMutations } = createNamespacedHelpers("examHomeModule");
 
 export default {
   name: "OnlinePracticeRecordList",
   data() {
-    return { recordList: [] };
+    return { exam: null, recordList: [] };
   },
   async created() {
     const res = await this.$http.get(
@@ -80,6 +84,20 @@ export default {
     formatTime(ms) {
       return moment.utc(ms).format("HH:mm:ss") || "";
     }
+  },
+  computed: {
+    maxAccuracy() {
+      return Math.max(...this.recordList.map(v => v.objectiveAccuracy)) || 0;
+    },
+    aveAccuracy() {
+      if (this.recordList.length === 0) {
+        return 0;
+      }
+      return (
+        this.recordList.map(v => v.objectiveAccuracy).reduce((a, b) => a + b) /
+        this.recordList.length
+      );
+    }
   }
 };
 </script>
@@ -106,4 +124,3 @@ export default {
   padding: 10px;
 }
 </style>
-