首先,您应该已经知晓,作者 Imken 的代码风格和英文拼写跟依托答辩一样。
本节不包括完成作业的相关内容。
login(username, password)
必须要先登录,才能进行接下来的操作,例如获取作业、完成作业。(废话
有两个方法。
get_unfinished_homework()
& get_expired_homework()
返回以下对象:
{
"homeworkList": [
{
"id": "<homework_id>",
"name": "几何中的动点问题",
"stageId": 2,
"subjectId": 1,
"publisherId": -1,
"semesterId": -1,
"judgmentMethod": "student",
"createdTime": "[Private]T[Private]Z",
"expiredTime": "[Private]T[Private]Z",
"leaveMessage": "",
"creator": "[Private]",
"specialCourseId": "[Private]",
"startTime": "[Private]T[Private]Z",
"source": "",
"state": -1,
"showWarnExpiredTime": true,
"roomStudentTotal": 48,
"finishedStudentTotal": 12,
"itemCount": 3,
"finishedItemCount": 0,
"accuracy": 0,
"type": 0,
"topics": [
{
"id": "<topic_id>",
"_id": "",
"name": "动点与面积问题",
"pay": true,
"isFreeTime": false,
"state": "unfinished",
"videoState": "unfinished",
"practiceState": "unfinished",
"topicOrder": 1
}
],
"subsections": []
}
]
}
一个基本的作业长这样:
Homework
|- Topic A
|- Video A (只有一个)
|- Practice Problem A-1
|- Practice Problem A-2
|- Practice Problem A-3
|- Topic B
|- ...
完成作业的基本流程是:
homework_id
,在获取未完成作业时获取到作业id)topic
。
topic_id
获取 topic
的相关信息(get_detail(topic_id)
),其中包含了视频的基本信息以及课后试题(含答案)。会保存视频时长。submit_problem(problem_id, homework_id, topic_id, answers)
)。正确性是服务端 + 客户端双重检验。作业完成流程:
get_practice_problems(homework_id)
)。submit_practice_problem(homework_id, problems, state)
)。TODO: 将代码里的task改为exam。
作业完成流程:
get_task_problem(homework_id)
)。commit_problem_progress(group_id, is_finished: bool, problems)
)。single_choice
/ 多选题 multi_choice
本质上一致。
答案位于选项内choices
。例如:
{
"choices": [[
{
"body": "$选A$",
"correct": true
},
{
"body": "$不选B$",
"correct": false
},
{
"body": "$选C$",
"correct": true
}
]] // 注意这是二维数组
}
multi_blank
| single_blank
{
"blanks": ["第一个空"]
}
hybrid
无论里面有没有选择,都可以直接提交blanks
。
{
"blanks": [
"第一个空",
"第二个空,但是单选",
"$\\sqrt{x}$"
]
}