feat(user): 新增用户端答题流程页面与相关功能

- 新增用户端答题流程主页面,包含封面、介绍、答题、答题图解四个状态
- 新增用户端组件:封面、介绍页、答题页、答题图解页、题目渲染器
- 新增用户端类型定义、模拟数据及业务常量
- 新增用户路由及类型声明
- 优化题库分类树,改为扁平化列表结构
- 完善比赛创建功能,增加轮次类型、题目分数类型及关联AP字段
- 修复模板删除函数调用参数错误
This commit is contained in:
2026-01-23 18:16:03 +08:00
parent f1dacf7c66
commit 264f600250
28 changed files with 1750 additions and 348 deletions

View File

@ -1,9 +1,13 @@
import { computed } from 'vue'
import { roundTypeOptions, scoreTypeOptions } from '@/constants/business'
export interface QuestionItem {
id: string
value: string | null
score: number
time: number
title: string
scoreType: Api.Competition.QuestionScoreType
}
export interface RoundModel {
@ -12,8 +16,8 @@ export interface RoundModel {
questions: QuestionItem[]
}
export interface QuestionConfigModel {
rounds: RoundModel[]
function generateId() {
return `q_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`
}
export function useQuestionConfig(props: any) {
@ -59,14 +63,6 @@ export function useQuestionConfig(props: any) {
{ label: '极速成语接龙 - 每题20秒', value: 'speed20' },
]
const scoreOptions = [
{ label: '1分', value: 1 },
{ label: '2分', value: 2 },
{ label: '3分', value: 3 },
{ label: '5分', value: 5 },
{ label: '10分', value: 10 },
]
const timeOptions = [
{ label: '15s', value: 15 },
{ label: '30s', value: 30 },
@ -76,7 +72,7 @@ export function useQuestionConfig(props: any) {
]
// 新增轮次
function addRound(customName?: string, customCount?: number) {
function addRound(customName?: string, customCount?: number, roundType?: Api.Competition.CompetitionRoundType) {
if (!props.modelValue.rounds) {
props.modelValue.rounds = []
}
@ -87,10 +83,14 @@ export function useQuestionConfig(props: any) {
props.modelValue.rounds.push({
id: `round_${Date.now()}`,
name,
roundType: roundType || roundTypeOptions[0].value,
questions: Array.from({ length: count }).map(() => ({
id: generateId(),
value: null,
score: 5,
time: 30,
title: '',
scoreType: scoreTypeOptions[0].value,
})),
})
}
@ -109,9 +109,12 @@ export function useQuestionConfig(props: any) {
const round = props.modelValue.rounds[roundIndex]
if (round) {
round.questions.push({
id: generateId(),
value: null,
score: 5,
time: 30,
title: '',
scoreType: scoreTypeOptions[0].value,
})
}
}
@ -158,7 +161,6 @@ export function useQuestionConfig(props: any) {
getRoundTime,
totalStats,
questionOptions,
scoreOptions,
timeOptions,
addRound,
removeRound,