Ver Fonte

播放下一节

xuqiaoying há 2 anos atrás
pai
commit
2873426371

+ 2 - 2
common/request.js

@@ -7,10 +7,10 @@ var num = 1
 //接口api   
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-// export const BASE_URL = 'http://120.79.166.78:19012' // 测试环境
+export const BASE_URL = 'http://120.79.166.78:19012' // 测试环境
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test(后端本地)
 // export const BASE_URL = 'http://192.168.1.222:5055'    //后端本地更新到222
-export const BASE_URL = 'http://192.168.1.24:5055'    //后端本地
+// export const BASE_URL = 'http://192.168.1.24:5055'    //后端本地
 // export const BASE_URL = 'http://192.168.1.7:5055'    //后端本地
 
  //图片上传api

+ 14 - 7
components/course/courseChapter.vue

@@ -153,12 +153,10 @@ export default {
       examList: {},
       canLearn: false, //是否全部视频看完才可以练习、测试
       sectionExam: [],
-      // newMenuAllList: [],
     };
   },
   onLoad() {},
   created() {
-    // this.newMenuAllList = this.menuAllList
   },
   mounted() {
     console.log('needOpen:', this.needOpen, this.chapterOpen);
@@ -166,6 +164,14 @@ export default {
       this.updateChapterOpen(false);
       this.openChapter(this.menuItem);
     }
+    uni.$off('openEmit')
+		uni.$once('openEmit', (data) => {
+      console.log('------章-data:', data);
+      if (data.chapterId && data.chapterId > 0) {
+        this.openChapter(data)
+      }
+			
+		})
   },
   onPageShow() {
     if (this.isBuy) {
@@ -221,6 +227,7 @@ export default {
       }
       return {};
     },
+    // /study/record/menuAllList - 查询课程所有子目录结构列表
     studyRecordMenuAllList() {
       return new Promise((resolve) => {
         this.$api
@@ -355,8 +362,7 @@ export default {
         }
       } else if (this.learningOrder == 2 && !item.rebuild) {
         let canLearn = this.list[index - 1].learning == 1;
-        // /study/record/menuAllList - 查询课程所有子目录结构列表
-        // let rows = await this.studyRecordMenuAllList();
+
         let rows = this.menuAllList
         let isStop = false;
         let newRows = [];
@@ -538,14 +544,15 @@ export default {
 
         if (this.isBuy) {
           let moduleId = item.moduleId ? item.moduleId : 0;
+          let chapterId = item.chapterId || item.id
           if (this.isRebuild) {
-            this.getReSectionList(item.id, item.courseId, moduleId);
+            this.getReSectionList(chapterId, item.courseId, moduleId);
           } else {
-            this.getBuySectionList(item.id, item.courseId, moduleId);
+            this.getBuySectionList(chapterId, item.courseId, moduleId);
             //				this.getMenuExamList(item.id,item.courseId,moduleId)
           }
         } else {
-          this.getSectionList(item.id);
+          this.getSectionList(chapterId);
         }
       }
     },

+ 10 - 2
components/course/courseModule.vue

@@ -137,10 +137,17 @@ export default {
 		};
 	},
 	mounted() {
-		// console.log('模块的needOpen:', this.needOpen, 'chapterOpen:', this.chapterOpen);
+		console.log('模块的needOpen:', this.needOpen, 'chapterOpen:', this.chapterOpen);
 		if(this.needOpen && this.chapterOpen) {
 			this.openModule(this.menuItem)
 		}
+		uni.$off('openEmit')
+		uni.$once('openEmit', (data) => {
+			console.log('------木块-data:', data);
+			if (data.moduleId && data.moduleId > 0) {
+				this.openModule(data)
+			}
+		})
 	},
 	methods: {
 		playEnd(isRebuild) {
@@ -150,6 +157,7 @@ export default {
 			this.$emit('toDo',item)
 		},
 		openModule(item){
+			console.log('打kai模块');
 			this.down = !this.down
 			if(!this.down&&this.list.length==0){
 				if(this.isBuy){
@@ -204,7 +212,7 @@ export default {
 						}
 					}
 					this.list = res.data.data
-					// console.log('章的列表:', this.list);
+					console.log('章的列表:', this.list);
 				}
 			});
 			

+ 50 - 5
components/course/courseSection.vue

@@ -161,13 +161,12 @@ export default {
 			moduleSectionExam: [], // 模块下的所有节试卷列表
 			chapterExams: {},
 			moduleExams: {},
-			newMenuAllList: [],
+			// newMenuAllList: [],
 		};
 	},
 	onLoad() {
 	},
 	created() {
-		// this.newMenuAllList = this.menuAllList
 		if (this.testType == 3) {
 			// 模块下的所有节试卷列表
 			this.$api.reSectionExamList({
@@ -190,7 +189,7 @@ export default {
 		let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
 		let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}${this.isRebuild?'isRebuild':''}`;
 		this.playId = playNextId;
-		// console.log('playNextId:', this.playNextId, 'playId:', this.playId);
+		console.log('playNextId:', this.playNextId, 'playId:', this.playId);
 		uni.$off('playNext'+playNextId) //绑定前先移除之前的事件
 		uni.$once('playNext'+playNextId, async (data) => {
 			//到时会触发每个节的监听事件,只允许当前节的接收
@@ -224,11 +223,56 @@ export default {
 				    }
 				});
 			} else {
+				console.log('播放结束--节的');
 				this.$emit('playEnd',{isRebuild:this.isRebuild})
-				// this.newMenuAllList = await this.studyRecordMenuAllList()
-				// console.log('====this.newMenuAllList', this.newMenuAllList);
 			}
 		});
+		uni.$off('playNextSection') //绑定前先移除之前的事件
+		// uni.$once('playNextSection', (data) => {
+		// 	console.log('监听到播放结束的点:', data, this.menuAllList);
+		// 	let nextItem = {}
+		// 	if (data + 1 == this.menuAllList.length) {
+		// 		this.$u.toast('已学完所有视频课程!')
+		// 		return
+		// 	} else {
+		// 		nextItem = this.menuAllList[data + 1]
+		// 	}
+		// 	console.log('nextItem:', nextItem)
+		// 	uni.showModal({
+		// 		title: '温馨提示',
+		// 		content: '当前节视频已学完,继续学习下一节?',
+		// 		success: (res) => {
+		// 			if (res.confirm) {
+		// 				//设置播放的节ID
+		// 				if(this.playSectionId>0){
+		// 					console.log('切换视频1111', this.playSectionId);
+		// 					//切换视频
+		// 					uni.$emit('changeSection', this.playSectionId)
+		// 				}
+		// 				this.newId = nextItem.sectionId
+		// 				this.playId = `moduleId${nextItem.moduleId || 0}chapterId${nextItem.chapterId || 0}sectionId${nextItem.sectionId || 0}`
+		// 				this.$store.commit('setPlaySectionId', {playSectionId: nextItem.sectionId});
+		// 				this.$store.commit('setPlayVID', {playVID: nextItem.recordingUrl}); // nextItem.recordingUrl
+		// 				this.$store.commit('updatePlayNextId',this.playId)
+
+		// 				console.log('====');
+		// 				let ids = this.levelId.split('-');
+		// 				ids[2] = nextItem.sectionId 
+		// 				uni.$emit('levelId', ids.join('-'))
+		// 				uni.$emit('getSection', nextItem)
+		// 				this.$emit('playEnd',{isRebuild:this.isRebuild})
+						
+		// 			} else {
+		// 				//设置播放的节ID
+		// 				this.$store.commit('setPlaySectionId', {playSectionId: nextItem.sectionId});
+		// 				this.$store.commit('setPlayVID', {playVID: nextItem.recordingUrl});
+		// 				let ids = this.levelId.split('-');
+		// 				ids[2] = nextItem.sectionId 
+		// 				this.$emit('playEnd',{isRebuild:this.isRebuild})
+		// 			}
+		// 		}
+		// 	});
+		// })
 	},
 	methods: {
 		isLast() {
@@ -443,6 +487,7 @@ export default {
 					let oldSectionId = this.playSectionId
 					uni.$emit('changeSection', oldSectionId)
 				}
+				// console.log('===设置播放的节IDthis.menuItem,', this.menuItem, this.playId);
 				//设置播放的节ID
 				this.$store.commit('setPlaySectionId', {playSectionId  :this.newId});
 				this.$store.commit('setPlayVID', {playVID  :this.menuItem.recordingUrl});

+ 56 - 6
pages3/polyv/detail.vue

@@ -777,6 +777,7 @@ export default {
       CountTo: 30, // 倒计时
       menuAllList: [],
       popupPhotoShow: false,
+      curPlayIndex: 0, // 正在播放的节的下标
     };
   },
   computed: {
@@ -1042,7 +1043,7 @@ export default {
     // 原来的mouted内容
     originMounted() {
       uni.$on("changeSection", (oldSectionId) => {
-        // console.log('切换课程-originMounted->playVID:', this.playVID, oldSectionId);
+        console.log('切换课程-originMounted->playVID:', this.playVID, oldSectionId);
         this.studyTimer && clearInterval(this.studyTimer) // 清除定时器
         this.hasStart = false;
         this.photoConfig = false;
@@ -1076,6 +1077,7 @@ export default {
         this.playVideo(item);
       });
       uni.$on("levelId", (item) => {
+        console.log('点击节获取的各层级ID', item);
         let arr = item.split("-");
         //点击节获取的各层级ID
         this.moduleId = arr[0];
@@ -1404,7 +1406,6 @@ export default {
 					this.$store.commit("setPlaySectionId", { playSectionId: res.data.data.sectionId });
 					this.$store.commit("setPlayVID", { playVID: res.data.data.recordingUrl });
 
-          // console.log('playVID:', this.playVID, 'playSectionId-', this.playSectionId, 'moduleId:', this.moduleId,'chapterId:', this.chapterId, 'courseId:', this.courseId)
 					this.sectionItem = res.data.data;
           await this.getPhotoLastRecord() // 获取拍照历史
 						this.playVideo(res.data.data)
@@ -1634,9 +1635,9 @@ export default {
 				goodsId:this.goodsId
 			}).then(res => {
 				let nowTime = Number(new  Date().getTime()/1000).toFixed(0)
-				// this.livingItem = res.data.data[0]
         if (res.data.data) {
           this.menuAllList = res.data.data
+          // console.log('======0', this.sectionItem);
 				this.livingItem = res.data.data.find(item => item.liveStartTime<=nowTime&&item.liveEndTime>nowTime);          
         }
 			})
@@ -2450,6 +2451,7 @@ export default {
               fromRebuild: this.isRebuild,
             }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
             uni.$emit("playNext" + playNextId); //通知播放结束
+            uni.$emit('playNextSection', this.curPlayIndex) // 播放下一节
           }
 
           self.ossAvatarUrl = "";
@@ -2575,7 +2577,7 @@ export default {
       var polyvPlayerContext = this.selectComponent("#playerVideo");
       if (polyvPlayerContext != null) {
         this.playTime = polyvPlayerContext.getCurrentTime(); //播放时刻
-        console.log('拍照啊', 789, this.photoHistoryList, 'this.photoList:', this.photoList)
+        // console.log('拍照啊', 789, this.photoHistoryList, 'this.photoList:', this.photoList)
         //判断是否需要拍照
         if (this.photoNum > 0) {
           this.configPhoto();
@@ -2679,9 +2681,57 @@ export default {
         });
 				this.hasStart = false;
         this.postStudyRecord(1);
+        this.nextSection()
         // uni.$emit('playNext') //播放重修下一节
+       
       }
     },
+   //播放下一节
+   async nextSection(){
+    console.log("放完了",this.menuAllList)
+      if(!this.menuAllList.length){
+        return
+      }
+      console.log('this.sectionId:', this.sectionId, 'this.chapterId:', this.chapterId, 'this.moduleId:', this.moduleId);
+      //第一个弹窗
+      this.curPlayIndex = this.menuAllList.findIndex((item) => {
+        let i_sectionId = item.sectionId || 0
+        let i_chapterId = item.chapterId || 0
+        let i_moduleId = item.moduleId || 0
+        return i_sectionId == this.playSectionId && i_chapterId == this.chapterId && i_moduleId == this.moduleId
+      })
+      console.log('查找到的curItem:', this.curPlayIndex);
+      let data = this.menuAllList[this.curPlayIndex+1];
+      if (!data) {
+        //第二个弹窗
+      }
+      console.log("放下一个", data)
+      this.moduleId = data.moduleId
+      this.chapterId = data.chapterId
+      this.sectionId = data.sectionId
+      if(data.sectionType == 1) { //录播
+        this.$store.commit("setPlaySectionId", { playSectionId: data.sectionId })
+        this.$store.commit("setPlayVID", { playVID: data.recordingUrl })
+
+        this.sectionItem = data;
+        await this.getPhotoLastRecord() // 获取拍照历史
+        this.playVideo(data)
+      } else if(data.sectionType == 2) { //直播
+        this.studyRecordGetLastLive();
+      } else if(data.sectionType == 3) { //回放
+        this.$store.commit("setPlaySectionId", { playSectionId: data.sectionId })
+        this.$store.commit("setPlayVID", { playVID: data.recordingUrl })
+        this.sectionItem = data
+        this.playVideo(data)
+      }
+      let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
+      this.$store.commit("updatePlayNextId", playNextId);
+      // this.updateChapterOpen(true)
+      // this.$emit('openModuleTwo', data)\
+      data.id = data.moduleId
+      uni.$emit('openEmit', data)
+   },
+
     //拍照
     openPhoto() {
       var polyvPlayerContext = this.selectComponent("#playerVideo");
@@ -2966,7 +3016,7 @@ export default {
                 let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
                 this.$store.commit("updatePlayNextId", playNextId);
               }
-              
+             
               self.list = [
                 {
                   name: "目录",
@@ -2987,7 +3037,7 @@ export default {
         });
     },
     getMenuList() {
-      // console.log('menuList的目录', this.sectionItem);
+      // console.log('menuList的目录');
       let self = this;
       // /course/menuList 查询课程目录结构列表
       this.$api