feat(competition): 支持决赛环节并添加加时赛管理功能
- 扩展竞赛环节类型,支持决赛环节(RoundType=3) - 新增加时赛创建功能,支持多分组队伍选择 - 添加题目库禁用/启用功能,支持批量操作 - 优化用户端竞赛流程,区分常规赛和加时赛 - 重构操作按钮组件,提高代码复用性
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import CompetitionLayout from '@/components/custom/user/CompetitionLayout.vue'
|
||||
import { useRouterPush } from '@/hooks/common/router'
|
||||
@ -13,6 +13,12 @@ const loading = ref(false)
|
||||
const activityId = route.query.activityId as string
|
||||
const isAllEnd = ref(false)
|
||||
|
||||
// 是否有加时赛
|
||||
const hasExtraTime = computed(() => {
|
||||
const extraTimeGroups = groups.value.filter(item => item.RoundType === 1)
|
||||
return extraTimeGroups.length > 0 && extraTimeGroups.every(item => item.IsEnd)
|
||||
})
|
||||
|
||||
async function getGroups() {
|
||||
if (!activityId)
|
||||
return
|
||||
@ -32,7 +38,7 @@ async function getGroups() {
|
||||
icon: 'activity',
|
||||
}))
|
||||
}
|
||||
isAllEnd.value = list.every((item: Api.Competition.ActivityTeamGroup) => item.IsEnd)
|
||||
isAllEnd.value = list.filter(item => item.RoundType === 0).every((item: Api.Competition.ActivityTeamGroup) => item.IsEnd)
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
@ -46,7 +52,7 @@ function handleBack() {
|
||||
}
|
||||
|
||||
function handleNext() {
|
||||
routerPushByKey('user_rank-list', { query: { activityId } })
|
||||
routerPushByKey('user_rank-list', { query: { activityId, RoundType: 0 } })
|
||||
}
|
||||
|
||||
function selectGroup(item: Api.Competition.ActivityTeamGroup) {
|
||||
@ -54,7 +60,14 @@ function selectGroup(item: Api.Competition.ActivityTeamGroup) {
|
||||
return
|
||||
|
||||
// 选择组别逻辑
|
||||
routerPushByKey('user_teams', { query: { activityId, groupsId: item.Id } })
|
||||
routerPushByKey('user_teams', { query: { activityId, groupsId: item.Id, RoundType: item.RoundType } })
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看加时赛结果
|
||||
*/
|
||||
function handleNext2() {
|
||||
routerPushByKey('user_rank-list', { query: { activityId, RoundType: 1 } }, true)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@ -67,8 +80,9 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<CompetitionLayout
|
||||
:show-back="true" :show-next="isAllEnd" next-btn-text="查看队伍结果" :title-bg-type="2"
|
||||
title="展示组别" @back="handleBack" @next="handleNext"
|
||||
:show-back="true" :show-next="isAllEnd" next-btn-text="查看常规赛结果" next-btn-text2="查看加时赛结果"
|
||||
:show-next-btn2="hasExtraTime && isAllEnd" :title-bg-type="2" title="展示组别" @back="handleBack" @next="handleNext"
|
||||
@next2="handleNext2"
|
||||
>
|
||||
<!-- Groups Grid -->
|
||||
<div class="groups-container">
|
||||
|
||||
Reference in New Issue
Block a user