Browse Source

日常开发

林旭祥 2 weeks ago
parent
commit
6923e5558b
3 changed files with 12 additions and 18 deletions
  1. 3 3
      src/components/OnlineFaceWindow/index.vue
  2. 0 8
      src/types/components.d.ts
  3. 9 7
      src/utils/faceWs.ts

+ 3 - 3
src/components/OnlineFaceWindow/index.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
     <Transition :enter-active-class="proxy?.animate.mask.enter" :leave-active-class="proxy?.animate.mask.leave">
-      <div class="mask" v-show="faceState"></div>
+      <div class="mask" v-if="faceState"></div>
     </Transition>
     <Transition :enter-active-class="proxy?.animate.rankingWindow.enter"
       :leave-active-class="proxy?.animate.rankingWindow.leave">
-      <div class="confirmDiaBg" v-show="faceState">
+      <div class="confirmDiaBg" v-if="faceState">
         <div>
           <div class="confirmDiaWindow">
             <div class="confirmDiaWindow-con">
@@ -79,7 +79,7 @@ const getInit = async () => {
       if (e?.code == 0) {
         //查看人脸识别状态,如果不处于关闭就先关闭再重新启动(可能会APP退出然后工作站还在运行的可能性)
         getFaceState(handcontroller_id);
-      } else if (e?.code == 102402) {
+      } else if (e.code == 102402) {
         getCloseFace()
         proxy?.$modal.msgError(`人脸识别模块被占用,请重试`);
       } else {

+ 0 - 8
src/types/components.d.ts

@@ -8,18 +8,10 @@ export {}
 declare module 'vue' {
   export interface GlobalComponents {
     ChooseStudent: typeof import('./../components/ChooseStudent/index.vue')['default']
-    copy: typeof import('./../components/FaceWindow copy/index.vue')['default']
-    ElAvatar: typeof import('element-plus/es')['ElAvatar']
-    ElButton: typeof import('element-plus/es')['ElButton']
     ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
     ElIcon: typeof import('element-plus/es')['ElIcon']
-    ElInput: typeof import('element-plus/es')['ElInput']
     ElOption: typeof import('element-plus/es')['ElOption']
-    ElPagination: typeof import('element-plus/es')['ElPagination']
     ElSelect: typeof import('element-plus/es')['ElSelect']
-    ElSwitch: typeof import('element-plus/es')['ElSwitch']
-    ElTable: typeof import('element-plus/es')['ElTable']
-    ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     FaceWindow: typeof import('./../components/FaceWindow/index.vue')['default']
     Header: typeof import('./../components/Header/index.vue')['default']
     JumpRopeGame: typeof import('./../components/JumpRopeGame/index.vue')['default']

+ 9 - 7
src/utils/faceWs.ts

@@ -22,12 +22,12 @@ export function useWebSocket() {
       callback(e);
     });
     socketFace.on('facecontroller_ack', (e: any) => {
-      if (e?.cmd == 'check_facecontroller_available' && e?.code != 0) {
-        closeWS();
-      }
-      if (e?.cmd == 'get_facecontroller_state' && [3, 36].includes(e.state)) {
-        closeWS();
-      }
+      // if (e?.cmd == 'check_facecontroller_available' && e?.code != 0) {
+      //   closeWS();
+      // }
+      // if (e?.cmd == 'get_facecontroller_state' && [3, 36].includes(e.state)) {
+      //   closeWS();
+      // }
       callback(e);
     });
     socketFace.on('facecontroller_result', (e: any) => {
@@ -103,7 +103,9 @@ export function useWebSocket() {
         cmd: 'terminate_facecontroller',
         ctrl_name: `facecontroller_${data}`
       },
-      () => { }
+      () => {
+        closeWS();
+      }
     );
   }