|
@@ -61,6 +61,7 @@
|
|
|
</div>
|
|
|
</Transition>
|
|
|
<div class="close" v-if="currentGame" @click="getExitGame"></div>
|
|
|
+ <ActionConfirmWindow ref="actionConfirmRef" @confirmExit="getExitGame(1)"></ActionConfirmWindow>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -76,6 +77,8 @@ import HumanBody from "./components/humanBody.vue";
|
|
|
import Basketball from "./components/basketball.vue";
|
|
|
import Football from "./components/football.vue";
|
|
|
import Fruit from "./components/fruit.vue";
|
|
|
+const router = useRouter();
|
|
|
+const { proxy } = getCurrentInstance() as any;
|
|
|
const humanBodyLeftRef = ref();
|
|
|
const humanBodyRightRef = ref();
|
|
|
const basketballLeftRef = ref();
|
|
@@ -83,9 +86,8 @@ const basketballRightRef = ref();
|
|
|
const footballLeftRef = ref();
|
|
|
const footballRightRef = ref();
|
|
|
const fruitRef = ref();
|
|
|
+const actionConfirmRef = ref();
|
|
|
|
|
|
-const router = useRouter();
|
|
|
-const { proxy } = getCurrentInstance() as any;
|
|
|
const { bodyposeWs, startDevice, checkBodypose, openBodypose, terminateBodypose, suspendBodypose, resumeBodypose, getBodyposeState, closeWS } = useWebSocket();
|
|
|
|
|
|
const data = reactive<any>({
|
|
@@ -94,7 +96,7 @@ const data = reactive<any>({
|
|
|
bodyposeState: false,//姿态识别窗口状态
|
|
|
deviceInfo: {},//设备信息
|
|
|
currentGame: "",//当前游戏
|
|
|
- currentGameArea: "",//当前游戏区
|
|
|
+ currentGameArea: [],//当前游戏区
|
|
|
});
|
|
|
const { projectList, wsState, bodyposeState, deviceInfo, currentGame, currentGameArea } = toRefs(data);
|
|
|
|
|
@@ -144,13 +146,18 @@ const getInit = async () => {
|
|
|
if (e?.code == 0) {
|
|
|
getBodyposeState(area);
|
|
|
} else {
|
|
|
+ setTimeout(() => {
|
|
|
+ checkBodypose(area);
|
|
|
+ }, 500)
|
|
|
}
|
|
|
}
|
|
|
if (e?.cmd == 'get_bodyposecontroller_state') {
|
|
|
let area = e.ctrl_name.replace('bodyposecontroller_', '');
|
|
|
//state说明: 0:关闭,3:空闲,36:工作中
|
|
|
if ([3, 36].includes(e.state)) {
|
|
|
- terminateBodypose(area);
|
|
|
+ setTimeout(() => {
|
|
|
+ terminateBodypose(area);
|
|
|
+ }, 500)
|
|
|
} else {
|
|
|
openBodypose(area);
|
|
|
}
|
|
@@ -160,6 +167,9 @@ const getInit = async () => {
|
|
|
return false;
|
|
|
}
|
|
|
let area = e.ctrl_name.replace('bodyposecontroller_', '');
|
|
|
+ //传给预备窗口
|
|
|
+ actionConfirmRef.value.getInit(e);
|
|
|
+ //传给游戏窗口
|
|
|
if (currentGame.value == 'bodyposecontroller') {
|
|
|
if (currentGameArea.value.length == 2) {
|
|
|
if (area == currentGameArea.value[0]) {
|
|
@@ -209,7 +219,8 @@ const getJump = (data: any) => {
|
|
|
router.push({ path: '/game/test' });
|
|
|
} else {
|
|
|
currentGame.value = data.exam_name;
|
|
|
- currentGameArea.value = data.area_test_id.split(",");
|
|
|
+ currentGameArea.value = data.area_test_id?.split(",") || [];
|
|
|
+ actionConfirmRef.value.getOpen(currentGame.value,currentGameArea.value);
|
|
|
currentGameArea.value.forEach((item: any) => {
|
|
|
checkBodypose(item);
|
|
|
})
|
|
@@ -227,20 +238,26 @@ const getExit = () => {
|
|
|
/**
|
|
|
* 退出游戏
|
|
|
*/
|
|
|
-const getExitGame = () => {
|
|
|
- proxy?.$modal.confirm("确定退出吗?").then(() => {
|
|
|
- let obj = projectList.value.find((item: any) => {
|
|
|
- return item.exam_name == currentGame.value
|
|
|
- })
|
|
|
- let myList = obj.area_test_id.split(",");
|
|
|
- myList.forEach((item: any) => {
|
|
|
+const getExitGame = (type:any) => {
|
|
|
+ if (type == 1) {
|
|
|
+ currentGameArea.value.forEach((item: any) => {
|
|
|
terminateBodypose(item);
|
|
|
})
|
|
|
currentGame.value = "";
|
|
|
- }).finally(() => {
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ proxy?.$modal.confirm("确定退出吗?").then(() => {
|
|
|
+ currentGameArea.value.forEach((item: any) => {
|
|
|
+ terminateBodypose(item);
|
|
|
+ })
|
|
|
+ currentGame.value = "";
|
|
|
+ }).finally(() => {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
};
|
|
|
|
|
|
+
|
|
|
onBeforeMount(async () => {
|
|
|
getInit();
|
|
|
});
|
|
@@ -407,7 +424,7 @@ $waiPadding: 6.51rem;
|
|
|
width: 100vw;
|
|
|
height: 100vh;
|
|
|
position: absolute;
|
|
|
- z-index: 999;
|
|
|
+ z-index: 990;
|
|
|
left: 0;
|
|
|
top: 0;
|
|
|
display: flex;
|
|
@@ -436,7 +453,7 @@ $waiPadding: 6.51rem;
|
|
|
}
|
|
|
|
|
|
.close {
|
|
|
- z-index: 9999;
|
|
|
+ z-index: 991;
|
|
|
position: fixed;
|
|
|
bottom: 35px;
|
|
|
left: 50%;
|