|
@@ -496,6 +496,8 @@ export default {
|
|
|
sectionItem: {},
|
|
|
playCourseId: 0,
|
|
|
recommendList: {}, //推荐课程
|
|
|
+ needOpen: true, //是否需要一进来展开第一章节
|
|
|
+ menuIndex: [], //需要展开的章节索引值
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -592,6 +594,15 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
item.list = res.rows;
|
|
|
+
|
|
|
+ if (this.needOpen) {
|
|
|
+ if (item.list[this.menuIndex[1]].type == 1) {
|
|
|
+ this.openModule(item.list[this.menuIndex[1]]);
|
|
|
+ } else if (item.list[this.menuIndex[1]].type == 2) {
|
|
|
+ this.needOpen = false;
|
|
|
+ this.openChapter(item.list[this.menuIndex[1]]);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
@@ -1111,6 +1122,11 @@ export default {
|
|
|
item.menuType = 2;
|
|
|
}
|
|
|
Module.list = res.data;
|
|
|
+
|
|
|
+ if (this.needOpen) {
|
|
|
+ this.needOpen = false;
|
|
|
+ this.openChapter(Module.list[0]);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
@@ -1403,12 +1419,41 @@ export default {
|
|
|
* 获取课程章节列表
|
|
|
*/
|
|
|
goodsCourseList() {
|
|
|
- this.$request.goodsCourseList(this.goodsId).then((res) => {
|
|
|
+ this.$request.goodsCourseList(this.goodsId).then(async (res) => {
|
|
|
res.rows.forEach((item) => {
|
|
|
item.showList = false;
|
|
|
item.list = [];
|
|
|
});
|
|
|
this.courseList = res.rows;
|
|
|
+
|
|
|
+ if (this.needOpen) {
|
|
|
+ for (let i = 0; i < this.courseList.length; i++) {
|
|
|
+ let menuIndexOrFalse = await this.getCourseMenus(
|
|
|
+ this.courseList[i]
|
|
|
+ );
|
|
|
+
|
|
|
+ if (menuIndexOrFalse !== false) {
|
|
|
+ this.menuIndex = [i, menuIndexOrFalse];
|
|
|
+ this.openCourse(this.courseList[i]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ getCourseMenus(item) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ this.$request.menuList({ courseId: item.courseId }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ for (let i = 0; i < res.rows.length; i++) {
|
|
|
+ if (res.rows[i].type == 1 || res.rows[i].type == 2) {
|
|
|
+ resolve(i);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
collect() {
|