Tang 2 年 前
コミット
cfb4e60b1d

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

@@ -313,6 +313,7 @@ export default {
                 });
               } //PC端播放加密视频所需的授权凭证。
             });
+            self.$emit("videoScript", this.player); //抛出播放实例
             resolve();
           });
       });
@@ -578,6 +579,7 @@ export default {
   },
   beforeDestroy() {
     this.player.HTML5.video.removeEventListener("timeupdate", this.timeEvent); //监听器
+    this.$bus.$off("toPlay");
   }
 };
 </script>

+ 73 - 82
src/pages/course-detail/components/CourseTree.vue

@@ -34,12 +34,12 @@
               <div class="during">
                 {{ $tools.secondToDate(item1.durationTime) }}
               </div>
-              <template v-if="backSTATUS(item1)['name']">
+              <template v-if="BackSTATUS(item1)['name']">
                 <el-tag
                   size="mini"
-                  effect="dark"
-                  :type="backSTATUS(item1)['style']"
-                  >{{ backSTATUS(item1)["name"] }}</el-tag
+                  effect="light"
+                  :type="BackSTATUS(item1)['style']"
+                  >{{ BackSTATUS(item1)["name"] }}</el-tag
                 >
               </template>
               <el-tag
@@ -51,26 +51,14 @@
               >
             </template>
             <template v-else-if="item1.type == -1">
-              <el-tag
-                v-if="item1.learning == 1"
-                size="mini"
-                effect="light"
-                type="success"
-                >合格</el-tag
-              >
-              <el-tag
-                v-else-if="item1.learning == 0"
-                size="mini"
-                effect="light"
-                type="danger"
-                >不及格(需重考)</el-tag
-              ><el-tag
-                v-if="item1.rebuild > 0"
-                size="mini"
-                effect="light"
-                type="warning"
-                >待重测</el-tag
-              >
+              <template v-if="BackExamStatus(item1)['name']">
+                <el-tag
+                  size="mini"
+                  effect="light"
+                  :type="BackExamStatus(item1)['style']"
+                  >{{ BackExamStatus(item1)["name"] }}</el-tag
+                >
+              </template>
             </template>
             <el-tag
               v-else
@@ -116,12 +104,12 @@
                   <div class="during">
                     {{ $tools.secondToDate(item2.durationTime) }}
                   </div>
-                  <template v-if="backSTATUS(item2)['name']">
+                  <template v-if="BackSTATUS(item2)['name']">
                     <el-tag
                       size="mini"
-                      effect="dark"
-                      :type="backSTATUS(item2)['style']"
-                      >{{ backSTATUS(item2)["name"] }}</el-tag
+                      effect="light"
+                      :type="BackSTATUS(item2)['style']"
+                      >{{ BackSTATUS(item2)["name"] }}</el-tag
                     >
                   </template>
                   <el-tag
@@ -133,26 +121,14 @@
                   >
                 </template>
                 <template v-else-if="item2.type == -1">
-                  <el-tag
-                    v-if="item2.learning == 1"
-                    size="mini"
-                    effect="light"
-                    type="success"
-                    >合格</el-tag
-                  >
-                  <el-tag
-                    v-else-if="item2.learning == 0"
-                    size="mini"
-                    effect="light"
-                    type="danger"
-                    >不及格(需重考)</el-tag
-                  ><el-tag
-                    v-if="item2.rebuild > 0"
-                    size="mini"
-                    effect="light"
-                    type="warning"
-                    >待重测</el-tag
-                  >
+                  <template v-if="BackExamStatus(item2)['name']">
+                    <el-tag
+                      size="mini"
+                      effect="light"
+                      :type="BackExamStatus(item2)['style']"
+                      >{{ BackExamStatus(item2)["name"] }}</el-tag
+                    >
+                  </template>
                 </template>
                 <el-tag
                   v-else
@@ -200,12 +176,12 @@
                       <div class="during">
                         {{ $tools.secondToDate(item3.durationTime) }}
                       </div>
-                      <template v-if="backSTATUS(item3)['name']">
+                      <template v-if="BackSTATUS(item3)['name']">
                         <el-tag
                           size="mini"
-                          effect="dark"
-                          :type="backSTATUS(item3)['style']"
-                          >{{ backSTATUS(item3)["name"] }}</el-tag
+                          effect="light"
+                          :type="BackSTATUS(item3)['style']"
+                          >{{ BackSTATUS(item3)["name"] }}</el-tag
                         >
                       </template>
                       <el-tag
@@ -217,26 +193,14 @@
                       >
                     </template>
                     <template v-else-if="item3.type == -1">
-                      <el-tag
-                        v-if="item3.learning == 1"
-                        size="mini"
-                        effect="light"
-                        type="success"
-                        >合格</el-tag
-                      >
-                      <el-tag
-                        v-else-if="item3.learning == 0"
-                        size="mini"
-                        effect="light"
-                        type="danger"
-                        >不及格(需重考)</el-tag
-                      ><el-tag
-                        v-if="item3.rebuild > 0"
-                        size="mini"
-                        effect="light"
-                        type="warning"
-                        >待重测</el-tag
-                      >
+                      <template v-if="BackExamStatus(item3)['name']">
+                        <el-tag
+                          size="mini"
+                          effect="light"
+                          :type="BackExamStatus(item3)['style']"
+                          >{{ BackExamStatus(item3)["name"] }}</el-tag
+                        >
+                      </template>
                     </template>
                     <el-tag v-else size="mini" effect="dark">{{
                       getStudyStatus(item3)
@@ -319,18 +283,18 @@ export default {
         }
       };
     },
-    backSTATUS: function() {
+    BackSTATUS: function() {
       return function(item) {
         if (item.sectionType == 1) {
-          if (item.learning == 1) {
+          if (item.rebuild > 0) {
             return {
-              name: "已学完",
-              style: "success"
+              name: "待重修",
+              style: "danger"
             };
-          } else if (item.rebuild > 0) {
+          } else if (item.learning == 1) {
             return {
-              name: "待重修",
-              style: "warning"
+              name: "已学完",
+              style: "success"
             };
           }
         }
@@ -358,6 +322,27 @@ export default {
         return {};
       };
     },
+    BackExamStatus: function() {
+      return function(item) {
+        if (item.rebuild > 0) {
+          return {
+            name: "待重测",
+            style: "danger"
+          };
+        } else if (item.learing == 1) {
+          return {
+            name: "合格",
+            style: "success"
+          };
+        } else if (item.learing == 0) {
+          return {
+            name: "不及格(需重考)",
+            style: "danger"
+          };
+        }
+        return {};
+      };
+    },
     isActive: function() {
       return function(item) {
         return (
@@ -644,7 +629,7 @@ export default {
             gradeId: this.goodsData.gradeId,
             goodsId: this.goodsData.goodsId,
             courseId: this.courseList[0].courseId,
-            orderGoodsId:this.goodsData.orderGoodsId
+            orderGoodsId: this.goodsData.orderGoodsId
             // rebuild: this.rebuild
           })
           .then(res => {
@@ -713,7 +698,12 @@ export default {
           });
           return reject();
         }
-        if (item.type == -1 && item.doType != 1 && item.learning == 1) {
+        if (
+          item.type == -1 &&
+          item.doType != 1 &&
+          item.learning == 1 &&
+          !(item.rebuild > 0)
+        ) {
           this.$message.warning("考试已通过,请勿重复考试");
           return reject();
         }
@@ -738,6 +728,7 @@ export default {
     watchSection(item) {
       if (this.isActive(item)) return;
       this.$bus.$emit("toPlay", item);
+      this.$emit("backActiveSection", item);
       this.activeSection = item;
       let query = {
         gradeId: this.goodsData.gradeId,
@@ -856,7 +847,7 @@ export default {
         if (Ary.length == 0) {
           return true;
         } else {
-          return Ary.every(i => i.studyStatus == 1);
+          return Ary.every(i => i.studyStatus == 1 && !(i.rebuild > 0));
         }
       }
     },

+ 34 - 43
src/pages/course-detail/components/Notes.vue

@@ -2,7 +2,7 @@
   <div class="lecture-notes">
     <div class="lecture-notes__content clearfix">
       <div class="left-boxs">
-        <div class="textarea clearfix" v-if="!(isPlayRebuild > 0)">
+        <div class="textarea clearfix" v-if="!(activeSection.rebuild > 0)">
           <el-input
             resize="none"
             rows="3"
@@ -53,18 +53,7 @@
 
 <script>
 export default {
-  inject: ["getGoodsData"],
-  // props: [
-  //   "courseId",
-  //   "gradeId",
-  //   "goodsId",
-  //   "moduleId",
-  //   "chapterId",
-  //   "isPlayRebuild",
-  //   "vidzb",
-  //   "playSectionId",
-  //   "player",
-  // ],
+  inject: ["getGoodsData", "getPlayer", "getActiveSection"],
   data() {
     return {
       textareaNote: "",
@@ -75,9 +64,23 @@ export default {
   computed: {
     goodsData() {
       return this.getGoodsData();
+    },
+    player() {
+      return this.getPlayer();
+    },
+    activeSection() {
+      return this.getActiveSection();
+    }
+  },
+  watch: {
+    //因为刚开始获取不到goodsData的数据 所以需要监听
+    activeSection: function(newVal, oldVal) {
+      if (newVal) {
+        this.getNoteList();
+      }
     }
   },
-  created() {
+  mounted() {
     this.getNoteList();
   },
   methods: {
@@ -88,13 +91,14 @@ export default {
       let self = this;
       self.noteList = [];
       let data = {
-        courseId: this.goodsData.courseId,
         gradeId: this.goodsData.gradeId,
-        goodsId: this.goodsData.goodsId
+        goodsId: this.goodsData.goodsId,
+        orderGoodsId: this.goodsData.orderGoodsId,
+        courseId: this.activeSection.courseId,
+        moduleId: this.activeSection.moduleId,
+        chapterId: this.activeSection.chapterId,
+        sectionId: this.activeSection.sectionId
       };
-      // if (this.playSectionId > 0) {
-      //   data.sectionId = this.playSectionId;
-      // }
       this.$request.noteList(data).then(res => {
         self.noteList = res.rows;
         self.noteTotal = res.total;
@@ -102,13 +106,6 @@ export default {
     },
     noteSubmit() {
       let self = this;
-      if (!(this.playSectionId > 0)) {
-        this.$message({
-          message: "目前无播放视频",
-          type: "warning"
-        });
-        return;
-      }
       if (!this.textareaNote) {
         this.$message({
           message: "请输入内容",
@@ -116,13 +113,6 @@ export default {
         });
         return;
       }
-      if (!this.gradeId) {
-        this.$message({
-          message: "暂无班级数据",
-          type: "warning"
-        });
-        return;
-      }
       var polyvPlayerContext = this.player;
       let noteDate = this.$tools.getZeroTime();
       let noteSecond = polyvPlayerContext.j2s_getCurrentTime();
@@ -140,15 +130,16 @@ export default {
         }
       }
       let data = {
-        gradeId: this.gradeId,
-        goodsId: this.goodsId,
-        sectionId: this.playSectionId,
-        courseId: this.courseId,
+        orderGoodsId: this.goodsData.orderGoodsId,
+        gradeId: this.goodsData.gradeId,
+        goodsId: this.goodsData.goodsId,
+        courseId: this.activeSection.courseId,
+        moduleId: this.activeSection.moduleId,
+        chapterId: this.activeSection.chapterId,
+        sectionId: this.activeSection.sectionId,
         noteText: this.textareaNote,
         noteDate: noteDate,
-        noteSecond: noteSecond,
-        moduleId: this.moduleId,
-        chapterId: this.chapterId
+        noteSecond: noteSecond
       };
       this.$request.postNote(data).then(res => {
         this.$message({
@@ -356,9 +347,9 @@ export default {
   }
 }
 /deep/ textarea {
-  background: #65696d;
-  color: #c7c7c7;
-  border-color: transparent;
+  // background: #65696d;
+  // color: #c7c7c7;
+  // border-color: transparent;
 }
 .user_notes {
   border-bottom: 1px solid #555;

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

@@ -1,7 +1,7 @@
 <template>
   <div id="coreContent">
     <div class="left_box">
-      <video-cy></video-cy>
+      <video-cy ref="video_cy" @videoScript="videoScript"></video-cy>
     </div>
     <div class="right_box">
       <el-tabs stretch v-model="courseTabIndex">
@@ -16,7 +16,7 @@
           </div>
           <!-- 章节目录 -->
           <template v-if="tab.name == '1'">
-            <course-tree ref="courseTree"> </course-tree>
+            <course-tree ref="courseTree" @backActiveSection="backActiveSection"> </course-tree>
           </template>
           <!-- 重修目录 -->
           <!-- <template v-if="tab.name == '2' && rebuildCourseList.length">
@@ -34,9 +34,9 @@
           <template v-if="tab.name == '3'">
             <answer-questions ref="answerQuestions"></answer-questions>
           </template>
-          <!-- <template v-if="tab.name == '4'">
+          <template v-if="tab.name == '4'">
             <Notes ref="notes"></Notes>
-          </template> -->
+          </template>
           <template v-if="tab.name == '5'">
             <hand-out
               ref="handOut"
@@ -67,6 +67,12 @@ export default {
     dataReview
   },
   inject: ["getGoodsData"],
+  provide() {
+    return {
+      getPlayer: () => this.player,
+      getActiveSection: () => this.activeSection,
+    };
+  },
   data() {
     return {
       courseTabIndex: "",
@@ -88,7 +94,9 @@ export default {
           label: "讲义"
         }
       ],
-      gradeDetail: {} //班级详情
+      gradeDetail: {}, //班级详情
+      player: null, //视频播放器实例
+      activeSection: {} //当前选中节数据
     };
   },
   computed: {
@@ -272,10 +280,12 @@ export default {
           .getRebuildCourse({
             goodsId: this.goodsData.goodsId,
             rebuild: 1,
-            gradeId: this.goodsData.gradeId
+            gradeId: this.goodsData.gradeId,
+            orderGoodsId:this.goodsData.orderGoodsId
           })
           .then(async res => {
             if (res.data.length > 0) {
+              console.log(res.data,'resda')
               // this.rebuildCourseList = [res.data[0]];
               this.menuTab.splice(1, 0, {
                 name: "2",
@@ -291,7 +301,15 @@ export default {
       });
     },
     //讲义模块返回
-    backSwitchOfficeData() {}
+    backSwitchOfficeData() {},
+    //视频播放实例
+    videoScript(player) {
+      this.player = player;
+    },
+    backActiveSection(item) {
+      console.log(item,'ttt')
+      this.activeSection = item;
+    }
   }
 };
 </script>