路由更新
This commit is contained in:
200
schoolNewsWeb/src/views/user-center/MyAchievementsView.vue
Normal file
200
schoolNewsWeb/src/views/user-center/MyAchievementsView.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<div class="my-achievements">
|
||||
<div class="achievements-header">
|
||||
<h2>我的成就</h2>
|
||||
<div class="achievement-stats">
|
||||
<span>已获得 <strong>{{ earnedCount }}</strong> / {{ totalCount }} 个成就</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="achievements-grid">
|
||||
<div
|
||||
class="achievement-item"
|
||||
v-for="achievement in achievements"
|
||||
:key="achievement.id"
|
||||
:class="{ earned: achievement.earned, locked: !achievement.earned }"
|
||||
>
|
||||
<div class="achievement-icon">
|
||||
<img :src="achievement.icon" :alt="achievement.name" />
|
||||
<div class="achievement-badge" v-if="achievement.earned">✓</div>
|
||||
</div>
|
||||
<div class="achievement-info">
|
||||
<h3>{{ achievement.name }}</h3>
|
||||
<p class="achievement-description">{{ achievement.description }}</p>
|
||||
<div class="achievement-progress" v-if="!achievement.earned && achievement.progress">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" :style="{ width: achievement.progress + '%' }"></div>
|
||||
</div>
|
||||
<span class="progress-text">{{ achievement.progress }}%</span>
|
||||
</div>
|
||||
<div class="achievement-date" v-if="achievement.earned">
|
||||
获得时间:{{ achievement.earnedDate }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
|
||||
const achievements = ref<any[]>([]);
|
||||
|
||||
const earnedCount = computed(() => {
|
||||
return achievements.value.filter(a => a.earned).length;
|
||||
});
|
||||
|
||||
const totalCount = computed(() => {
|
||||
return achievements.value.length;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
// TODO: 加载成就数据
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.my-achievements {
|
||||
.achievements-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 32px;
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: #141F38;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.achievement-stats {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
|
||||
strong {
|
||||
color: #C62828;
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.achievements-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.achievement-item {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
padding: 20px;
|
||||
border: 2px solid #e0e0e0;
|
||||
border-radius: 8px;
|
||||
transition: all 0.3s;
|
||||
|
||||
&.earned {
|
||||
border-color: #C62828;
|
||||
background: linear-gradient(135deg, #fff5f5, #ffffff);
|
||||
|
||||
.achievement-icon {
|
||||
img {
|
||||
filter: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.locked {
|
||||
opacity: 0.6;
|
||||
|
||||
.achievement-icon {
|
||||
img {
|
||||
filter: grayscale(100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover.earned {
|
||||
box-shadow: 0 4px 12px rgba(198, 40, 40, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
.achievement-icon {
|
||||
position: relative;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
flex-shrink: 0;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
.achievement-badge {
|
||||
position: absolute;
|
||||
bottom: -4px;
|
||||
right: -4px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background: #4caf50;
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
border: 2px solid white;
|
||||
}
|
||||
|
||||
.achievement-info {
|
||||
flex: 1;
|
||||
|
||||
h3 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #141F38;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.achievement-description {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.achievement-progress {
|
||||
margin-bottom: 8px;
|
||||
|
||||
.progress-bar {
|
||||
width: 100%;
|
||||
height: 6px;
|
||||
background: #f5f5f5;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #C62828, #E53935);
|
||||
transition: width 0.3s;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.achievement-date {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user