Tang 2 年之前
父節點
當前提交
f33d7c65c9

+ 1 - 0
src/components/videoCy/index.vue

@@ -505,6 +505,7 @@ export default {
             if (status > 0) {
               this.openPhotoStatus = 0;
               this.$message.success("学习完成");
+              this.$bus.$emit("BackVideoFunc", this.activeSection);
               resolve(false);
             }
             if (this.openPhotoStatus === 1) {

+ 80 - 16
src/pages/course-detail/components/CourseTree.vue

@@ -225,6 +225,12 @@ export default {
       default: () => {
         return 0;
       }
+    },
+    activeSection: {
+      type: Object,
+      default: () => {
+        return {};
+      } //当前节数据
     }
   },
   data() {
@@ -232,7 +238,6 @@ export default {
       courseList: [], //商品的课程列表
       courseDataList: [], //课程内容
       allSectionList: [], //商品下所有节和试卷
-      activeSection: {}, //当前节数据
       nowTime: 0 //当前时间
     };
   },
@@ -425,13 +430,20 @@ export default {
     this.init();
     this.nowTime = Number(new Date().getTime() / 1000).toFixed(0);
   },
+  mounted() {
+    this.$bus.$on("BackVideoFunc", () => {
+      this.BackVideoFunc(); //已学完,重新定位
+    });
+  },
   methods: {
     async init() {
       await this.getGoodsCourseList(); //获取商品课程列表
       await this.getCourseData(this.courseList[0].courseId); //获取课程内容
       await this.getAllSectionList(); //获取所有节列表
       /**播放逻辑 */
-      this.playBackLogic();
+      if (!(this.rebuild > 0)) {
+        this.playBackLogic();
+      }
     },
     //获取商品课程列表
     getGoodsCourseList() {
@@ -507,8 +519,8 @@ export default {
               moduleId: item.moduleId,
               gradeId: this.goodsData.gradeId,
               courseId: this.courseDataList[0].courseId,
-              orderGoodsId: this.goodsData.orderGoodsId
-              // rebuild: isRebuild ? 1 : undefined
+              orderGoodsId: this.goodsData.orderGoodsId,
+              rebuild: this.rebuild
             })
             .then(res => {
               this.$set(item, "showStatus", true);
@@ -564,7 +576,7 @@ export default {
               chapterId: item.chapterId,
               gradeId: this.goodsData.gradeId,
               courseId: item.courseId,
-              // rebuild: isRebuild ? 1 : undefined,
+              rebuild: this.rebuild,
               moduleId: item.moduleId,
               orderGoodsId: this.goodsData.orderGoodsId
             })
@@ -613,8 +625,8 @@ export default {
             gradeId: this.goodsData.gradeId,
             goodsId: this.goodsData.goodsId,
             courseId: this.courseList[0].courseId,
-            orderGoodsId: this.goodsData.orderGoodsId
-            // rebuild: this.rebuild
+            orderGoodsId: this.goodsData.orderGoodsId,
+            rebuild: this.rebuild
           })
           .then(res => {
             let ary = res.data.map(i => {
@@ -651,7 +663,7 @@ export default {
         await this.openChapter(item); //展开章
       } else {
         try {
-          await this.waitCheckStatus(item); //检查是否可以继续执行
+          // await this.waitCheckStatus(item); //检查是否可以继续执行
           if (item.type == 3) {
             if (item.sectionType == 1) {
               this.watchSection(item);
@@ -682,12 +694,7 @@ export default {
           });
           return reject();
         }
-        if (
-          item.type == -1 &&
-          item.doType != 1 &&
-          item.learning == 1 &&
-          !(item.rebuild > 0)
-        ) {
+        if (item.type == -1 && item.doType != 1 && item.learning == 1) {
           this.$message.warning("考试已通过,请勿重复考试");
           return reject();
         }
@@ -712,8 +719,7 @@ export default {
     watchSection(item) {
       if (this.isActive(item)) return;
       this.$bus.$emit("toPlay", item);
-      this.$emit("backActiveSection", item);
-      this.activeSection = item;
+      this.$emit("update:activeSection", item);
       let query = {
         gradeId: this.goodsData.gradeId,
         orderGoodsId: this.goodsData.orderGoodsId,
@@ -953,7 +959,65 @@ export default {
         var ary = this.courseDataList.find(i => i.chapterId == item.chapterId);
         await this.openChapter(ary);
       }
+    },
+    //已学完,重新定位
+    BackVideoFunc() {
+      if (this.businessData.goodsLearningOrder == 2) {
+        let ary = this.allSectionList.find(i => i.studyStatus != 1);
+        if (ary) {
+          if (ary.type != 3) {
+            this.$confirm(
+              "本章视频已学习完成,继续进行下一个考试?",
+              "温馨提示",
+              {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+              }
+            )
+              .then(() => {
+                // this.openMenu(ary);
+                // this.unfoldFunc(ary);
+              })
+              .catch(() => {});
+          } else {
+            this.$confirm("当前视频已学完,继续学习下一个视频?", "温馨提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning"
+            })
+              .then(() => {
+                // this.openMenu(ary);
+                // this.unfoldFunc(ary);
+              })
+              .catch(() => {});
+          }
+        } else {
+          this.$alert(
+            "恭喜您课程学习全部完成,教务会在1-3个工作日内完成学习初审,请耐心等待。",
+            "温馨提示",
+            {
+              confirmButtonText: "确定",
+              showClose: false,
+              callback: action => {
+                if (action == "confirm") {
+                  this.jumpPage();
+                }
+              }
+            }
+          );
+        }
+      }
+    },
+    //回到个人中心
+    jumpPage() {
+      this.$router.replace({
+        path: "person-center/my-course"
+      });
     }
+  },
+  beforeDestroy() {
+    this.$bus.$off("BackVideoFunc");
   }
 };
 </script>

+ 7 - 10
src/pages/course-detail/components/coreContent.vue

@@ -1,7 +1,10 @@
 <template>
   <div id="coreContent">
     <div class="left_box">
-      <video-cy ref="video_cy" @videoScript="videoScript"></video-cy>
+      <video-cy
+        ref="video_cy"
+        @videoScript="videoScript"
+      ></video-cy>
     </div>
     <div class="right_box">
       <el-tabs stretch v-model="courseTabIndex">
@@ -16,11 +19,11 @@
           </div>
           <!-- 章节目录 -->
           <template v-if="tab.name == '1'">
-            <course-tree @backActiveSection="backActiveSection"> </course-tree>
+            <course-tree ref="courseTree" :activeSection.sync="activeSection"> </course-tree>
           </template>
           <!-- 重修目录 -->
           <template v-if="tab.name == '2'">
-            <course-tree @backActiveSection="backActiveSection" :rebuild="1">
+            <course-tree :activeSection.sync="activeSection" :rebuild="1">
             </course-tree>
           </template>
           <template v-if="tab.name == '3'">
@@ -124,6 +127,7 @@ export default {
       }
       // await this.confirmInfoDetail(); //判断开通信息推送是否成功
       await this.getRebuildCourse(); //获取重修列表
+      this.courseTabIndex = "1";
     },
     //提交完资料返回判断是否已开班
     getGradeInfo() {
@@ -281,9 +285,6 @@ export default {
                 name: "2",
                 label: "重修目录"
               });
-              this.courseTabIndex = "2";
-            } else {
-              this.courseTabIndex = "1";
             }
             resolve();
           })
@@ -299,10 +300,6 @@ export default {
     videoScript(player) {
       this.player = player;
     },
-    backActiveSection(item) {
-      console.log(item, "ttt");
-      this.activeSection = item;
-    }
   }
 };
 </script>

+ 4 - 0
src/pages/course-detail/index.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="course-detail">
     <Header></Header>
+    <el-button @click="test">测试</el-button>
     <section class="section_box">
       <!-- 面包屑START -->
       <div class="breadcrumb">
@@ -59,6 +60,9 @@ export default {
     this.getInit();
   },
   methods: {
+    test() {
+      this.$bus.$emit("BackVideoFunc", {});
+    },
     async getInit() {
       await this.getGoodsData(); //获取商品详情
       await this.courseBusiness(); //获取培训项目详情