- 添加了完整的酒桌小游戏页面,包含数字炸弹、猜拳大战、骰子大话和命运转盘四个游戏 - 实现了成就徽章组件的图标路径判断逻辑,支持图片和文字图标的动态切换 - 更新了饮酒分类常量中的白酒图标为酒杯样式,并修改成就图标为SVG路径 - 重构了动态卡片组件中的分类表情符号显示方式,支持SVG图标渲染 - 添加了游戏页面的路由配置和完整的交互功能实现
109 lines
2.1 KiB
Vue
109 lines
2.1 KiB
Vue
<template>
|
|
<view
|
|
class="badge"
|
|
:class="{ 'badge-unlocked': achievement.unlocked, 'badge-locked': !achievement.unlocked }"
|
|
@click="$emit('click')"
|
|
>
|
|
<view class="badge-icon-wrap">
|
|
<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>
|
|
</view>
|
|
<text class="badge-name">{{ achievement.name }}</text>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { isIconPath } from '../common/utils'
|
|
|
|
export default {
|
|
props: {
|
|
achievement: { type: Object, required: true }
|
|
},
|
|
emits: ['click'],
|
|
methods: { isIconPath }
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.badge {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: $sp-sm;
|
|
padding: $sp-lg $sp-sm;
|
|
background: $bg-card;
|
|
border-radius: $radius-lg;
|
|
transition: all $duration-fast $ease-out;
|
|
|
|
&:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
&.badge-unlocked {
|
|
.badge-icon-wrap {
|
|
box-shadow: 0 0 24rpx rgba(232,168,56,0.3);
|
|
border-color: rgba(232,168,56,0.3);
|
|
}
|
|
|
|
.badge-name {
|
|
color: $text-primary;
|
|
}
|
|
}
|
|
|
|
&.badge-locked {
|
|
opacity: 0.5;
|
|
|
|
.badge-icon {
|
|
filter: grayscale(1);
|
|
}
|
|
}
|
|
}
|
|
|
|
.badge-icon-wrap {
|
|
width: 96rpx;
|
|
height: 96rpx;
|
|
background: $bg-elevated;
|
|
border-radius: $radius-full;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border: 3rpx solid var(--border-faint, rgba(255, 255, 255, 0.08));
|
|
position: relative;
|
|
}
|
|
|
|
.badge-icon {
|
|
font-size: 48rpx;
|
|
}
|
|
|
|
.badge-icon-img {
|
|
width: 52rpx;
|
|
height: 52rpx;
|
|
}
|
|
|
|
.badge-lock {
|
|
position: absolute;
|
|
bottom: -4rpx;
|
|
right: -4rpx;
|
|
width: 36rpx;
|
|
height: 36rpx;
|
|
background: $bg-base;
|
|
border-radius: $radius-full;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.badge-lock-icon {
|
|
font-size: 20rpx;
|
|
}
|
|
|
|
.badge-name {
|
|
font-size: $fs-xs;
|
|
color: $text-secondary;
|
|
text-align: center;
|
|
}
|
|
</style>
|