Browse Source

考前人脸比对,视频不正常,禁止比对

Michael Wang 6 years ago
parent
commit
feea172a24
1 changed files with 14 additions and 4 deletions
  1. 14 4
      src/components/FaceRecognition/FaceRecognition.vue

+ 14 - 4
src/components/FaceRecognition/FaceRecognition.vue

@@ -13,7 +13,7 @@
       style="position: absolute; width: 400px; text-align: center; margin-top: -50px; color: #232323;"
     >
       <button
-        class="verify-button"
+        :class="['verify-button', disableSnap && 'disable-verify-button']"
         @click="snap"
         :disabled="disableSnap"
       >{{msg}}</button>
@@ -29,7 +29,7 @@ const { mapState, mapMutations } = createNamespacedHelpers("examingHomeModule");
 export default {
   name: "FaceRecognition",
   data() {
-    return { disableSnap: false, msg: "开始识别" };
+    return { disableSnap: true, msg: "开始识别" };
   },
   props: {
     width: String,
@@ -90,6 +90,7 @@ export default {
             video.srcObject = stream;
             try {
               await video.play();
+              this.disableSnap = false;
             } catch (error) {
               this.$Message.error({
                 content: "摄像头没有正常启用",
@@ -106,7 +107,6 @@ export default {
             ]);
           }
         } catch (error) {
-          console.log(error);
           this.$Message.error("无法启用摄像头");
           window._hmt.push([
             "_trackEvent",
@@ -197,7 +197,8 @@ export default {
             "_trackEvent",
             "摄像头框",
             "摄像头状态",
-            "摄像头没有正常启用-退出"
+            "摄像头没有正常启用-退出" +
+              (this.lastSnapTime ? "(非初次抓拍)" : "")
           ]);
           reject("摄像头没有正常启用");
           this.logout();
@@ -351,4 +352,13 @@ export default {
   color: #444444;
   cursor: pointer;
 }
+
+.disable-verify-button {
+  background-color: #ffceff;
+}
+
+.disable-verify-button:hover {
+  color: black;
+  cursor: not-allowed;
+}
 </style>