diff --git a/CLAUDE.md b/CLAUDE.md index 8703064..9805a22 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -299,7 +299,6 @@ type WrongQuestion struct { NextReviewTime *time.Time // 下次复习时间 ConsecutiveCorrect int // 连续答对次数 IsMastered bool // 是否已掌握 - Tags []string // 标签列表 (JSON) } ``` @@ -317,18 +316,6 @@ type WrongQuestionHistory struct { } ``` -#### 错题标签表 (`wrong_question_tags`) - -```go -type WrongQuestionTag struct { - ID uint // 主键 - UserID uint // 用户ID - Name string // 标签名 - Color string // 标签颜色 - Description string // 描述 -} -``` - ### 间隔重复算法(艾宾浩斯遗忘曲线) 系统采用科学的间隔重复算法,根据用户答题情况自动安排复习时间: @@ -380,7 +367,6 @@ func (wq *WrongQuestion) CalculateNextReviewTime() { | GET | `/api/wrong-questions/recommended` | 获取推荐错题 | `limit` | | DELETE | `/api/wrong-questions/:id` | 删除错题 | - | | DELETE | `/api/wrong-questions` | 清空错题本 | - | -| PUT | `/api/wrong-questions/:id/tags` | 更新标签 | - | **排序选项** (`sort` 参数): - `review_time` - 按复习时间排序(最需要复习的在前) @@ -388,14 +374,6 @@ func (wq *WrongQuestion) CalculateNextReviewTime() { - `mastery_level` - 按掌握度排序(掌握度最低的在前) - `time` - 按最后错误时间排序(默认) -#### 标签管理 API - -| 方法 | 路由 | 功能 | -|------|------|------| -| GET | `/api/wrong-question-tags` | 获取标签列表 | -| POST | `/api/wrong-question-tags` | 创建标签 | -| PUT | `/api/wrong-question-tags/:id` | 更新标签 | -| DELETE | `/api/wrong-question-tags/:id` | 删除标签 | ### 智能推荐算法 @@ -447,7 +425,6 @@ interface WrongQuestion { next_review_time?: string consecutive_correct: number is_mastered: boolean - tags: string[] recent_history?: WrongQuestionHistory[] } ``` @@ -464,11 +441,6 @@ getRecommendedWrongQuestions(limit: number = 10) // 获取错题统计 getWrongQuestionStats() -// 标签管理 -getWrongQuestionTags() -createWrongQuestionTag(data) -updateWrongQuestionTag(id, data) -deleteWrongQuestionTag(id) ``` ### 注意事项 diff --git a/internal/handlers/wrong_question_handler.go b/internal/handlers/wrong_question_handler.go index c74f5c4..1718313 100644 --- a/internal/handlers/wrong_question_handler.go +++ b/internal/handlers/wrong_question_handler.go @@ -31,10 +31,6 @@ func GetWrongQuestions(c *gin.Context) { query = query.Where("is_mastered = ?", isMastered == "true") } - if tag := c.Query("tag"); tag != "" { - query = query.Where("tags LIKE ?", "%"+tag+"%") - } - // 排序 switch c.Query("sort") { case "wrong_count": diff --git a/internal/models/wrong_question.go b/internal/models/wrong_question.go index 7763563..aa32d1c 100644 --- a/internal/models/wrong_question.go +++ b/internal/models/wrong_question.go @@ -58,7 +58,6 @@ type WrongQuestionDTO struct { MasteryLevel int `json:"mastery_level"` ConsecutiveCorrect int `json:"consecutive_correct"` IsMastered bool `json:"is_mastered"` - Tags []string `json:"tags"` RecentHistory []WrongQuestionHistoryDTO `json:"recent_history,omitempty"` // 最近3次历史 } diff --git a/web/src/pages/WrongQuestions.tsx b/web/src/pages/WrongQuestions.tsx index 514a10f..0c7712d 100644 --- a/web/src/pages/WrongQuestions.tsx +++ b/web/src/pages/WrongQuestions.tsx @@ -126,6 +126,27 @@ const WrongQuestions: React.FC = () => { return String(answer) } + // 渲染填空题内容(将 **** 替换为下划线) + const renderFillInBlankContent = (content: string) => { + const parts = content.split('****') + if (parts.length === 1) { + return content + } + + return ( + + {parts.map((part, index) => ( + + {part} + {index < parts.length - 1 && ( + ________ + )} + + ))} + + ) + } + // 获取题型标签颜色 const getTypeColor = (type: string) => { const colorMap: Record = { @@ -322,7 +343,11 @@ const WrongQuestions: React.FC = () => { {/* 题目内容 */} {item.question && (
- {item.question.content} + + {item.question.type === 'fill-in-blank' + ? renderFillInBlankContent(item.question.content) + : item.question.content} +
)} diff --git a/web/src/types/question.ts b/web/src/types/question.ts index 91ee1cb..191f3b8 100644 --- a/web/src/types/question.ts +++ b/web/src/types/question.ts @@ -81,7 +81,6 @@ export interface WrongQuestion { mastery_level: number // 掌握度 (0-100) consecutive_correct: number // 连续答对次数 is_mastered: boolean // 是否已掌握 - tags: string[] // 标签列表 recent_history?: WrongQuestionHistory[] // 最近的历史记录 }