|
@@ -2,13 +2,13 @@
|
|
<div id="courseTree">
|
|
<div id="courseTree">
|
|
<el-empty description="暂无课程" v-if="courseList.length === 0"></el-empty>
|
|
<el-empty description="暂无课程" v-if="courseList.length === 0"></el-empty>
|
|
<ul v-else class="courseTree">
|
|
<ul v-else class="courseTree">
|
|
- <li
|
|
|
|
- v-for="(item1, index1) in courseDataList"
|
|
|
|
- :key="index1"
|
|
|
|
- class="level1"
|
|
|
|
- >
|
|
|
|
- <div class="menu_box" @click="openMenu(item1)">
|
|
|
|
- <div class="left">
|
|
|
|
|
|
+ <li v-for="(item1, index1) in courseDataList" :key="index1">
|
|
|
|
+ <div
|
|
|
|
+ class="menu_box"
|
|
|
|
+ @click="openMenu(item1)"
|
|
|
|
+ :class="isActive(item1) ? 'active' : ''"
|
|
|
|
+ >
|
|
|
|
+ <div class="left level1">
|
|
<el-tag
|
|
<el-tag
|
|
size="mini"
|
|
size="mini"
|
|
effect="dark"
|
|
effect="dark"
|
|
@@ -24,6 +24,12 @@
|
|
</div>
|
|
</div>
|
|
<div class="right">
|
|
<div class="right">
|
|
<template v-if="item1.type == 3">
|
|
<template v-if="item1.type == 3">
|
|
|
|
+ <img
|
|
|
|
+ v-if="isActive(item1)"
|
|
|
|
+ src="@/assets/learing.gif"
|
|
|
|
+ alt=""
|
|
|
|
+ class="activeImg_style"
|
|
|
|
+ />
|
|
<div class="during">
|
|
<div class="during">
|
|
{{ $tools.secondToDate(item1.durationTime) }}
|
|
{{ $tools.secondToDate(item1.durationTime) }}
|
|
</div>
|
|
</div>
|
|
@@ -40,13 +46,13 @@
|
|
<ul
|
|
<ul
|
|
v-if="item1.children && item1.children.length > 0 && item1.showStatus"
|
|
v-if="item1.children && item1.children.length > 0 && item1.showStatus"
|
|
>
|
|
>
|
|
- <li
|
|
|
|
- v-for="(item2, index2) in item1.children"
|
|
|
|
- :key="index2"
|
|
|
|
- class="level2"
|
|
|
|
- >
|
|
|
|
- <div class="menu_box" @click="openMenu(item2)">
|
|
|
|
- <div class="left">
|
|
|
|
|
|
+ <li v-for="(item2, index2) in item1.children" :key="index2">
|
|
|
|
+ <div
|
|
|
|
+ class="menu_box"
|
|
|
|
+ @click="openMenu(item2)"
|
|
|
|
+ :class="isActive(item2) ? 'active' : ''"
|
|
|
|
+ >
|
|
|
|
+ <div class="left level2">
|
|
<el-tag
|
|
<el-tag
|
|
size="mini"
|
|
size="mini"
|
|
effect="dark"
|
|
effect="dark"
|
|
@@ -75,13 +81,13 @@
|
|
item2.children && item2.children.length > 0 && item2.showStatus
|
|
item2.children && item2.children.length > 0 && item2.showStatus
|
|
"
|
|
"
|
|
>
|
|
>
|
|
- <li
|
|
|
|
- v-for="(item3, index3) in item2.children"
|
|
|
|
- :key="index3"
|
|
|
|
- class="level3"
|
|
|
|
- >
|
|
|
|
- <div class="menu_box" @click="openMenu(item3)">
|
|
|
|
- <div class="left">
|
|
|
|
|
|
+ <li v-for="(item3, index3) in item2.children" :key="index3">
|
|
|
|
+ <div
|
|
|
|
+ class="menu_box"
|
|
|
|
+ @click="openMenu(item3)"
|
|
|
|
+ :class="isActive(item3) ? 'active' : ''"
|
|
|
|
+ >
|
|
|
|
+ <div class="left level3">
|
|
<el-tag
|
|
<el-tag
|
|
size="mini"
|
|
size="mini"
|
|
effect="dark"
|
|
effect="dark"
|
|
@@ -121,7 +127,8 @@ export default {
|
|
return {
|
|
return {
|
|
courseList: [], //商品的课程列表
|
|
courseList: [], //商品的课程列表
|
|
courseDataList: [], //课程内容
|
|
courseDataList: [], //课程内容
|
|
- allSectionList: [] //商品下所有节和试卷
|
|
|
|
|
|
+ allSectionList: [], //商品下所有节和试卷
|
|
|
|
+ activeSection: {} //当前节数据
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -164,6 +171,16 @@ export default {
|
|
}
|
|
}
|
|
return str;
|
|
return str;
|
|
};
|
|
};
|
|
|
|
+ },
|
|
|
|
+ isActive: function() {
|
|
|
|
+ return function(item) {
|
|
|
|
+ return (
|
|
|
|
+ item.courseId == this.activeSection.courseId &&
|
|
|
|
+ item.moduleId == this.activeSection.moduleId &&
|
|
|
|
+ item.chapterId == this.activeSection.chapterId &&
|
|
|
|
+ item.sectionId == this.activeSection.sectionId
|
|
|
|
+ );
|
|
|
|
+ };
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -175,6 +192,7 @@ export default {
|
|
await this.getCourseData(this.courseList[0].courseId); //获取课程内容
|
|
await this.getCourseData(this.courseList[0].courseId); //获取课程内容
|
|
await this.getAllSectionList(); //获取所有节列表
|
|
await this.getAllSectionList(); //获取所有节列表
|
|
/**播放逻辑 */
|
|
/**播放逻辑 */
|
|
|
|
+ this.playBackLogic();
|
|
},
|
|
},
|
|
//获取商品课程列表
|
|
//获取商品课程列表
|
|
getGoodsCourseList() {
|
|
getGoodsCourseList() {
|
|
@@ -242,99 +260,107 @@ export default {
|
|
if (item.children && item.children.length > 0) {
|
|
if (item.children && item.children.length > 0) {
|
|
item.showStatus = !item.showStatus;
|
|
item.showStatus = !item.showStatus;
|
|
} else {
|
|
} else {
|
|
- this.$request
|
|
|
|
- .reChapterList({
|
|
|
|
- moduleId: item.moduleId,
|
|
|
|
- gradeId: this.goodsData.gradeId,
|
|
|
|
- courseId: this.courseDataList[0].courseId
|
|
|
|
- // rebuild: isRebuild ? 1 : undefined
|
|
|
|
- })
|
|
|
|
- .then(res => {
|
|
|
|
- this.$set(item, "showStatus", true);
|
|
|
|
- this.$set(
|
|
|
|
- item,
|
|
|
|
- "children",
|
|
|
|
- res.data.map(i => {
|
|
|
|
- if (i.id) {
|
|
|
|
- return {
|
|
|
|
- level: item.level + 1,
|
|
|
|
- type: 2,
|
|
|
|
- name: i.name,
|
|
|
|
- courseId: i.courseId,
|
|
|
|
- moduleId: i.moduleId,
|
|
|
|
- chapterId: i.chapterId,
|
|
|
|
- sectionId: 0,
|
|
|
|
- sectionType: null,
|
|
|
|
- durationTime: null,
|
|
|
|
- recordingUrl: null,
|
|
|
|
- showStatus: false, //展开状态
|
|
|
|
- children: null, //子列表
|
|
|
|
- examList: [] //关联试卷
|
|
|
|
- };
|
|
|
|
- } else {
|
|
|
|
- return Object.assign(i, {
|
|
|
|
- type: -1,
|
|
|
|
- chapterId: 0,
|
|
|
|
- examType: 3
|
|
|
|
- }); //examType:1章卷,2节卷,3模块卷
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
- });
|
|
|
|
|
|
+ return new Promise(resolve => {
|
|
|
|
+ this.$request
|
|
|
|
+ .reChapterList({
|
|
|
|
+ moduleId: item.moduleId,
|
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
|
+ courseId: this.courseDataList[0].courseId,
|
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId
|
|
|
|
+ // rebuild: isRebuild ? 1 : undefined
|
|
|
|
+ })
|
|
|
|
+ .then(res => {
|
|
|
|
+ this.$set(item, "showStatus", true);
|
|
|
|
+ this.$set(
|
|
|
|
+ item,
|
|
|
|
+ "children",
|
|
|
|
+ res.data.map(i => {
|
|
|
|
+ if (i.id) {
|
|
|
|
+ return {
|
|
|
|
+ level: item.level + 1,
|
|
|
|
+ type: 2,
|
|
|
|
+ name: i.name,
|
|
|
|
+ courseId: i.courseId,
|
|
|
|
+ moduleId: i.moduleId,
|
|
|
|
+ chapterId: i.chapterId,
|
|
|
|
+ sectionId: 0,
|
|
|
|
+ sectionType: null,
|
|
|
|
+ durationTime: null,
|
|
|
|
+ recordingUrl: null,
|
|
|
|
+ showStatus: false, //展开状态
|
|
|
|
+ children: null, //子列表
|
|
|
|
+ examList: [] //关联试卷
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ return Object.assign(i, {
|
|
|
|
+ type: -1,
|
|
|
|
+ chapterId: 0,
|
|
|
|
+ examType: 3
|
|
|
|
+ }); //examType:1章卷,2节卷,3模块卷
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+ resolve(item.children);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
//展开章
|
|
//展开章
|
|
- async openChapter(item) {
|
|
|
|
|
|
+ openChapter(item) {
|
|
if (item.children && item.children.length > 0) {
|
|
if (item.children && item.children.length > 0) {
|
|
item.showStatus = !item.showStatus;
|
|
item.showStatus = !item.showStatus;
|
|
} else {
|
|
} else {
|
|
- const examRes = await this.$request.reSectionExamList({
|
|
|
|
- moduleId: item.moduleId,
|
|
|
|
- chapterId: item.chapterId,
|
|
|
|
- courseId: item.courseId,
|
|
|
|
- gradeId: this.goodsData.gradeId,
|
|
|
|
- orderGoodsId: this.goodsData.orderGoodsId
|
|
|
|
- }); //获取节关联练习试卷
|
|
|
|
- this.$request
|
|
|
|
- .reSectionList({
|
|
|
|
|
|
+ return new Promise(async resolve => {
|
|
|
|
+ const examRes = await this.$request.reSectionExamList({
|
|
|
|
+ moduleId: item.moduleId,
|
|
chapterId: item.chapterId,
|
|
chapterId: item.chapterId,
|
|
- gradeId: this.goodsData.gradeId,
|
|
|
|
courseId: item.courseId,
|
|
courseId: item.courseId,
|
|
- // rebuild: isRebuild ? 1 : undefined,
|
|
|
|
- moduleId: item.moduleId
|
|
|
|
- })
|
|
|
|
- .then(res => {
|
|
|
|
- this.$set(item, "showStatus", true);
|
|
|
|
- this.$set(
|
|
|
|
- item,
|
|
|
|
- "children",
|
|
|
|
- res.data.map(i => {
|
|
|
|
- console.log(i);
|
|
|
|
- if (i.id) {
|
|
|
|
- return {
|
|
|
|
- level: item.level + 1,
|
|
|
|
- type: 3,
|
|
|
|
- name: i.name,
|
|
|
|
- courseId: item.courseId,
|
|
|
|
- moduleId: i.moduleId,
|
|
|
|
- chapterId: i.chapterId,
|
|
|
|
- sectionId: i.sectionId,
|
|
|
|
- sectionType: i.sectionType,
|
|
|
|
- durationTime: i.durationTime,
|
|
|
|
- recordingUrl: i.recordingUrl,
|
|
|
|
- showStatus: false, //展开状态
|
|
|
|
- children: null, //子列表
|
|
|
|
- examList:
|
|
|
|
- examRes.data.filter(
|
|
|
|
- item => item.sectionId == i.sectionId
|
|
|
|
- ) || [] //关联试卷
|
|
|
|
- };
|
|
|
|
- } else {
|
|
|
|
- return Object.assign(i, { type: -1, examType: 1 }); //examType:1章卷,2节卷,3模块卷
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
- });
|
|
|
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId
|
|
|
|
+ }); //获取节关联练习试卷
|
|
|
|
+ this.$request
|
|
|
|
+ .reSectionList({
|
|
|
|
+ chapterId: item.chapterId,
|
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
|
+ courseId: item.courseId,
|
|
|
|
+ // rebuild: isRebuild ? 1 : undefined,
|
|
|
|
+ moduleId: item.moduleId,
|
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId
|
|
|
|
+ })
|
|
|
|
+ .then(res => {
|
|
|
|
+ this.$set(item, "showStatus", true);
|
|
|
|
+ this.$set(
|
|
|
|
+ item,
|
|
|
|
+ "children",
|
|
|
|
+ res.data.map(i => {
|
|
|
|
+ console.log(i);
|
|
|
|
+ if (i.id) {
|
|
|
|
+ return {
|
|
|
|
+ level: item.level + 1,
|
|
|
|
+ type: 3,
|
|
|
|
+ name: i.name,
|
|
|
|
+ courseId: item.courseId,
|
|
|
|
+ moduleId: i.moduleId,
|
|
|
|
+ chapterId: i.chapterId,
|
|
|
|
+ sectionId: i.sectionId,
|
|
|
|
+ sectionType: i.sectionType,
|
|
|
|
+ durationTime: i.durationTime,
|
|
|
|
+ recordingUrl: i.recordingUrl,
|
|
|
|
+ showStatus: false, //展开状态
|
|
|
|
+ children: null, //子列表
|
|
|
|
+ examList:
|
|
|
|
+ examRes.data.filter(
|
|
|
|
+ item => item.sectionId == i.sectionId
|
|
|
|
+ ) || [] //关联试卷
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ return Object.assign(i, { type: -1, examType: 1 }); //examType:1章卷,2节卷,3模块卷
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+ resolve();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
//获取所有节列表
|
|
//获取所有节列表
|
|
@@ -377,11 +403,11 @@ export default {
|
|
//点击菜单
|
|
//点击菜单
|
|
async openMenu(item) {
|
|
async openMenu(item) {
|
|
if (item.type == 1) {
|
|
if (item.type == 1) {
|
|
- this.openModule(item);
|
|
|
|
|
|
+ await this.openModule(item); //展开模块
|
|
} else if (item.type == 2) {
|
|
} else if (item.type == 2) {
|
|
- this.openChapter(item);
|
|
|
|
|
|
+ await this.openChapter(item); //展开章
|
|
} else {
|
|
} else {
|
|
- // await this.waitCheckStatus(item); //检查是否可以继续执行
|
|
|
|
|
|
+ await this.waitCheckStatus(item); //检查是否可以继续执行
|
|
if (item.type == 3) {
|
|
if (item.type == 3) {
|
|
if (item.sectionType == 1) {
|
|
if (item.sectionType == 1) {
|
|
this.watchSection(item);
|
|
this.watchSection(item);
|
|
@@ -432,9 +458,9 @@ export default {
|
|
},
|
|
},
|
|
//播放视频节
|
|
//播放视频节
|
|
watchSection(item) {
|
|
watchSection(item) {
|
|
|
|
+ if (this.isActive(item)) return;
|
|
this.$bus.$emit("toPlay", item);
|
|
this.$bus.$emit("toPlay", item);
|
|
- // if (this.isActive(item)) return;
|
|
|
|
- // this.toPlay(item);
|
|
|
|
|
|
+ this.activeSection = item;
|
|
},
|
|
},
|
|
toPlay(item) {},
|
|
toPlay(item) {},
|
|
//回放或直播
|
|
//回放或直播
|
|
@@ -610,12 +636,72 @@ export default {
|
|
resolve(res.data);
|
|
resolve(res.data);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+ },
|
|
|
|
+ //播放逻辑
|
|
|
|
+ async playBackLogic() {
|
|
|
|
+ const { courseId, moduleId, chapterId, sectionId } = this.$route.query;
|
|
|
|
+ if (courseId >= 0 && moduleId >= 0 && chapterId >= 0 && sectionId >= 0) {
|
|
|
|
+ let data = this.allSectionList.find(
|
|
|
|
+ e =>
|
|
|
|
+ e.courseId == courseId &&
|
|
|
|
+ e.moduleId == moduleId &&
|
|
|
|
+ e.chapterId == chapterId &&
|
|
|
|
+ e.sectionId == sectionId
|
|
|
|
+ );
|
|
|
|
+ this.openMenu(data);
|
|
|
|
+ this.unfoldFunc(data); //展开定位列表
|
|
|
|
+ } else {
|
|
|
|
+ this.$request
|
|
|
|
+ .studyRecordQueryLiveLast({
|
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
|
+ courseId: this.courseList[0].courseId
|
|
|
|
+ })
|
|
|
|
+ .then(res => {
|
|
|
|
+ let data = res.data;
|
|
|
|
+ if (!data.sectionId) {
|
|
|
|
+ data = this.allSectionList[0];
|
|
|
|
+ }
|
|
|
|
+ if (
|
|
|
|
+ data.learning == 1 &&
|
|
|
|
+ this.businessData.goodsLearningOrder == 2
|
|
|
|
+ ) {
|
|
|
|
+ let next = this.allSectionList.find(e => e.studyStatus != 1);
|
|
|
|
+ next && (data = next);
|
|
|
|
+ }
|
|
|
|
+ this.openMenu(data);
|
|
|
|
+ this.unfoldFunc(data); //展开定位列表
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //展开定位列表
|
|
|
|
+ async unfoldFunc(item) {
|
|
|
|
+ if (item.moduleId) {
|
|
|
|
+ var ary = this.courseDataList.find(i => i.moduleId == item.moduleId);
|
|
|
|
+ let moduleChildren = await this.openModule(ary);
|
|
|
|
+ if (item.chapterId) {
|
|
|
|
+ await this.openChapter(
|
|
|
|
+ moduleChildren.find(i => i.chapterId == item.chapterId)
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!item.moduleId && item.chapterId) {
|
|
|
|
+ var ary = this.courseDataList.find(i => i.chapterId == item.chapterId);
|
|
|
|
+ await this.openChapter(ary);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
+.active {
|
|
|
|
+ background-color: rgb(107, 107, 107) !important;
|
|
|
|
+}
|
|
|
|
+.activeImg_style {
|
|
|
|
+ width: 20px;
|
|
|
|
+ height: 30px;
|
|
|
|
+}
|
|
.courseTree {
|
|
.courseTree {
|
|
height: 416px;
|
|
height: 416px;
|
|
overflow: auto;
|
|
overflow: auto;
|
|
@@ -646,10 +732,10 @@ export default {
|
|
padding-left: 0px;
|
|
padding-left: 0px;
|
|
}
|
|
}
|
|
.level2 {
|
|
.level2 {
|
|
- padding-left: 14px;
|
|
|
|
|
|
+ padding-left: 10px;
|
|
}
|
|
}
|
|
.level3 {
|
|
.level3 {
|
|
- padding-left: 24px;
|
|
|
|
|
|
+ padding-left: 20px;
|
|
}
|
|
}
|
|
.menu_box {
|
|
.menu_box {
|
|
margin-top: 4px;
|
|
margin-top: 4px;
|
|
@@ -664,8 +750,8 @@ export default {
|
|
background-color: rgb(81, 81, 81);
|
|
background-color: rgb(81, 81, 81);
|
|
}
|
|
}
|
|
& > .left {
|
|
& > .left {
|
|
- width: 40px;
|
|
|
|
flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
|
|
+ padding-right: 10px;
|
|
}
|
|
}
|
|
& > .center {
|
|
& > .center {
|
|
flex: 1;
|
|
flex: 1;
|
|
@@ -681,7 +767,7 @@ export default {
|
|
}
|
|
}
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
- width: 80px;
|
|
|
|
|
|
+ // width: 80px;
|
|
flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
}
|
|
}
|
|
}
|
|
}
|