|
@@ -40,11 +40,17 @@ const { mySwiper, projectList, timerManager, device_info, listenWs } = toRefs(da
|
|
|
/**
|
|
|
* 清空定时任务
|
|
|
*/
|
|
|
-const getClearTimer = () => {
|
|
|
- for (let key in timerManager.value) {
|
|
|
- if (timerManager.value.hasOwnProperty(key)) {
|
|
|
- clearInterval(timerManager.value[key])
|
|
|
- timerManager.value[key] = null;
|
|
|
+const getClearTimer = (data?: any) => {
|
|
|
+ if (data) {
|
|
|
+ //清除指定
|
|
|
+ clearInterval(timerManager.value[data])
|
|
|
+ timerManager.value[data] = null;
|
|
|
+ } else {
|
|
|
+ for (let key in timerManager.value) {
|
|
|
+ if (timerManager.value.hasOwnProperty(key)) {
|
|
|
+ clearInterval(timerManager.value[key])
|
|
|
+ timerManager.value[key] = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -204,6 +210,14 @@ onBeforeMount(() => {
|
|
|
listenWs.value = true;
|
|
|
let deviceid = localStorage.getItem("deviceid");
|
|
|
startDevice({ deviceid: deviceid })
|
|
|
+ timerManager.value.deviceid = setInterval(() => {
|
|
|
+ if (device_info.value.handcontroller_id == undefined) {
|
|
|
+ proxy?.$modal.msgWarning(`获取项目信息失败,正尝试重新获取,请稍等!`)
|
|
|
+ startDevice({ deviceid: deviceid })
|
|
|
+ } else {
|
|
|
+ getClearTimer("deviceid");
|
|
|
+ }
|
|
|
+ }, 10000)
|
|
|
}
|
|
|
if (listenWs.value == false) {
|
|
|
return false;
|
|
@@ -211,9 +225,11 @@ onBeforeMount(() => {
|
|
|
//接收参数
|
|
|
if (e?.device_info) {
|
|
|
console.log("222", e)
|
|
|
- device_info.value = e.device_info
|
|
|
+ getClearTimer("deviceid");
|
|
|
+ device_info.value = e.device_info;
|
|
|
let handcontroller_id = device_info.value.handcontroller_id;
|
|
|
- startHand(handcontroller_id)
|
|
|
+ startHand(handcontroller_id);
|
|
|
+ getTips();
|
|
|
}
|
|
|
//左滑动
|
|
|
if (e?.data?.result == "next_item") {
|
|
@@ -238,7 +254,6 @@ onBeforeMount(() => {
|
|
|
})
|
|
|
onMounted(() => {
|
|
|
getInitExam();
|
|
|
- getTips();
|
|
|
})
|
|
|
onBeforeUnmount(() => {
|
|
|
listenWs.value = false;
|