topfans/frontend/pages/dashboard/components/RecentUpgrades.vue

160 lines
3.5 KiB
Vue

<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>