From 5e0da973afb24fb671b56f12f125e87e45d65032 Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Wed, 25 Feb 2026 16:34:35 +0800 Subject: [PATCH] fix: check-in --- pages/index/index.vue | 47 ++++++++++++------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 6be2b8e..ed5a000 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -258,6 +258,7 @@ const weekDays = computed(() => { const days = []; const labels = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]; + const signedDays = signInfo.value.signedDays || []; for (let i = 0; i < 7; i++) { const d = new Date(monday); @@ -271,40 +272,8 @@ const weekDays = computed(() => { const isToday = dateStr === todayStr; const isFuture = dateStr > todayStr; - if (signInfo.value.continuousDays > 0) { - const continuous = signInfo.value.continuousDays; - const signedToday = signInfo.value.isSignedToday; - - const streakEndDate = new Date(todayStr); - if (!signedToday) { - streakEndDate.setDate(streakEndDate.getDate() - 1); - } - - const streakStartDate = new Date(streakEndDate); - streakStartDate.setDate(streakEndDate.getDate() - continuous + 1); - - const checkDate = new Date(dateStr); - const checkTime = checkDate.getTime(); - // Reset time components to avoid issues - const sTime = new Date( - streakStartDate.getFullYear(), - streakStartDate.getMonth(), - streakStartDate.getDate(), - ).getTime(); - const eTime = new Date( - streakEndDate.getFullYear(), - streakEndDate.getMonth(), - streakEndDate.getDate(), - ).getTime(); - const cTime = new Date( - checkDate.getFullYear(), - checkDate.getMonth(), - checkDate.getDate(), - ).getTime(); - - if (cTime >= sTime && cTime <= eTime) { - isSigned = true; - } + if (signedDays.includes(i + 1)) { + isSigned = true; } days.push({ @@ -444,6 +413,16 @@ const onOpenLucky = async () => { signInfo.value.totalDays = (signInfo.value.totalDays || 0) + 1; } + // Update signedDays locally + if (!signInfo.value.signedDays) { + signInfo.value.signedDays = []; + } + const today = new Date(signInfo.value.today || new Date()); + const dayIndex = today.getDay() || 7; + if (!signInfo.value.signedDays.includes(dayIndex)) { + signInfo.value.signedDays.push(dayIndex); + } + // Update user assets (points) userStore.fetchUserAssets();