diff --git a/App.vue b/App.vue index 1b36693..ca6d32f 100644 --- a/App.vue +++ b/App.vue @@ -196,9 +196,10 @@ page { padding: $sp-md $sp-xl; border-radius: $radius-full; border: 2rpx solid rgba(255, 255, 255, 0.08); - text-align: center; transition: all $duration-fast $ease-out; - + display: flex; + align-items: center; + justify-content: center; &:active { background-color: $bg-card-alt; transform: scale(0.97); diff --git a/components/DrinkCalendar.vue b/components/DrinkCalendar.vue index 96e4a19..451ab0c 100644 --- a/components/DrinkCalendar.vue +++ b/components/DrinkCalendar.vue @@ -25,10 +25,11 @@ :class="{ 'cal-cell-empty': !cell.day, 'cal-cell-today': cell.isToday, + 'cal-cell-future': cell.day && isFuture(cell.date), 'cal-cell-drank': getRecordMode(cell.date) === 'drank', 'cal-cell-abstain': getRecordMode(cell.date) === 'abstain' }" - @click="cell.day && onSelectDate(cell.date)" + @click="cell.day && !isFuture(cell.date) && onSelectDate(cell.date)" > {{ cell.day }} @@ -61,6 +62,13 @@ export default { } }, methods: { + isFuture(date) { + if (!date) return false + const today = new Date() + today.setHours(0, 0, 0, 0) + const d = new Date(date.replace(/-/g, '/')) + return d > today + }, getRecordMode(date) { if (!date) return null const record = this.records.find(r => r.date === date) @@ -157,7 +165,7 @@ export default { border: 2rpx solid $amber; } - &:active:not(.cal-cell-empty) { + &:active:not(.cal-cell-empty):not(.cal-cell-future) { transform: scale(0.92); } } @@ -186,6 +194,15 @@ export default { } } +/* 未来日期置灰 */ +.cal-cell-future { + opacity: 0.3; +} + +.cal-cell-future .cal-day-num { + color: $text-tertiary; +} + /* 饮酒日高亮背景 */ .cal-cell-drank { background: rgba(232, 168, 56, 0.08); diff --git a/components/DrinkCard.vue b/components/DrinkCard.vue index ce619ce..4a4258a 100644 --- a/components/DrinkCard.vue +++ b/components/DrinkCard.vue @@ -1,205 +1,75 @@ diff --git a/pages/card/card.vue b/pages/card/card.vue index f752680..1d82e14 100644 --- a/pages/card/card.vue +++ b/pages/card/card.vue @@ -4,68 +4,43 @@ - 你的酒局卡片 - - - - {{ photoHintText }} - - - - - - - - {{ t.name }} - {{ t.desc }} - + 酒局卡片 + - + + 暂无记录 + - + - - - - - + diff --git a/pages/index/index.vue b/pages/index/index.vue index 74f3df1..a886a4b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -27,15 +27,15 @@ - + {{ stats.monthDrinkCount }} 本月饮酒 - + {{ stats.monthCups }} 标准杯 - + {{ stats.streak }} @@ -84,11 +84,6 @@ 过量饮酒有害健康 · 请理性记录 - - - + - - @@ -107,10 +102,12 @@ {{ getFeelingName(selectedRecord.feeling) }} {{ selectedRecord.standardCupsTotal }} 标准杯 + 🚫 今日未饮酒,好样的 + @@ -197,12 +194,40 @@ export default { url: `/pages/record/record?date=${this.selectedDate}&mode=backfill` }) }, + // 改为未饮酒 + toggleToAbstain() { + uni.showModal({ + title: '确认修改', + content: '确定将这天改为未饮酒吗?饮酒记录将被清除。', + success: (res) => { + if (!res.confirm) return + const idx = this.records.findIndex(r => r.date === this.selectedDate) + if (idx === -1) return + this.records[idx].mode = 'abstain' + this.records[idx].drinks = [] + this.records[idx].food = null + this.records[idx].feeling = null + this.records[idx].standardCupsTotal = 0 + this.selectedRecord = this.records[idx] + this.saveRecords() + } + }) + }, + // 改为饮酒(跳转到补录页) + toggleToDrank() { + this.showDayDetail = false + uni.navigateTo({ + url: `/pages/record/record?date=${this.selectedDate}&mode=backfill` + }) + }, + // 保存记录到本地存储 + saveRecords() { + uni.setStorageSync('drink_records', JSON.stringify(this.records)) + }, goRecord() { uni.navigateTo({ url: '/pages/record/record' }) }, - goProfile() { - uni.switchTab({ url: '/pages/profile/profile' }) - } + } } @@ -222,7 +247,7 @@ export default { .greeting-text { display: block; - font-size: $fs-lg; + font-size:38rpx; font-weight: $fw-bold; } @@ -283,7 +308,6 @@ export default { } .week-summary { - margin-bottom: $sp-md; padding: $sp-md; } @@ -422,38 +446,11 @@ export default { .bottom-health-tip { text-align: center; padding: $sp-sm 0; - padding-bottom: calc(100rpx + env(safe-area-inset-bottom)); font-size: $fs-xs; color: $text-tertiary; opacity: 0.4; } -/* 悬浮记录按钮 */ -.fab-record { - position: fixed; - right: 40rpx; - bottom: calc(140rpx + env(safe-area-inset-bottom)); - width: 100rpx; - height: 100rpx; - background: linear-gradient(135deg, $amber-light, $amber-deep); - border-radius: $radius-full; - display: flex; - align-items: center; - justify-content: center; - box-shadow: $shadow-amber; - z-index: 50; - - &:active { - transform: scale(0.92); - } -} - -.fab-icon { - font-size: $fs-2xl; - font-weight: $fw-bold; - color: $text-on-amber; -} - /* 日期弹窗 */ .day-overlay { position: fixed; @@ -507,4 +504,12 @@ export default { margin-top: $sp-lg; } } + +.day-toggle-btn { + margin-top: $sp-lg; + width: 100%; + font-size: $fs-sm; + color: $text-secondary; + border-color: rgba(255,255,255,0.1); +} diff --git a/pages/login/login.vue b/pages/login/login.vue index d3c10bf..a894bf7 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -88,51 +88,6 @@ - - - - - 你的饮酒偏好 - 选择你常喝的酒类(可多选) - - - - 常喝的酒类 - - - {{ cat.emoji }} {{ cat.name }} - - - - - - 饮酒频率 - - - {{ freq.name }} - - - - - - - - - - - 登录即代表同意 @@ -144,27 +99,14 @@