From e9ef9bfe411bda655f6231f3213cb09039b9dbb7 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期一, 27 十一月 2023 09:22:21 +0800
Subject: [PATCH] 更新识别逻辑 定时

---
 src/views/home/index.vue |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index e293f87..d35609a 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -216,7 +216,7 @@
 import Speech from 'speak-tts'
 import { reactive,computed, toRefs, onMounted, watch, ref } from "vue"
 import { sendPationCodeApi } from '../../samples/httpApi'
-import { formatDate } from '@/utils/formatTime'
+import { formatDate,jgTime } from '@/utils/formatTime'
 import { confingInfoStore } from '@/stores/StoresConfing'
 import {base64toFile} from '@/samples/faceApi'
 import{initPort} from '@/samples/portApi'
@@ -229,12 +229,14 @@
 import{toDataTz,todatatzs } from '@/samples/deviceApi/seca101'
 import { ElLoading, ElMessage } from 'element-plus'
 import { el } from 'element-plus/es/locale'
+import { Console } from 'console'
 let trackerTask: any = null;
+let lsDateTime:any=new Date()
 // 标识用的画布
 const myCanvas = ref<HTMLCanvasElement | null>(null);
 let imgSrc:'';
 const msg = ref<string>("没识别到人脸...");
-// 实例人脸检查器
+// 实例人脸检查器                    ObjectTracker
 const myTracker: any = new tracking.ObjectTracker("face");
 myTracker.setInitialScale(4);
 myTracker.setStepSize(2);
@@ -246,18 +248,25 @@
     context.clearRect(0, 0, myCanvas.value.width, myCanvas.value.height);
   }
   if (event.data.length === 0) {
+    // console.log('没有监测到---')
     msg.value = "没识别到人脸...";
-  } else if(event.data.length === 1) {
+  } else if(event.data.length >= 1){
     trackerTask.stop();
     msg.value = "检测到人脸";
+    console.log('监测到人脸2样')
+    console.log(event.data)
     const myCanvas = document.getElementById("myCanvas");// 
     const thisContext = myCanvas?.getContext("2d");
     const myVideo = document.querySelector("#myVideo") as HTMLVideoElement;
     thisContext.drawImage(myVideo, 0,0, 250, 200);
     imgSrc = myCanvas?.toDataURL('image/png');
+    const X= jgTime(lsDateTime,new Date())
+    
     // 转文件
     // 识别框显示才能到传阿里云识别
-    if(dialogVisible.value){
+    if(dialogVisible.value&&X>configData.value.face_push){
+      lsDateTime=new Date()
+      console.log(X,'上传阿里识别间隔')
       base64toFile(imgSrc)
     }
     setTimeout(() => {
@@ -528,11 +537,11 @@
         }else if(Number(patientInfo.value.pureWeight) !== 0&&patientInfo.value.isAfterMed===1 && patientInfo.value.preWeight>10){
           aimTSL.value = (Number(patientInfo.value.preWeight)- Number(patientInfo.value.pureWeight) - Number(patientInfo.value.clothesWeight)).toFixed(2)
         }
-      }else if(patientInfo.value.code===''&&weightInfo.value.result !== "0"){
-        speech.value?.speak({ text: "没有识别的患者,请先验证患者" }).then(() => {
-          // console.log("播报完成...")
-        })
-      }
+    }else if(patientInfo.value.code===''&&weightInfo.value.result !== "0"){
+      speech.value?.speak({ text: "没有识别的患者,请先验证患者" }).then(() => {
+        // console.log("播报完成...")
+      })
+    }
   }
 );
 // 血压发送了变化
@@ -697,6 +706,7 @@
   console.log(0%5)
   console.log('页面初始化', os.hostname())
   setTimeout(()=>{
+    
     console.log('8秒后执行')
     console.log('打印设置文件')
     console.log(configData.value)

--
Gitblit v1.8.0