|
@@ -52,7 +52,33 @@ export class PageLessonComponent {
|
|
|
this.courseList = this.courseList.concat(list)
|
|
|
infiScroll?.complete();
|
|
|
}
|
|
|
+ scrollToCardSection(category: string) {
|
|
|
+ const cardSection = document.getElementById(`card-section-${category}`);
|
|
|
+ if (cardSection) {
|
|
|
+ cardSection.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ groupedCourseList: any[] = [];
|
|
|
|
|
|
+ // 在获取课程数据后,将课程按照每4个为一组进行分组
|
|
|
+ // groupCoursesByCategory() {
|
|
|
+ // const coursesPerCategory = 4;
|
|
|
+ // const totalCourses = this.courseList.length;
|
|
|
+ // const totalCategories = Math.ceil(totalCourses / coursesPerCategory);
|
|
|
+
|
|
|
+ // for (let i = 0; i < totalCategories; i++) {
|
|
|
+ // const startIndex = i * coursesPerCategory;
|
|
|
+ // const endIndex = startIndex + coursesPerCategory;
|
|
|
+ // const categoryCourses = this.courseList.slice(startIndex, endIndex);
|
|
|
+ // this.groupedCourseList.push(categoryCourses);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // ngOnInit() {
|
|
|
+ // this.groupCoursesByCategory();
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
goLessonDetail(lesson: any) {
|
|
|
this.router.navigate(["/lesson/lesson/detail"], { queryParams: lesson })
|