feat(theme): 实现日夜主题自动切换功能

- 添加日夜主题CSS变量定义,支持琥珀夜光和暖白琥珀两种风格
- 实现主题切换逻辑,根据时间自动切换白天(light)和夜间(dark)主题
- 在App.vue中集成主题初始化和token恢复功能
- 更新全局样式类应用主题颜色变量,包括卡片、文本、边框等
- 创建主题混入(mixin)供各页面使用,确保主题同步更新
- 实现导航栏和TabBar主题动态切换,提升用户体验
- 添加API服务层封装HaveADrink SDK,统一处理认证和请求
- 优化DrinkCard组件显示饮酒感受信息,丰富打卡记录展示
- 更新项目依赖配置,集成新的API客户端库
This commit is contained in:
cg
2026-07-16 22:47:38 +08:00
parent 145976f221
commit 860136bceb
22 changed files with 7051 additions and 155 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ export default {
display: flex;
align-items: center;
justify-content: center;
border: 3rpx solid rgba(255,255,255,0.06);
border: 3rpx solid var(--border-faint, rgba(255, 255, 255, 0.08));
position: relative;
}
+2 -1
View File
@@ -126,6 +126,7 @@ export default {
font-size: $fs-lg;
font-weight: $fw-bold;
font-family: $font-num;
color: $text-primary;
}
.cal-weekdays {
@@ -205,7 +206,7 @@ export default {
/* 饮酒日高亮背景 */
.cal-cell-drank {
background: rgba(232, 168, 56, 0.08);
background: var(--amber-glow, rgba(232, 168, 56, 0.15));
}
.cal-cell-abstain {
+29 -7
View File
@@ -34,7 +34,7 @@
<view class="drink-list">
<view v-for="(drink, i) in record.drinks" :key="i" class="drink-row">
<text class="drink-name">{{ getCatEmoji(drink.category) }} {{ drink.brand }}</text>
<text class="drink-detail">{{ formatAmount(drink) }}·{{ drink.standardCups }}</text>
<text class="drink-detail">{{ formatAmount(drink) }}</text>
</view>
<view v-if="record.food" class="drink-row">
<text class="drink-name">🍲 {{ getFoodName() }}</text>
@@ -42,6 +42,11 @@
</view>
</view>
<!-- 饮酒感受 -->
<view v-if="feelingLabel" class="feeling-row">
<text class="feeling-text">{{ feelingLabel }}</text>
</view>
<!-- 分割线 -->
<view class="divider"></view>
@@ -63,7 +68,7 @@
</template>
<script>
import { DRINK_CATEGORIES, FOOD_CATEGORIES, DRINK_QUOTES } from '../common/constants'
import { DRINK_CATEGORIES, FOOD_CATEGORIES, DRINK_QUOTES, FEELINGS } from '../common/constants'
const UNIT_NAMES = { ml: 'ml', liang: '两', bottle: '瓶', cup: '杯', can: '听', shot: 'shot' }
@@ -83,6 +88,10 @@ export default {
mainEmoji() {
const first = (this.record.drinks || [])[0]
return first ? this.getCatEmoji(first.category) : '🥃'
},
feelingLabel() {
const f = FEELINGS.find(fe => fe.id === this.record.feeling)
return f ? `${f.emoji} ${f.name}` : ''
}
},
methods: {
@@ -109,9 +118,9 @@ export default {
width: 620rpx;
border-radius: 32rpx;
overflow: hidden;
background: linear-gradient(170deg, #1A1510 0%, #0D0B08 100%);
border: 2rpx solid rgba(232, 168, 56, 0.15);
box-shadow: 0 24rpx 80rpx rgba(0, 0, 0, 0.5), 0 0 60rpx rgba(232, 168, 56, 0.06);
background: linear-gradient(170deg, var(--card-gradient-start, #1A1510) 0%, var(--card-gradient-end, #0D0B08) 100%);
border: 2rpx solid var(--border-subtle, rgba(255, 255, 255, 0.10));
box-shadow: var(--shadow-lg, 0 16rpx 48rpx rgba(0, 0, 0, 0.45)), 0 0 60rpx var(--amber-glow, rgba(232, 168, 56, 0.15));
display: flex;
flex-direction: column;
}
@@ -213,6 +222,19 @@ export default {
margin-left: $sp-md;
}
/* 饮酒感受 */
.feeling-row {
padding: $sp-sm $sp-xl 0;
display: flex;
align-items: center;
}
.feeling-text {
font-size: $fs-base;
color: $amber;
font-weight: $fw-medium;
letter-spacing: 2rpx;
}
/* 分割线 */
.divider {
margin: $sp-lg $sp-xl;
@@ -265,7 +287,7 @@ export default {
width: 80rpx;
height: 80rpx;
border-radius: $radius-sm;
border: 2rpx solid rgba(232, 168, 56, 0.15);
background: rgba(255, 255, 255, 0.03);
border: 2rpx solid var(--border-subtle, rgba(255, 255, 255, 0.10));
background: var(--bg-subtle, rgba(255, 255, 255, 0.03));
}
</style>