feat: 优化用户任务页面和管理页面的表格样式

调整字体大小和列宽,增强可读性;更新管理员登录页面的样式,调整按钮和文本大小;修复考试科目页面、考试任务页面、问题管理页面等多个页面的表格分页样式,统一设置为小尺寸;更新选项列表和测验组件的样式,提升用户体验。
This commit is contained in:
2025-12-29 16:51:59 +08:00
parent 46cd96a6be
commit 03eb858749
26 changed files with 490 additions and 352 deletions

View File

@@ -29,6 +29,7 @@ interface LocationState {
timeLimit?: number;
subjectId?: string;
taskId?: string;
taskName?: string;
}
const QuizPage = () => {
@@ -43,6 +44,7 @@ const QuizPage = () => {
const [timeLimit, setTimeLimit] = useState<number | null>(null);
const [subjectId, setSubjectId] = useState<string>('');
const [taskId, setTaskId] = useState<string>('');
const [taskName, setTaskName] = useState<string>('');
const lastTickSavedAtMsRef = useRef<number>(0);
const saveDebounceTimerRef = useRef<number | null>(null);
const [navDirection, setNavDirection] = useState<'next' | 'prev'>('next');
@@ -124,6 +126,7 @@ const QuizPage = () => {
if (state?.questions) {
const nextSubjectId = state.subjectId || '';
const nextTaskId = state.taskId || '';
const nextTaskName = state.taskName || '';
const nextTimeLimit = state.timeLimit || 60;
setQuestions(state.questions);
@@ -133,6 +136,7 @@ const QuizPage = () => {
setTimeLeft(nextTimeLimit * 60);
setSubjectId(nextSubjectId);
setTaskId(nextTaskId);
setTaskName(nextTaskName);
const progressKey = buildProgressKey(user.id, nextSubjectId, nextTaskId);
setActiveProgress(user.id, progressKey);
@@ -308,6 +312,14 @@ const QuizPage = () => {
setCurrentQuestionIndex(index);
};
const handleJumpToFirstUnanswered = () => {
const firstUnansweredIndex = questions.findIndex(q => !answers[q.id]);
if (firstUnansweredIndex !== -1) {
handleJumpTo(firstUnansweredIndex);
}
setAnswerSheetOpen(false);
};
const handleSubmit = async (forceSubmit = false) => {
try {
setSubmitting(true);
@@ -442,6 +454,7 @@ const QuizPage = () => {
total={questions.length}
timeLeft={timeLeft}
onGiveUp={handleGiveUp}
taskName={taskName}
/>
<QuizProgress
@@ -464,13 +477,13 @@ const QuizPage = () => {
}
`}
>
<div className="bg-white rounded-xl shadow-sm border border-gray-100 p-4 min-h-[350px]">
<div className="mb-4">
<span className={`inline-block px-2 py-0.5 rounded-md text-xs font-medium border ${getTagColor(currentQuestion.type)}`}>
<div className="bg-white rounded-xl shadow-sm border border-gray-100 p-2 min-h-[280px]">
<div className="mb-2">
<span className={`inline-block px-1 py-0.5 rounded-md text-xs font-medium border ${getTagColor(currentQuestion.type)}`}>
{questionTypeMap[currentQuestion.type]}
</span>
{currentQuestion.category && (
<span className="ml-2 inline-block px-1.5 py-0.5 bg-gray-50 text-gray-600 text-xs rounded border border-gray-100">
<span className="ml-2 inline-block px-1 py-0.5 bg-gray-50 text-gray-600 text-xs rounded border border-gray-100">
{currentQuestion.category}
</span>
)}
@@ -479,7 +492,7 @@ const QuizPage = () => {
<h2
ref={questionHeadingRef}
tabIndex={-1}
className="text-base font-medium text-gray-900 leading-relaxed mb-6 outline-none"
className="text-sm font-medium text-gray-900 leading-tight mb-3 outline-none"
>
{currentQuestion.content}
</h2>
@@ -520,7 +533,7 @@ const QuizPage = () => {
</div>
<Button
type="primary"
onClick={() => setAnswerSheetOpen(false)}
onClick={handleJumpToFirstUnanswered}
className="bg-[#00897B] hover:bg-[#00796B] text-xs h-7 px-3"
>