feat(game): 新增酒桌小游戏功能并优化图标显示
- 添加了完整的酒桌小游戏页面,包含数字炸弹、猜拳大战、骰子大话和命运转盘四个游戏 - 实现了成就徽章组件的图标路径判断逻辑,支持图片和文字图标的动态切换 - 更新了饮酒分类常量中的白酒图标为酒杯样式,并修改成就图标为SVG路径 - 重构了动态卡片组件中的分类表情符号显示方式,支持SVG图标渲染 - 添加了游戏页面的路由配置和完整的交互功能实现
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
@click="$emit('click')"
|
||||
>
|
||||
<view class="badge-icon-wrap">
|
||||
<text class="badge-icon">{{ achievement.icon }}</text>
|
||||
<image v-if="isIconPath(achievement.icon)" :src="achievement.icon" class="badge-icon-img" mode="aspectFit"></image>
|
||||
<text v-else class="badge-icon">{{ achievement.icon }}</text>
|
||||
<view v-if="!achievement.unlocked" class="badge-lock">
|
||||
<text class="badge-lock-icon">🔒</text>
|
||||
</view>
|
||||
@@ -15,11 +16,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { isIconPath } from '../common/utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
achievement: { type: Object, required: true }
|
||||
},
|
||||
emits: ['click']
|
||||
emits: ['click'],
|
||||
methods: { isIconPath }
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -74,6 +78,11 @@ export default {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
|
||||
.badge-icon-img {
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
}
|
||||
|
||||
.badge-lock {
|
||||
position: absolute;
|
||||
bottom: -4rpx;
|
||||
|
||||
+12
-5
@@ -20,7 +20,8 @@
|
||||
<!-- 饮酒标签 -->
|
||||
<view class="feed-drinks" v-if="feed.drinks && feed.drinks.length">
|
||||
<view class="feed-drink-tag" v-for="(d, i) in feed.drinks" :key="i">
|
||||
<text class="feed-drink-emoji">{{ categoryEmoji(d.category) }}</text>
|
||||
<image v-if="isIconPath(getCatIcon(d.category))" :src="getCatIcon(d.category)" class="feed-drink-icon-img" mode="aspectFit"></image>
|
||||
<text v-else class="feed-drink-emoji">{{ getCatIcon(d.category) }}</text>
|
||||
<text class="feed-drink-name">{{ d.name }} {{ d.amount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -60,16 +61,16 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCatIcon, isIconPath } from '../common/utils'
|
||||
|
||||
export default {
|
||||
name: 'FeedCard',
|
||||
props: {
|
||||
feed: { type: Object, default: () => ({}) }
|
||||
},
|
||||
methods: {
|
||||
categoryEmoji(cat) {
|
||||
const map = { baijiu: '🏺', beer: '🍺', wine: '🍷', whisky: '🥃', huangjiu: '🫖', sake: '🍶', fruit: '🍹', cocktail: '🍸' }
|
||||
return map[cat] || '🍻'
|
||||
},
|
||||
getCatIcon,
|
||||
isIconPath,
|
||||
feelingLabel(f) {
|
||||
const map = { sober: '😌 清醒', buzzed: '😊 微醺', tipsy: '😄 小醉', drunk: '🥴 喝多了' }
|
||||
return map[f] || '🍻 喝了点'
|
||||
@@ -163,6 +164,12 @@ export default {
|
||||
font-size: $fs-sm;
|
||||
}
|
||||
|
||||
.feed-drink-icon-img {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.feed-drink-name {
|
||||
font-size: $fs-xs;
|
||||
color: $text-secondary;
|
||||
|
||||
Reference in New Issue
Block a user