feat(dashboard): UpcomingUpgrades + RecentUpgrades 双列布局

This commit is contained in:
zheng020 2026-06-02 22:51:59 +08:00
parent 1dbdcc5e20
commit b40ca02bd1
3 changed files with 316 additions and 1 deletions

View File

@ -8,13 +8,19 @@
<!-- 等级分布 --> <!-- 等级分布 -->
<LevelDistribution :items="levels" /> <LevelDistribution :items="levels" />
<!-- 后续 Task 12 在此追加 UpcomingUpgrades / RecentUpgrades --> <!-- 即将升级 + 最近升级 (双列) -->
<view class="upgrades-two-col">
<UpcomingUpgrades :items="upgrades?.upcoming || []" />
<RecentUpgrades :items="upgrades?.recent || []" />
</view>
</view> </view>
</template> </template>
<script setup> <script setup>
import TopFiveAssets from './TopFiveAssets.vue' import TopFiveAssets from './TopFiveAssets.vue'
import LevelDistribution from './LevelDistribution.vue' import LevelDistribution from './LevelDistribution.vue'
import UpcomingUpgrades from './UpcomingUpgrades.vue'
import RecentUpgrades from './RecentUpgrades.vue'
defineProps({ defineProps({
topFive: { type: Array, default: () => [] }, topFive: { type: Array, default: () => [] },
@ -41,4 +47,14 @@ defineProps({
margin-bottom: 24rpx; margin-bottom: 24rpx;
text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3); text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
} }
.upgrades-two-col {
display: flex;
gap: 12rpx;
margin-top: 16rpx;
> * {
flex: 1;
}
}
</style> </style>

View File

@ -0,0 +1,159 @@
<template>
<view class="recent-upgrades">
<text class="card-title">最近升级</text>
<view v-if="!items || items.length === 0" class="empty-row">
<text class="empty-text">暂无数据</text>
</view>
<view v-else class="upgrades-list">
<view
v-for="item in items"
:key="item.asset_id"
class="upgrade-row"
>
<view class="upgrade-thumb">
<view class="thumb-circle" :style="{ background: 'linear-gradient(135deg, #B17BFF 0%, #FF8FE6 100%)' }">
<text class="thumb-letter">{{ item.asset_name[0] }}</text>
</view>
</view>
<view class="upgrade-info">
<text class="upgrade-name">{{ item.asset_name }}</text>
<text class="upgrade-time">{{ formatTime(item.upgrade_time) }}</text>
</view>
<view class="level-badge" :class="`level-${item.new_level}`">
<text class="level-letter">{{ item.new_level }}</text>
<text class="lv-up">Lv UP</text>
</view>
</view>
</view>
</view>
</template>
<script setup>
defineProps({
items: { type: Array, default: () => [] }, // RecentLevelUpItem[]
})
function formatTime(ts) {
const now = Date.now()
const diff = now - ts
if (diff < 60 * 60 * 1000) return `${Math.floor(diff / 60000)} 分钟前`
if (diff < 24 * 60 * 60 * 1000) return `${Math.floor(diff / 3600000)} 小时前`
return `${Math.floor(diff / 86400000)} 天前`
}
</script>
<style lang="scss" scoped>
.recent-upgrades {
background: rgba(255, 255, 255, 0.1);
border-radius: 17rpx;
padding: 20rpx;
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.15);
}
.card-title {
display: block;
font-size: 28rpx;
font-weight: 600;
color: #ffffff;
margin-bottom: 16rpx;
}
.upgrades-list {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.upgrade-row {
display: flex;
align-items: center;
gap: 12rpx;
background: rgba(255, 255, 255, 0.05);
border-radius: 12rpx;
padding: 10rpx;
}
.upgrade-thumb {
width: 56rpx;
height: 56rpx;
flex-shrink: 0;
}
.thumb-circle {
width: 100%;
height: 100%;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}
.thumb-letter {
font-size: 22rpx;
font-weight: 700;
color: #ffffff;
}
.upgrade-info {
flex: 1;
display: flex;
flex-direction: column;
gap: 4rpx;
min-width: 0;
}
.upgrade-name {
font-size: 22rpx;
color: #ffffff;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.upgrade-time {
font-size: 18rpx;
color: rgba(255, 255, 255, 0.6);
}
.level-badge {
display: flex;
flex-direction: column;
align-items: center;
padding: 6rpx 12rpx;
border-radius: 8rpx;
flex-shrink: 0;
}
.level-UR { background: linear-gradient(135deg, #FF8A65 0%, #FFD740 100%); }
.level-SSR { background: linear-gradient(135deg, #FF5E9C 0%, #FFB199 100%); }
.level-SR { background: linear-gradient(135deg, #B17BFF 0%, #FF8FE6 100%); }
.level-R { background: linear-gradient(135deg, #5EDFFF 0%, #6FA9FF 100%); }
.level-N { background: linear-gradient(135deg, #C5C5C5 0%, #8C8C8C 100%); }
.level-letter {
font-size: 20rpx;
font-weight: 700;
color: #ffffff;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}
.lv-up {
font-size: 14rpx;
font-weight: 600;
color: rgba(255, 255, 255, 0.9);
}
.empty-row {
height: 120rpx;
display: flex;
align-items: center;
justify-content: center;
}
.empty-text {
color: rgba(255, 255, 255, 0.5);
font-size: 24rpx;
}
</style>

View File

@ -0,0 +1,140 @@
<template>
<view class="upcoming-upgrades">
<text class="card-title">即将升级</text>
<view v-if="!items || items.length === 0" class="empty-row">
<text class="empty-text">暂无数据</text>
</view>
<view v-else class="upgrades-list">
<view
v-for="item in items"
:key="item.asset_id"
class="upgrade-row"
>
<view class="upgrade-thumb">
<view class="thumb-circle" :style="{ background: 'linear-gradient(135deg, #FF6B6B 0%, #FFB199 100%)' }">
<text class="thumb-letter">{{ item.asset_name[0] }}</text>
</view>
</view>
<view class="upgrade-progress">
<view class="progress-bar progress-cyan">
<view class="progress-fill" :style="{ width: item.like_progress + '%' }"></view>
<text class="progress-text">{{ item.like_progress }}%</text>
</view>
<view class="progress-bar progress-pink">
<view class="progress-fill" :style="{ width: item.duration_progress + '%' }"></view>
<text class="progress-text">{{ item.duration_progress }}%</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
defineProps({
items: { type: Array, default: () => [] }, // UpcomingLevelUpItem[]
})
</script>
<style lang="scss" scoped>
.upcoming-upgrades {
background: rgba(255, 255, 255, 0.1);
border-radius: 17rpx;
padding: 20rpx;
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.15);
}
.card-title {
display: block;
font-size: 28rpx;
font-weight: 600;
color: #ffffff;
margin-bottom: 16rpx;
}
.upgrades-list {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.upgrade-row {
display: flex;
align-items: center;
gap: 16rpx;
}
.upgrade-thumb {
width: 64rpx;
height: 64rpx;
flex-shrink: 0;
}
.thumb-circle {
width: 100%;
height: 100%;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}
.thumb-letter {
font-size: 24rpx;
font-weight: 700;
color: #ffffff;
}
.upgrade-progress {
flex: 1;
display: flex;
flex-direction: column;
gap: 6rpx;
}
.progress-bar {
position: relative;
height: 16rpx;
border-radius: 6rpx;
background: rgba(217, 217, 217, 0.2);
overflow: hidden;
}
.progress-fill {
height: 100%;
border-radius: 6rpx;
transition: width 0.3s ease;
}
.progress-cyan .progress-fill {
background: linear-gradient(90deg, #5EDFFF 0%, #FFC8C8 100%);
}
.progress-pink .progress-fill {
background: linear-gradient(90deg, #FFF375 0%, #FF6B84 100%);
}
.progress-text {
position: absolute;
right: 6rpx;
top: 50%;
transform: translateY(-50%);
font-size: 16rpx;
font-weight: 700;
color: #ffffff;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}
.empty-row {
height: 120rpx;
display: flex;
align-items: center;
justify-content: center;
}
.empty-text {
color: rgba(255, 255, 255, 0.5);
font-size: 24rpx;
}
</style>