题库导入功能完成,考试计划功能完成。

This commit is contained in:
2025-12-19 00:58:58 +08:00
parent ba252b2f56
commit 465d4d7b4a
27 changed files with 1851 additions and 177 deletions

View File

@@ -0,0 +1,13 @@
# Change: Fix QuizPage useEffect Bug
## Why
在QuizPage.tsx中useEffect钩子末尾错误地调用了clearQuiz()函数导致从SubjectSelectionPage传递过来的题目数据被立即清除引发"Cannot read properties of undefined (reading 'type')"错误。
## What Changes
- 移除QuizPage.tsx useEffect钩子末尾的clearQuiz()调用
- 修改清除逻辑只清除answers对象而保留题目数据
- 添加对currentQuestion的空值检查确保组件正确渲染
## Impact
- Affected specs: quiz
- Affected code: src/pages/QuizPage.tsx

View File

@@ -0,0 +1,17 @@
## MODIFIED Requirements
### Requirement: Quiz Page State Management
The system SHALL preserve question data when navigating to QuizPage from other pages, and only clear答题状态(answers) to ensure proper component rendering.
#### Scenario: Navigation from SubjectSelectionPage
- **WHEN** user selects a subject and navigates to QuizPage
- **THEN** the system SHALL preserve the questions data
- **THEN** the system SHALL clear only the answers state
- **THEN** the system SHALL render the first question correctly
### Requirement: Quiz Page Error Handling
The system SHALL properly handle null or undefined question data to prevent runtime errors during rendering.
#### Scenario: Null Question Data
- **WHEN** currentQuestion is null or undefined
- **THEN** the system SHALL display a loading state instead of crashing
- **THEN** the system SHALL NOT attempt to access properties of undefined objects

View File

@@ -0,0 +1,8 @@
## 1. Implementation
- [x] 1.1 移除QuizPage.tsx useEffect钩子末尾的clearQuiz()调用
- [x] 1.2 修改清除逻辑只清除answers对象而保留题目数据
- [x] 1.3 添加对currentQuestion的空值检查确保组件正确渲染
## 2. Validation
- [x] 2.1 运行项目确保bug已修复
- [x] 2.2 验证从SubjectSelectionPage可以正常跳转到QuizPage并显示题目