Эх сурвалжийг харах

继续观看,定位上次最后观看位置

xuqiaoying 2 жил өмнө
parent
commit
1be3af4fe4

+ 6 - 6
common/request.js

@@ -5,22 +5,22 @@ import method from '@/common/methodTool.js'
 import api from './api.js'
 var num = 1
 //接口api   
-export const BASE_URL = 'https://api.xyyxt.net'   //release
+// 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.7:5055'    //后端本地
 
  //图片上传api
-export const BASE_IMG_URL = 'https://file.xyyxt.net/'     //release
-// export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/'  //test
+// export const BASE_IMG_URL = 'https://file.xyyxt.net/'     //release
+export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/'  //test
 
 // web_view的
-export const WEBVIEW_URL = 'https://m.xyyxt.net/'  //release
+// export const WEBVIEW_URL = 'https://m.xyyxt.net/'  //release
 // export const WEBVIEW_URL = 'https://testm.xyyxt.net/'  //预发布
-// export const WEBVIEW_URL = 'http://120.79.166.78:18001/' // 测试环境
+export const WEBVIEW_URL = 'http://120.79.166.78:18001/' // 测试环境
 // export const WEBVIEW_URL = 'http://api.xyyxt.net:6066/'  //预发布(弃用了)
 
 // export const socket_url = 'ws://42.192.164.187:19005/webSocket/'  //test

+ 8 - 5
components/course/courseChapter.vue

@@ -137,7 +137,11 @@ export default {
     menuAllList: { // 课程所有子目录结构列表
 			type: Array,
 			default: () => []
-		}
+		},
+    sectionItem: { // 用户最后一次看的录播的信息
+			type: Object,
+			default: () => {}
+		},
   },
   components: {
     courseSection,
@@ -157,6 +161,7 @@ export default {
     // this.newMenuAllList = this.menuAllList
   },
   mounted() {
+    console.log('needOpen:', this.needOpen, this.chapterOpen);
     if (this.needOpen && this.chapterOpen) {
       this.updateChapterOpen(false);
       this.openChapter(this.menuItem);
@@ -272,7 +277,6 @@ export default {
      * 去做题
      */
     async toDo(id, goodsId = 0, moduleId = 0, chapterId = 0, item, index) {
-      console.log('menuAllList', this.menuAllList);
       // 查询用户商品今天学习节数- /goods/todayStudySectionNum
       let learnNum = await this.goodsTodayStudySectionNum();
       // 检查用户是否学习过节 - /grade/grade/checkGoodsStudy
@@ -376,7 +380,6 @@ export default {
             }
           }
         }
-        console.log(newRows);
         let isAllLearn = newRows.every((item) => {
           return item.studyStatus == 1;
         });
@@ -518,7 +521,7 @@ export default {
       });
     },
     async openChapter(item) {
-      // console.log('---zhang',this.menuItem, this.down,this.list, item.id, item.courseId, item.moduleId);
+      console.log('---zhang',this.menuItem, this.down, item.courseId, item.moduleId);
       this.down = !this.down;
       if (!this.down && this.list.length == 0) {
         // console.log(item.id, 69);
@@ -660,7 +663,7 @@ export default {
               }
             });
             self.list = res.data.data;
-            console.log('=========', this.list);
+            console.log('=======节列表==', this.list);
           }
         });
     },

+ 14 - 2
components/course/courseModule.vue

@@ -12,7 +12,7 @@
 			<view v-for="(itemM,indexM) in list" :key="indexM">
 				<!-- v-if='itemM.type != 2' -->
 				<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="itemM.needOpen" @playEnd="playEnd($event)" 
 						@toDo="toDo($event)" :courseId="courseId" :learningOrder="learningOrder" :goodsId="goodsId" :isBuy="isBuy" :gradeId="gradeId" 
 						:isRebuild="isRebuild"  :menuItem="itemM" :levelId="levelId+'-'+itemM.chapterId" :menuAllList="menuAllList">
 				</courseChapter>
@@ -121,7 +121,11 @@ export default {
 		menuAllList: { // 课程所有子目录结构列表
 			type: Array,
 			default: () => []
-		}
+		},
+		sectionItem: { // 用户最后一次看的录播的信息
+			type: Object,
+			default: () => {}
+		},
 	},
 	components: {
 		courseChapter
@@ -133,6 +137,7 @@ export default {
 		};
 	},
 	mounted() {
+		// console.log('模块的needOpen:', this.needOpen, 'chapterOpen:', this.chapterOpen);
 		if(this.needOpen && this.chapterOpen) {
 			this.openModule(this.menuItem)
 		}
@@ -192,8 +197,15 @@ 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 {
+							item['needOpen'] = i == 0 ? true : false
+						}
 					}
 					this.list = res.data.data
+					// console.log('章的列表:', this.list);
 				}
 			});
 			

+ 2 - 2
components/course/courseSection.vue

@@ -177,7 +177,7 @@ export default {
 		}
 	},
     mounted() {
-		// console.log('节的播放---', this.menuAllList)
+		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,6 +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);
 		uni.$off('playNext'+playNextId) //绑定前先移除之前的事件
 		uni.$once('playNext'+playNextId, async (data) => {
 			//到时会触发每个节的监听事件,只允许当前节的接收
@@ -218,7 +219,6 @@ export default {
 				    }
 				});
 			} else {
-				console.log('playEnd----');
 				this.$emit('playEnd',{isRebuild:this.isRebuild})
 				// this.newMenuAllList = await this.studyRecordMenuAllList()
 				// console.log('====this.newMenuAllList', this.newMenuAllList);

+ 30 - 6
pages3/polyv/detail.vue

@@ -151,6 +151,7 @@
                 :levelId="item.menuId"
                 :goodsType='1'
                 :menuAllList="menuAllList"
+                :sectionItem="sectionItem"
               ></courseModule
             ></view>
             <!--章 -->
@@ -171,6 +172,7 @@
                 :levelId="'0-' + item.menuId"
                 :goodsType='1'
                 :menuAllList="menuAllList"
+                :sectionItem="sectionItem"
               ></courseChapter
             ></view>
             <!--节 -->
@@ -332,6 +334,9 @@
                 :isBuy="true"
                 :menuItem="item"
                 :levelId="item.menuId"
+                :goodsType='1'
+                :menuAllList="menuAllList"
+                :sectionItem="sectionItem"
               ></courseModule
             ></view>
             <!--章 -->
@@ -347,6 +352,9 @@
                 :isBuy="true"
                 :menuItem="item"
                 :levelId="'0-' + item.menuId"
+                :goodsType='1'
+                :menuAllList="menuAllList"
+                :sectionItem="sectionItem"
               ></courseChapter>
             </view>
             <!--节 -->
@@ -363,6 +371,9 @@
                 :nextMenuItem="findMenuNextSection(index)"
                 :menuItem="item"
                 :levelId="'0-0-' + item.menuId"
+                :goodsType='1'
+                :testType="3"
+                :menuAllList="menuAllList"
               ></courseSection>
             </view>
           </view>
@@ -720,7 +731,7 @@ export default {
       photoConfig: false, //是否配置好拍照次数
       photoIndex: 0, //当前位于拍照的区间下标 从0开始
       photoHistoryList: [], //已拍照历史的下标点
-      sectionItem: null,
+      sectionItem: {},
       businessData: {},
       showNotes: true,
       menuIndex: [],
@@ -885,7 +896,7 @@ export default {
         }
       }).then((res) => {
         if (res.data.code == 200) {
-          this.sectionItem = res.data.data
+          this.sectionItem = res.data.data || {}
           if (res.data.data && Object.keys(res.data.data).length) { //有最后一次看的录播的信息
             this.courseId = res.data.data.courseId
             // console.log('查询用户最后一次看的录播的信息', res.data, this.courseId)
@@ -1401,7 +1412,7 @@ export default {
             }
           }).then((res) => {
             if (res.data.code == 200) {
-              this.sectionItem = res.data.data  
+              this.sectionItem = res.data.data || {}
             }
           })
 
@@ -2425,7 +2436,6 @@ export default {
               fromRebuild: this.isRebuild,
             }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
             uni.$emit("playNext" + playNextId); //通知播放结束
-            console.log("playNext" + playNextIdisRebuild, '-----l', "playNext" + playNextId);
           }
 
           self.ossAvatarUrl = "";
@@ -2899,7 +2909,7 @@ export default {
               item.name = item.menuName;
             }
             self.reMenuList = res.data.rows;
-            console.log('reMenuList:' , this.reMenuList);
+            console.log('reMenuList:' , this.reMenuList, 'this.sectionItem:', this.sectionItem);
             if (self.reMenuList.length > 0) {
               this.showNotes = false;
               self.list = [
@@ -2918,7 +2928,17 @@ export default {
                 { name: "重修目录" },
               ];
               this.current = 0;
+              if (Object.keys(this.sectionItem).length) {
+                let playNextIdisRebuild = `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}`;
+                this.$store.commit("updatePlayNextId", playNextId);
+                console.log('拼接playNextId:', playNextId);
+              }
+              
               self.list = [
                 {
                   name: "目录",
@@ -2939,7 +2959,7 @@ export default {
         });
     },
     getMenuList() {
-      console.log('menuList的目录');
+      console.log('menuList的目录', this.sectionItem);
       let self = this;
       // /course/menuList 查询课程目录结构列表
       this.$api
@@ -2956,10 +2976,14 @@ 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) {
                 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)
                 this.menuIndex = [i];
                 break;
               }