Skip to content

Commit

Permalink
fix(script): 继续优化智慧树作业考试检测
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed May 12, 2023
1 parent b2a120f commit 2a337bb
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions packages/scripts/src/projects/zhs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,21 +464,10 @@ export const ZHSProject = Project.create({
const isWork = location.href.includes('dohomework');

if (isExam || isWork) {
const res = await Promise.race([
waitForQuestionsLoad(),
(async () => {
console.log('res');
await $.sleep(10 * 1000);
$message('warn', { content: '作业/试卷加载超时,请刷新重试。', duration: 0 });
return false;
})()
]);
if (res === false) {
$message('info', { content: `开始${isExam ? '考试' : '作业'}` });
commonWork(this, {
workerProvider: (opts) => gxkWorkAndExam(opts)
});
}
await waitForQuestionsLoad(), $message('info', { content: `开始${isExam ? '考试' : '作业'}` });
commonWork(this, {
workerProvider: (opts) => gxkWorkAndExam(opts)
});
} else {
$message('info', { content: '📢 请手动进入作业/考试,如果未开始答题,请尝试刷新页面。', duration: 0 });
CommonProject.scripts.render.methods.pin(this);
Expand Down

0 comments on commit 2a337bb

Please sign in to comment.