Browse Source

看完视频后请求课程所有子目录结构列表接口

xuqiaoying 2 years ago
parent
commit
c40a9a6e77

+ 16 - 3
components/course/courseChapter.vue

@@ -26,6 +26,7 @@
             :levelId="levelId + '-' + itemM.sectionId"
             :levelId="levelId + '-' + itemM.sectionId"
             :testType="2"
             :testType="2"
             :ChapterSectionExam='sectionExam'
             :ChapterSectionExam='sectionExam'
+            :menuAllList="menuAllList"
             @togoBack='togoBack()'
             @togoBack='togoBack()'
           ></courseSection>
           ></courseSection>
           <u-line v-if="indexM < list.length - 1"></u-line>
           <u-line v-if="indexM < list.length - 1"></u-line>
@@ -133,6 +134,10 @@ export default {
       type: [Number, String],
       type: [Number, String],
       default: 0,
       default: 0,
     }, 
     }, 
+    menuAllList: { // 课程所有子目录结构列表
+			type: Array,
+			default: () => []
+		}
   },
   },
   components: {
   components: {
     courseSection,
     courseSection,
@@ -144,10 +149,13 @@ export default {
       examList: {},
       examList: {},
       canLearn: false, //是否全部视频看完才可以练习、测试
       canLearn: false, //是否全部视频看完才可以练习、测试
       sectionExam: [],
       sectionExam: [],
+      newMenuAllList: [],
     };
     };
   },
   },
   onLoad() {},
   onLoad() {},
-  created() {},
+  created() {
+    this.newMenuAllList = this.menuAllList
+  },
   mounted() {
   mounted() {
     if (this.needOpen && this.chapterOpen) {
     if (this.needOpen && this.chapterOpen) {
       this.updateChapterOpen(false);
       this.updateChapterOpen(false);
@@ -179,7 +187,8 @@ export default {
           });
           });
       });
       });
     },
     },
-    refreshList(isRebuild) {
+    async refreshList(isRebuild) {
+      // console.log('节的播放结束');
       let moduleId = this.menuItem.moduleId ? this.menuItem.moduleId : 0;
       let moduleId = this.menuItem.moduleId ? this.menuItem.moduleId : 0;
       if (this.isRebuild) {
       if (this.isRebuild) {
         this.getReSectionList(
         this.getReSectionList(
@@ -188,6 +197,7 @@ export default {
           moduleId
           moduleId
         );
         );
       } else {
       } else {
+        // console.log('重新请求');
         this.getBuySectionList(
         this.getBuySectionList(
           this.menuItem.id,
           this.menuItem.id,
           this.menuItem.courseId,
           this.menuItem.courseId,
@@ -197,6 +207,7 @@ export default {
       }
       }
 
 
       this.$emit("playEnd", { isRebuild: isRebuild.isRebuild });
       this.$emit("playEnd", { isRebuild: isRebuild.isRebuild });
+      this.newMenuAllList = await this.studyRecordMenuAllList()
     },
     },
     findNextSection(index) {
     findNextSection(index) {
       for (let i = index + 1; i < this.list.length; i++) {
       for (let i = index + 1; i < this.list.length; i++) {
@@ -340,7 +351,8 @@ export default {
       } else if (this.learningOrder == 2 && !item.rebuild) {
       } else if (this.learningOrder == 2 && !item.rebuild) {
         let canLearn = this.list[index - 1].learning == 1;
         let canLearn = this.list[index - 1].learning == 1;
         // /study/record/menuAllList - 查询课程所有子目录结构列表
         // /study/record/menuAllList - 查询课程所有子目录结构列表
-        let rows = await this.studyRecordMenuAllList();
+        // let rows = await this.studyRecordMenuAllList();
+        let rows = this.newMenuAllList
         let isStop = false;
         let isStop = false;
         let newRows = [];
         let newRows = [];
         for (let i = 0; i < rows.length; i++) {
         for (let i = 0; i < rows.length; i++) {
@@ -647,6 +659,7 @@ export default {
               }
               }
             });
             });
             self.list = res.data.data;
             self.list = res.data.data;
+            console.log('=========', this.list);
           }
           }
         });
         });
     },
     },

+ 5 - 1
components/course/courseModule.vue

@@ -14,7 +14,7 @@
 				<courseChapter v-if='itemM.type != 2'  :orderGoodsId="orderGoodsId"
 				<courseChapter v-if='itemM.type != 2'  :orderGoodsId="orderGoodsId"
 						:isLive="isLive" :preItem="list[indexM - 1] || preItem" :sectionMaxNum="sectionMaxNum" :needOpen="needOpen" @playEnd="playEnd($event)" 
 						:isLive="isLive" :preItem="list[indexM - 1] || preItem" :sectionMaxNum="sectionMaxNum" :needOpen="needOpen" @playEnd="playEnd($event)" 
 						@toDo="toDo($event)" :courseId="courseId" :learningOrder="learningOrder" :goodsId="goodsId" :isBuy="isBuy" :gradeId="gradeId" 
 						@toDo="toDo($event)" :courseId="courseId" :learningOrder="learningOrder" :goodsId="goodsId" :isBuy="isBuy" :gradeId="gradeId" 
-						:isRebuild="isRebuild"  :menuItem="itemM" :levelId="levelId+'-'+itemM.chapterId">
+						:isRebuild="isRebuild"  :menuItem="itemM" :levelId="levelId+'-'+itemM.chapterId" :menuAllList="menuAllList">
 				</courseChapter>
 				</courseChapter>
 				<u-line v-if="indexM<list.length-1"></u-line>
 				<u-line v-if="indexM<list.length-1"></u-line>
 				<!-- 模块卷 -->
 				<!-- 模块卷 -->
@@ -118,6 +118,10 @@ export default {
 			type: [Number, String],
 			type: [Number, String],
 			default: 0,
 			default: 0,
 		}, 
 		}, 
+		menuAllList: { // 课程所有子目录结构列表
+			type: Array,
+			default: () => []
+		}
 	},
 	},
 	components: {
 	components: {
 		courseChapter
 		courseChapter

+ 16 - 7
components/course/courseSection.vue

@@ -136,6 +136,10 @@ export default {
 		testType: {
 		testType: {
 			type: Number,
 			type: Number,
 			default: 0,
 			default: 0,
+		},
+		menuAllList: { // 课程所有子目录结构列表
+			type: Array,
+			default: () => []
 		}
 		}
 	},
 	},
 	watch:{
 	watch:{
@@ -152,11 +156,13 @@ export default {
 			moduleSectionExam: [], // 模块下的所有节试卷列表
 			moduleSectionExam: [], // 模块下的所有节试卷列表
 			chapterExams: {},
 			chapterExams: {},
 			moduleExams: {},
 			moduleExams: {},
+			newMenuAllList: [],
 		};
 		};
 	},
 	},
 	onLoad() {
 	onLoad() {
 	},
 	},
 	created() {
 	created() {
+		this.newMenuAllList = this.menuAllList
 		if (this.testType == 3) {
 		if (this.testType == 3) {
 			// 模块下的所有节试卷列表
 			// 模块下的所有节试卷列表
 			this.$api.reSectionExamList({
 			this.$api.reSectionExamList({
@@ -170,8 +176,8 @@ export default {
 			})
 			})
 		}
 		}
 	},
 	},
-	mounted() {
-		console.log('节的播放---');
+    mounted() {
+		// console.log('节的播放---', this.menuAllList)
 		this.nowTime = Number(new  Date().getTime()/1000).toFixed(0)
 		this.nowTime = Number(new  Date().getTime()/1000).toFixed(0)
 		this.newId= this.menuItem.sectionId>0?this.menuItem.sectionId:this.menuItem.menuId
 		this.newId= this.menuItem.sectionId>0?this.menuItem.sectionId:this.menuItem.menuId
 		let moduleId = this.menuItem.moduleId || 0;
 		let moduleId = this.menuItem.moduleId || 0;
@@ -180,10 +186,10 @@ export default {
 		let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}${this.isRebuild?'isRebuild':''}`;
 		let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}${this.isRebuild?'isRebuild':''}`;
 		this.playId = playNextId;
 		this.playId = playNextId;
 		uni.$off('playNext'+playNextId) //绑定前先移除之前的事件
 		uni.$off('playNext'+playNextId) //绑定前先移除之前的事件
-		uni.$once('playNext'+playNextId, (data) => {
+		uni.$once('playNext'+playNextId, async (data) => {
 			//到时会触发每个节的监听事件,只允许当前节的接收
 			//到时会触发每个节的监听事件,只允许当前节的接收
 			let self = this
 			let self = this
-			
+			console.log('playNext====');
 			if(this.nextMenuItem.recordingUrl&&this.isRebuild&&(this.newId==this.playSectionId) && data.fromRebuild){  // fromRebuild 来自重修目录的点击才弹出播放下一节
 			if(this.nextMenuItem.recordingUrl&&this.isRebuild&&(this.newId==this.playSectionId) && data.fromRebuild){  // fromRebuild 来自重修目录的点击才弹出播放下一节
 				//重修存在下一节
 				//重修存在下一节
 				uni.showModal({
 				uni.showModal({
@@ -213,7 +219,9 @@ export default {
 				    }
 				    }
 				});
 				});
 			} else {
 			} else {
+				console.log('playEnd----');
 				this.$emit('playEnd',{isRebuild:this.isRebuild})
 				this.$emit('playEnd',{isRebuild:this.isRebuild})
+				this.newMenuAllList = await this.studyRecordMenuAllList()
 			}
 			}
 		});
 		});
 	},
 	},
@@ -298,8 +306,8 @@ export default {
 				})
 				})
 			})
 			})
 		},
 		},
-		async getVideo(){
-			console.log('点击节', this.preItem, this.menuItem);
+		getVideo(){
+			console.log('点击节', this.newMenuAllList);
 			if(this.clickLock) {
 			if(this.clickLock) {
 				return;
 				return;
 			}
 			}
@@ -308,7 +316,8 @@ export default {
 			
 			
 			if(this.learningOrder == 2 && !this.menuItem.isRebuild && !this.isLive) { //要按从头到尾顺序学习, 且不是重修课程
 			if(this.learningOrder == 2 && !this.menuItem.isRebuild && !this.isLive) { //要按从头到尾顺序学习, 且不是重修课程
 				if(this.preItem) {
 				if(this.preItem) {
-					let rows = await this.studyRecordMenuAllList();
+					// let rows = await this.studyRecordMenuAllList();
+					let rows = this.newMenuAllList
 					let newRows = [];
 					let newRows = [];
 					for(let i = 0; i < rows.length; i++ ) {
 					for(let i = 0; i < rows.length; i++ ) {
 						let moduleTrue = rows[i].moduleId == this.menuItem.moduleId || rows[i].moduleId == 0
 						let moduleTrue = rows[i].moduleId == this.menuItem.moduleId || rows[i].moduleId == 0

+ 1 - 0
pages3/live/detail.vue

@@ -762,6 +762,7 @@ export default {
     ...mapGetters(["userInfo", "playSectionId", "playChannelId", "playVID"]),
     ...mapGetters(["userInfo", "playSectionId", "playChannelId", "playVID"]),
   },
   },
   onLoad(option) {
   onLoad(option) {
+    console.log('--option--', option);
     this.options = option
     this.options = option
     this.courseId = option.courseId || ''
     this.courseId = option.courseId || ''
     this.goodsId = Number(option.goodsId);
     this.goodsId = Number(option.goodsId);

+ 7 - 0
pages3/polyv/detail.vue

@@ -150,6 +150,7 @@
                 :menuItem="item"
                 :menuItem="item"
                 :levelId="item.menuId"
                 :levelId="item.menuId"
                 :goodsType='1'
                 :goodsType='1'
+                :menuAllList="menuAllList"
               ></courseModule
               ></courseModule
             ></view>
             ></view>
             <!--章 -->
             <!--章 -->
@@ -169,6 +170,7 @@
                 :menuItem="item"
                 :menuItem="item"
                 :levelId="'0-' + item.menuId"
                 :levelId="'0-' + item.menuId"
                 :goodsType='1'
                 :goodsType='1'
+                :menuAllList="menuAllList"
               ></courseChapter
               ></courseChapter
             ></view>
             ></view>
             <!--节 -->
             <!--节 -->
@@ -189,6 +191,7 @@
                 :levelId="'0-0-' + item.menuId"
                 :levelId="'0-0-' + item.menuId"
                 :goodsType='1'
                 :goodsType='1'
                 :testType="3"
                 :testType="3"
+                :menuAllList="menuAllList"
                 @togoBack="togoBack($event)"
                 @togoBack="togoBack($event)"
               ></courseSection
               ></courseSection
             ></view>
             ></view>
@@ -748,6 +751,7 @@ export default {
       prendreAutoCarme: false, // 是否发起授权相机
       prendreAutoCarme: false, // 是否发起授权相机
       studyTimer: null, // 学习记录定时器
       studyTimer: null, // 学习记录定时器
       CountTo: 30, // 倒计时
       CountTo: 30, // 倒计时
+      menuAllList: [],
     };
     };
   },
   },
   computed: {
   computed: {
@@ -772,6 +776,7 @@ export default {
     }
     }
   },
   },
   onLoad(option) {
   onLoad(option) {
+    console.log('--option--', option);
     this.courseId = Number(option.id) || '';
     this.courseId = Number(option.id) || '';
     this.goodsId = Number(option.goodsId);
     this.goodsId = Number(option.goodsId);
     this.orderGoodsId = Number(option.orderGoodsId) || '';
     this.orderGoodsId = Number(option.orderGoodsId) || '';
@@ -1586,6 +1591,7 @@ export default {
 				let nowTime = Number(new  Date().getTime()/1000).toFixed(0)
 				let nowTime = Number(new  Date().getTime()/1000).toFixed(0)
 				// this.livingItem = res.data.data[0]
 				// this.livingItem = res.data.data[0]
         if (res.data.data) {
         if (res.data.data) {
+          this.menuAllList = res.data.data
 				this.livingItem = res.data.data.find(item => item.liveStartTime<=nowTime&&item.liveEndTime>nowTime);
 				this.livingItem = res.data.data.find(item => item.liveStartTime<=nowTime&&item.liveEndTime>nowTime);
           let isShowNotice = res.data.data.every(e => e.studyStatus == -1)
           let isShowNotice = res.data.data.every(e => e.studyStatus == -1)
           if (isShowNotice) { // studyStatus 全部等于-1的时候就是没有看过
           if (isShowNotice) { // studyStatus 全部等于-1的时候就是没有看过
@@ -2412,6 +2418,7 @@ export default {
               fromRebuild: this.isRebuild,
               fromRebuild: this.isRebuild,
             }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
             }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
             uni.$emit("playNext" + playNextId); //通知播放结束
             uni.$emit("playNext" + playNextId); //通知播放结束
+            console.log("playNext" + playNextIdisRebuild, '-----l', "playNext" + playNextId);
           }
           }
 
 
           self.ossAvatarUrl = "";
           self.ossAvatarUrl = "";