From fe2618c213d59d2fe3cbef757cfe593ba46a56e5 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 24 一月 2025 11:12:29 +0800
Subject: [PATCH] 优化本地人脸识别逻辑
---
src/views/home/index.vue | 2 +-
src/api/user/index.ts | 2 +-
src/stores/StoresConfing.ts | 4 +++-
chenyc.ps | 27 +++++++++++++++++++++++++++
src/samples/faceApi.ts | 15 +++++++++++++++
src/samples/deviceApi/XK3190A12.ts | 1 +
6 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/chenyc.ps b/chenyc.ps
new file mode 100644
index 0000000..25c6bd7
--- /dev/null
+++ b/chenyc.ps
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# 设置变量
+user="chenyc"
+start_date="2024-01-01T00:00:00"
+end_date="2024-12-30T23:59:59"
+
+# 检查当前目录是否是Git仓库
+if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
+ echo "当前目录不是一个Git仓库。请在Git仓库的根目录下运行此脚本。"
+ exit 1
+fi
+
+# 获取提交次数
+commit_count=$(git log --author="$user" --since="$start_date" --until="$end_date" --pretty=oneline | wc -l)
+
+# 获取代码行数的变化
+lines_info=$(git log --author="$user" --since="$start_date" --until="$end_date" --pretty=tformat: --numstat | awk '{ add += $1; del += $2; net += $1 - $2 } END { printf "%s,%s,%s", add, del, net }')
+IFS=',' read lines_added lines_deleted lines_changed <<< "$lines_info"
+
+# 输出结果
+echo "日期: $start_date ~ $end_date"
+echo "用户: $user"
+echo "提交次数: $commit_count"
+echo "增加的代码行数: $lines_added"
+echo "删除的代码行数: $lines_deleted"
+echo "净变化的代码行数: $lines_changed"
diff --git a/src/api/user/index.ts b/src/api/user/index.ts
index 4594e8b..b043aa8 100644
--- a/src/api/user/index.ts
+++ b/src/api/user/index.ts
@@ -41,7 +41,7 @@
}
export function checkUploadFile(params: Object) {
return request({
- url: `http://127.0.0.1:5000/check-face`,
+ url: `${confingInfoStore().confingInfo.faceApi}/check-face`,
method: 'post',
data: params,
})
diff --git a/src/samples/deviceApi/XK3190A12.ts b/src/samples/deviceApi/XK3190A12.ts
index d5e087e..f9e6073 100644
--- a/src/samples/deviceApi/XK3190A12.ts
+++ b/src/samples/deviceApi/XK3190A12.ts
@@ -93,6 +93,7 @@
})
// 解析分割数据流
// 77 6E 30 30 30 30 30 2E 30 6B 67 0D 0A
+
// 77 6E 30 30 30 30 32 38 2E 36 6B 67 0D 0A
// 77 6E 30 30 30 30 32 38 2E 36 6B 67 0D 0A
//wn000016.6kg
diff --git a/src/samples/faceApi.ts b/src/samples/faceApi.ts
index fa1f959..2de0bdf 100644
--- a/src/samples/faceApi.ts
+++ b/src/samples/faceApi.ts
@@ -141,6 +141,19 @@
formData.append('file', blobFile)
checkUploadFile(formData).then(re=>{
console.log('-----',re)
+ if(re.code===200&&re?.result?.length>0){
+ const entityId=re?.result[0]._label
+ console.log(entityId,'得到了人脸识别id,存患者code到vuex')
+ sockteStore().setfaceSockte({
+ deviceType: "人脸识别",
+ deviceName: "人脸识别",
+ result: entityId,
+ resultTime: ''
+ })
+ }else{
+ console.log('本地没识别')
+ }
+
}).finally(()=>{
// 删除图片
delImg(path)
@@ -173,10 +186,12 @@
// 是否本地识别
const isLanFace= confingInfoStore().confingInfo.isLanFace
if(isLanFace===true){
+ console.log('本地识别')
//本地识别
faceApiCheck(path)
}else{
//阿里验证外网
+ console.log('阿里识别')
faceShibie(path)
}
diff --git a/src/stores/StoresConfing.ts b/src/stores/StoresConfing.ts
index f53b7c5..f671846 100644
--- a/src/stores/StoresConfing.ts
+++ b/src/stores/StoresConfing.ts
@@ -2,7 +2,8 @@
import { ref } from 'vue'
export const confingInfoStore =defineStore('confingInfo',()=>{
const confingInfo=ref({
- isLanFace:false,
+ isLanFace:false,//内网版
+ faceApi:'',
screenTimeout: 150,
// 启用人脸识别
isUseFaceRecogService: true,
@@ -13,6 +14,7 @@
//结果展示等待页面读秒
timeJg:10000,
base_api:"",
+
// 人脸识别请求间隔
face_push:3,
imgHeight:200,
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index f5da880..2126732 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -53,7 +53,7 @@
<div style="height: 77%;">
<div style="display: grid;grid-template-columns: minmax(250px, 40%) 1fr; height: 100%; padding-left: 20px;padding-top: 20px;">
<!-- 头像 -->
- <div :style="{backgroundImage:`url(${patientInfo.patientAvatarIcon})`}" style="background-size:100% 100%;height: 100%;" >
+ <div :style="{backgroundImage:`url(${patientInfo.patientAvatarIcon.replace(/\\/g, '/').replace(/%EF%BF%BD/g, '')})`}" style="background-size:100% 100%;height: 100%;" >
<div style="width:140px; height: 50px; line-height: 50px; font-size: 25px; background: #9F61DC;color: #FFFFFF; font-weight: 500; text-align: center; border-radius: 0px 8px 0px 30px; float: right;">
{{patientInfo.name}}
</div>
--
Gitblit v1.8.0