Browse Source

日常开发

林旭祥 2 weeks ago
parent
commit
1b36c319d0
3 changed files with 129 additions and 120 deletions
  1. 5 2
      src/views/gesture/index.vue
  2. 50 47
      src/views/train/multiple.vue
  3. 74 71
      src/views/train/test.vue

+ 5 - 2
src/views/gesture/index.vue

@@ -283,8 +283,11 @@ onBeforeMount(() => {
     if (e?.device_info) {
       deviceInfo.value = e.device_info;
       let handcontroller_id = deviceInfo.value.handcontroller_id;
-      stateHand(handcontroller_id);
-      getInitExam();
+      //启用才执行命令
+      if (deviceInfo.value.status) {
+        stateHand(handcontroller_id);
+        getInitExam();
+      }
     }
     //获取手势状态
     if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {

+ 50 - 47
src/views/train/multiple.vue

@@ -670,7 +670,10 @@ const initHand = () => {
     if (e?.device_info) {
       deviceInfo.value = e.device_info;
       let handcontroller_id = deviceInfo.value.handcontroller_id;
-      stateHand(handcontroller_id);
+      //启用才执行命令
+      if(deviceInfo.value.status){
+        stateHand(handcontroller_id);
+      }
     }
     //获取手势状态
     if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {
@@ -738,52 +741,52 @@ const initHand = () => {
     }
     //退出
     if (e?.data?.result == 'exit') {
-      //proxy?.$modal.msgSuccess('手势指令:交叉手');
-      // console.log("exitStatus.value", exitStatus.value)
-      // if (exitStatus.value == 0) {
-      //   speckText("请保持两秒确认退出");
-      //   //第一次才弹出
-      //   confirmExit();
-      //   setTimeout(() => {
-      //     let keyEvent: any = null;
-      //     let myKey = null;
-      //     //如果交叉手两秒后返回超过4次就确认退出
-      //     if (exitStatus.value >= 4) {
-      //       myKey = 'Enter';
-      //     } else {
-      //       myKey = 'Esc';
-      //     }
-      //     if (myKey == 'Esc') {
-      //       keyEvent = new KeyboardEvent('keydown', {
-      //         key: 'Escape', // 键值
-      //         code: 'Escape', // 键盘代码
-      //         keyCode: 27, // 旧的键盘代码
-      //         which: 27, // 新的键盘代码
-      //         shiftKey: false, // 是否按下Shift键
-      //         ctrlKey: false, // 是否按下Ctrl键
-      //         metaKey: false, // 是否按下Meta键(Win键或Command键)
-      //         bubbles: true, // 事件是否冒泡
-      //         cancelable: true // 是否可以取消事件的默认行为
-      //       });
-      //       exitStatus.value = 0;
-      //     }
-      //     if (myKey == 'Enter') {
-      //       keyEvent = new KeyboardEvent('keydown', {
-      //         key: 'Enter', // 键值
-      //         code: 'Enter', // 键盘代码
-      //         keyCode: 13, // 旧的键盘代码
-      //         which: 13, // 新的键盘代码
-      //         shiftKey: false, // 是否按下Shift键
-      //         ctrlKey: false, // 是否按下Ctrl键
-      //         metaKey: false, // 是否按下Meta键(Win键或Command键)
-      //         bubbles: true, // 事件是否冒泡
-      //         cancelable: true // 是否可以取消事件的默认行为
-      //       });
-      //     }
-      //     document.activeElement?.dispatchEvent(keyEvent);
-      //   }, 2500)
-      // }
-      // exitStatus.value = exitStatus.value + 1
+      proxy?.$modal.msgSuccess('手势指令:交叉手');
+      console.log("exitStatus.value", exitStatus.value)
+      if (exitStatus.value == 0) {
+        speckText("请保持两秒确认退出");
+        //第一次才弹出
+        confirmExit();
+        setTimeout(() => {
+          let keyEvent: any = null;
+          let myKey = null;
+          //如果交叉手两秒后返回超过4次就确认退出
+          if (exitStatus.value >= 4) {
+            myKey = 'Enter';
+          } else {
+            myKey = 'Esc';
+          }
+          if (myKey == 'Esc') {
+            keyEvent = new KeyboardEvent('keydown', {
+              key: 'Escape', // 键值
+              code: 'Escape', // 键盘代码
+              keyCode: 27, // 旧的键盘代码
+              which: 27, // 新的键盘代码
+              shiftKey: false, // 是否按下Shift键
+              ctrlKey: false, // 是否按下Ctrl键
+              metaKey: false, // 是否按下Meta键(Win键或Command键)
+              bubbles: true, // 事件是否冒泡
+              cancelable: true // 是否可以取消事件的默认行为
+            });
+            exitStatus.value = 0;
+          }
+          if (myKey == 'Enter') {
+            keyEvent = new KeyboardEvent('keydown', {
+              key: 'Enter', // 键值
+              code: 'Enter', // 键盘代码
+              keyCode: 13, // 旧的键盘代码
+              which: 13, // 新的键盘代码
+              shiftKey: false, // 是否按下Shift键
+              ctrlKey: false, // 是否按下Ctrl键
+              metaKey: false, // 是否按下Meta键(Win键或Command键)
+              bubbles: true, // 事件是否冒泡
+              cancelable: true // 是否可以取消事件的默认行为
+            });
+          }
+          document.activeElement?.dispatchEvent(keyEvent);
+        }, 2500)
+      }
+      exitStatus.value = exitStatus.value + 1
     }
     // if (e?.data?.result == "exit") {
     //   console.log("exitStatus.value", exitStatus.value)

+ 74 - 71
src/views/train/test.vue

@@ -823,7 +823,10 @@ const initHand = () => {
     if (e?.device_info) {
       deviceInfo.value = e.device_info;
       let handcontroller_id = deviceInfo.value.handcontroller_id;
-      stateHand(handcontroller_id);
+      //启用才执行命令
+      if(deviceInfo.value.status){
+        stateHand(handcontroller_id);
+      }
     }
     //获取手势状态
     if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {
@@ -841,30 +844,30 @@ const initHand = () => {
       return false;
     }
     //左滑动
-    // if (e?.data?.result == "next_item") {
-    //   proxy?.$modal.msgSuccess('手势指令:左滑动');
-    //   if(examState.value == 43 && time.value.ready){
-    //     return false;
-    //   }
-    //   if (examState.value == 43 || examState.value == 42) {
-    //     speckCancel();//停止播报
-    //     if (needStart.value == false) {
-    //       //自动流程项目重新识别直接返回3
-    //       closeOneTest();
-    //     } else {
-    //       //手动流程项目重新识别43返回41,42返回3
-    //       if (examState.value == 43) {
-    //         cleanData();
-    //         startFace();
-    //       } else {
-    //         closeOneTest();
-    //       }
-    //     }
-    //   }
-    // }
+    if (e?.data?.result == "next_item") {
+      // proxy?.$modal.msgSuccess('手势指令:左滑动');
+      // if(examState.value == 43 && time.value.ready){
+      //   return false;
+      // }
+      // if (examState.value == 43 || examState.value == 42) {
+      //   speckCancel();//停止播报
+      //   if (needStart.value == false) {
+      //     //自动流程项目重新识别直接返回3
+      //     closeOneTest();
+      //   } else {
+      //     //手动流程项目重新识别43返回41,42返回3
+      //     if (examState.value == 43) {
+      //       cleanData();
+      //       startFace();
+      //     } else {
+      //       closeOneTest();
+      //     }
+      //   }
+      // }
+    }
     //举左手
     if (e?.data?.result == 'left_hand') {
-      //proxy?.$modal.msgSuccess('手势指令:举左手');
+      proxy?.$modal.msgSuccess('手势指令:举左手');
       //举左手确认退出
       // if (exitStatus.value) {
       //   exitStatus.value = 0;
@@ -904,54 +907,54 @@ const initHand = () => {
       }
     }
     //退出
-    // if (e?.data?.result == "exit") {
-    //   proxy?.$modal.msgSuccess('手势指令:交叉手');
-    //   // console.log("exitStatus.value", exitStatus.value)
-    //   if (exitStatus.value == 0) {
-    //     speckText("请保持两秒确认退出");
-    //     //第一次才弹出
-    //     confirmExit();
-    //     setTimeout(() => {
-    //       let keyEvent: any = null;
-    //       let myKey = null;
-    //       //如果交叉手两秒后返回超过4次就确认退出
-    //       if (exitStatus.value >= 4) {
-    //         myKey = 'Enter';
-    //       } else {
-    //         myKey = 'Esc';
-    //       }
-    //       if (myKey == 'Esc') {
-    //         keyEvent = new KeyboardEvent('keydown', {
-    //           key: 'Escape', // 键值
-    //           code: 'Escape', // 键盘代码
-    //           keyCode: 27, // 旧的键盘代码
-    //           which: 27, // 新的键盘代码
-    //           shiftKey: false, // 是否按下Shift键
-    //           ctrlKey: false, // 是否按下Ctrl键
-    //           metaKey: false, // 是否按下Meta键(Win键或Command键)
-    //           bubbles: true, // 事件是否冒泡
-    //           cancelable: true // 是否可以取消事件的默认行为
-    //         });
-    //         exitStatus.value = 0;
-    //       }
-    //       if (myKey == 'Enter') {
-    //         keyEvent = new KeyboardEvent('keydown', {
-    //           key: 'Enter', // 键值
-    //           code: 'Enter', // 键盘代码
-    //           keyCode: 13, // 旧的键盘代码
-    //           which: 13, // 新的键盘代码
-    //           shiftKey: false, // 是否按下Shift键
-    //           ctrlKey: false, // 是否按下Ctrl键
-    //           metaKey: false, // 是否按下Meta键(Win键或Command键)
-    //           bubbles: true, // 事件是否冒泡
-    //           cancelable: true // 是否可以取消事件的默认行为
-    //         });
-    //       }
-    //       document.activeElement?.dispatchEvent(keyEvent);
-    //     }, 2500)
-    //   }
-    //   exitStatus.value = exitStatus.value + 1
-    // }
+    if (e?.data?.result == "exit") {
+      proxy?.$modal.msgSuccess('手势指令:交叉手');
+      // console.log("exitStatus.value", exitStatus.value)
+      if (exitStatus.value == 0) {
+        speckText("请保持两秒确认退出");
+        //第一次才弹出
+        confirmExit();
+        setTimeout(() => {
+          let keyEvent: any = null;
+          let myKey = null;
+          //如果交叉手两秒后返回超过4次就确认退出
+          if (exitStatus.value >= 4) {
+            myKey = 'Enter';
+          } else {
+            myKey = 'Esc';
+          }
+          if (myKey == 'Esc') {
+            keyEvent = new KeyboardEvent('keydown', {
+              key: 'Escape', // 键值
+              code: 'Escape', // 键盘代码
+              keyCode: 27, // 旧的键盘代码
+              which: 27, // 新的键盘代码
+              shiftKey: false, // 是否按下Shift键
+              ctrlKey: false, // 是否按下Ctrl键
+              metaKey: false, // 是否按下Meta键(Win键或Command键)
+              bubbles: true, // 事件是否冒泡
+              cancelable: true // 是否可以取消事件的默认行为
+            });
+            exitStatus.value = 0;
+          }
+          if (myKey == 'Enter') {
+            keyEvent = new KeyboardEvent('keydown', {
+              key: 'Enter', // 键值
+              code: 'Enter', // 键盘代码
+              keyCode: 13, // 旧的键盘代码
+              which: 13, // 新的键盘代码
+              shiftKey: false, // 是否按下Shift键
+              ctrlKey: false, // 是否按下Ctrl键
+              metaKey: false, // 是否按下Meta键(Win键或Command键)
+              bubbles: true, // 事件是否冒泡
+              cancelable: true // 是否可以取消事件的默认行为
+            });
+          }
+          document.activeElement?.dispatchEvent(keyEvent);
+        }, 2500)
+      }
+      exitStatus.value = exitStatus.value + 1
+    }
     // if (e?.data?.result == "exit") {
     //   console.log("exitStatus.value", exitStatus.value)
     //   if (exitStatus.value == 0) {