Quellcode durchsuchen

多课程时新增courseId判断正在学习中

xuqiaoying vor 3 Jahren
Ursprung
Commit
3eba073306
2 geänderte Dateien mit 39 neuen und 24 gelöschten Zeilen
  1. 1 1
      components/course/courseSection.vue
  2. 38 23
      pages3/polyv/detail.vue

+ 1 - 1
components/course/courseSection.vue

@@ -186,7 +186,7 @@ export default {
 		let moduleId = this.menuItem.moduleId || 0;
 		let chapterId = this.menuItem.chapterId || 0;
 		let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
-		let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}${this.isRebuild?'isRebuild':''}`;
+		let playNextId = `courseId${this.courseId}moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}${this.isRebuild?'isRebuild':''}`;
 		this.playId = playNextId;
 		console.log('playNextId:', this.playNextId, 'playId:', this.playId);
 		uni.$off('playNext'+playNextId) //绑定前先移除之前的事件

+ 38 - 23
pages3/polyv/detail.vue

@@ -149,7 +149,7 @@
                         :orderGoodsId="orderGoodsId"
                         :sectionMaxNum="goodsData.sectionMaxNum"
                         :needOpen="item.menuIndex === index ? true : false"
-                        :courseId="courseId"
+                        :courseId="item.courseId"
                         :preItem="menuList[index - 1]"
                         :learningOrder="businessData.goodsLearningOrder"
                         :goodsId="goodsId"
@@ -169,7 +169,7 @@
                         :orderGoodsId="orderGoodsId"
                         :sectionMaxNum="goodsData.sectionMaxNum"
                         :needOpen="item.menuIndex === index ? true : false"
-                        :courseId="courseId"
+                        :courseId="item.courseId"
                         :preItem="menuList[index - 1]"
                         @playEnd="sectionPlayEnd($event, index)"
                         :learningOrder="businessData.goodsLearningOrder"
@@ -190,7 +190,7 @@
                         :orderGoodsId="orderGoodsId"
                         :sectionMaxNum="goodsData.sectionMaxNum"
                         @playEnd="sectionPlayEnd($event, index)"
-                        :courseId="courseId"
+                        :courseId="item.courseId"
                         :preItem="menuList[index - 1]"
                         :learningOrder="businessData.goodsLearningOrder"
                         :goodsId="goodsId"
@@ -1043,7 +1043,7 @@ export default {
             noteSecond: noteSecond,
             studyDuration: noteSecond,
           };
-          let playNextId = `moduleId${this.option.moduleId}chapterId${
+          let playNextId = `courseId${this.courseId}moduleId${this.option.moduleId}chapterId${
             this.option.chapterId
           }sectionId${this.option.sectionId}${this.option.isRebuild ? "isRebuild" : ""}`;
           this.$store.commit("setPlaySectionId", { playSectionId: item.sectionId || item.menuId });
@@ -2460,8 +2460,8 @@ export default {
             this.studyRecordMenuAllList()
             let moduleId = this.moduleId || 0;
             let chapterId = this.chapterId || 0;
-            let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
-            let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
+            let playNextIdisRebuild = `courseId${this.courseId}moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
+            let playNextId = `courseId${this.courseId}moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
 
             uni.$emit("playNext" + playNextIdisRebuild, {
               fromRebuild: this.isRebuild,
@@ -2702,7 +2702,8 @@ export default {
       }
     },
    //播放下一节
-    nextSection(){
+    async nextSection(){
+      console.log('结束:', this.menuAllList);
       if(!this.menuAllList.length){
         return
       }
@@ -2713,21 +2714,25 @@ export default {
         return i_sectionId == this.playSectionId && i_chapterId == this.chapterId && i_moduleId == this.moduleId
       })
       let data = this.menuAllList[this.curPlayIndex+1];
+      console.log('data:', data);
       if (!data) {
         // 如果是多课程,
-        if (this.courseTotal > 1) {
-          
+        if (this.goodsTeacher.length > 1) {
+          let goodsIndex = this.goodsTeacher.findIndex((item) => {
+            return item.courseList.find((e) => e.courseId == this.courseId)
+          })
+          console.log('goodsIndex:', goodsIndex)
+          let nextCourse = this.goodsTeacher[goodsIndex + 1]
+          if (!nextCourse) {
+            this.allLearnShow()
+          } else {
+            this.courseId = this.goodsTeacher[nextCourse].courseList[0].courseId
+            await this.studyRecordMenuAllList()
+            console.log('---- this.menuAllList:',  this.menuAllList)
+          }
         } else {
           //第二个弹窗
-          uni.showModal({
-            title: '温馨提示',
-            content: '当前最后一节视频已学完 请检查所有章节是否学习完成?',
-            showCancel: false,
-            success: (res) => {
-              if (res.confirm) {
-              }
-            }
-          })
+          this.allLearnShow()
         }
         
       } else {
@@ -2754,7 +2759,7 @@ export default {
                 this.sectionItem = data
                 this.playVideo(data)
               }
-              let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
+              let playNextId = `courseId${this.courseId}moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
               this.$store.commit("updatePlayNextId", playNextId);
               this.updateChapterOpen(true)
               this.reStart = false
@@ -2763,8 +2768,18 @@ export default {
           }
         })
       }
-  },
-
+    },
+    allLearnShow() {
+      uni.showModal({
+        title: '温馨提示',
+        content: '当前最后一节视频已学完,请检查所有章节是否学习完成?',
+        showCancel: false,
+        success: (res) => {
+          if (res.confirm) {
+          }
+        }
+      })
+    },
     //拍照
     openPhoto() {
       var polyvPlayerContext = this.selectComponent("#playerVideo");
@@ -3040,12 +3055,12 @@ export default {
               ];
               this.current = 0;
               if (Object.keys(this.sectionItem).length) {
-                let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
+                let playNextIdisRebuild = `courseId${this.courseId}moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
                 this.$store.commit("updatePlayNextId", playNextIdisRebuild);
               }
             } else {
               if (Object.keys(this.sectionItem).length) {
-                let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
+                let playNextId = `courseId${this.courseId}moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
                 this.$store.commit("updatePlayNextId", playNextId);
               }