feat(app): 项目重命名为干杯日记并优化UI设计
- 将应用名称从"喝了么"更改为"干杯日记" - 更新所有相关文件中的品牌标识和描述信息 - 升级HaveADrink依赖包从1.0.3到1.0.4版本 - 在pages.json中新增分享个人资料页面配置 - 重构DrinkCard组件UI,增加装饰背景、酒类图标支持、饮酒感受徽章等功能 - 优化API错误处理逻辑,增加静默模式支持 - 修改白酒类别图标为 urn emoji,黄酒图标为 tea emoji - 添加分享功能按钮并优化页面返回交互体验 - 引入新的工具函数用于获取酒类图标和路径判断 - 更新主题混入、常量定义等基础配置文件 - 调整全局样式和设计令牌以匹配新品牌形象
This commit is contained in:
+68
-6
@@ -36,7 +36,8 @@
|
||||
:class="{ 'category-active': currentDrink.category === cat.id }"
|
||||
@click="selectCategory(cat)"
|
||||
>
|
||||
<text class="category-emoji">{{ cat.emoji }}</text>
|
||||
<image v-if="isIconPath(cat.icon)" :src="cat.icon" class="category-icon-img" mode="aspectFit"></image>
|
||||
<text v-else class="category-emoji">{{ cat.emoji }}</text>
|
||||
<text class="category-name">{{ cat.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -112,6 +113,7 @@
|
||||
@click="currentDrink.unit = u.id; onAmountChange()"
|
||||
>
|
||||
<text>{{ u.name }}</text>
|
||||
<text v-if="u.id !== 'ml'" class="unit-ml">≈{{ u.toMl }}ml</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -133,7 +135,11 @@
|
||||
</view>
|
||||
<view v-for="(d, i) in drinks" :key="i" class="added-drink-item card">
|
||||
<view class="flex-between">
|
||||
<text>{{ getCatEmoji(d.category) }} {{ d.brand }} {{ d.product }} · {{ d.amount }}{{ d.unit }}</text>
|
||||
<view class="added-drink-name">
|
||||
<image v-if="isIconPath(getCatIcon(d.category))" :src="getCatIcon(d.category)" class="inline-icon-img" mode="aspectFit"></image>
|
||||
<text v-else>{{ getCatEmoji(d.category) }}</text>
|
||||
<text>{{ d.brand }} {{ d.product }} · {{ d.customAmount || d.amount }}{{ getUnitLabel(d.customUnit || d.unit) }}</text>
|
||||
</view>
|
||||
<view class="added-drink-right">
|
||||
<text class="text-amber text-num">{{ d.standardCups }}杯</text>
|
||||
<view class="added-drink-remove" @click="removeDrink(i)">
|
||||
@@ -308,7 +314,7 @@ import {
|
||||
DRINK_CATEGORIES, DRINK_UNITS, BRANDS, FOOD_CATEGORIES,
|
||||
FEELINGS, VISIBILITY_OPTIONS
|
||||
} from '../../common/constants'
|
||||
import { calcStandardCups, unitToMl, formatDate } from '../../common/utils'
|
||||
import { calcStandardCups, unitToMl, formatDate, getCatIcon, isIconPath } from '../../common/utils'
|
||||
import client from '../../common/api'
|
||||
import { addRecord } from '../../common/mock-data'
|
||||
import themeMixin from '../../common/theme-mixin'
|
||||
@@ -383,6 +389,18 @@ export default {
|
||||
this.backfillDate = options.date
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: '干杯日记 - 记录每一杯酒',
|
||||
path: '/pages/index/index'
|
||||
}
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: '干杯日记 - 记录每一杯酒',
|
||||
query: ''
|
||||
}
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.currentStep > 1 || this.hasFormData()) {
|
||||
uni.showModal({
|
||||
@@ -420,6 +438,13 @@ export default {
|
||||
const cat = this.drinkCategories.find(c => c.id === catId)
|
||||
return cat ? cat.emoji : '🥃'
|
||||
},
|
||||
getCatIcon,
|
||||
isIconPath,
|
||||
getUnitLabel(unitId) {
|
||||
if (!unitId) return ''
|
||||
const u = DRINK_UNITS.find(u => u.id === unitId)
|
||||
return u ? u.name : unitId
|
||||
},
|
||||
getFoodName() {
|
||||
const food = this.foodCategories.find(f => f.id === this.selectedFood)
|
||||
if (!food) return ''
|
||||
@@ -489,7 +514,9 @@ export default {
|
||||
...this.currentDrink,
|
||||
amount: parseFloat(this.amountStr) || 0,
|
||||
degree: parseFloat(this.degreeStr) || 0,
|
||||
standardCups: calcStandardCups(ml, parseFloat(this.degreeStr) || 0)
|
||||
standardCups: calcStandardCups(ml, parseFloat(this.degreeStr) || 0),
|
||||
customAmount: parseFloat(this.amountStr) || 0,
|
||||
customUnit: this.currentDrink.unit
|
||||
})
|
||||
// 重置表单,准备添加下一种
|
||||
this.currentDrink = { category: '', brand: '', product: '', amount: 0, unit: 'ml', degree: 0 }
|
||||
@@ -508,11 +535,13 @@ export default {
|
||||
amount: d.amount,
|
||||
unit: d.unit,
|
||||
degree: d.degree,
|
||||
standardCups: d.standardCups
|
||||
standardCups: d.standardCups,
|
||||
customAmount: d.customAmount || d.amount,
|
||||
customUnit: d.customUnit || d.unit
|
||||
})),
|
||||
food: this.selectedFood ? { category: this.selectedFood, name: this.foodName || '' } : null,
|
||||
feeling: this.selectedFeeling || null,
|
||||
photos: [],
|
||||
photos: this.photos,
|
||||
visibility: 'friends',
|
||||
quote: ''
|
||||
}
|
||||
@@ -658,6 +687,12 @@ export default {
|
||||
margin-bottom: $sp-sm;
|
||||
}
|
||||
|
||||
.category-icon-img {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
margin-bottom: $sp-sm;
|
||||
}
|
||||
|
||||
.category-name {
|
||||
font-size: $fs-sm;
|
||||
font-weight: $fw-medium;
|
||||
@@ -780,6 +815,9 @@ export default {
|
||||
}
|
||||
|
||||
.unit-btn {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 6rpx;
|
||||
padding: $sp-xs $sp-md;
|
||||
background: $bg-elevated;
|
||||
border-radius: $radius-full;
|
||||
@@ -792,9 +830,19 @@ export default {
|
||||
background: $amber-glow;
|
||||
color: $amber;
|
||||
border-color: rgba(232,168,56,0.3);
|
||||
|
||||
.unit-ml {
|
||||
color: rgba(232, 168, 56, 0.6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.unit-ml {
|
||||
font-size: 20rpx;
|
||||
color: $text-tertiary;
|
||||
font-family: $font-num;
|
||||
}
|
||||
|
||||
.degree-input {
|
||||
width: 100rpx;
|
||||
text-align: center;
|
||||
@@ -1224,6 +1272,20 @@ export default {
|
||||
border-radius: $radius-full;
|
||||
}
|
||||
|
||||
.added-drink-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $sp-xs;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.inline-icon-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.added-drink-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user