chenyc
2023-11-27 e9ef9bfe411bda655f6231f3213cb09039b9dbb7
更新识别逻辑 定时
8个文件已修改
3个文件已添加
65 ■■■■ 已修改文件
imgs/1701000759385.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1701001208978.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1701042873813.png 补丁 | 查看 | 原始文档 | blame | 历史
package.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/samples/deviceApi/XK3190A12.ts 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/samples/faceApi.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/stores/StoresConfing.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/formatTime.ts 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/index.vue 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1701000759385.png
imgs/1701001208978.png
imgs/1701042873813.png
package.json
@@ -1,6 +1,6 @@
{
  "name": "sign-tool",
  "version": "2.7.2",
  "version": "2.7.3",
  "icon": "public/favicon.ico",
  "main": "dist/electron/main/index.js",
  "author": "",
src/main.ts
@@ -4,6 +4,8 @@
import router from './router/index'
import "tracking";
import "tracking/build/data/face";
import "tracking/build/data/eye";
import "tracking/build/data/mouth";
import { ElMessage } from 'element-plus';
import { createPinia } from 'pinia'
import App from './App.vue'
src/samples/deviceApi/XK3190A12.ts
@@ -7,7 +7,8 @@
import { confingInfoStore } from '@/stores/StoresConfing'
const initPort=(path:String,baudRate:Number)=>{
    // 是否清零了
   let  sfqingling=true
    // 配置文件定义的对此次数
    const yanjiancishu=confingInfoStore().confingInfo.jianyancishu===undefined?4:confingInfoStore().confingInfo.jianyancishu
    console.log('初始化打开XK3190-A12体重秤端口',yanjiancishu)
@@ -54,7 +55,9 @@
                duibinum=0
            }
            // 对比4次结果都一致
            if(duibinum>=yanjiancishu){
            if(duibinum>=yanjiancishu&&sfqingling){
                // 数据发送  体重没有清零  下次就不播报不发送
                sfqingling=false
                const res=Number(list)
                console.log(res,'获取到的体重')
                sockteStore().setweightSockte(
@@ -75,6 +78,7 @@
            
        }else{
            sfqingling=true
            console.log('小于20')
        }  
    }) // all data after READY is received
src/samples/faceApi.ts
@@ -100,7 +100,7 @@
  if(err){
    console.log(err);
  }else{
    console.log('写入成功!',path);
    console.log('写入成功!验证阿里',path);
    // getOssUrl(path)
    // 验证图片
    faceShibie(path)
src/stores/StoresConfing.ts
@@ -22,7 +22,7 @@
        // 志荣的[zhiRongT605];台衡的M523[taiHengM523] //[s]eca101]读文件夹//  耀华XK3190-A12
        tzc_type:"seca101",
        tzcPortPath:"COM34",
        tzcBaudRate:9600,// zhiRongT605波特率1200;台衡523波特率9600, 耀华XK3190-A12 9600
        tzcBaudRate:9600,// zhiRongT605波特率1200;台衡523波特率9600, 耀华XK3190-A12 9600 耀华XK3190-A11E 1200
        seca101Path:"D:/seca101/data/",//该参数只对体重秤 赛康101 文件获取目录,
        jianyancishu:4,// 该参数只对耀华XK3190-A12体重秤有效  检验体重秤多次数据相等就传送
        
src/utils/formatTime.ts
@@ -1,3 +1,5 @@
import { Data } from "electron/main"
/**
 * 时间日期转换
 * @param date 当前时间,new Date() 格式
@@ -211,3 +213,12 @@
    const y=Math.abs(parseInt(date1[11]) - parseInt(date2[12]))
    return m+'年'+y+'月'
}
export function jgTime(data1:Data,data2:Data):number{
    // 获取两个日期的毫秒数
    var milliseconds1 = data1.getTime();
    var milliseconds2 = data2.getTime();
    // 计算两个日期的差值(毫秒数差)
    var differenceInMilliseconds = milliseconds2 - milliseconds1;
    var differenceInSeconds = Math.floor(differenceInMilliseconds / 1000);
    return differenceInSeconds
}
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)
src/views/login/index.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
import {base64toFile} from '@/samples/faceApi'
import { formatDate } from "@/utils/formatTime";
import { formatDate ,jgTime} from "@/utils/formatTime";
import { confingInfoStore } from "@/stores/StoresConfing";
const msg = ref<string>("没识别到人脸...");
@@ -13,6 +13,7 @@
// 标识用的画布
const myCanvas = ref<HTMLCanvasElement | null>(null);
let imgSrc:'';
let chuansongTime;
// 实例人脸检查器
const myTracker: any = new tracking.ObjectTracker("face");
myTracker.setInitialScale(4);
@@ -37,6 +38,8 @@
    // 转文件
    // 识别框显示才能到传阿里云识别
    if(dialogVisible.value){
      // if(new Date())
      // chuansongTime=new Date()
      base64toFile(imgSrc)
    }
    setTimeout(() => {
@@ -55,7 +58,10 @@
  // 触发人脸检查器
  console.log('人脸识别初始化')
  const  isUseFaceRecogService = confingInfoStore().confingInfo.isUseFaceRecogService
  console.log('人脸识别',isUseFaceRecogService)
  // console.log('人脸识别',isUseFaceRecogService)
  let jg= jgTime(new Date(),new Date())
  console.log(jg)
  setInterval(function () {
    date.value= formatDate(new Date(),'YYYY-mm-dd HH:MM')
  }, 1000)