优化题目列表页面UI和交互体验
主要改进: 1. 优化题目标题布局 - 调整标题大小为 level 5,更加精致 - 添加占位元素使标题真正居中显示 - 优化标题与返回按钮的视觉平衡 2. 统一标签样式 - 题目列表中的标签改为统一的蓝色分类标签 - 题目顺序调整:「第X题」在前,分类标签在后 - 移除题目ID显示,界面更简洁 3. 优化题目导航抽屉 - 导航抽屉从按题型分组改为按分类分组 - 使用统一的蓝色分类标签 - 题号网格显示题目序号而非题目ID - 与答题页面QuestionCard保持统一的视觉风格 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f3360aab48
commit
ac3249a4a4
@ -6,17 +6,6 @@ import styles from './QuestionListDrawer.module.less'
|
|||||||
|
|
||||||
const { Text } = Typography
|
const { Text } = Typography
|
||||||
|
|
||||||
// 题型配置
|
|
||||||
const questionTypeConfig: Record<string, { label: string; color: string }> = {
|
|
||||||
'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 {
|
interface QuestionListDrawerProps {
|
||||||
visible: boolean
|
visible: boolean
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
@ -25,9 +14,7 @@ interface QuestionListDrawerProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface QuestionGroup {
|
interface QuestionGroup {
|
||||||
type: string
|
category: string
|
||||||
typeLabel: string
|
|
||||||
typeColor: string
|
|
||||||
items: Array<{ index: number; question: Question }>
|
items: Array<{ index: number; question: Question }>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,21 +24,18 @@ const QuestionListDrawer: React.FC<QuestionListDrawerProps> = ({
|
|||||||
questions,
|
questions,
|
||||||
onQuestionSelect,
|
onQuestionSelect,
|
||||||
}) => {
|
}) => {
|
||||||
// 按题型分组
|
// 按分类分组
|
||||||
const groupedQuestions = useMemo(() => {
|
const groupedQuestions = useMemo(() => {
|
||||||
const groups: Record<string, QuestionGroup> = {}
|
const groups: Record<string, QuestionGroup> = {}
|
||||||
|
|
||||||
questions.forEach((question, index) => {
|
questions.forEach((question, index) => {
|
||||||
const typeConfig = questionTypeConfig[question.type]
|
if (!groups[question.category]) {
|
||||||
if (!groups[question.type]) {
|
groups[question.category] = {
|
||||||
groups[question.type] = {
|
category: question.category,
|
||||||
type: question.type,
|
|
||||||
typeLabel: typeConfig?.label || question.type,
|
|
||||||
typeColor: typeConfig?.color || 'default',
|
|
||||||
items: [],
|
items: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
groups[question.type].items.push({ index, question })
|
groups[question.category].items.push({ index, question })
|
||||||
})
|
})
|
||||||
|
|
||||||
return Object.values(groups)
|
return Object.values(groups)
|
||||||
@ -76,11 +60,11 @@ const QuestionListDrawer: React.FC<QuestionListDrawerProps> = ({
|
|||||||
>
|
>
|
||||||
<div className={styles.groupsContainer}>
|
<div className={styles.groupsContainer}>
|
||||||
{groupedQuestions.map((group, groupIndex) => (
|
{groupedQuestions.map((group, groupIndex) => (
|
||||||
<div key={group.type} className={styles.questionGroup}>
|
<div key={group.category} className={styles.questionGroup}>
|
||||||
{/* 题型标题 */}
|
{/* 分类标题 */}
|
||||||
<div className={styles.groupHeader}>
|
<div className={styles.groupHeader}>
|
||||||
<Tag color={group.typeColor} className={styles.typeTag}>
|
<Tag color="blue" className={styles.typeTag}>
|
||||||
{group.typeLabel}
|
{group.category}
|
||||||
</Tag>
|
</Tag>
|
||||||
<span className={styles.groupCount}>共 {group.items.length} 题</span>
|
<span className={styles.groupCount}>共 {group.items.length} 题</span>
|
||||||
</div>
|
</div>
|
||||||
@ -95,9 +79,9 @@ const QuestionListDrawer: React.FC<QuestionListDrawerProps> = ({
|
|||||||
onQuestionSelect(index)
|
onQuestionSelect(index)
|
||||||
onClose()
|
onClose()
|
||||||
}}
|
}}
|
||||||
title={`题目 ${question.question_id}`}
|
title={`第 ${index + 1} 题`}
|
||||||
>
|
>
|
||||||
{question.question_id}
|
{index + 1}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -16,9 +16,14 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
width: 64px; // 与返回按钮宽度保持一致
|
||||||
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filterCard {
|
.filterCard {
|
||||||
|
|||||||
@ -222,9 +222,11 @@ const QuestionList: React.FC = () => {
|
|||||||
>
|
>
|
||||||
返回
|
返回
|
||||||
</Button>
|
</Button>
|
||||||
<Title level={3} className={styles.title}>
|
<Title level={5} className={styles.title}>
|
||||||
<BookOutlined /> 题目列表
|
<BookOutlined /> 题目列表
|
||||||
</Title>
|
</Title>
|
||||||
|
{/* 占位元素,保持标题居中 */}
|
||||||
|
<div className={styles.placeholder}></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 筛选栏 */}
|
{/* 筛选栏 */}
|
||||||
@ -289,16 +291,11 @@ const QuestionList: React.FC = () => {
|
|||||||
{/* 题目头部 */}
|
{/* 题目头部 */}
|
||||||
<div className={styles.questionHeader}>
|
<div className={styles.questionHeader}>
|
||||||
<Space size="small">
|
<Space size="small">
|
||||||
<Tag color={typeConfig?.color || 'default'}>
|
<Text type="secondary" className={styles.questionNumber}>
|
||||||
{typeConfig?.icon} {typeConfig?.label || question.type}
|
第 {index + 1} 题
|
||||||
</Tag>
|
|
||||||
<Text type="secondary" className={styles.questionId}>
|
|
||||||
#{question.question_id}
|
|
||||||
</Text>
|
</Text>
|
||||||
|
<Tag color="blue">{question.category}</Tag>
|
||||||
</Space>
|
</Space>
|
||||||
<Text type="secondary" className={styles.questionNumber}>
|
|
||||||
第 {index + 1} 题
|
|
||||||
</Text>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 题目内容 */}
|
{/* 题目内容 */}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user