| | |
| | | <h3 class="table-title">最近比赛</h3> |
| | | <el-button type="primary" @click="$router.push('/activity')">查看全部</el-button> |
| | | </div> |
| | | |
| | | <el-table :data="recentActivities" class="recent-table"> |
| | | <el-table-column prop="name" label="比赛名称" width="180" /> |
| | | <el-table-column prop="playerCount" label="报名人数" width="120" /> |
| | |
| | | <el-table-column label="操作"> |
| | | <template #default="scope"> |
| | | <a class="action-link" @click="viewActivity(scope.row)">查看</a> |
| | | <a class="action-link" @click="manageActivity(scope.row)">管理</a> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | 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, |
| | | endTime: activity.endTime || '待定', |
| | | status: activity.stateName || '未知' |
| | | const { content } = data || {}; |
| | | recentActivities.value = (content || []).map(item => ({ |
| | | id: item.id, |
| | | name: item.name, |
| | | playerCount: item.playerCount || 0, |
| | | startTime: item.matchTime, |
| | | endTime: item.matchTime, |
| | | status: item.stateName |
| | | })) |
| | | } catch (error) { |
| | | console.error('加载最近活动失败:', error) |
| | |
| | | // 查看比赛 |
| | | const viewActivity = (activity: any) => { |
| | | router.push(`/activity/${activity.id}`) |
| | | } |
| | | |
| | | // 管理比赛 |
| | | const manageActivity = (activity: any) => { |
| | | router.push('/activity') |
| | | } |
| | | |
| | | // 获取状态样式类 |