chore: init

This commit is contained in:
2025-11-11 14:15:40 +08:00
commit 867beb5de7
17 changed files with 3144 additions and 0 deletions

495
src/views/BattleRanking.vue Normal file
View File

@@ -0,0 +1,495 @@
<template>
<div class="battle-ranking">
<!-- 第一部分百日大战主题 -->
<section class="theme-section">
<div class="theme-container">
<h1 class="main-title">🔥 百人大战排行榜 🔥</h1>
<p class="subtitle">2025年度精英挑战赛 | 百日冲刺 · 争创佳绩</p>
<div class="timer">
<span class="label">距离结束还有</span>
<div class="countdown">
<span class="time-item">{{ days }}</span>
<span class="time-item">{{ hours }}</span>
<span class="time-item">{{ minutes }}</span>
<span class="time-item">{{ seconds }}</span>
</div>
</div>
</div>
</section>
<!-- 第二部分战鼓动画 -->
<section class="drums-section">
<div class="drums-container">
<!-- 战鼓动画在上面 -->
<div class="drums-animation">
<div class="drum" :class="{ beating: isBeating }">🥁</div>
<div class="drum" :class="{ beating: isBeating }">🥁</div>
<div class="trophy">🏆</div>
<div class="drum" :class="{ beating: isBeating }">🥁</div>
<div class="drum" :class="{ beating: isBeating }">🥁</div>
</div>
</div>
</section>
<!-- 第三部分奖金设置行布局 -->
<section class="bonus-section">
<h2>🎯 奖金设置</h2>
<div class="bonus-rules-row">
<div
v-for="(rule, index) in bonusRules"
:key="index"
class="bonus-rule-item"
>
<div class="rule-header">
<span class="rank-range">名次: {{ rule.rank }}</span>
<span class="rule-desc">{{ rule.description }}</span>
</div>
<div class="rule-details">
<p>🏅 个人奖励: {{ rule.individualBonus }}</p>
<p>👥 团队奖励: {{ rule.teamBonus }}</p>
</div>
</div>
</div>
</section>
<!-- 第四部分排名明细 -->
<section class="rankings-section">
<div class="rankings-container">
<!-- 个人排名 -->
<div class="individual-rankings">
<h2 class="section-title">👤 个人排名</h2>
<div class="rank-table">
<div class="table-header">
<span class="rank-col">排名</span>
<span class="avatar-col">头像</span>
<span class="name-col">姓名</span>
<span class="score-col">得分</span>
<span class="level-col">等级</span>
<span class="dept-col">部门</span>
<span class="bonus-col">奖金</span>
</div>
<div
v-for="(item, index) in individualRankings"
:key="item.id"
class="table-row"
:class="{
'top-three': index < 3,
'highlight': index === 0
}"
>
<span class="rank-col">{{ index + 1 }}</span>
<span class="avatar-col">{{ item.avatar }}</span>
<span class="name-col">{{ item.name }}</span>
<span class="score-col">{{ item.score }}</span>
<span class="level-col" :class="`level-${item.level}`">{{ item.level }}</span>
<span class="dept-col">{{ item.department }}</span>
<span class="bonus-col">¥{{ item.bonus }}</span>
</div>
</div>
</div>
<!-- 战队排名 -->
<div class="team-rankings">
<h2 class="section-title">👥 战队排名</h2>
<div class="rank-table">
<div class="table-header">
<span class="rank-col">排名</span>
<span class="name-col">战队名称</span>
<span class="score-col">总分</span>
<span class="member-col">人数</span>
<span class="leader-col">队长</span>
<span class="bonus-col">奖金</span>
</div>
<div
v-for="(item, index) in teamRankings"
:key="item.id"
class="table-row"
:class="{
'top-three': index < 3,
'highlight': index === 0
}"
>
<span class="rank-col">{{ index + 1 }}</span>
<span class="name-col">{{ item.name }}</span>
<span class="score-col">{{ item.totalScore }}</span>
<span class="member-col">{{ item.memberCount }}</span>
<span class="leader-col">{{ item.leader }}</span>
<span class="bonus-col">¥{{ item.bonus }}</span>
</div>
</div>
</div>
</div>
</section>
<!-- 浮动管理员入口 -->
<div class="admin-entry-float">
<button @click="goToAdmin" class="admin-btn-float">
🔐 管理员入口
</button>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import {
individualRankings,
teamRankings,
bonusRules
} from '../data/mockData.js';
const router = useRouter();
// 倒计时状态
const days = ref(0);
const hours = ref(0);
const minutes = ref(0);
const seconds = ref(0);
// 战鼓动画状态
const isBeating = ref(false);
let beatInterval = null;
let countdownInterval = null;
// 计算倒计时
const calculateCountdown = () => {
const endDate = new Date('2024-12-31T23:59:59').getTime();
const now = new Date().getTime();
const distance = endDate - now;
if (distance > 0) {
days.value = Math.floor(distance / (1000 * 60 * 60 * 24));
hours.value = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
minutes.value = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
seconds.value = Math.floor((distance % (1000 * 60)) / 1000);
}
};
// 战鼓动画效果
const startDrumAnimation = () => {
beatInterval = setInterval(() => {
isBeating.value = !isBeating.value;
}, 500);
};
// 跳转到管理员页面
const goToAdmin = () => {
router.push('/admin');
};
onMounted(() => {
calculateCountdown();
countdownInterval = setInterval(calculateCountdown, 1000);
startDrumAnimation();
});
onUnmounted(() => {
if (countdownInterval) clearInterval(countdownInterval);
if (beatInterval) clearInterval(beatInterval);
});
</script>
<style scoped>
.battle-ranking {
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
padding-bottom: 30px;
}
/* 主题部分 */
.theme-section {
background: rgba(255, 255, 255, 0.95);
padding: 40px 0;
text-align: center;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.main-title {
font-size: 2.5rem;
color: #d63031;
margin-bottom: 8px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}
.subtitle {
font-size: 1.2rem;
color: #636e72;
margin-bottom: 20px;
}
.timer {
display: inline-block;
background: linear-gradient(45deg, #6c5ce7, #a29bfe);
color: white;
padding: 12px 25px;
border-radius: 50px;
font-weight: bold;
margin-bottom: 10px;
}
.time-item {
background: rgba(255, 255, 255, 0.2);
padding: 5px 10px;
border-radius: 5px;
margin: 0 5px;
font-size: 1.1rem;
}
/* 战鼓部分 */
.drums-section {
margin: 20px 0 10px 0;
padding: 20px;
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
margin-left: 20px;
margin-right: 20px;
}
.drums-container {
display: flex;
justify-content: center;
}
.drums-animation {
display: flex;
align-items: center;
gap: 20px;
font-size: 3rem;
}
.drum {
transition: transform 0.3s ease;
}
.drum.beating {
transform: scale(1.2) translateY(-10px);
}
.trophy {
animation: bounce 1s infinite alternate;
}
@keyframes bounce {
from { transform: translateY(0); }
to { transform: translateY(-10px); }
}
/* 奖金设置部分(行布局) */
.bonus-section {
margin: 0 20px 15px 20px;
padding: 15px;
background: linear-gradient(135deg, #ffeaa7, #fab1a0);
border-radius: 20px;
}
.bonus-section h2 {
color: #d63031;
margin-bottom: 10px;
text-align: center;
font-size: 1.4rem;
}
.bonus-rules-row {
display: flex;
gap: 30px;
justify-content: center;
flex-wrap: wrap;
width: 100%;
}
.bonus-rule-item {
background: rgba(255, 255, 255, 0.8);
padding: 8px 10px;
border-radius: 12px;
border-left: 5px solid #e17055;
flex: 1;
min-width: 220px;
max-width: 100%;
transition: transform 0.3s ease;
box-sizing: border-box;
}
.bonus-rule-item:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.rule-header {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 4px;
font-weight: bold;
color: #d63031;
font-size: 1.2rem;
line-height: 1.2;
}
.rule-details p {
margin: 3px 0;
font-size: 1rem;
word-wrap: break-word;
white-space: normal;
line-height: 1.2;
}
/* 排名部分 */
.rankings-section {
margin: 0 20px 30px 20px;
}
.rankings-container {
display: flex;
gap: 15px;
flex-wrap: wrap;
justify-content: center;
}
.individual-rankings,
.team-rankings {
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
padding: 20px;
flex: 1;
min-width: 350px;
max-width: 550px;
}
.section-title {
color: #d63031;
text-align: center;
margin-bottom: 15px;
font-size: 1.6rem;
}
.rank-table {
border-radius: 10px;
overflow: hidden;
max-height: 400px;
overflow-y: auto;
position: relative;
}
.table-header {
background: linear-gradient(45deg, #6c5ce7, #a29bfe);
color: white;
display: grid;
grid-template-columns: 60px 60px 1fr 80px 80px 1fr 80px;
padding: 12px 10px;
font-weight: bold;
position: sticky;
top: 0;
z-index: 10;
}
.team-rankings .table-header {
grid-template-columns: 60px 1fr 80px 60px 1fr 80px;
position: sticky;
top: 0;
z-index: 10;
}
.table-row {
display: grid;
grid-template-columns: 60px 60px 1fr 80px 80px 1fr 80px;
padding: 12px 10px;
border-bottom: 1px solid #eee;
transition: background-color 0.3s;
}
.team-rankings .table-row {
grid-template-columns: 60px 1fr 80px 60px 1fr 80px;
padding: 12px 10px;
}
.table-row:hover {
background-color: #f8f9fa;
}
.table-row.top-three {
background-color: #fff3cd;
}
.table-row.highlight {
background: linear-gradient(135deg, #ffd32a, #ff7979);
color: white;
}
.level-SSS {
color: #ffd700;
font-weight: bold;
}
.level-SS {
color: #c0c0c0;
font-weight: bold;
}
.level-S {
color: #cd7f32;
font-weight: bold;
}
.level-A {
color: #4caf50;
font-weight: bold;
}
.level-B {
color: #2196f3;
font-weight: bold;
}
/* 浮动管理员入口 */
.admin-entry-float {
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
}
.admin-btn-float {
background: linear-gradient(45deg, #6c5ce7, #a29bfe);
color: white;
border: none;
padding: 12px 20px;
border-radius: 30px;
font-size: 1rem;
cursor: pointer;
box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
transition: all 0.3s ease;
border: 2px solid rgba(255, 255, 255, 0.3);
}
.admin-btn-float:hover {
transform: scale(1.1) translateY(-2px);
box-shadow: 0 6px 30px rgba(108, 92, 231, 0.6);
background: linear-gradient(45deg, #7f7fd5, #86a8e7);
}
/* 响应式设计 */
@media (max-width: 768px) {
.main-title {
font-size: 2rem;
}
.drums-container {
flex-direction: column;
gap: 20px;
}
.rankings-container {
flex-direction: column;
}
.individual-rankings,
.team-rankings {
min-width: auto;
}
.table-header,
.table-row {
font-size: 0.9rem;
}
}
</style>