Administrator 1f55170c6d fix: 修复模块导入路径并移除未使用的 @nuxt/icon 依赖
- 修复 index.vue 中 scoreboard 模块导入路径
- 从 nuxt.config.ts 移除未使用的 @nuxt/icon 模块
- 消除构建时的弃用警告
2026-03-18 22:18:08 +08:00

215 lines
5.2 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="home-container">
<el-card class="welcome-card">
<h1>欢迎使用运动会记分板系统</h1>
<p>本系统用于管理运动会的比赛项目队伍和成绩</p>
</el-card>
<el-row :gutter="20" class="stats-row">
<el-col :xs="12" :sm="12" :md="6" :lg="6">
<el-card class="stat-card">
<div class="stat-content">
<el-icon class="stat-icon" color="#409eff"><Trophy /></el-icon>
<div>
<div class="stat-value">{{ stats.events }}</div>
<div class="stat-label">比赛项目</div>
</div>
</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="12" :md="6" :lg="6">
<el-card class="stat-card">
<div class="stat-content">
<el-icon class="stat-icon" color="#67c23a"><UserFilled /></el-icon>
<div>
<div class="stat-value">{{ stats.teams }}</div>
<div class="stat-label">参赛队伍</div>
</div>
</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="12" :md="6" :lg="6">
<el-card class="stat-card">
<div class="stat-content">
<el-icon class="stat-icon" color="#e6a23c"><Edit /></el-icon>
<div>
<div class="stat-value">{{ stats.results }}</div>
<div class="stat-label">成绩记录</div>
</div>
</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="12" :md="6" :lg="6">
<el-card class="stat-card">
<div class="stat-content">
<el-icon class="stat-icon" color="#f56c6c"><DataLine /></el-icon>
<div>
<div class="stat-value">{{ stats.categories }}</div>
<div class="stat-label">比赛类别</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :xs="24" :sm="24" :md="12" :lg="12">
<el-card>
<template #header>
<span>快速操作</span>
</template>
<div class="quick-actions">
<el-row :gutter="10">
<el-col :span="12">
<el-button type="primary" class="action-btn" @click="navigateTo('/events')">管理比赛项目</el-button>
</el-col>
<el-col :span="12">
<el-button type="success" class="action-btn" @click="navigateTo('/teams')">管理队伍</el-button>
</el-col>
<el-col :span="12">
<el-button type="warning" class="action-btn" @click="navigateTo('/results')">录入成绩</el-button>
</el-col>
<el-col :span="12">
<el-button type="info" class="action-btn" @click="navigateTo('/scoreboard')">查看记分板</el-button>
</el-col>
</el-row>
</div>
</el-card>
</el-col>
<el-col :xs="24" :sm="24" :md="12" :lg="12">
<el-card>
<template #header>
<span>系统说明</span>
</template>
<ul class="system-info">
<li>田赛跳高跳远掷铅球</li>
<li>径赛100m200m400m4×100m4×400m20×50m</li>
<li>团体赛旱地龙舟跳长绳折返跑</li>
<li>组别教师组航空班组体育班组文化班甲组文化班乙组</li>
</ul>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script setup lang="ts">
import { Trophy, UserFilled, Edit, DataLine } from '@element-plus/icons-vue'
import { fetchEvents, fetchTeams, fetchResults } from '~/modules/scoreboard/api'
const stats = ref({
events: 0,
teams: 0,
results: 0,
categories: 3
})
onMounted(async () => {
try {
const [eventsRes, teamsRes, resultsRes] = await Promise.all([
fetchEvents(),
fetchTeams(),
fetchResults()
])
stats.value.events = eventsRes?.length || 0
stats.value.teams = teamsRes?.length || 0
stats.value.results = resultsRes?.length || 0
} catch (error) {
console.error('Failed to load stats:', error)
}
})
</script>
<style scoped>
.home-container {
max-width: 1200px;
margin: 0 auto;
}
.welcome-card {
margin-bottom: 20px;
text-align: center;
}
.welcome-card h1 {
color: #303133;
margin-bottom: 10px;
}
.welcome-card p {
color: #909399;
font-size: 16px;
}
.stats-row {
margin-bottom: 20px;
}
.stat-card {
text-align: center;
}
.stat-content {
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
}
.stat-icon {
font-size: 40px;
}
.stat-value {
font-size: 32px;
font-weight: bold;
color: #303133;
}
.stat-label {
font-size: 14px;
color: #909399;
margin-top: 5px;
}
.quick-actions {
display: block;
}
.quick-actions .action-btn {
width: 100%;
margin-bottom: 10px;
}
.system-info {
list-style: none;
padding: 0;
margin: 0;
}
.system-info li {
padding: 8px 0;
border-bottom: 1px solid #ebeef5;
color: #606266;
}
.system-info li:last-child {
border-bottom: none;
}
@media (max-width: 900px) {
.stat-value {
font-size: 24px;
}
.stat-icon {
font-size: 28px;
}
.stats-row :deep(.el-col) {
margin-bottom: 12px;
}
}
</style>