MCPcopy
hub / github.com/ocsjs/ocsjs / WishdomH5

Class WishdomH5

packages/scripts/src/projects/zhs.ts:412–522  ·  view source on GitHub ↗

* 2025-9月份新智慧学习页面,为智慧课程分类中的新课程

Source from the content-addressed store, hash-verified

410 * 2025-9月份新智慧学习页面,为智慧课程分类中的新课程
411 */
412class WishdomH5 extends StudyVideoH5 implements ZHSProcessor {
413 getCourseName() {
414 return $el('.course-name')?.textContent?.match(/课程名称:(.+)/)?.[1] || '无名称';
415 }
416
417 getChapterName(item: HTMLElement): string {
418 return item.textContent || '未知章节';
419 }
420
421 hasJob() {
422 return $$el('.chapter-content .chapter-content-second')?.length > 0;
423 }
424
425 getNext(opts: { next: boolean; restudy: boolean }) {
426 let jobs = Array.from(document.querySelectorAll<HTMLElement>('.chapter-content .chapter-item'));
427
428 jobs = jobs
429 .map((el) => {
430 const children = el.querySelectorAll<HTMLElement>('.chapter-content-second');
431 if (children.length > 0) {
432 return Array.from(children);
433 } else {
434 return [el];
435 }
436 })
437 .flat();
438
439 console.log(jobs);
440 // 如果不是复习模式,则排除掉已经完成的任务
441 if (!opts.restudy) {
442 jobs = jobs.filter((el) => {
443 if (el.querySelector('.finish-icon')) {
444 return false;
445 }
446 return true;
447 });
448 }
449
450 for (let i = 0; i < jobs.length; i++) {
451 const item = jobs[i];
452 if (item.classList.contains('current')) {
453 return jobs[i + (opts.next ? 1 : 0)];
454 }
455 }
456 return jobs[0];
457 }
458
459 hideDialog() {
460 /** 隐藏通知弹窗 */
461 $$el('.el-overlay,.el-dialog').forEach((dialog) => {
462 dialog.style.display = 'none';
463 });
464 }
465
466 async handleTestDialog(remotePage?: RemotePage) {
467 const question_box = $el('.ai-class-exercise-dialog');
468 if (question_box) {
469 const options = $$el('.ques-list .item .option');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected