From a228697c2b438ccbba0263855a0da5f729538be0 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Thu, 5 Jun 2025 15:19:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=80=92=E8=AE=A1=E6=97=B6=E5=92=8C?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=B7=B2=E6=9C=8D=E5=8A=A1=E5=99=A8=E4=B8=BA?= =?UTF-8?q?=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/system.ts | 1 + src/components/common/Countdown.vue | 105 +++++++++++++++++++++++++++++ src/components/home/Tube/index.vue | 24 ++----- src/hooks/useServerTime.ts | 43 ++++++++++++ src/layouts/default.vue | 15 ++--- src/libs/utils.ts | 4 +- src/stores/systemStore.ts | 5 +- src/types/system.d.ts | 1 + src/views/debug/index.vue | 127 ++++++++++++++++++++---------------- 9 files changed, 240 insertions(+), 85 deletions(-) create mode 100644 src/components/common/Countdown.vue create mode 100644 src/hooks/useServerTime.ts diff --git a/src/apis/system.ts b/src/apis/system.ts index ab33991..9ffe170 100644 --- a/src/apis/system.ts +++ b/src/apis/system.ts @@ -5,3 +5,4 @@ export const control = (params: System.CmdControlParams): Promise => export const getStatus = (): Promise => http.get('/sys/device-status') export const getPoint = (): Promise => http.get('/cmd/step/gantry-point') export const requireOutTray = (): Promise<{ moduleCode: string }[]> => http.get('/self-test/require-out-tray') +export const getTime = (): Promise => http.get('/sys/datetime') diff --git a/src/components/common/Countdown.vue b/src/components/common/Countdown.vue new file mode 100644 index 0000000..674c71a --- /dev/null +++ b/src/components/common/Countdown.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/components/home/Tube/index.vue b/src/components/home/Tube/index.vue index 2479fa9..0b22cc2 100644 --- a/src/components/home/Tube/index.vue +++ b/src/components/home/Tube/index.vue @@ -5,10 +5,10 @@ import errorIcon from 'assets/images/error.svg' import ingIcon from 'assets/images/ing.svg' import successIcon from 'assets/images/success.svg' import waitIcon from 'assets/images/wait.svg' -import { socket } from 'libs/socket' +import CountDown from 'components/common/Countdown.vue' import { useHomeStore } from 'stores/homeStore' import { useSystemStore } from 'stores/systemStore' -import { computed, onMounted, onUnmounted, ref } from 'vue' +import { computed, ref } from 'vue' const props = withDefaults(defineProps<{ data: System.HeatArea }>(), { data: () => ({ @@ -17,6 +17,7 @@ const props = withDefaults(defineProps<{ data: System.HeatArea }>(), { trayStatus: 0, fanOpen: false, heating: false, + heatingType: 'constant', capExist: false, temperature: 0, targetTemperature: 0, @@ -25,19 +26,6 @@ const props = withDefaults(defineProps<{ data: System.HeatArea }>(), { const emits = defineEmits(['selectChange', 'setTemperature']) -onMounted(() => { - socket.init(receiveMessage, 'heat_countdown') -}) - -onUnmounted(() => { - socket.unregisterCallback(receiveMessage, 'heat_countdown') -}) - -const numList = ref<{ heatModuleCode: string, countdownStr: string }[]>([]) -const receiveMessage = (data: any) => { - numList.value = data -} - const homeStore = useHomeStore() const systemStore = useSystemStore() const mousedownHandle = async (e: Event) => { @@ -122,7 +110,7 @@ defineExpose({
恒温中 降温中
-
- {{ numList.find(item => item.heatModuleCode === data.moduleCode)?.countdownStr }} -
+