From 29fc6f5b1981775be5d2f0f9f8e61fec2f550252 Mon Sep 17 00:00:00 2001
From: lrj <owen.stl@gmail.com>
Date: 星期一, 29 九月 2025 19:29:11 +0800
Subject: [PATCH] 删除所有test开头的测试文件
---
web/src/views/dashboard/index.vue | 113 +++++++++++++++++++++++++-------------------------------
1 files changed, 50 insertions(+), 63 deletions(-)
diff --git a/web/src/views/dashboard/index.vue b/web/src/views/dashboard/index.vue
index 26e53e0..d2a3ba5 100644
--- a/web/src/views/dashboard/index.vue
+++ b/web/src/views/dashboard/index.vue
@@ -8,7 +8,7 @@
<el-icon color="#409eff"><Trophy /></el-icon>
</div>
<div class="stat-content">
- <div class="stat-number">{{ stats.activeCompetitions }}</div>
+ <div class="stat-number">{{ stats.activeActivities }}</div>
<div class="stat-label">褰撳墠杩涜姣旇禌</div>
</div>
</div>
@@ -51,37 +51,6 @@
</el-col>
</el-row>
- <!-- 蹇�熸搷浣� -->
- <div class="page-card">
- <h3 class="card-title">蹇�熸搷浣�</h3>
- <el-row :gutter="20">
- <el-col :span="6">
- <el-button type="primary" size="large" class="quick-btn" @click="$router.push('/activity')">
- <el-icon><Plus /></el-icon>
- 鏂板姣旇禌
- </el-button>
- </el-col>
- <el-col :span="6">
- <el-button type="success" size="large" class="quick-btn" @click="$router.push('/judge')">
- <el-icon><Plus /></el-icon>
- 鏂板璇勫
- </el-button>
- </el-col>
- <el-col :span="6">
- <el-button type="warning" size="large" class="quick-btn" @click="$router.push('/player')">
- <el-icon><View /></el-icon>
- 瀹℃牳鎶ュ悕
- </el-button>
- </el-col>
- <el-col :span="6">
- <el-button type="info" size="large" class="quick-btn" @click="$router.push('/carousel')">
- <el-icon><Plus /></el-icon>
- 鍙戝竷鏂伴椈
- </el-button>
- </el-col>
- </el-row>
- </div>
-
<!-- 鏈�杩戞椿鍔� -->
<div class="page-card">
<h3 class="card-title">鏈�杩戞瘮璧�</h3>
@@ -106,41 +75,59 @@
</template>
<script setup lang="ts">
-import { reactive } from 'vue'
+import { ref, onMounted } from 'vue'
+import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
+import { Trophy, UserFilled, Clock, User } from '@element-plus/icons-vue'
+import { getDashboardStats } from '@/api/dashboard'
+import { getActivities } from '@/api/activity'
+
+const router = useRouter()
// 缁熻鏁版嵁
-const stats = reactive({
- activeCompetitions: 5,
- totalPlayers: 128,
- pendingReviews: 23,
- totalJudges: 15
+const stats = ref({
+ activeActivities: 0,
+ totalPlayers: 0,
+ pendingReviews: 0,
+ totalJudges: 0
})
-// 鏈�杩戞瘮璧涙暟鎹�
-const recentActivities = reactive([
- {
- id: 1,
- name: '2024骞村垱鏂板垱涓氬ぇ璧�',
- playerCount: 45,
- startTime: '2024-01-15 09:00',
- status: '杩涜涓�'
- },
- {
- id: 2,
- name: '鎶�鑳界珵璧涘垵璧�',
- playerCount: 32,
- startTime: '2024-01-20 14:00',
- status: '鎶ュ悕涓�'
- },
- {
- id: 3,
- name: '璁捐澶ц禌鍐宠禌',
- playerCount: 18,
- startTime: '2024-01-25 10:00',
- status: '寰呭紑濮�'
+// 鏈�杩戞椿鍔ㄦ暟鎹�
+const recentActivities = ref([])
+
+// 鍔犺浇缁熻鏁版嵁
+const loadStats = async () => {
+ try {
+ const data = await getDashboardStats()
+ stats.value = data
+ } catch (error) {
+ console.error('鍔犺浇缁熻鏁版嵁澶辫触:', error)
+ ElMessage.error('鍔犺浇缁熻鏁版嵁澶辫触')
}
-])
+}
+
+// 鍔犺浇鏈�杩戞椿鍔�
+const loadRecentActivities = async () => {
+ try {
+ const data = await getActivities(0, 5) // 鑾峰彇鍓�5鏉℃椿鍔�
+ recentActivities.value = data.content.map(activity => ({
+ id: activity.id,
+ name: activity.name,
+ playerCount: activity.playerCount || 0,
+ startTime: activity.matchTime || activity.createTime,
+ status: activity.stateName || '鏈煡'
+ }))
+ } catch (error) {
+ console.error('鍔犺浇鏈�杩戞椿鍔ㄥけ璐�:', error)
+ ElMessage.error('鍔犺浇鏈�杩戞椿鍔ㄥけ璐�')
+ }
+}
+
+// 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
+onMounted(() => {
+ loadStats()
+ loadRecentActivities()
+})
// 鑾峰彇鐘舵�佹爣绛剧被鍨�
const getStatusType = (status: string) => {
@@ -155,12 +142,12 @@
// 鏌ョ湅姣旇禌
const viewActivity = (activity: any) => {
- ElMessage.info(`鏌ョ湅姣旇禌锛�${activity.name}`)
+ router.push(`/activity/${activity.id}`)
}
// 绠$悊姣旇禌
const manageActivity = (activity: any) => {
- ElMessage.info(`绠$悊姣旇禌锛�${activity.name}`)
+ router.push('/activity')
}
</script>
--
Gitblit v1.8.0