From 1c294a7f93083926de76dcdb01e388971002bb38 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Thu, 5 Jun 2025 15:31:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Countdown.vue | 10 ++++------ src/hooks/useServerTime.ts | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/common/Countdown.vue b/src/components/common/Countdown.vue index 674c71a..ff21d71 100644 --- a/src/components/common/Countdown.vue +++ b/src/components/common/Countdown.vue @@ -14,11 +14,7 @@ const remaining = ref(0) let timer: number | null = null const calculateRemaining = () => { - // const now = new Date() - // // 计算时间差(考虑网络延迟) - // const timeDiff = now.getTime() - props.current // 计算结束时间 - console.log(props) const endTime = props.startTime + props.duration * 1000 // 剩余时间 = 结束时间 - 当前时间 - 网络延迟 remaining.value = Math.max(0, endTime - new Date(systemStore.currentTime).getTime()) @@ -43,7 +39,6 @@ const startTimer = () => { const stopTimer = () => { if (timer) { - console.log(111) clearInterval(timer) timer = null } @@ -63,11 +58,14 @@ const hours = ref('00') const minutes = ref('00') const seconds = ref('00') +const visible = ref(true) + // 监听剩余时间变化 watch( () => remaining.value, (newVal) => { if (newVal <= 0 || !newVal) { + visible.value = false days.value = 0 hours.value = '00' minutes.value = '00' @@ -90,7 +88,7 @@ watch(