From 995f645c1f9d7c9bdc7462806c2506820397cf65 Mon Sep 17 00:00:00 2001
From: chenyincheng <501753378@qq.com>
Date: 星期三, 28 十二月 2022 21:12:02 +0800
Subject: [PATCH] 添加刷脸识别

---
 src/views/home/index.vue |   93 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 64 insertions(+), 29 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index a58e3da..f1ad53c 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -18,10 +18,15 @@
 import step2 from '@/assets/mp3/step2.mp3'
 import step1 from '@/assets/mp3/step1.mp3'
 import step7 from '@/assets/mp3/chongfuchengzhong.mp3'
+import login from '@/views/login/index.vue'
+import { confingInfoStore } from '@/stores/StoresConfing'
 
 export default {
+    name: 'hoem',
+    components: { login },
     setup() {
         let timer: any = 0
+        const loginRef = ref();
         const user = userInfoStore()
         const sockte = sockteStore()
         const inputRef = ref()
@@ -33,7 +38,7 @@
         const AudioRef5=ref()
         const AudioRef7=ref()
         let patientCodeLs=''
-        
+        const isUseFaceRecogService=ref(false)
         const isLink = computed(() => {
             return !sockte.isLink
         })
@@ -135,33 +140,42 @@
               console.log('患者信息变化',patientInfo.value)
               patientCodeLs=''
               console.log(patientCodeLs,'患者codec初始化')
-                if (patientInfo.value.id !== 0) {
-                    AudioRef.value.play();
-                    sockteStore().setweightSockte({
-                        type: "体重秤",
-                        state: 2,
-                        deviceName: "",
-                        result: "0",
-                        resultTime: ""
-                    })
-                    sockteStore().setxyjSockte({
-                        type: "血压计",
-                        state: 2,
-                        deviceName: "",
-                        result: "",
-                        resultTime: ""
-                    })
-                    settime()
+             
+              if (patientInfo.value.id !== 0) {
+                  AudioRef.value.play();
+                  sockteStore().setweightSockte({
+                      type: "体重秤",
+                      state: 2,
+                      deviceName: "",
+                      result: "0",
+                      resultTime: ""
+                  })
+                  sockteStore().setxyjSockte({
+                      type: "血压计",
+                      state: 2,
+                      deviceName: "",
+                      result: "",
+                      resultTime: ""
+                  })
+                  settime()
 
-                }
-                else if(patientInfo.value.name===''){
-                    AudioRef4.value.play();
-                    return
+              }
+              // 没有找到患者
+              else if(patientInfo.value.name===''){
+                  AudioRef4.value.play();
+                  if(isUseFaceRecogService.value){
+                    state.dialogVisible=true
                   }
-                else if(patientInfo.value.isScheduled===0){
-                      AudioRef5.value.play();
-                      return
-                }
+                  return
+              }
+                // 没有排班
+              else if(patientInfo.value.isScheduled===0){
+                    AudioRef5.value.play();
+                    if(isUseFaceRecogService.value){
+                      state.dialogVisible=true
+                    }
+                    return
+              }
             }
         );
         watch(
@@ -239,6 +253,7 @@
         watch(
             () => dkqInfo.value.resultTime,
             () => {
+              state.dialogVisible=false
               console.log(dkqInfo.value,'读卡器')
                 if (dkqInfo.value.result !== ''&&dkqInfo.value.result !== undefined) {
                   const code=dkqInfo.value.result.split(",")[0]
@@ -267,6 +282,12 @@
         }
         onMounted(() => {
             console.log('页面初始化', os.hostname())
+            console.log('页面初始化读取配置文件',confingInfoStore().confingInfo)
+            // 是否开启脸识别
+            isUseFaceRecogService.value=confingInfoStore().confingInfo.isUseFaceRecogService
+            if(isUseFaceRecogService.value){
+              state.dialogVisible=true
+            }
             state.haodu=(document.documentElement.clientHeight-180)/2+'px'
             state.clockNum = patientInfoStore().viewNumber
             setInterval(function () {
@@ -276,13 +297,23 @@
             
         })
         return {
-            ...toRefs(state), guyanbi,isLink, netLink, weightInfo, patientInfo, xyjInfo, inputRef, AudioRef0, AudioRef, AudioRef4,AudioRef5, AudioRef2, AudioRef3,AudioRef7, inputChabge
+            ...toRefs(state), guyanbi, loginRef,isLink, netLink, weightInfo, patientInfo, xyjInfo, inputRef, AudioRef0, AudioRef, AudioRef4,AudioRef5, AudioRef2, AudioRef3,AudioRef7, inputChabge
         }
     }
 }
 </script>
 <template>
-    <div class="pagehome">
+    <div >
+      <div class="pagehome">
+        <el-dialog v-model="dialogVisible" width="80%" center :show-close="false">
+          <template>
+            <div class="my-header">
+              <h4>人脸识别中。。。</h4>
+            </div>
+          </template>
+          <login ref="loginRef" />
+        </el-dialog>
+      </div>
          <!-- 提醒刷卡 -->
         <audio :src="step1" ref="AudioRef0" id="eventAudio1"></audio>
         <!-- 患者信息读取成功 -->
@@ -303,6 +334,9 @@
         <el-dialog title="提示" v-model="isLink" width="30%">
             <span>sockte连接失败正在重连。。。。。。</span>
         </el-dialog>
+        <!-- <div>
+          <el-button type="primary" @click="dialogVisible=true"  size="small">测试</el-button>
+        </div> -->
         <el-row class="header">
           <el-col :span="8">
               <img 
@@ -492,7 +526,7 @@
     </div>
 
 </template>
-<style  scoped>
+<style lang="less"  scoped>
 body{
   background: #F3F6FE;
   padding: 0;
@@ -603,4 +637,5 @@
 
 
 
+
 </style>

--
Gitblit v1.8.0