Explorar el Código

fix:切换课程时节没更新的问题

xuqiaoying hace 3 años
padre
commit
44bab5b245

+ 0 - 1
common/request.js

@@ -20,7 +20,6 @@ export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/'  //test
 // 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://192.168.1.38:8082/'  //test
 // export const WEBVIEW_URL = 'http://api.xyyxt.net:6066/'  //预发布(弃用了)
 
 // export const socket_url = 'ws://42.192.164.187:19005/webSocket/'  //test

+ 2 - 17
components/course/courseChapter.vue

@@ -145,27 +145,13 @@ export default {
   },
   onLoad() {},
   created() {},
-  watch: {
-    menuItem: {
-      handler(newV, oldV) {
-        console.log('监听---章---》', newV.courseId, oldV.courseId, this.menuItem)
-        if (this.needOpen && this.chapterOpen) {
-          // this.updateChapterOpen(false);
-          this.openChapter(this.menuItem);
-        }
-      },
-      deep: true,
-    },
-  },
   mounted() {
-    console.log('[[[[[[[[[[[[[[[[[[[[', this.needOpen, this.chapterOpen, this.menuItem.courseId)
     if (this.needOpen && this.chapterOpen) {
-      // this.updateChapterOpen(false);
+      this.updateChapterOpen(false);
       this.openChapter(this.menuItem);
     }
   },
   onPageShow() {
-    console.log('onPageShowonPageShow')
     if (this.isBuy) {
       this.refreshList({ isRebuild: this.isRebuild });
     }
@@ -506,7 +492,7 @@ export default {
       });
     },
     openChapter(item) {
-      console.log('张咋还能工作职责',this.menuItem);
+      console.log('---zhang',this.menuItem, this.down,this.list);
       this.down = !this.down;
       if (!this.down && this.list.length == 0) {
         console.log(item.id, 69);
@@ -641,7 +627,6 @@ export default {
               }
             });
             self.list = res.data.data;
-            console.log('=====================================', self.list)
           }
         });
     },

+ 0 - 5
components/course/courseModule.vue

@@ -85,11 +85,6 @@ export default {
 	onLoad() {},
 	created() {
 		
-	},
-	watch: {
-    	courseId(newV, oldV) {
-			console.log('监听---模块---》', newV, oldV)
-		}
 	},
 	mounted() {
 		if(this.needOpen && this.chapterOpen) {

+ 0 - 5
components/course/courseSection.vue

@@ -142,11 +142,6 @@ export default {
 	},
 	created() {
 		
-	},
-	watch: {
-		courseId(newV, oldV) {
-		console.log('监听---节---》', newV, oldV)
-		}
 	},
 	mounted() {
 		this.nowTime = Number(new  Date().getTime()/1000).toFixed(0)

+ 19 - 17
pages3/live/detail.vue

@@ -136,6 +136,7 @@
             <!--模块 -->
             <view v-if="item.type == 1"
               ><courseModule
+                v-if="reStart"
 								:isLive="true"
 								:orderGoodsId="orderGoodsId"
                 :sectionMaxNum="goodsData.sectionMaxNum"
@@ -153,6 +154,7 @@
             <!--章 -->
             <view v-if="item.type == 2"
               ><courseChapter
+                v-if="reStart"
 								:isLive="true"
 								:orderGoodsId="orderGoodsId"
                 :sectionMaxNum="goodsData.sectionMaxNum"
@@ -172,6 +174,7 @@
             <!--节 -->
             <view v-if="item.type == 3"
               ><courseSection
+                v-if="reStart"
 								:isLive="true"
 								:orderGoodsId="orderGoodsId"
                 :sectionMaxNum="goodsData.sectionMaxNum"
@@ -719,6 +722,7 @@ export default {
       courseList: [], // 课程列表
       courseTotal: 0,
       options: {},
+      reStart: false, // 是否显示模块/章/节
     };
   },
   computed: {
@@ -830,7 +834,6 @@ export default {
         }
       }).then((res) => {
         if (res.data.code == 200) {
-          console.log('res.data', res.data)
           if (res.data.data && Object.keys(res.data.data).length) { //有最后一次看的录播的信息
             this.courseId = res.data.data.courseId
             this.originOnShow()
@@ -867,7 +870,7 @@ export default {
         this.$store.commit("setPlaySectionId", { playSectionId: item.sectionId });
         this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
         this.$store.commit("updatePlayNextId", playNextId);
-        console.log("this.playNoteVideo");
+        // console.log("this.playNoteVideo");
         
         this.playNoteVideo(item)
       } else {
@@ -876,7 +879,7 @@ export default {
     },
     originOnMount() {
       uni.$on("changeSection", (oldSectionId) => {
-        console.log(this.playVID);
+        // console.log(this.playVID);
 				this.hasStart = false;
         this.photoConfig = false;
         this.photoIndex = 0;
@@ -891,7 +894,7 @@ export default {
         this.postStudyRecord(0, oldSectionId);
       });
       uni.$on("getSection", (item) => {
-        console.log('触发事件-=====')
+        // console.log('触发事件-=====')
         //清除直播
           this.hasStart = false;
         this.isPlayRebuild = item.rebuild;
@@ -919,7 +922,7 @@ export default {
         this.channelItem = item;
       });
       uni.$on("isRebuild", (item) => {
-        console.log(item);
+        // console.log(item);
         this.isRebuild = item;
       });
       this.updateChapterOpen(true);
@@ -933,6 +936,7 @@ export default {
     // 进入学习
     jump(item, index) {
       this.courseId = item.courseId
+      this.reStart = false
       this.toggleCourseShow = false
       this.originOnShow()
       this.originOnMount()
@@ -948,7 +952,7 @@ export default {
 				orderGoodsId:this.orderGoodsId,
 				courseId:this.courseId
 			}).then(res => {
-				console.log(res,'liveres')
+				// console.log(res,'liveres')
 				this.updateLiveLast(res.data.data)
 			})
 		},
@@ -1152,11 +1156,11 @@ export default {
           timeInterval: postTime ? self.photoList.join(",") : "",
 					orderGoodsId: this.orderGoodsId,
         };
-        console.log("提交接口", data);
+        // console.log("提交接口", data);
         this.$api
           .coursePhotoRecord(data)
           .then((res) => {
-						console.log(res,'postCoursePhotoRecord')
+						// console.log(res,'postCoursePhotoRecord')
             if (res.data.code == 200) {
               resolve();
             } else {
@@ -1251,10 +1255,10 @@ export default {
           // 	this.photoList.push(s)
           // 	initSpace+=spaceTime
           // }
-          console.log(this.photoList, "随机拍照时间数组11", photoNum);
+          // console.log(this.photoList, "随机拍照时间数组11", photoNum);
           this.postCoursePhotoRecord(true); //提交随机拍照时间数组
         }
-        console.log(this.photoList, "随机拍照时间数组");
+        // console.log(this.photoList, "随机拍照时间数组");
         //兼容已有观看历史
         for (let i = 0; i < this.photoList.length - 1; i++) {
           if (
@@ -1262,12 +1266,10 @@ export default {
             this.photoList[i + 1] > duration
           ) {
             this.photoIndex = i + 1;
-            //				console.log("我的修改了photoIndex")
             break;
           }
           if (duration > this.photoList[this.photoList.length - 1]) {
             this.photoIndex = this.photoList.length - 1; //取最后一个下标
-            //				console.log("我的修改了photoIndex")
             break;
           }
         }
@@ -1308,9 +1310,9 @@ export default {
     },
     playerLiveStatusChange(e) {
       const status = e.detail.status;
-      console.log("直播状态", status);
+      // console.log("直播状态", status);
       if (status === "live") {
-        console.log("开始直播");
+        // console.log("开始直播");
         //开始播放
         if (this.timer) {
           clearInterval(this.timer);
@@ -1324,7 +1326,7 @@ export default {
           //只有播放过的结束才提交,避免未开播触发结束
           this.postStudyRecord(1);
         }
-        console.log("结束直播");
+        // console.log("结束直播");
         this.livePlay = false;
         // 未开始
       }
@@ -1396,7 +1398,7 @@ export default {
       });
     },
     openSetting(res) {
-      console.log(res, 98);
+      // console.log(res, 98);
     },
     getCameraSetting() {
       const self = this;
@@ -2150,7 +2152,7 @@ export default {
               item.menuType = item.type;
             }
             this.menuList = res.data.rows;
-
+            this.reStart = true
             for (let i = 0; i < res.data.rows.length; i++) {
               if (res.data.rows[i].type == 1) {
                 this.menuIndex = [i];

+ 8 - 1
pages3/polyv/detail.vue

@@ -128,6 +128,7 @@
             <!--模块 -->
             <view v-if="item.type == 1"
               ><courseModule
+                v-if="reStart"
 								:orderGoodsId="orderGoodsId"
                 :sectionMaxNum="goodsData.sectionMaxNum"
                 :needOpen="menuIndex[0] === index ? true : false"
@@ -144,6 +145,7 @@
             <!--章 -->
             <view v-if="item.type == 2"
               ><courseChapter
+                v-if="reStart"
 								:orderGoodsId="orderGoodsId"
                 :sectionMaxNum="goodsData.sectionMaxNum"
                 :needOpen="menuIndex[0] === index ? true : false"
@@ -162,6 +164,7 @@
             <!--节 -->
             <view v-if="item.type == 3"
               ><courseSection
+                v-if="reStart"
 								:orderGoodsId="orderGoodsId"
                 :sectionMaxNum="goodsData.sectionMaxNum"
                 @playEnd="sectionPlayEnd($event, index)"
@@ -689,6 +692,7 @@ export default {
       informId: '', //消息id,从公众号消息模板进来的才有
       courseList: [], // 课程列表
       courseTotal: 0,
+      reStart: false, // 是否显示模块/章/节
     };
   },
   computed: {
@@ -925,8 +929,10 @@ export default {
     },
     // 进入学习
     jump(item, index) {
-      console.log('item------>', item, item.goodsId, item.courseId, item.orderGoodsId)
+      console.log('item------>', item, item.goodsId, item.gradeId, item.courseId, item.orderGoodsId)
+      this.reStart = false
       this.courseId = item.courseId
+      this.gradeId = item.gradeId
       // return
       if (index == 0) {
         if (item.rebuild === 0) {
@@ -2687,6 +2693,7 @@ export default {
             }
             self.menuList = res.data.rows;
 console.log('======menuList', this.menuList)
+            this.reStart = true
             for (let i = 0; i < res.data.rows.length; i++) {
               if (res.data.rows[i].type == 1) {
                 this.menuIndex = [i];