Bladeren bron

日常开发

林旭祥 3 weken geleden
bovenliggende
commit
09cbe59e8e
1 gewijzigde bestanden met toevoegingen van 8 en 10 verwijderingen
  1. 8 10
      src/views/game/index.vue

+ 8 - 10
src/views/game/index.vue

@@ -24,7 +24,7 @@
       <div class="gameWindow" v-if="currentGame">
         <!---人体姿态识别-->
         <div class="columns" v-if="currentGame == 'bodyposecontroller'">
-          <template v-if="projectList.length == 2">
+          <template v-if="currentGameArea.length == 2">
             <div class="item left">
               <HumanBody ref="humanBodyLeftRef" type="left"></HumanBody>
             </div>
@@ -32,7 +32,7 @@
               <HumanBody ref="humanBodyRightRef" type="right"></HumanBody>
             </div>
           </template>
-          <template>
+          <template v-else>
             <HumanBody ref="humanBodyLeftRef" type="left"></HumanBody>
           </template>
         </div>
@@ -94,8 +94,9 @@ const data = reactive<any>({
   bodyposeState: false,//姿态识别窗口状态
   deviceInfo: {},//设备信息
   currentGame: "",//当前游戏
+  currentGameArea: "",//当前游戏区
 });
-const { projectList, wsState, bodyposeState, deviceInfo, currentGame } = toRefs(data);
+const { projectList, wsState, bodyposeState, deviceInfo, currentGame, currentGameArea } = toRefs(data);
 
 /**
  * 初始化
@@ -162,9 +163,10 @@ const getInit = async () => {
         return item.exam_name == currentGame.value
       })
       let myList = obj.area_test_id.split(",");
+      currentGameArea.value = myList;
       let area = e.ctrl_name.replace('bodyposecontroller_', '');
       if (currentGame.value == 'bodyposecontroller') {
-        if (projectList.value.length == 2) {
+        if (currentGameArea.value.length == 2) {
           if (area == myList[0]) {
             humanBodyLeftRef.value.getInit(e);
           }
@@ -211,16 +213,12 @@ const getJump = (data: any) => {
   if (data.exam_name == 'test') {
     router.push({ path: '/game/test' });
   } else {
-
     currentGame.value = data.exam_name;
-
-    data.area_test_id.split(",").forEach((item: any) => {
+    currentGameArea.value = data.area_test_id.split(",");
+    currentGameArea.value.forEach((item: any) => {
       checkBodypose(item);
     })
-
   }
-
-
 };
 
 /**