linxuxiang hace 6 meses
padre
commit
75b447ee47
Se han modificado 4 ficheros con 60 adiciones y 46 borrados
  1. 41 41
      src/App.vue
  2. 7 5
      src/views/gesture/index.vue
  3. 6 0
      src/views/train/multiple.vue
  4. 6 0
      src/views/train/test.vue

+ 41 - 41
src/App.vue

@@ -5,52 +5,52 @@
 </template>
 
 <script setup lang="ts">
-import { useWebSocket } from '@/utils/handWs';
-const { handWs, startDevice, startHand, stateHand } = useWebSocket();
+// import { useWebSocket } from '@/utils/handWs';
+// const { handWs, startDevice, startHand, stateHand } = useWebSocket();
 
-const router = useRouter();
+// const router = useRouter();
 
-const data = reactive<any>({
-  device_info: {},//设备信息
-});
-const { device_info } = toRefs(data);
+// const data = reactive<any>({
+//   device_info: {},//设备信息
+// });
+// const { device_info } = toRefs(data);
 
 
-/**
- * 手势
-*/
-const getHandWs = async () => {
-  //加载手势WS
-  handWs((e: any) => {
-    // console.log("eeee", e)
-    if (e?.wksid) {
-      //获取设备项目
-      let deviceid = localStorage.getItem("deviceid") || '';
-      if (deviceid) {
-        startDevice({ deviceid: deviceid })
-      }
-    }
-    //接收设备信息
-    if (e?.device_info) {
-      device_info.value = e.device_info;
-      let handcontroller_id = device_info.value.handcontroller_id;
-      stateHand(handcontroller_id);
-    }
-    //获取手势状态
-    if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {
-      let handcontroller_id = device_info.value.handcontroller_id;
-      startHand(handcontroller_id);
-    }
-    //刷新
-    if (e?.data?.result == "refresh") {
-      router.push({ path: '/gesture' });
-      //刷新
-      window.location.reload()
-    }
-  });
-};
+// /**
+//  * 手势
+// */
+// const getHandWs = async () => {
+//   //加载手势WS
+//   handWs((e: any) => {
+//     // console.log("eeee", e)
+//     if (e?.wksid) {
+//       //获取设备项目
+//       let deviceid = localStorage.getItem("deviceid") || '';
+//       if (deviceid) {
+//         startDevice({ deviceid: deviceid })
+//       }
+//     }
+//     //接收设备信息
+//     if (e?.device_info) {
+//       device_info.value = e.device_info;
+//       let handcontroller_id = device_info.value.handcontroller_id;
+//       stateHand(handcontroller_id);
+//     }
+//     //获取手势状态
+//     if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {
+//       let handcontroller_id = device_info.value.handcontroller_id;
+//       startHand(handcontroller_id);
+//     }
+//     //刷新
+//     if (e?.data?.result == "refresh") {
+//       router.push({ path: '/gesture' });
+//       //刷新
+//       window.location.reload()
+//     }
+//   });
+// };
 
-getHandWs()
+// getHandWs()
 </script>
 
 <style scoped></style>

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

@@ -80,10 +80,8 @@ const getInitExam = () => {
  * 获取项目
 */
 const getExam = async () => {
-  if (device_info.value.project_list == undefined) {
-    return false;
-  }
-  let examList = device_info.value?.project_list.map((item: any) => {
+  let myList = device_info.value?.project_list || [];
+  let examList = myList.map((item: any) => {
     return item.exam_name;
   })
   await proxy?.$http.train.projectList().then((res: any) => {
@@ -300,6 +298,7 @@ onBeforeMount(() => {
       device_info.value = e.device_info;
       let handcontroller_id = device_info.value.handcontroller_id;
       stateHand(handcontroller_id);
+      getInitExam();
     }
     //获取手势状态
     if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {
@@ -320,10 +319,13 @@ onBeforeMount(() => {
     //退出
     if (e?.data?.result == "exit") {
     }
+    //刷新
+    if (e?.data?.result == "refresh") {
+      window.location.reload()
+    }
   });
 })
 onMounted(() => {
-  getInitExam();
   getUserInfo();
   //登录码
   getErweima();

+ 6 - 0
src/views/train/multiple.vue

@@ -626,6 +626,12 @@ const initHand = () => {
       let handcontroller_id = device_info.value.handcontroller_id;
       startHand(handcontroller_id);
     }
+    //刷新
+    if (e?.data?.result == "refresh") {
+      getExit();
+      //刷新
+      window.location.reload()
+    }
     //没初始化完成不监听手势动作
     if(examState.value == 0){
       return false;

+ 6 - 0
src/views/train/test.vue

@@ -739,6 +739,12 @@ const initHand = () => {
       let handcontroller_id = device_info.value.handcontroller_id;
       startHand(handcontroller_id);
     }
+    //刷新
+    if (e?.data?.result == "refresh") {
+      getExit();
+      //刷新
+      window.location.reload()
+    }
     //没初始化完成不监听手势动作
     if(examState.value == 0){
       return false;