- 扩展竞赛环节类型,支持决赛环节(RoundType=3) - 新增加时赛创建功能,支持多分组队伍选择 - 添加题目库禁用/启用功能,支持批量操作 - 优化用户端竞赛流程,区分常规赛和加时赛 - 重构操作按钮组件,提高代码复用性
151 lines
4.4 KiB
TypeScript
151 lines
4.4 KiB
TypeScript
import { request } from '../request'
|
|
|
|
/** 房间相关接口 */
|
|
export function fetchGetRoomList() {
|
|
return request<App.Service.Response<Api.Competition.Room[]>>({
|
|
url: '/Base/ActivityMain/GetActivity_RoomList',
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
// 现在服务端把活动新建弄成了三个接口:
|
|
// 1. 创建活动
|
|
// 2. 创建活动房间
|
|
// 3. 创建活动队伍
|
|
// 但是业务要求最后一步创建
|
|
|
|
/** 创建活动基础信息 */
|
|
export function fetchCreateActivity(data: Api.Competition.CreateRoomRequest) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: '/Base/ActivityMain/AddActivity',
|
|
method: 'post',
|
|
data,
|
|
})
|
|
}
|
|
|
|
/** 获取活动的基础信息 */
|
|
export function fetchGetActivityDetail(id: number) {
|
|
return request<App.Service.Response<Api.Competition.ActivityDetail>>({
|
|
url: `/Base/ActivityMain/GetActivityByID/?ID=${id}`,
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
/** 创建活动队伍 */
|
|
export function fetchCreateTeamList(data: Api.Competition.CreateTeamListRequest[]) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: '/Base/ActivityMain/AddActivity_TeamList',
|
|
method: 'post',
|
|
data,
|
|
})
|
|
}
|
|
|
|
/** 根据活动ID获取活动队伍列表 */
|
|
export function fetchGetTeamList(id: number) {
|
|
return request<App.Service.Response>({
|
|
url: `/Base/ActivityMain/GetActivity_TeamsByMainID/?MainID=${id}`,
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
/** 创建活动题目 */
|
|
export function fetchCreateQuestion(data: Api.Competition.CreateQuestionRequest[]) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: '/Base/ActivityMain/AddOrUpdateActivity_Question',
|
|
method: 'post',
|
|
data,
|
|
})
|
|
}
|
|
|
|
/** 根据活动ID获取活动题目列表 */
|
|
export function fetchGetQuestionList(id: number, roundType = 0) {
|
|
return request<App.Service.Response<Api.Competition.QuestionListRecord[]>>({
|
|
url: `/Base/ActivityMain/GetActivity_QuestionByActivityID?ID=${id}&RoundType=${roundType}`,
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
/** 获取活动列表 */
|
|
export function fetchGetActivityList() {
|
|
return request<App.Service.Response>({
|
|
url: '/Base/ActivityMain/Activity_MainList',
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
/** 新增活动 (包括基础信息、房间、队伍、题目) */
|
|
export function fetchCreateCompetition(data: any) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: '/Base/ActivityMain/AddActivityAllData',
|
|
method: 'post',
|
|
data,
|
|
})
|
|
}
|
|
|
|
/** 根据活动id查询分组列表 */
|
|
export function fetchGetGroupList(id: string) {
|
|
return request<App.Service.Response>({
|
|
url: `/Base/ActivityMain/GetActivity_TeamGroupByMainID?ActivityID=${id}`,
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
/** 根据组id查询队伍列表 */
|
|
export function fetchGetTeamListByGroupId(GroupID: number) {
|
|
return request<App.Service.Response<Api.Competition.TeamListRecord[]>>({
|
|
url: `/Base/ActivityMain/GetActivity_TeamsByTeamGroupID?GroupID=${GroupID}`,
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
/** 更新活动基础信息 */
|
|
export function fetchUpdateActivity(data: Api.Competition.ActivityDetail) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: '/Base/ActivityMain/UpdateActivity',
|
|
method: 'post',
|
|
data,
|
|
})
|
|
}
|
|
|
|
/** 更新活动队伍 */
|
|
export function fetchUpdateTeamList(data: Api.Competition.CreateTeamListRequest[]) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: '/Base/ActivityMain/UpdateActivity_TeamList',
|
|
method: 'post',
|
|
data,
|
|
})
|
|
}
|
|
|
|
/** 更新活动题目 */
|
|
export function fetchUpdateQuestion(data: Api.Competition.QuestionListRecord[]) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: '/Base/ActivityMain/AddOrUpdateActivity_Question',
|
|
method: 'post',
|
|
data,
|
|
})
|
|
}
|
|
|
|
/** 删除活动 */
|
|
export function fetchDeleteActivity(id: number) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: `/Base/ActivityMain/DeleteActivity?ID=${id}`,
|
|
method: 'post',
|
|
})
|
|
}
|
|
|
|
/** 更新活动状态 */
|
|
export function fetchUpdatePublishStatus(id: number, status: number) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: `/Base/ActivityMain/UpdateActivityStatus?ActivityID=${id}&status=${status}`,
|
|
method: 'post',
|
|
})
|
|
}
|
|
|
|
/** 复制活动 */
|
|
export function fetchCopyActivity(ActivityID: number) {
|
|
return request<App.Service.Response<Api.Common.CommonResponse>>({
|
|
url: `/Base/ActivityMain/CopyActivity?ActivityID=${ActivityID}`,
|
|
method: 'post',
|
|
})
|
|
}
|