From 79feb73b275955684a43a8035efa6411687fe576 Mon Sep 17 00:00:00 2001 From: Alirea <2981883527@qq.com> Date: Thu, 4 Sep 2025 10:16:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/Home.vue | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index 17651de..236ee0e 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -62,9 +62,23 @@
+ + + { } } -// 检查剩余时间是否小于两天 -const isLessThanTwoDays = (expireTime: string) => { +// 检查剩余时间状态:normal(>2天)、warning(<=2天>0)、ended(<=0) +const getActivityTimeStatus = (expireTime: string): 'normal' | 'warning' | 'ended' => { try { const expire = new Date(expireTime) const now = new Date() const remaining = expire.getTime() - now.getTime() const twoDaysInMs = 2 * 24 * 60 * 60 * 1000 - return remaining <= twoDaysInMs + if (remaining <= 0) return 'ended' + if (remaining <= twoDaysInMs) return 'warning' + return 'normal' } catch { - return false + return 'ended' } }