zengyicheng 3 tahun lalu
induk
melakukan
ff1abb4748
1 mengubah file dengan 6 tambahan dan 4 penghapusan
  1. 6 4
      src/components/function.vue

+ 6 - 4
src/components/function.vue

@@ -157,7 +157,7 @@ export default {
           // 实时拍照效果
           _this.$refs["video"].play();
 
-          if (_this.$store.state.function.indexOf("face=1;") != -1) {
+          if (_this.$store.state.function.indexOf("face=1;") != -1 && _this.$store.state.function.indexOf("police=1;") != -1) {
             // this.$message.error("摄像头开启失败,请检查摄像头是否可用!");
 
             const video = this.videoEl;
@@ -186,7 +186,9 @@ export default {
                 _this.count += 1;
                 if (_this.count > 10) {
                   _this.isdetected = "已检测到人脸";
-                  _this.fnRun();
+                  if (_this.sampleArr.length > 0) {
+                    _this.fnRun();
+                  }
                 }
               } else {
                 _this.count -= 1;
@@ -223,8 +225,8 @@ export default {
       json.img.push(imgBase64);
       this.sampleArr.push(json);
       if (this.sampleArr.length > 0) {
-        var a = document.getElementsByClassName("spot");
-        a[0].style.display = "block";
+        // var a = document.getElementsByClassName("spot");
+        // a[0].style.display = "block";
         this.fnsample();
       }
       //this.fnInit()