|
@@ -1,9 +1,9 @@
|
|
|
<template>
|
|
|
<div class="gesture">
|
|
|
<Header :showTool="false" @confirmExit="getLogout"></Header>
|
|
|
- <div class="menu">
|
|
|
- <swiper v-if="projectList.length" :slides-per-view="5" :space-between="0" :loop="true" :centeredSlides="true"
|
|
|
- :modules="[Navigation]" @swiper="onSwiper">
|
|
|
+ <div class="menu" v-if="projectList.length">
|
|
|
+ <swiper :slides-per-view="5" :space-between="0" :loop="true" :observeParents="true" :observer="true"
|
|
|
+ :centeredSlides="true" :modules="[Navigation]" @swiper="onSwiper">
|
|
|
<swiper-slide v-for="(item, index) in projectList" :key="index" @click="getOption(item)">
|
|
|
<div class="li">
|
|
|
<div class="pic"><img :src="'static/images/train/' + item.key + '.png'"></div>
|
|
@@ -19,7 +19,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Gesture" lang="ts">
|
|
|
-import { handWs, startHand, closeHand, startDevice } from '@/utils/handWs'
|
|
|
+import { handWs, startDevice, stateHand, startHand, closeHand } from '@/utils/handWs'
|
|
|
import { Swiper, SwiperSlide } from 'swiper/vue';
|
|
|
import { Navigation } from 'swiper/modules';
|
|
|
import 'swiper/css';
|
|
@@ -28,13 +28,13 @@ const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
const optionWindowRef = ref();
|
|
|
-const mySwiper = ref();
|
|
|
const data = reactive<any>({
|
|
|
+ mySwiper: {},
|
|
|
projectList: [],
|
|
|
timerManager: {},
|
|
|
device_info: {}
|
|
|
});
|
|
|
-const { projectList, timerManager, device_info } = toRefs(data);
|
|
|
+const { mySwiper, projectList, timerManager, device_info } = toRefs(data);
|
|
|
|
|
|
/**
|
|
|
* 清空定时任务
|
|
@@ -74,7 +74,7 @@ const getExam = async () => {
|
|
|
//只显示能开的
|
|
|
return item.area.length > 0 && examList.includes(item.key);
|
|
|
});
|
|
|
- console.log("projectList.value", projectList.value)
|
|
|
+ // console.log("projectList.value", projectList.value)
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -82,7 +82,7 @@ const getExam = async () => {
|
|
|
* 获取实例
|
|
|
*/
|
|
|
const onSwiper = ($ev: any) => {
|
|
|
- console.log("9999999", $ev)
|
|
|
+ console.log("1111111", $ev)
|
|
|
mySwiper.value = $ev;
|
|
|
};
|
|
|
|
|
@@ -107,12 +107,11 @@ const getOption = (data: any) => {
|
|
|
confirm(data);
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 确定并进入
|
|
|
*/
|
|
|
const confirm = (myProject?: any) => {
|
|
|
- let project = myProject ? myProject : projectList.value[mySwiper.value.realIndex];
|
|
|
+ let project = myProject || projectList.value[mySwiper.value.realIndex];
|
|
|
console.log("projectList.value", projectList.value)
|
|
|
console.log("mySwiper.value", mySwiper.value)
|
|
|
console.log("mySwiper.value.realIndex", mySwiper.value.realIndex)
|
|
@@ -137,13 +136,7 @@ const confirm = (myProject?: any) => {
|
|
|
music: obj?.music_info?.url || '',
|
|
|
handcontroller: device_info.value.handcontroller_id,
|
|
|
}
|
|
|
- console.log("111", project)
|
|
|
- let handcontroller_id = device_info.value.handcontroller_id;
|
|
|
- if (handcontroller_id) {
|
|
|
- closeHand(handcontroller_id)
|
|
|
- }
|
|
|
- optionWindowRef.value.getGesture(JSON.parse(JSON.stringify(project)), data);
|
|
|
-
|
|
|
+ optionWindowRef.value.getGesture(project, data);
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -195,19 +188,22 @@ onBeforeMount(() => {
|
|
|
handWs((e: any) => {
|
|
|
//发送设备
|
|
|
if (e?.wksid) {
|
|
|
+ console.log("111", e)
|
|
|
let deviceid = localStorage.getItem("deviceid");
|
|
|
startDevice({ deviceid: deviceid })
|
|
|
}
|
|
|
//接收参数
|
|
|
if (e?.device_info) {
|
|
|
- console.log("e.device_info", e.device_info)
|
|
|
+ console.log("222", e)
|
|
|
device_info.value = e.device_info
|
|
|
let handcontroller_id = device_info.value.handcontroller_id;
|
|
|
startHand(handcontroller_id)
|
|
|
}
|
|
|
//左滑动
|
|
|
if (e?.data?.result == "next_item") {
|
|
|
- console.log("mySwiper.value", mySwiper.value)
|
|
|
+ if (projectList.value.length == 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if (projectList.value.length < 5) {
|
|
|
slidePrev()
|
|
|
} else {
|