diff --git a/web/src/components/QuestionListDrawer.tsx b/web/src/components/QuestionListDrawer.tsx index 2ab7021..63dd871 100644 --- a/web/src/components/QuestionListDrawer.tsx +++ b/web/src/components/QuestionListDrawer.tsx @@ -6,17 +6,6 @@ import styles from './QuestionListDrawer.module.less' const { Text } = Typography -// 题型配置 -const questionTypeConfig: Record = { - 'multiple-choice': { label: '选择题', color: '#1677ff' }, - 'multiple-selection': { label: '多选题', color: '#52c41a' }, - 'true-false': { label: '判断题', color: '#fa8c16' }, - 'fill-in-blank': { label: '填空题', color: '#722ed1' }, - 'short-answer': { label: '简答题', color: '#eb2f96' }, - 'ordinary-essay': { label: '普通涉密人员论述题', color: '#f759ab' }, - 'management-essay': { label: '保密管理人员论述题', color: '#d4380d' }, -} - interface QuestionListDrawerProps { visible: boolean onClose: () => void @@ -25,9 +14,7 @@ interface QuestionListDrawerProps { } interface QuestionGroup { - type: string - typeLabel: string - typeColor: string + category: string items: Array<{ index: number; question: Question }> } @@ -37,21 +24,18 @@ const QuestionListDrawer: React.FC = ({ questions, onQuestionSelect, }) => { - // 按题型分组 + // 按分类分组 const groupedQuestions = useMemo(() => { const groups: Record = {} questions.forEach((question, index) => { - const typeConfig = questionTypeConfig[question.type] - if (!groups[question.type]) { - groups[question.type] = { - type: question.type, - typeLabel: typeConfig?.label || question.type, - typeColor: typeConfig?.color || 'default', + if (!groups[question.category]) { + groups[question.category] = { + category: question.category, items: [], } } - groups[question.type].items.push({ index, question }) + groups[question.category].items.push({ index, question }) }) return Object.values(groups) @@ -76,11 +60,11 @@ const QuestionListDrawer: React.FC = ({ >
{groupedQuestions.map((group, groupIndex) => ( -
- {/* 题型标题 */} +
+ {/* 分类标题 */}
- - {group.typeLabel} + + {group.category} 共 {group.items.length} 题
@@ -95,9 +79,9 @@ const QuestionListDrawer: React.FC = ({ onQuestionSelect(index) onClose() }} - title={`题目 ${question.question_id}`} + title={`第 ${index + 1} 题`} > - {question.question_id} + {index + 1}
))}
diff --git a/web/src/pages/QuestionList.module.less b/web/src/pages/QuestionList.module.less index b61b177..0590086 100644 --- a/web/src/pages/QuestionList.module.less +++ b/web/src/pages/QuestionList.module.less @@ -16,9 +16,14 @@ font-size: 16px; } +.placeholder { + width: 64px; // 与返回按钮宽度保持一致 +} + .title { margin: 0 !important; flex: 1; + text-align: center; } .filterCard { diff --git a/web/src/pages/QuestionList.tsx b/web/src/pages/QuestionList.tsx index a168665..28876bc 100644 --- a/web/src/pages/QuestionList.tsx +++ b/web/src/pages/QuestionList.tsx @@ -222,9 +222,11 @@ const QuestionList: React.FC = () => { > 返回 - + <Title level={5} className={styles.title}> <BookOutlined /> 题目列表 + {/* 占位元素,保持标题居中 */} +
{/* 筛选栏 */} @@ -289,16 +291,11 @@ const QuestionList: React.FC = () => { {/* 题目头部 */}
- - {typeConfig?.icon} {typeConfig?.label || question.type} - - - #{question.question_id} + + 第 {index + 1} 题 + {question.category} - - 第 {index + 1} 题 -
{/* 题目内容 */}