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) }) } },