From 28aae509e156f9f88143b9144c49c59999e06130 Mon Sep 17 00:00:00 2001 From: hzj <1304805162@qq.com> Date: Wed, 17 Sep 2025 16:26:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=80=92=E8=AE=A1=E6=97=B6):=20=E5=B0=86?= =?UTF-8?q?=E5=91=A8=E4=B8=80=E5=88=B7=E6=96=B0=E6=94=B9=E6=88=90=E6=B2=99?= =?UTF-8?q?=E7=89=B9=E7=9A=84=E5=91=A8=E4=B8=80=E6=97=A9=E4=B8=8A6?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/TopList/TopList.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/views/TopList/TopList.vue b/src/views/TopList/TopList.vue index 896b3c8..f1d81dd 100644 --- a/src/views/TopList/TopList.vue +++ b/src/views/TopList/TopList.vue @@ -797,17 +797,18 @@ const Minutes = ref(0) const Second = ref(0) let timer = null -const getNextMonday = () => { +// 获取沙特下周一早上六点的时间戳 +const getNextMondayInSaudi = () => { const now = new Date() - const day = now.getDay() //0(周日)-6(周六) + const utcDay = now.getUTCDay() //获取UTC星期几,0(周日)-6(周六) // 计算到下周一的所需天数 - const daysToAdd = day === 1 ? 7 : (1 + 7 - day) % 7 - const nextMonday = new Date(now) //以当前时间为基准,而不是重新获取时间 + const daysToAdd = utcDay === 1 ? 7 : (1 + 7 - utcDay) % 7 + const nextMondayUTC = new Date(now) //以当前UTC时间为基准,而不是重新获取 - nextMonday.setDate(now.getDate() + daysToAdd) //增加到下周一那天 - nextMonday.setHours(0, 0, 0, 0) // 设置为下周一当天00:00:00.000 - return nextMonday.getTime() //得到下周一00:00:00.000的时间戳 + nextMondayUTC.setUTCDate(now.getUTCDate() + daysToAdd) //增加到下周一那天 + nextMondayUTC.setUTCHours(3, 0, 0, 0) // 设置为沙特下周一当天早上6点(北京时间3点) + return nextMondayUTC.getTime() //得到下周一00:00:00.000的时间戳 } // 时间格式化为2位 @@ -815,7 +816,7 @@ const formatTime = (value) => { return value < 10 ? `0${value}` : value } -const targetTime = ref(getNextMonday()) // 闭包保存目标时间 (核心修正) +const targetTime = ref(getNextMondayInSaudi()) // 闭包保存目标时间 (核心修正) // 更新倒计时 const getCountdown = () => {