渲染填空题内容(将 **** 替换为下划线)
This commit is contained in:
parent
0f544c169d
commit
e724e7120b
28
CLAUDE.md
28
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)
|
||||
```
|
||||
|
||||
### 注意事项
|
||||
|
||||
@ -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":
|
||||
|
||||
@ -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次历史
|
||||
}
|
||||
|
||||
|
||||
@ -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 (
|
||||
<span>
|
||||
{parts.map((part, index) => (
|
||||
<React.Fragment key={index}>
|
||||
{part}
|
||||
{index < parts.length - 1 && (
|
||||
<span> ________ </span>
|
||||
)}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
// 获取题型标签颜色
|
||||
const getTypeColor = (type: string) => {
|
||||
const colorMap: Record<string, string> = {
|
||||
@ -322,7 +343,11 @@ const WrongQuestions: React.FC = () => {
|
||||
{/* 题目内容 */}
|
||||
{item.question && (
|
||||
<div className={styles.questionContent}>
|
||||
<Text>{item.question.content}</Text>
|
||||
<Text>
|
||||
{item.question.type === 'fill-in-blank'
|
||||
? renderFillInBlankContent(item.question.content)
|
||||
: item.question.content}
|
||||
</Text>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@ -81,7 +81,6 @@ export interface WrongQuestion {
|
||||
mastery_level: number // 掌握度 (0-100)
|
||||
consecutive_correct: number // 连续答对次数
|
||||
is_mastered: boolean // 是否已掌握
|
||||
tags: string[] // 标签列表
|
||||
recent_history?: WrongQuestionHistory[] // 最近的历史记录
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user