谢杰标 2 rokov pred
rodič
commit
1fa29effca
2 zmenil súbory, kde vykonal 40 pridanie a 76 odobranie
  1. 11 6
      components/course/courseModule.vue
  2. 29 70
      pages3/polyv/detail.vue

+ 11 - 6
components/course/courseModule.vue

@@ -168,12 +168,6 @@ export default {
       list: [],
     };
   },
-  mounted() {
-    // console.log('模块的needOpen:', this.needOpen, 'chapterOpen:', this.chapterOpen);
-    if (this.needOpen && this.chapterOpen) {
-      this.openModule(this.menuItem);
-    }
-  },
   methods: {
     playEnd(isRebuild) {
       this.$emit("playEnd", { isRebuild: isRebuild.isRebuild });
@@ -346,6 +340,17 @@ export default {
       return isAllLearn ? 1 : -1;
     },
   },
+  watch: {
+    courseId: {
+      handler(val) {
+        console.log("🚀 ~ file: courseModule.vue:346 ~ handler ~ val:", val)
+        if (this.needOpen && this.chapterOpen) {
+          this.openModule(this.menuItem);
+        }
+      },
+      immediate: true,
+    },
+  },
 };
 </script>
 

+ 29 - 70
pages3/polyv/detail.vue

@@ -750,7 +750,11 @@ export default {
     },
   },
   async onLoad(option) {
-    console.log("🚀 ~ file: detail.vue:747 ~ onLoad ~ option:", option,this.$refs.player);
+    console.log(
+      "🚀 ~ file: detail.vue:747 ~ onLoad ~ option:",
+      option,
+      this.$refs.player
+    );
     if (option.isOther) {
       this.showMark = true;
       return;
@@ -985,7 +989,7 @@ export default {
     // 原来onshow里面的内容
     async originOnShow() {
       this.getMenuList();
-      this.getReMenuList(); 
+      this.getReMenuList();
       await this.studyRecordMenuAllList();
       // 消息过来 定位某个节
       if (this.option.noteSecond) {
@@ -1012,7 +1016,7 @@ export default {
         this.photoIndex = 0;
         //清除直播
         this.$store.commit("setPlayChannelId", { playChannelId: 0 });
-        if(!this.refPlv){
+        if (!this.refPlv) {
           this.refPlv = this.$refs.player;
         }
         this.postStudyRecord(0, oldSectionId);
@@ -1128,75 +1132,20 @@ export default {
     },
     // 进入学习
     async jump(item, index, type) {
-      console.log("🚀 ~ file: detail.vue:1127 ~ jump ~ item:", item)
-      if(this.courseId===item.courseId){
-        return
+      if (this.courseId === item.courseId) {
+        this.toggleCourseShow = false;
+        return;
       }
-      if (index == 0) {
-        await this.nextCourses(item, type);
-
-        if (item.rebuild === 0) {
-          //未重修
-          this.$navTo.togo("/pages2/learn/details", {
-            id: item.courseId,
-            gradeId: item.gradeId,
-            goodsId: this.goodsId,
-            orderGoodsId: this.orderGoodsId,
-          });
-          return;
-        }
-        this.courseId = item.courseId;
-        this.originOnShow();
-        this.originMounted();
-      } else {
-        if (this.orderNum == 2) {
-          //学习顺序是从头到尾学习,没学完上一课不能学习下一课
-          let prevItem = this.courseList[index - 1]; //上一课
-          if (prevItem.stuAllNum == prevItem.secAllNum) {
-            await this.nextCourses(item, type);
-
-            if (item.rebuild === 0) {
-              //未重修
-              this.$navTo.togo("/pages2/learn/details", {
-                id: item.courseId,
-                gradeId: item.gradeId,
-                goodsId: this.goodsId,
-                orderGoodsId: this.orderGoodsId,
-              });
-              return;
-            }
-            this.courseId = item.courseId;
-            this.originOnShow();
-            this.originMounted();
-          } else {
-            uni.showToast({
+      if (this.orderNum == 2&&index!=0){
+         let prevItem = this.courseList[index - 1]; 
+         if (prevItem.stuAllNum + prevItem.recordNum < prevItem.secAllNum + prevItem.examNum) {
+           uni.showToast({
               icon: "none",
               title: "请按顺序学完上一课再学习这一课",
             });
-          }
-        } else {
-          await this.nextCourses(item, type);
-          if (item.rebuild === 0) {
-            //未重修
-            this.$navTo.togo("/pages2/learn/details", {
-              id: item.courseId,
-              gradeId: item.gradeId,
-              goodsId: this.goodsId,
-              orderGoodsId: this.orderGoodsId,
-            });
-            return;
-          }
-          this.courseId = item.courseId;
-          this.originOnShow();
-          this.originMounted();
-        }
+            return
+         }
       }
-    },
-    async nextCourses(item, type) {
-      this.vid = "";
-      this.hasStart = true;
-      await this.originUnload();
-
       if (type) {
         this.teacherIndex = 0;
         this.goodsTeacher.forEach((citem) => {
@@ -1205,6 +1154,16 @@ export default {
           }
         });
       }
+      this.toggleCourseShow = false;
+      this.courseId = item.courseId
+      this.originOnShow()
+    },
+    async nextCourses(item, type) {
+      this.vid = "";
+      this.hasStart = true;
+      await this.originUnload();
+
+      
       this.reStart = false;
       this.courseId = item.courseId;
       this.gradeId = item.gradeId;
@@ -1926,8 +1885,8 @@ export default {
       });
     },
     postStudyRecord(status = 0, sectionId = this.playSectionId) {
-      if(!this.refPlv){
-        return
+      if (!this.refPlv) {
+        return;
       }
       let currentTime = this.refPlv.playCurrentTime();
       let PlayDuration = this.refPlv.playVideoTime();
@@ -2224,7 +2183,7 @@ export default {
       this.nextSection();
     },
     playerError() {
-      console.log(46546)
+      console.log(46546);
     },
     //播放下一节
     nextSection() {