diff --git a/src/views/components/Footer.vue b/src/views/components/Footer.vue index 3caa6ce..e17fcac 100644 --- a/src/views/components/Footer.vue +++ b/src/views/components/Footer.vue @@ -55,26 +55,6 @@ function testStatus() { } } onMounted(() => { - const wsClient = createWebSocket(sharedWsUrl); - const subscription = wsClient.dataOb.subscribe(data => { - if (data.type === "cmd") { - const cmdInfo = peekTxnRecord(data.data.commandId, "task"); - if (cmdInfo) { - if ( - cmdInfo.command === "openDoor" || - cmdInfo.command === "closeDoor" || - cmdInfo.command === "startShakeUp" || - cmdInfo.command === "injectFluid" || - cmdInfo.command === "moveToActionArea" || - cmdInfo.command === "moveToHeatArea" - ) { - setOnGoingStatus("idle"); - } - } - } - }); - wsClient.connect(); - const subscription2 = onGoingStatusOb.subscribe(status => { if (status === "idle") { statusStr.value = "等待指令"; @@ -94,7 +74,6 @@ onMounted(() => { }); onUnmounted(() => { - subscription.unsubscribe(); subscription2.unsubscribe(); }); }); diff --git a/src/views/graphite/index.vue b/src/views/graphite/index.vue index d218507..d72d81e 100644 --- a/src/views/graphite/index.vue +++ b/src/views/graphite/index.vue @@ -162,6 +162,16 @@ onMounted(() => { if (data.type === "cmd") { const cmdInfo = getTxnRecord(data.data.commandId, "task"); if (cmdInfo) { + if ( + cmdInfo.command === "openDoor" || + cmdInfo.command === "closeDoor" || + cmdInfo.command === "startShakeUp" || + cmdInfo.command === "injectFluid" || + cmdInfo.command === "moveToActionArea" || + cmdInfo.command === "moveToHeatArea" + ) { + setOnGoingStatus("idle"); + } const command:any = cmdInfo.command; //@ts-ignore const cmdName = CmdDescMap[command];