From df562f9a52d016f6a4166f350ff33444a318c0bd Mon Sep 17 00:00:00 2001 From: H1d3rOne Date: Tue, 10 Mar 2026 04:53:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 连续签到几天,前几个图标变亮 - 下面的星期几显示对应签到日期的星期 - 添加currentStreak计算属性 --- xuan-deduct-uniapp/src/pages/mine/coins.vue | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/xuan-deduct-uniapp/src/pages/mine/coins.vue b/xuan-deduct-uniapp/src/pages/mine/coins.vue index e9bf069..8de9df8 100644 --- a/xuan-deduct-uniapp/src/pages/mine/coins.vue +++ b/xuan-deduct-uniapp/src/pages/mine/coins.vue @@ -16,7 +16,7 @@ - + {{ index + 1 }} {{ day.label }} @@ -116,6 +116,9 @@ export default { computed: { todayReward() { return this.getDayReward(this.streakDays % 7) + }, + currentStreak() { + return this.streakDays % 7 || (this.streakDays > 0 ? 7 : 0) } }, onShow() { @@ -153,7 +156,6 @@ export default { }, initWeekProgress() { const today = new Date() - const dayOfWeek = today.getDay() const weekLabels = ['日', '一', '二', '三', '四', '五', '六'] const lastSignInStr = uni.getStorageSync('lastSignInDate') @@ -163,20 +165,14 @@ export default { const todayStr = this.formatDate(today) this.signedToday = lastSignInStr === todayStr - const signInHistory = uni.getStorageSync('signInHistory') || '{}' - const history = JSON.parse(signInHistory) - this.weekDays = [] for (let i = 0; i < 7; i++) { const date = new Date(today) - date.setDate(today.getDate() - dayOfWeek + i) - const dateStr = this.formatDate(date) + date.setDate(today.getDate() - (this.currentStreak - 1 - i)) this.weekDays.push({ - label: weekLabels[i], - signed: history[dateStr] === true, - isToday: i === dayOfWeek, - date: dateStr + label: weekLabels[date.getDay()], + date: this.formatDate(date) }) } },