Преглед на файлове

点击进入学习,自动跳转到上一次学习的视频节/直播节

xuqiaoying преди 2 години
родител
ревизия
67f023feef
променени са 5 файла, в които са добавени 50 реда и са изтрити 18 реда
  1. 4 4
      components/course/courseChapter.vue
  2. 0 1
      components/course/courseModule.vue
  3. 2 2
      components/course/courseSection.vue
  4. 24 1
      pages3/live/detail.vue
  5. 20 10
      pages3/polyv/detail.vue

+ 4 - 4
components/course/courseChapter.vue

@@ -138,10 +138,10 @@ export default {
 			type: Array,
 			default: () => []
 		},
-    sectionItem: { // 用户最后一次看的录播的信息
-			type: Object,
-			default: () => {}
-		},
+    // sectionItem: { // 用户最后一次看的录播的信息
+		// 	type: Object,
+		// 	default: () => {}
+		// },
   },
   components: {
     courseSection,

+ 0 - 1
components/course/courseModule.vue

@@ -197,7 +197,6 @@ export default {
 						let item = res.data.data[i]
 						item.id = item.chapterId
 						item.menuType = 2;
-						// console.log('章:sectionItem', this.sectionItem);
 						if (Object.keys(this.sectionItem).length) {
 							item['needOpen'] = item.chapterId == this.sectionItem.chapterId ? true : false
 						} else {

+ 2 - 2
components/course/courseSection.vue

@@ -177,7 +177,7 @@ export default {
 		}
 	},
     mounted() {
-		console.log('节的播放---menuItem', this.menuItem, 'playSectionId:', this.playSectionId, 'isBuy:', this.isBuy)
+		// console.log('节的播放---menuItem', this.menuItem, 'playSectionId:', this.playSectionId, 'isBuy:', this.isBuy)
 		this.nowTime = Number(new  Date().getTime()/1000).toFixed(0)
 		this.newId= this.menuItem.sectionId>0?this.menuItem.sectionId:this.menuItem.menuId
 		let moduleId = this.menuItem.moduleId || 0;
@@ -185,7 +185,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) => {
 			//到时会触发每个节的监听事件,只允许当前节的接收

+ 24 - 1
pages3/live/detail.vue

@@ -151,6 +151,7 @@
                 :isBuy="true"
                 :menuItem="item"
                 :levelId="item.menuId"
+                :sectionItem="sectionItem"
               ></courseModule
             ></view>
             <!--章 -->
@@ -733,7 +734,7 @@ export default {
       photoConfig: false, //是否配置好拍照次数
       photoIndex: 0, //当前位于拍照的区间下标 从0开始
       photoHistoryList: [], //已拍照历史的下标点
-      sectionItem: null,
+      sectionItem: {},
       businessData: {},
       showNotes: true,
       menuIndex: [],
@@ -866,6 +867,7 @@ export default {
         }
       }).then((res) => {
         if (res.data.code == 200) {
+          this.sectionItem = res.data.data || {}
           if (res.data.data && Object.keys(res.data.data).length) { //有最后一次看的录播的信息
             this.courseId = res.data.data.courseId
           } else {
@@ -2259,11 +2261,32 @@ export default {
             this.reStart = true
             for (let i = 0; i < res.data.rows.length; i++) {
               if (res.data.rows[i].type == 1) {
+                if (Object.keys(this.sectionItem).length) {
+                  let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
+                  this.$store.commit("updatePlayNextId", playNextId)
+
+                  if (res.data.rows[i].menuId == this.sectionItem.moduleId) {
+                    this.menuIndex = [i];
+                    break;
+                  }
+                } else {
                 this.menuIndex = [i];
                 break;
+                }
               } else if (res.data.rows[i].type == 2) {
+                // 章
+                if (Object.keys(this.sectionItem).length) {
+                  let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
+                  this.$store.commit("updatePlayNextId", playNextId)
+                  
+                  if (res.data.rows[i].menuId == this.sectionItem.chapterId && (!this.sectionItem.moduleId || this.sectionItem.moduleId == 0)) {
+                    this.menuIndex = [i];
+                    break;
+                  }
+                } else {
                 this.menuIndex = [i];
                 break;
+                }
               }
             }
 

+ 20 - 10
pages3/polyv/detail.vue

@@ -172,7 +172,6 @@
                 :levelId="'0-' + item.menuId"
                 :goodsType='1'
                 :menuAllList="menuAllList"
-                :sectionItem="sectionItem"
               ></courseChapter
             ></view>
             <!--节 -->
@@ -354,7 +353,6 @@
                 :levelId="'0-' + item.menuId"
                 :goodsType='1'
                 :menuAllList="menuAllList"
-                :sectionItem="sectionItem"
               ></courseChapter>
             </view>
             <!--节 -->
@@ -2891,7 +2889,7 @@ export default {
         });
     },
     getReMenuList() {
-      console.log('重修的目录');
+      // console.log('重修的目录');
       let self = this;
       this.$api
         .reMenuList({
@@ -2909,7 +2907,6 @@ export default {
               item.name = item.menuName;
             }
             self.reMenuList = res.data.rows;
-            console.log('reMenuList:' , this.reMenuList, 'this.sectionItem:', this.sectionItem);
             if (self.reMenuList.length > 0) {
               this.showNotes = false;
               self.list = [
@@ -2936,7 +2933,6 @@ export default {
               if (Object.keys(this.sectionItem).length) {
                 let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
                 this.$store.commit("updatePlayNextId", playNextId);
-                console.log('拼接playNextId:', playNextId);
               }
               
               self.list = [
@@ -2959,7 +2955,7 @@ export default {
         });
     },
     getMenuList() {
-      console.log('menuList的目录', this.sectionItem);
+      // console.log('menuList的目录', this.sectionItem);
       let self = this;
       // /course/menuList 查询课程目录结构列表
       this.$api
@@ -2976,16 +2972,30 @@ export default {
             self.menuList = res.data.rows;
             this.reStart = true
             for (let i = 0; i < res.data.rows.length; i++) {
-              //  && res.data.rows[i].menuId == this.sectionItem.moduleId
               if (res.data.rows[i].type == 1) {
+                // 模块
+                if (Object.keys(this.sectionItem).length) {
+                  if (res.data.rows[i].menuId == this.sectionItem.moduleId) {
+                    this.menuIndex = [i];
+                    break;
+                  }
+                } else {
                 this.menuIndex = [i];
                 break;
+                }
+                
               } else if (res.data.rows[i].type == 2) {
-                // &&
-                // res.data.rows[i].menuId == this.sectionItem.chapterId &&
-                // (!this.sectionItem.moduleId || this.sectionItem.moduleId == 0)
+                // 章
+                if (Object.keys(this.sectionItem).length) {
+                  if (res.data.rows[i].menuId == this.sectionItem.chapterId && (!this.sectionItem.moduleId || this.sectionItem.moduleId == 0)) {
+                    this.menuIndex = [i];
+                    break;
+                  }
+                } else {
                 this.menuIndex = [i];
                 break;
+                }
+                
               }
             }
             console.log('menuList: ---', this.menuList, 'menuIndex:', this.menuIndex);