* @description 查询专项练习列表
()
| 3516 | * @description 查询专项练习列表 |
| 3517 | */ |
| 3518 | async function findExamPaper() { |
| 3519 | // 获取总页数 |
| 3520 | const total = await initExam(); |
| 3521 | // 当前页数 |
| 3522 | let current = 1; |
| 3523 | log(`正在寻找的专项练习...`); |
| 3524 | // 创建提示 |
| 3525 | createTip(`正在寻找的专项练习...`); |
| 3526 | while (current <= total && current) { |
| 3527 | // 请求数据 |
| 3528 | const data = await getExamPaper(current); |
| 3529 | if (data) { |
| 3530 | // 获取专项练习的列表 |
| 3531 | const examPapers = data.list; |
| 3532 | for (const i in examPapers) { |
| 3533 | // 遍历查询有没有没做过的 |
| 3534 | if (examPapers[i].status !== 2) { |
| 3535 | // status: 1 开始答题, 2 已满分/重新答题, 3 继续答题 |
| 3536 | return examPapers[i].id; |
| 3537 | } |
| 3538 | } |
| 3539 | // 增加页码 |
| 3540 | current += 1; |
| 3541 | // 等待 |
| 3542 | await sleep(3000); |
| 3543 | } |
| 3544 | else { |
| 3545 | break; |
| 3546 | } |
| 3547 | } |
| 3548 | } |
| 3549 | /** |
| 3550 | * @description 初始化主页面 |
| 3551 | */ |
no test coverage detected