一款基于间隔重复算法的刷题应用,帮助你高效记忆和掌握题目。支持判断题、单选题、多选题、填空题四种题型。
构建后生成单个 HTML 文件,方便分享和离线使用。
# 安装依赖
npm install
# 开发模式
npm run dev
# 构建生产版本(生成 dist/index.html)
npm run build
# 预览生产版本
npm run preview
题库存储在 assets/questions.json 文件中。替换此文件即可使用自己的题库。
题库是一个 JSON 数组,每个元素是一道题目。支持四种题型:
{
"id": "judgment_1",
"type": "judgment",
"question": "这是一道判断题的题目内容",
"answer": true
}
| 字段 | 类型 | 说明 |
|---|---|---|
id |
string | 题目唯一标识,建议格式:judgment_序号 |
type |
string | 固定为 "judgment" |
question |
string | 题目内容 |
answer |
boolean | 正确答案,true 或 false |
{
"id": "single_1",
"type": "single",
"question": "这是一道单选题的题目内容",
"options": [
{ "text": "选项 A" },
{ "text": "选项 B" },
{ "text": "选项 C" },
{ "text": "选项 D" }
],
"answer": [0]
}
| 字段 | 类型 | 说明 |
|---|---|---|
id |
string | 题目唯一标识,建议格式:single_序号 |
type |
string | 固定为 "single" |
question |
string | 题目内容,支持换行符 \n |
options |
array | 选项数组,每个选项包含 text 字段 |
answer |
number[] | 正确答案的索引数组(从 0 开始),单选题只有一个元素 |
{
"id": "multiple_1",
"type": "multiple",
"question": "这是一道多选题的题目内容",
"options": [
{ "text": "选项 A" },
{ "text": "选项 B" },
{ "text": "选项 C" },
{ "text": "选项 D" }
],
"answer": [0, 2]
}
格式与单选题相同,区别在于 answer 数组可以包含多个索引。
{
"id": "blank_1",
"type": "blank",
"question": "取得进步",
"answer": "make progress"
}
| 字段 | 类型 | 说明 |
|---|---|---|
id |
string | 题目唯一标识,建议格式:blank_序号 |
type |
string | 固定为 "blank" |
question |
string | 中文提示(展示给用户) |
answer |
string | 英文答案(用于比对) |
填空题答案支持以下语法,系统会自动宽松匹配:
| 语法 | 含义 | 示例 |
|---|---|---|
(xxx) |
括号内容可选 | on (an) average → 写不写 an 都算对 |
A/B |
斜杠两侧任选其一 | fall ill/sick → fall ill 或 fall sick 均可 |
(A/B) |
括号内词级替换 | (be/get) used to → be used to 或 get used to |
| 全角符号 | 自动转半角 | (an)、/ 与半角等价 |
匹配时忽略大小写、空格和标点,只比较英文字母。斜杠分支支持共享前缀/后缀,例如 draw/reach/come to a conclusion,输入 draw conclusion 也会被判为正确(宽松原则:存在合理解读即算对)。
完整示例见 assets/questions.example.json,内容如下:
[
{ "id": "judgment_1", "type": "judgment", "question": "地球是太阳系中最大的行星。", "answer": false },
{ "id": "judgment_2", "type": "judgment", "question": "水的化学式是 H2O。", "answer": true },
{
"id": "single_1",
"type": "single",
"question": "以下哪个是 JavaScript 的包管理器?",
"options": [ { "text": "pip" }, { "text": "npm" }, { "text": "cargo" }, { "text": "gem" } ],
"answer": [1]
},
{
"id": "single_2",
"type": "single",
"question": "光在真空中的传播速度约为多少?",
"options": [ { "text": "3×10⁶ m/s" }, { "text": "3×10⁷ m/s" }, { "text": "3×10⁸ m/s" }, { "text": "3×10⁹ m/s" } ],
"answer": [2]
},
{
"id": "multiple_1",
"type": "multiple",
"question": "以下哪些是前端框架/库?",
"options": [ { "text": "React" }, { "text": "Django" }, { "text": "Vue" }, { "text": "Flask" } ],
"answer": [0, 2]
},
{
"id": "multiple_2",
"type": "multiple",
"question": "以下哪些元素属于惰性气体?",
"options": [ { "text": "氦 (He)" }, { "text": "氧 (O)" }, { "text": "氖 (Ne)" }, { "text": "氮 (N)" } ],
"answer": [0, 2]
},
{ "id": "blank_1", "type": "blank", "question": "取得进步", "answer": "make progress" }
]
id 必须不同,否则会导致进度记录混乱answer 中的索引对应 options 数组的位置,第一个选项是 0\n**:题目内容中如需换行,使用 \n 转义字符assets/questions.json 后需要重新运行 npm run build如果更换了题库,建议清除浏览器中的学习进度:
或者在浏览器开发者工具的 Console 中执行:
localStorage.removeItem('quiz-state')
应用使用间隔重复算法来安排题目的复习,灵感来源于不背单词。
这些参数可以在应用设置中调整。
MIT