谢杰标 2 年之前
父节点
当前提交
a8d08f5d42

+ 11 - 11
components/course/answerBox.vue

@@ -151,17 +151,17 @@ export default {
       });
     },
     delAnswer(answerId) {
-      let self = this;
-      let data = {
-        answerId: answerId,
-        status: -1,
-        orderGoodsId: this.params.orderGoodsId,
-      };
-      this.$api.delAnswer(data).then((res) => {
-        if (res.data.code == 200) {
-          self.getAnswerList();
-        }
-      });
+      this.$api
+        .delAnswer({
+          answerId: answerId,
+          status: -1,
+          orderGoodsId: this.params.orderGoodsId,
+        })
+        .then((res) => {
+          if (res.data.code == 200) {
+            this.getAnswerList();
+          }
+        });
     },
     clearCtx() {
       this.placeholder = "您可以在这里输入答疑内容";

+ 55 - 172
components/course/courseChapter.vue

@@ -25,23 +25,16 @@
           <courseSection
             ref="ChapterSection"
             :isLive="isLive"
-            :orderGoodsId="orderGoodsId"
             :sectionMaxNum="sectionMaxNum"
             :preItem="list[indexM - 1] || preItem"
-            :learningOrder="learningOrder"
-            :courseId="courseId"
             @playEnd="refreshList($event)"
-            :goodsId="goodsId"
-            :sectionItem="sectionItem"
             :isBuy="isBuy"
             :nextMenuItem="findNextSection(indexM)"
             :isRebuild="isRebuild"
-            :gradeId="gradeId"
             :menuItem="itemM"
             :levelId="levelId + '-' + itemM.sectionId"
             :testType="2"
             :ChapterSectionExam="sectionExam"
-            :menuAllList="menuAllList"
           ></courseSection>
           <!-- @togoBack='togoBack()' -->
           <u-line v-if="indexM < list.length - 1"></u-line>
@@ -95,19 +88,14 @@ import { mapGetters, mapMutations } from "vuex";
 import courseSection from "@/components/course/courseSection.vue";
 export default {
   name: "courseChapter",
+  inject: ["paramsFn"],
   props: {
     isLive: false,
-    orderGoodsId: {
-      default: 0,
-    },
+
     preItem: {
       default: undefined,
     },
-    learningOrder: {
-      //是否设置学习顺序 1 章节顺序 0不设置 2从头学到尾顺序
-      type: Number,
-      default: 0,
-    },
+
     needOpen: {
       //是否默认展开
       type: Boolean,
@@ -125,22 +113,11 @@ export default {
       type: String,
       default: "",
     },
-    goodsId: {
-      type: Number,
-      default: 0,
-    },
-    courseId: {
-      type: Number,
-      default: 0,
-    },
     isRebuild: {
       type: Boolean,
       default: false,
     },
-    gradeId: {
-      type: Number,
-      default: 0,
-    },
+
     sectionMaxNum: {
       default: undefined,
     },
@@ -149,15 +126,6 @@ export default {
       type: [Number, String],
       default: 0,
     },
-    menuAllList: {
-      // 课程所有子目录结构列表
-      type: Array,
-      default: () => [],
-    },
-    sectionItem: {
-      type: Object,
-      default: () => {},
-    },
   },
   components: {
     courseSection,
@@ -171,14 +139,6 @@ export default {
       sectionExam: [],
     };
   },
-  onLoad() {},
-  created() {},
-  mounted() {},
-  onPageShow() {
-    if (this.isBuy) {
-      this.refreshList({ isRebuild: this.isRebuild });
-    }
-  },
   methods: {
     ...mapMutations(["updateChapterOpen"]),
     // 调用节的方法
@@ -247,9 +207,6 @@ export default {
       });
     },
     gradeCheckGoodsStudy(id) {
-      let moduleId = this.menuItem.moduleId || 0;
-      let chapterId = this.menuItem.chapterId || 0;
-      let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
       return new Promise((resolve) => {
         this.$api
           .gradeCheckGoodsStudy({
@@ -305,7 +262,7 @@ export default {
           return;
         }
       }
-      if (this.learningOrder == 1) {
+      if (this.params.orderNum == 1) {
         if (this.canLearn) {
           let num = await this.bankRecordDoNum(item.typeId);
           //有次数限制
@@ -374,7 +331,7 @@ export default {
             title: "请按顺序学完视频课程再进行练习和测试",
           });
         }
-      } else if (this.learningOrder == 2) {
+      } else if (this.params.orderNum == 2) {
         //  !item.rebuild
         let rows = this.menuAllList;
         const index = this.menuAllList.findIndex((e) => {
@@ -566,16 +523,9 @@ export default {
       });
     },
     async openChapter(item) {
-      console.log(
-        "🚀 ~ file: courseChapter.vue:571 ~ openChapter ~ item:",
-        item
-      );
-      // 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);
         //获取章下面所有节试卷列表-course/sectionExamList
-
         this.$method.isLogin() &&
           (await this.$api
             .reSectionExamList({
@@ -589,19 +539,7 @@ export default {
                 this.sectionExam = res.data.data || [];
               }
             }));
-
-        if (this.isBuy) {
-          let moduleId = item.moduleId ? item.moduleId : 0;
-          let chapterId = item.chapterId || item.id;
-          if (this.isRebuild) {
-            this.getReSectionList(chapterId, item.courseId, moduleId);
-          } else {
-            this.getBuySectionList(chapterId, item.courseId, moduleId);
-            //				this.getMenuExamList(item.id,item.courseId,moduleId)
-          }
-        } else {
-          this.getSectionList(item.chapterId || item.menuId);
-        }
+        this.getSectionList();
       }
     },
 
@@ -619,123 +557,44 @@ export default {
           }
         });
     },
-    getSectionList(chapterId) {
-      let self = this;
-      //   url: '/app/common/course/sectionList/'+data,
-      this.$api.sectionList(chapterId).then((res) => {
+    getSectionList() {
+      const fn = this.isBuy ? "reSectionList" : "sectionList";
+      let chapterId = this.menuItem.chapterId || this.menuItem.menuId;
+      this.$api[fn](
+        this.isBuy
+          ? {
+              chapterId,
+              gradeId: this.gradeId,
+              courseId: this.courseId,
+              moduleId: this.menuItem.moduleId || 0,
+              orderGoodsId: this.orderGoodsId,
+              rebuild: +this.isRebuild,
+            }
+          : chapterId
+      ).then((res) => {
         if (res.data.code == 200) {
           for (let i = 0; i < res.data.data.length; i++) {
             let item = res.data.data[i];
+            item.courseId = this.courseId;
             item.id = item.sectionId;
             item.menuType = 3;
-            //判断是否试听
-            item.tryListen = false;
-            if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
-              item.tryListen = true;
-            }
           }
-
           let newArr = res.data.data.filter((item) => {
             return item.type != 2;
           });
-          this.canLearn = newArr.every((item) => {
-            if (item.learning == 1) {
-              return true;
-            } else {
-              return false;
-            }
-          });
-          self.list = res.data.data;
+          this.canLearn = newArr.every((item) => item.learning == 1);
+          this.list = res.data.data;
         }
       });
     },
-    getReSectionList(chapterId, courseId, moduleId) {
-      let self = this;
-      this.$api
-        .reSectionList({
-          chapterId: chapterId,
-          gradeId: this.gradeId,
-          courseId: courseId,
-          rebuild: 1,
-          moduleId: moduleId,
-          orderGoodsId: this.orderGoodsId,
-        })
-        .then((res) => {
-          if (res.data.code == 200) {
-            for (let i = 0; i < res.data.data.length; i++) {
-              let item = res.data.data[i];
-              item.id = item.sectionId;
-              item.courseId = courseId;
-              item.menuType = 3;
-              //判断是否试听
-              item.tryListen = false;
-              if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
-                item.tryListen = true;
-              }
-            }
-            let newArr = res.data.data.filter((item) => {
-              return item.type != 2;
-            });
-            this.canLearn = newArr.every((item) => {
-              if (item.learning == 1) {
-                return true;
-              } else {
-                return false;
-              }
-            });
-            self.list = res.data.data;
-          }
-        });
-    },
-    getBuySectionList(chapterId, courseId, moduleId) {
-      let self = this;
-      // /course/sectionList
-      this.$api
-        .reSectionList({
-          chapterId: chapterId,
-          gradeId: this.gradeId,
-          courseId: courseId,
-          moduleId: moduleId,
-          orderGoodsId: this.orderGoodsId,
-        })
-        .then((res) => {
-          if (res.data.code == 200) {
-            for (let i = 0; i < res.data.data.length; i++) {
-              let item = res.data.data[i];
-              item.courseId = courseId;
-              item.id = item.sectionId;
-              item.menuType = 3;
-              //判断是否试听
-              item.tryListen = false;
-              if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
-                item.tryListen = true;
-              }
-            }
-            let newArr = res.data.data.filter((item) => {
-              return item.type != 2;
-            });
-            this.canLearn = newArr.every((item) => {
-              if (item.learning == 1) {
-                return true;
-              } else {
-                return false;
-              }
-            });
-            self.list = res.data.data;
-            // console.log('=======节列表==', this.list);
-          }
-        });
-    },
   },
   computed: {
     ...mapGetters(["goodsAuditionConfigIdList"]),
     learnStatus() {
-      if (!this.isBuy) {
+      if (!this.isBuy || !this.sectionItem) {
         return;
       }
       let { id, courseId, moduleId } = this.menuItem;
-      // console.log(this.menuItem, id, courseId, moduleId, "this.menuItem");
-      // console.log(this.sectionItem,)
       if (
         this.sectionItem.courseId == courseId &&
         this.sectionItem.moduleId == (moduleId || 0) &&
@@ -754,15 +613,39 @@ export default {
       });
       return isAllLearn ? 1 : -1;
     },
+    params() {
+      return this.paramsFn([
+        "orderGoodsId",
+        "gradeId",
+        "courseId",
+        "sectionItem",
+        "menuAllList",
+        "orderNum",
+        "goodsId",
+      ]);
+    },
+    courseId() {
+      return this.params.courseId;
+    },
+    gradeId() {
+      return this.params.gradeId;
+    },
+    orderGoodsId() {
+      return this.params.orderGoodsId;
+    },
+    sectionItem() {
+      return this.params.sectionItem;
+    },
+    menuAllList() {
+      return this.params.menuAllList;
+    },
+    goodsId() {
+      return this.params.goodsId;
+    },
   },
   watch: {
     courseId: {
       handler(val) {
-        console.log(
-          "🚀 ~ file: courseChapter.vue:749 ~ handler ~ val:",
-          val,
-          this.needOpen
-        );
         if (this.needOpen) {
           this.down = true;
           this.list = [];

+ 34 - 54
components/course/courseModule.vue

@@ -22,22 +22,15 @@
       <view v-for="(itemM, indexM) in list" :key="indexM">
         <courseChapter
           v-if="itemM.type != 2"
-          :orderGoodsId="orderGoodsId"
-          :isLive="isLive"
+          :isLive="false"
           :preItem="list[indexM - 1] || preItem"
           :sectionMaxNum="sectionMaxNum"
           :needOpen="itemM.needOpen"
           @toDo="toDo($event)"
-          :courseId="courseId"
-          :learningOrder="learningOrder"
-          :goodsId="goodsId"
           :isBuy="isBuy"
-          :gradeId="gradeId"
           :isRebuild="isRebuild"
           :menuItem="itemM"
           :levelId="levelId + '-' + itemM.chapterId"
-          :menuAllList="menuAllList"
-          :sectionItem="sectionItem"
         >
         </courseChapter>
         <u-line v-if="indexM < list.length - 1"></u-line>
@@ -88,19 +81,11 @@
 import courseChapter from "@/components/course/courseChapter.vue";
 export default {
   name: "courseModule",
+  inject: ["paramsFn"],
   props: {
-    isLive: false,
-    orderGoodsId: {
-      default: 0,
-    },
     preItem: {
       default: undefined,
     },
-    learningOrder: {
-      //是否设置学习顺序 1 章节顺序 0不设置 2从头学到尾顺序
-      type: Number,
-      defaule: 0,
-    },
     needOpen: {
       //是否默认展开
       type: Boolean,
@@ -110,50 +95,23 @@ export default {
       type: Object,
       default: {},
     },
-    goodsId: {
-      type: Number,
-      default: 0,
-    },
-    courseId: {
+    levelId: {
       type: [Number, String],
-      default: 0,
+      default: "",
     },
     isBuy: {
       //是否是已购买商品
       type: Boolean,
       default: false,
     },
-    levelId: {
-      type: [Number, String],
-      default: "",
-    },
     isRebuild: {
       //是否重修目录
       type: Boolean,
       default: false,
     },
-    gradeId: {
-      //重修需要班级ID
-      type: Number,
-      default: 0,
-    },
     sectionMaxNum: {
       default: undefined,
     },
-    // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
-    goodsType: {
-      type: [Number, String],
-      default: 0,
-    },
-    menuAllList: {
-      // 课程所有子目录结构列表
-      type: Array,
-      default: () => [],
-    },
-    sectionItem: {
-      type: Object,
-      default: () => {},
-    },
   },
   components: {
     courseChapter,
@@ -170,7 +128,6 @@ export default {
     },
     openModule(item) {
       this.down = !this.down;
-      console.log(this.down, 789);
       if (!this.down && this.list.length == 0) {
         if (this.isBuy) {
           if (this.isRebuild) {
@@ -216,7 +173,6 @@ export default {
         });
     },
     getBuyChapterList(moduleId, courseId) {
-      console.log(moduleId, courseId, "moduleId, courseId");
       // course/chapterList
       this.$api
         .reChapterList({
@@ -257,7 +213,7 @@ export default {
       if (item.doType === 2 && item.learning == 1) {
         return;
       }
-      if (this.learningOrder == 2) {
+      if (this.params.orderNum == 2) {
         let newRows = [];
         newRows = this.menuAllList.filter((e) => e.moduleId == moduleId);
         let isAllLearn = newRows.every((item) => {
@@ -320,6 +276,9 @@ export default {
   },
   computed: {
     learnStatus() {
+      if (!this.isBuy || !this.sectionItem) {
+        return -2;
+      }
       let { id, courseId } = this.menuItem;
       if (
         this.sectionItem.courseId == courseId &&
@@ -335,15 +294,36 @@ export default {
       });
       return isAllLearn ? 1 : -1;
     },
+    params() {
+      return this.paramsFn([
+        "orderGoodsId",
+        "gradeId",
+        "courseId",
+        "sectionItem",
+        "menuAllList",
+        "orderNum",
+      ]);
+    },
+    courseId() {
+      return this.params.courseId;
+    },
+    gradeId() {
+      return this.params.gradeId;
+    },
+    orderGoodsId() {
+      return this.params.orderGoodsId;
+    },
+    sectionItem() {
+      return this.params.sectionItem;
+    },
+    menuAllList() {
+      return this.params.menuAllList;
+    },
   },
   watch: {
     courseId: {
       handler(val) {
-        console.log(
-          "🚀 ~ file: courseModule.vue:346 ~ handler ~ val:",
-          this.sectionItem,
-          this.menuItem
-        );
+        if (!this.isBuy || !this.sectionItem) return;
         if (this.sectionItem.moduleId == this.menuItem.menuId) {
           this.down = true;
           this.list = [];

+ 66 - 87
components/course/courseSection.vue

@@ -116,7 +116,7 @@
         <u-icon name="arrow-right" color="#498AFE" size="28"></u-icon>
       </view>
     </view>
-    <view v-if="menuItem.tryListen && !isBuy" class="tryBox"> 试看 </view>
+    <view v-if="isTryListen" class="tryBox"> 试看 </view>
   </view>
 </template>
 
@@ -124,27 +124,13 @@
 import { mapGetters } from "vuex";
 export default {
   name: "courseSection",
+  inject: ["paramsFn"],
   props: {
     isLive: false, //是否是直播课
-    orderGoodsId: {
-      default: 0,
-    },
     preItem: {
       default: undefined,
     },
-    learningOrder: {
-      //是否设置学习顺序 1 章节顺序 0不设置 2从头学到尾顺序
-      type: Number,
-      default: 0,
-    },
-    courseId: {
-      type: Number,
-      default: 0,
-    },
-    goodsId: {
-      type: Number,
-      default: 0,
-    },
+
     menuItem: {
       type: Object,
       default: {},
@@ -161,10 +147,7 @@ export default {
       type: Boolean,
       default: false,
     },
-    gradeId: {
-      type: Number,
-      default: 0,
-    },
+
     nextMenuItem: {
       type: Object,
       default: () => {
@@ -184,17 +167,6 @@ export default {
       type: Number,
       default: 0,
     },
-    menuAllList: {
-      // 课程所有子目录结构列表
-      type: Array,
-      default: () => [],
-    },
-    sectionItem: {
-      type: Object,
-      default: () => {
-        return {};
-      },
-    },
   },
   watch: {
     menuItem(val) {
@@ -232,6 +204,14 @@ export default {
   },
   mounted() {
     this.nowTime = Number(new Date().getTime() / 1000).toFixed(0);
+
+    this.isBuy &&
+      uni.$on("playEnd", () => {
+        console.log("结束了");
+        if (this.isActive) {
+          this.menuItem.learning = 1;
+        }
+      });
   },
   methods: {
     isLast() {
@@ -322,22 +302,6 @@ export default {
           "&type=2",
       });
     },
-    studyRecordMenuAllList() {
-      return new Promise((resolve) => {
-        this.$api
-          .studyRecordMenuAllList({
-            courseId: this.courseId,
-            gradeId: this.gradeId,
-            goodsId: this.goodsId,
-            orderGoodsId: this.orderGoodsId,
-          })
-          .then((res) => {
-            if (res.data.code == 200) {
-              resolve(res.data.data);
-            }
-          });
-      });
-    },
     gradeCheckGoodsStudy() {
       return new Promise((resolve) => {
         this.$api
@@ -376,7 +340,7 @@ export default {
       if (this.$method.isGoLogin()) {
         return;
       }
-      if (this.menuItem.id == this.playSectionId) {
+      if (this.menuItem.id == this.sectionId) {
         return;
       }
       this.clickLock = true;
@@ -384,7 +348,6 @@ export default {
       if (this.learningOrder == 2 && !this.isLive) {
         //要按从头到尾顺序学习, 且不是重修课程
         if (this.preItem) {
-          // let rows = await this.studyRecordMenuAllList();
           let rows = this.menuAllList;
           let newRows = [];
           for (let i = 0; i < rows.length; i++) {
@@ -439,21 +402,15 @@ export default {
       });
     },
     async playVideo() {
-      if (this.menuItem.sectionType == 1 || this.menuItem.sectionType == 3) {
-        //1视频 3回放
-        if (!this.isBuy) {
-          //非购买
-          if (!this.menuItem.tryListen) {
-            //不允许试听
-            this.clickLock = false;
-            return;
-          } else {
-            this.menuItem.courseId = this.courseId;
-            uni.$emit("getSection", this.menuItem);
-            return;
-          }
+      if (!this.isBuy) {
+        if (this.isTryListen) {
+          uni.$emit("getSection", this.menuItem);
         }
-
+        //非购买
+        this.clickLock = false;
+        return;
+      }
+      if (this.menuItem.sectionType == 1 || this.menuItem.sectionType == 3) {
         let learnNum = await this.goodsTodayStudySectionNum();
         let hasLearn = await this.gradeCheckGoodsStudy();
 
@@ -516,26 +473,13 @@ export default {
           });
           return;
         }
-        if (this.playSectionId > 0) {
-          //切换视频
-          let oldSectionId = this.playSectionId;
-          uni.$emit("changeSection", oldSectionId);
-        }
         // console.log('===设置播放的节IDthis.menuItem,', this.menuItem, this.playId);
         //设置播放的节ID
         this.$store.commit("updatePlayNextId", this.playId);
-        uni.$emit("levelId", this.levelId);
         uni.$emit("getSection", this.menuItem);
         uni.$emit("isRebuild", this.isRebuild);
       }
       if (this.menuItem.sectionType == 2) {
-        //直播
-        if (!this.isBuy) {
-          //非购买
-          this.clickLock = false;
-          return;
-        }
-
         let learnNum = await this.goodsTodayStudySectionNum();
         let hasLearn = await this.gradeCheckGoodsStudy();
 
@@ -641,29 +585,64 @@ export default {
     },
   },
   computed: {
-    ...mapGetters(["playSectionId", "userInfo", "liveLast", "config"]),
+    ...mapGetters(["userInfo", "liveLast", "config"]),
     isActive() {
+      if (!this.isBuy || !this.sectionItem) {
+        return false;
+      }
       let moduleId = this.menuItem.moduleId || 0;
       let chapterId = this.menuItem.chapterId || 0;
       let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
       let moduleId1 = this.sectionItem.moduleId || 0;
       let chapterId1 = this.sectionItem.chapterId || 0;
       let sectionId1 = this.sectionItem.sectionId || this.sectionItem.menuId;
-      console.log(
-        "isActive",
-        moduleId,
-        moduleId1,
-        chapterId,
-        chapterId1,
-        sectionId,
-        sectionId1
-      );
       return (
         moduleId == moduleId1 &&
         chapterId == chapterId1 &&
         sectionId == sectionId1
       );
     },
+    params() {
+      return this.paramsFn([
+        "orderGoodsId",
+        "gradeId",
+        "courseId",
+        "sectionItem",
+        "menuAllList",
+        "orderNum",
+        "goodsId",
+        "sectionId",
+        "listenConfigList",
+      ]);
+    },
+    courseId() {
+      return this.params.courseId;
+    },
+    gradeId() {
+      return this.params.gradeId;
+    },
+    orderGoodsId() {
+      return this.params.orderGoodsId;
+    },
+    sectionItem() {
+      return this.params.sectionItem;
+    },
+    menuAllList() {
+      return this.params.menuAllList;
+    },
+    goodsId() {
+      return this.params.goodsId;
+    },
+    sectionId() {
+      return this.params.sectionId;
+    },
+    isTryListen() {
+      let { listenConfigList } = this.params;
+      return (
+        listenConfigList &&
+        listenConfigList.find((e) => e.sectionId == this.menuItem.sectionId)
+      );
+    },
   },
 };
 </script>

+ 43 - 91
components/course/courseTree.vue

@@ -5,42 +5,28 @@
         <!--模块 -->
         <view v-if="item.type == 1">
           <courseModule
-            :orderGoodsId="orderGoodsId"
             :sectionMaxNum="sectionMaxNum"
             :needOpen="sectionItem.moduleId == item.menuId"
-            :courseId="courseId"
             :preItem="menuList[index - 1]"
-            :learningOrder="learningOrder"
-            :goodsId="goodsId"
-            :gradeId="gradeId"
-            :isBuy="true"
+            :isBuy="isBuy"
             :menuItem="item"
             :levelId="item.menuId"
-            :goodsType="1"
-            :menuAllList="menuAllList"
-            :sectionItem="sectionItem"
+            :goodsType="goodsType"
             :isRebuild="isRebuild"
           ></courseModule
         ></view>
         <!--章 -->
         <view v-if="item.type == 2">
           <courseChapter
-            :orderGoodsId="orderGoodsId"
             :sectionMaxNum="sectionMaxNum"
             :needOpen="
               !sectionItem.moduleId && sectionItem.chapterId == item.menuId
             "
-            :courseId="courseId"
             :preItem="menuList[index - 1]"
-            :learningOrder="learningOrder"
-            :goodsId="goodsId"
-            :gradeId="gradeId"
-            :isBuy="true"
+            :isBuy="isBuy"
             :menuItem="item"
             :levelId="'0-' + item.menuId"
-            :goodsType="1"
-            :menuAllList="menuAllList"
-            :sectionItem="sectionItem"
+            :goodsType="goodsType"
             :isRebuild="isRebuild"
           ></courseChapter
         ></view>
@@ -48,21 +34,14 @@
         <view v-if="item.type == 3">
           <courseSection
             ref="MoudleSection"
-            :orderGoodsId="orderGoodsId"
             :sectionMaxNum="sectionMaxNum"
-            :courseId="courseId"
             :preItem="menuList[index - 1]"
-            :learningOrder="learningOrder"
-            :goodsId="goodsId"
-            :gradeId="gradeId"
-            :isBuy="true"
+            :isBuy="isBuy"
             :menuItem="item"
             :levelId="'0-0-' + item.menuId"
-            :goodsType="1"
+            :goodsType="goodsType"
             :testType="3"
-            :menuAllList="menuAllList"
             :isRebuild="isRebuild"
-            :sectionItem="sectionItem"
           ></courseSection
         ></view>
       </view>
@@ -76,67 +55,25 @@ import courseChapter from "@/components/course/courseChapter.vue";
 import courseSection from "@/components/course/courseSection.vue";
 export default {
   name: "SaasMiniprogramCourseTree",
+  inject: ["paramsFn"],
   props: {
-    isLive: false,
-    orderGoodsId: {
-      default: 0,
-    },
-    preItem: {
-      default: undefined,
-    },
-    learningOrder: {
-      //是否设置学习顺序 1 章节顺序 0不设置 2从头学到尾顺序
-      type: Number,
-      defaule: 0,
-    },
-    needOpen: {
-      //是否默认展开
-      type: Boolean,
-      default: false,
-    },
-    goodsId: {
-      type: Number,
-      default: 0,
-    },
-    courseId: {
-      type: [Number, String],
-      default: 0,
-    },
     isBuy: {
       //是否是已购买商品
       type: Boolean,
-      default: false,
-    },
-    levelId: {
-      type: [Number, String],
-      default: "",
+      default: true,
     },
     isRebuild: {
       //是否重修目录
       type: Boolean,
       default: false,
     },
-    gradeId: {
-      //重修需要班级ID
-      type: [Number, String],
-    },
     sectionMaxNum: {
       default: undefined,
     },
     // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
     goodsType: {
       type: [Number, String],
-      default: 0,
-    },
-    menuAllList: {
-      // 课程所有子目录结构列表
-      type: Array,
-      default: () => [],
-    },
-    sectionItem: {
-      // 用户最后一次看的录播的信息
-      type: Object,
-      default: () => {},
+      default: 1,
     },
   },
   data() {
@@ -149,27 +86,41 @@ export default {
 
   methods: {
     getMenuList() {
-      this.$api
-        .reMenuList({
-          courseId: this.courseId,
-          gradeId: this.gradeId,
-          orderGoodsId: this.orderGoodsId,
-        })
-        .then((res) => {
-          if (res.data.code == 200) {
-            for (let i = 0; i < res.data.rows.length; i++) {
-              let item = res.data.rows[i];
-              if (item.rebuild) {
-                this.$emit("isHaverebuild");
-              }
-              item.down = true;
-              item.id = item.menuId;
-              item.name = item.menuName;
-              item.menuType = item.type;
+      const fn = this.isBuy ? "reMenuList" : "menuList";
+      this.$api[fn](
+        this.isBuy
+          ? {
+              ...this.params,
+              rebuild: +this.isRebuild,
             }
-            this.menuList = res.data.rows;
+          : { courseId: this.courseId }
+      ).then((res) => {
+        if (res.data.code == 200) {
+          for (let i = 0; i < res.data.rows.length; i++) {
+            let item = res.data.rows[i];
+            // 显示重修目录
+            if (item.rebuild) {
+              this.$emit("isHaverebuild");
+            }
+            item.down = true;
+            item.id = item.menuId;
+            item.name = item.menuName;
+            item.menuType = item.type;
           }
-        });
+          this.menuList = res.data.rows;
+        }
+      });
+    },
+  },
+  computed: {
+    params() {
+      return this.paramsFn(["orderGoodsId", "gradeId", "courseId"]);
+    },
+    sectionItem() {
+      return this.paramsFn(["sectionItem"]);
+    },
+    courseId() {
+      return this.params.courseId;
     },
   },
   watch: {
@@ -179,6 +130,7 @@ export default {
         this.getMenuList();
       },
       immediate: true,
+      deep: true,
     },
   },
   components: {

+ 2 - 5
components/course/handoutsBox.vue

@@ -1,6 +1,6 @@
 <template>
   <view>
-    <template v-if="courseHandoutsData.handoutsId">
+    <template v-if="handoutsId">
       <u-search
         v-if="isShowSearch"
         placeholder="搜索讲义名称"
@@ -52,16 +52,13 @@ export default {
   },
 
   mounted() {
-    this.courseHandouts();
+    this.handoutsId && this.courseHandouts();
   },
   methods: {
     search(val) {
       this.courseHandouts();
     },
     courseHandouts() {
-      if (!this.handoutsId) {
-        return;
-      }
       this.$api
         .courseHandouts({
           handoutsId: this.handoutsId,

+ 28 - 27
components/course/noteBox.vue

@@ -38,8 +38,11 @@
         </view>
       </view>
     </view>
-    <!--  v-if="!(isPlayRebuild > 0) && playChannelId == 0" -->
-    <view class="inputBottom" :style="{ bottom: bottomHeight + 'px' }">
+    <view
+      class="inputBottom"
+      v-if="isShowInput"
+      :style="{ bottom: bottomHeight + 'px' }"
+    >
       <view style="width: 10%"
         ><image
           src="/static/icon/note3.png"
@@ -76,18 +79,8 @@
 </template>
 
 <script>
-import { mapGetters } from "vuex";
 export default {
   name: "SaasMiniprogramNoteBox",
-  props: {
-    refPlv: {
-      type: Object,
-      defaule: () => {
-        return {};
-      },
-    },
-    isPlayRebuild: {},
-  },
   inject: ["paramsFn"],
   data() {
     return {
@@ -105,13 +98,11 @@ export default {
   },
   methods: {
     getNoteList() {
-      this.$api
-        .noteList({ ...this.params, ...{ sectionId: this.playSectionId } })
-        .then((res) => {
-          if (res.data.code == 200) {
-            this.noteList = res.data.rows;
-          }
-        });
+      this.$api.noteList(this.params).then((res) => {
+        if (res.data.code == 200) {
+          this.noteList = res.data.rows;
+        }
+      });
     },
     jumpNote(item) {
       this.noteId = item.noteId;
@@ -119,7 +110,7 @@ export default {
     },
     postNote() {
       let self = this;
-      if (!(this.playSectionId > 0)) {
+      if (!(this.sectionId > 0)) {
         this.$u.toast("目前无播放视频");
         return;
       }
@@ -131,15 +122,12 @@ export default {
         this.$u.toast("暂无班级数据");
         return;
       }
-      let noteSecond = this.refPlv.playCurrentTime
-        ? this.refPlv.playCurrentTime()
-        : 0;
+      let noteSecond = this.params.playTime;
       if (!noteSecond) {
         this.$u.toast("视频暂未开始");
         return;
       }
       let data = {
-        sectionId: this.playSectionId,
         noteText: this.noteValue,
         noteDate: this.$method.getZeroTime(),
         noteSecond: noteSecond,
@@ -161,13 +149,26 @@ export default {
     },
   },
   computed: {
-    ...mapGetters(["playSectionId"]),
     params() {
-      return this.paramsFn(["orderGoodsId", "goodsId", "courseId"]);
+      return this.paramsFn([
+        "orderGoodsId",
+        "gradeId",
+        "goodsId",
+        "courseId",
+        "sectionId",
+        "playTime",
+        "isPlayRebuild",
+      ]);
+    },
+    sectionId() {
+      return this.params.sectionId;
+    },
+    isShowInput() {
+      return this.params.isPlayRebuild;
     },
   },
   watch: {
-    playSectionId: {
+    sectionId: {
       handler(val) {
         this.getNoteList();
       },

+ 29 - 77
pages3/course/detail.vue

@@ -152,40 +152,8 @@
                   </view>
                 </view>
                 <view v-show="!item.down">
-                  <view v-for="(itemM, indexM) in item.menuList" :key="indexM">
-                    <courseModule
-                      :courseId="itemM.courseId"
-                      :needOpen="
-                        isFirstEnter &&
-                        menuIndex[0] === index &&
-                        menuIndex[1] === indexM
-                          ? true
-                          : false
-                      "
-                      v-if="itemM.type == 1"
-                      :menuItem="itemM"
-                    ></courseModule>
-                    <courseChapter
-                      :courseId="itemM.courseId"
-                      :needOpen="
-                        isFirstEnter &&
-                        menuIndex[0] === index &&
-                        menuIndex[1] === indexM
-                          ? true
-                          : false
-                      "
-                      v-if="itemM.type == 2"
-                      :isBuy="false"
-                      :menuItem="itemM"
-                    ></courseChapter>
-                    <courseSection
-                      :courseId="itemM.courseId"
-                      v-if="itemM.type == 3"
-                      :isBuy="false"
-                      :menuItem="itemM"
-                    ></courseSection>
-                    <u-line></u-line>
-                  </view>
+                  <course-tree :isBuy="false"></course-tree>
+                  <u-line></u-line>
                 </view>
               </view>
             </view>
@@ -212,37 +180,7 @@
               </view>
               <view v-show="!item.down">
                 <view v-for="(itemM, indexM) in item.menuList" :key="indexM">
-                  <courseModule
-                    :courseId="itemM.courseId"
-                    :needOpen="
-                      isFirstEnter &&
-                      menuIndex[0] === index &&
-                      menuIndex[1] === indexM
-                        ? true
-                        : false
-                    "
-                    v-if="itemM.type == 1"
-                    :menuItem="itemM"
-                  ></courseModule>
-                  <courseChapter
-                    :courseId="itemM.courseId"
-                    :needOpen="
-                      isFirstEnter &&
-                      menuIndex[0] === index &&
-                      menuIndex[1] === indexM
-                        ? true
-                        : false
-                    "
-                    v-if="itemM.type == 2"
-                    :isBuy="false"
-                    :menuItem="itemM"
-                  ></courseChapter>
-                  <courseSection
-                    :courseId="itemM.courseId"
-                    v-if="itemM.type == 3"
-                    :isBuy="false"
-                    :menuItem="itemM"
-                  ></courseSection>
+                  <course-tree :isBuy="false"></course-tree>
                   <u-line></u-line>
                 </view>
               </view>
@@ -413,6 +351,7 @@ import courseModule from "@/components/course/courseModule.vue";
 import courseChapter from "@/components/course/courseChapter.vue";
 import courseSection from "@/components/course/courseSection.vue";
 import handoutsBox from "@/components/course/handoutsBox.vue";
+import courseTree from "@/components/course/courseTree.vue";
 import { mapGetters, mapMutations } from "vuex";
 export default {
   components: {
@@ -420,6 +359,7 @@ export default {
     courseChapter,
     courseSection,
     handoutsBox,
+    courseTree,
   },
   data() {
     return {
@@ -456,6 +396,7 @@ export default {
       selectGoodIndex: 0,
       specAttrPriceList: [],
       options: {},
+      courseId: "",
     };
   },
   computed: {
@@ -575,11 +516,12 @@ export default {
   mounted() {
     let self = this;
     uni.$on("getSection", (item) => {
+      console.log("🚀 ~ file: detail.vue:578 ~ uni.$on ~ item:", item);
       //播放试听
       self.listenSecond = 0;
       for (var itemChild of self.listenConfigList) {
         if (
-          self.playSectionId == (itemChild.sectionId || itemChild.menuId) &&
+          item.sectionId == (itemChild.sectionId || itemChild.menuId) &&
           item.courseId == itemChild.courseId
         ) {
           if (itemChild.auditionMinute > 0) {
@@ -588,7 +530,7 @@ export default {
           }
         }
       }
-
+      console.log(self.listenSecond, "self.listenSecond");
       if (self.listenSecond > 0) {
         if (self.timer) {
           clearInterval(self.timer);
@@ -739,6 +681,7 @@ export default {
       }
     },
     openCourse(item) {
+      this.courseId = item.courseId;
       item.down = !item.down;
       if (!item.down && item.menuList.length == 0) {
         this.getMenuList(item);
@@ -911,7 +854,6 @@ export default {
       console.log("切换后的this.goodsTeacher, ", this.goodsTeacher);
     },
     getMenuList(item) {
-      let self = this;
       this.$api.menuList({ courseId: item.courseId }).then((res) => {
         if (res.data.code == 200) {
           for (let i = 0; i < res.data.rows.length; i++) {
@@ -919,19 +861,17 @@ export default {
             item.down = true;
             item.id = item.menuId;
             item.name = item.menuName;
-
-            if (item.type == 3) {
-              //判断是否试听
-              item.tryListen = false;
-              if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
-                item.tryListen = true;
-              }
-            }
           }
           item.menuList = res.data.rows;
         }
       });
     },
+    paramsFn() {
+      return {
+        courseId: this.courseId,
+        listenConfigList: this.listenConfigList,
+      };
+    },
     getFxDetail() {
       let self = this;
       let sectionIdList = [];
@@ -957,6 +897,7 @@ export default {
                 self.listenConfigList = JSON.parse(
                   self.detail.goodsAuditionConfig
                 );
+                console.log(self.listenConfigList, "self.listenConfigList");
                 for (var itemChild of self.listenConfigList) {
                   sectionIdList.push(itemChild.sectionId); //存储试听节ID
                 }
@@ -984,11 +925,13 @@ export default {
             }
 
             self.detail = res.data.data;
+            console.log(self.detail, 789);
             this.courseBusiness();
             if (self.detail.goodsAuditionConfig) {
               self.listenConfigList = JSON.parse(
                 self.detail.goodsAuditionConfig
               );
+              console.log(self.listenConfigList, "self.listenConfigList");
               for (var itemChild of self.listenConfigList) {
                 sectionIdList.push(itemChild.sectionId); //存储试听节ID
               }
@@ -1363,6 +1306,11 @@ export default {
       });
     },
   },
+  provide() {
+    return {
+      paramsFn: this.paramsFn,
+    };
+  },
 };
 </script>
 <style>
@@ -1372,7 +1320,11 @@ page {
 </style>
 <style lang="scss" scope>
 @import "./index.scss";
-
+/deep/ {
+  .menuBox {
+    padding: 0;
+  }
+}
 .video_t2 {
   font-size: 24rpx;
   font-family: PingFang SC;

+ 52 - 166
pages3/polyv/detail.vue

@@ -8,7 +8,7 @@
       @clickLeft="clickLeft"
     ></uni-nav-bar>
     <view id="top">
-      <view class="video_box" v-if="!startStatus">
+      <view class="video_box" v-if="!playVid">
         <image
           :src="$method.splitImgHost(goodsData.coverUrl)"
           mode="widthFix"
@@ -17,9 +17,8 @@
       </view>
       <view v-else>
         <my-player
-          v-if="playVID"
           ref="player"
-          :playVid="playVID"
+          :playVid="playVid"
           :autoplay="autoplay"
           :allowSeek="isAllowSeek"
           :playbackRate="playbackRate"
@@ -91,17 +90,9 @@
           </view>
           <course-tree
             v-if="sectionItem.id || sectionItem.sectionId"
-            :orderGoodsId="orderGoodsId"
             :sectionMaxNum="goodsData.sectionMaxNum"
-            :courseId="courseId"
-            :learningOrder="orderNum"
-            :goodsId="goodsId"
-            :gradeId="gradeId"
             :isRebuild="false"
             :isBuy="true"
-            :goodsType="1"
-            :menuAllList="menuAllList"
-            :sectionItem="sectionItem"
             @isHaverebuild="isHaverebuild = true"
           ></course-tree>
         </view>
@@ -111,12 +102,7 @@
         </view>
         <!--笔记 -->
         <view v-if="current == 2">
-          <note-Box
-            :isPlayRebuild="sectionItem.rebuild"
-            :refPlv="refPlv"
-            @jumpNote="jumpNote"
-            :params="params()"
-          ></note-Box>
+          <note-Box @jumpNote="jumpNote"></note-Box>
         </view>
         <!--答疑 -->
         <view v-if="current == 3">
@@ -126,17 +112,9 @@
         <view v-if="current == 4">
           <course-tree
             v-if="sectionItem.id || sectionItem.sectionId"
-            :orderGoodsId="orderGoodsId"
             :sectionMaxNum="goodsData.sectionMaxNum"
-            :courseId="courseId"
-            :learningOrder="orderNum"
-            :goodsId="goodsId"
-            :gradeId="gradeId"
             :isRebuild="true"
             :isBuy="true"
-            :goodsType="1"
-            :menuAllList="menuAllList"
-            :sectionItem="sectionItem"
           ></course-tree>
         </view>
       </scroll-view>
@@ -149,7 +127,6 @@
       width="650rpx"
       height="622rpx"
       :mask-close-able="false"
-      @close="closeNotice"
     >
       <view class="content">
         <view class="title">学员须知</view>
@@ -164,12 +141,13 @@
         </scroll-view>
         <view
           class="had_read"
-          :class="{ gray: CountTo >= 0 }"
+          :class="{ gray: CountTo > 0 }"
           @click="noticeConfirm()"
         >
-          <text v-if="CountTo >= 0">请阅读学员须知,30s后可关闭</text>
+          <text v-if="CountTo > 0"
+            >请阅读学员须知,{{ " " + CountTo + "s" }}后可关闭</text
+          >
           <text v-else>我已阅读学员须知</text>
-          <text v-if="CountTo >= 0">{{ " " + CountTo + "s" }}</text>
         </view>
       </view>
     </u-popup>
@@ -331,15 +309,12 @@ export default {
       markContent: "http://admin.zhujianpeixun.com/",
       showMark: false,
       hasStart: false,
-      channelItem: null,
       lockTimer: null,
       orderGoodsId: 0,
       noticeShow: false,
       enableAutoRotation: true,
       showSet: false,
-      startStatus: false,
       courseId: 0,
-      menuList: [],
       current: 0,
       vid: "",
       goodsId: 0,
@@ -369,7 +344,6 @@ export default {
       photoHistoryList: [], //已拍照历史的下标点
       sectionItem: {},
       uploadLock: false, //上传图片
-      isPlayRebuild: false, //是否正在播放重修视频needOpen
       isRebuild: false, //视频是否从重修目录点击
       clearTimer: null,
       livingItem: "",
@@ -385,9 +359,8 @@ export default {
       compareFaceData: 0, // 拍照匹配相似度
       prendreAutoCarme: false, // 是否发起授权相机
       studyTimer: null, // 学习记录定时器
-      CountTo: 30, // 倒计时
+      CountTo: 0, // 倒计时
       CountTo1: 0,
-      handoutTipLength: 0,
       menuAllList: [],
       curPlayIndex: 0, // 正在播放的节的下标
       faceUrl: "",
@@ -404,13 +377,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters([
-      "userInfo",
-      "playSectionId",
-      "playChannelId",
-      "playVID",
-      "config",
-    ]),
+    ...mapGetters(["userInfo", "playSectionId", "config"]),
     playSecIsLearn() {
       return false;
       return this.sectionItem.learning != 1;
@@ -458,6 +425,12 @@ export default {
     sectionId() {
       return this.sectionItem.sectionId || this.sectionItem.id;
     },
+    playVid() {
+      return this.sectionItem.recordingUrl;
+    },
+    isPlayRebuild() {
+      return this.sectionItem.rebuild != 1;
+    },
   },
   async onLoad(option) {
     if (option.isOther) {
@@ -517,7 +490,6 @@ export default {
       lockAction();
       this.lockTimer = setInterval(lockAction, 10000);
       await this.isCanLearn();
-      !this.userInfo && this.$api.refreshUserInfo();
       this.courseCourseList();
     },
     // 七大员是否能进入学习
@@ -564,7 +536,6 @@ export default {
     },
     courseCourseList() {
       this.courseList = [];
-      this.menuList = [];
       this.photoConfig = false;
       this.$api
         .courseCourseList({
@@ -575,18 +546,14 @@ export default {
         .then((res) => {
           if (res.data.code == 200) {
             this.courseList = res.data.rows;
-            // 科目
-            let allItem = [{ subjectId: 0, subjectName: "所有" }];
-            let ids = [];
-            const newArr = [];
-            this.courseList.forEach((item) => {
-              if (ids.indexOf(item.subjectId) == -1) {
-                ids.push(item.subjectId);
-                newArr.push(item);
-              }
-            });
-            this.subList = [...allItem, ...newArr];
             if (res.data.total > 1) {
+              // 科目
+              this.subList = [{ subjectId: 0, subjectName: "所有" }];
+              this.courseList.forEach((item) => {
+                if (!this.subList.find((e) => e.subjectId == item.subjectId)) {
+                  this.subList.push(item);
+                }
+              });
               this.getUserWatchLast();
             } else {
               this.originOnShow();
@@ -742,56 +709,19 @@ export default {
     },
     // 原来的mouted内容
     originMounted() {
-      uni.$on("changeSection", (oldSectionId) => {
-        console.log(
-          "切换课程-originMounted->playVID:",
-          this.playVID,
-          oldSectionId
-        );
-        this.studyTimer && clearInterval(this.studyTimer); // 清除定时器
-        this.clearPauseTimer();
-        this.hasStart = false;
-        this.photoConfig = false;
-        //清除直播
-        this.$store.commit("setPlayChannelId", { playChannelId: 0 });
-        // 防止原先初始化错误
+      uni.$on("getSection", (item) => {
         if (!this.refPlv) {
           this.refPlv = this.$refs.player;
         }
-        this.postStudyRecord(0, oldSectionId);
-      });
-      uni.$on("getSection", (item) => {
+        this.postStudyRecord(0);
         //清除直播
         this.studyTimer && clearInterval(this.studyTimer);
         this.hasStart = false;
-        this.isPlayRebuild = item.rebuild;
         this.photoConfig = false;
-        this.sectionItem = item;
         this.moduleId = item.moduleId || null;
         this.chapterId = item.chapterId || null;
-        this.$store.commit("setPlayChannelId", { playChannelId: 0 });
         this.playVideo(item);
       });
-      uni.$on("levelId", (item) => {
-        let arr = item.split("-");
-        //点击节获取的各层级ID
-        this.moduleId = arr[0];
-        this.chapterId = arr[1];
-      });
-      uni.$on("getChannel", (item) => {
-        //清除录播
-        this.studyTimer && clearInterval(this.studyTimer);
-        this.hasStart = false;
-        this.$store.commit("setPlayVID", { playVID: null });
-
-        this.moduleId = item.moduleId;
-        this.chapterId = item.chapterId;
-        this.$store.commit("setPlaySectionId", {
-          playSectionId: item.sectionId || item.menuId,
-        });
-        this.playChannel(item);
-        this.channelItem = item;
-      });
       uni.$on("isRebuild", (item) => {
         this.isRebuild = item;
       });
@@ -812,15 +742,14 @@ export default {
     },
     // 原来onUnload里面的内容
     originUnload() {
-      if (this.playSectionId > 0 && this.hasStart) {
+      if (this.sectionId > 0 && this.hasStart) {
         //退出提交记录
         this.postStudyRecord();
       }
       //清除正在播放的节ID
       // this.$store.commit('setPlayObj',null)
       this.$store.commit("setPlaySectionId", { playSectionId: 0 });
-      this.$store.commit("setPlayChannelId", { playChannelId: 0 });
-      this.$store.commit("setPlayVID", { playVID: null });
+
       //移除所有的事件监听器
       uni.$off();
       this.clearTimer && clearTimeout(this.clearTimer);
@@ -921,20 +850,15 @@ export default {
         },
       });
     },
-    closeNotice() {
-      this.$api
-        .baseHandoutTip({
-          orderGoodsId: this.orderGoodsId,
-        })
-        .then((res) => {});
-    },
     noticeConfirm() {
-      if (this.CountTo < 0) {
+      if (this.CountTo <= 0) {
         this.noticeShow = false;
-        if (this.handoutTipLength == 0 && this.goodsPlayConfig.autoPlay > 0) {
-          this.autoplay = true;
-          this.refPlv.resumeVideo();
+        if (this.autoplay) {
+          this.refPlv && this.refPlv.resumeVideo();
         }
+        this.$api.baseHandoutTip({
+          orderGoodsId: this.orderGoodsId,
+        });
       }
     },
     baseHandoutTipList() {
@@ -943,19 +867,15 @@ export default {
           orderGoodsId: this.orderGoodsId,
         })
         .then((res) => {
-          this.handoutTipLength = res.data.rows.length;
           if (res.data.rows.length == 0) {
             this.noticeShow = true;
-            if (this.CountTo == 30) {
-              var timer = setInterval(() => {
-                this.CountTo--;
-                if (this.CountTo < 0) {
-                  clearInterval(timer);
-                }
-              }, 1000);
-            }
-          } else {
-            this.CountTo = -1;
+            this.CountTo = 30;
+            var timer = setInterval(() => {
+              this.CountTo--;
+              if (this.CountTo < 0) {
+                clearInterval(timer);
+              }
+            }, 1000);
           }
         });
     },
@@ -1005,7 +925,7 @@ export default {
         .then(async (res) => {
           this.photoHistoryList[this.photoIndex] = true;
           await this.postStudyRecord();
-          if (!this.erJianErZao && this.isReach) {
+          if (this.erJianErZao && this.isReach) {
             await this.postStudyRecord(1);
             cb();
             this.nextSection();
@@ -1049,7 +969,6 @@ export default {
       });
     },
     studyRecordQueryLiveLast() {
-      // /study/record/queryLiveLast
       this.$api
         .studyRecordQueryLiveLast({
           gradeId: this.gradeId,
@@ -1057,10 +976,6 @@ export default {
           courseId: this.courseId,
         })
         .then((res) => {
-          console.log(
-            "🚀 ~ file: detail.vue:1071 ~ .then ~ res:",
-            res.data.data
-          );
           let { data } = res.data;
           if (!data.sectionId) {
             data = this.menuAllList[0];
@@ -1251,7 +1166,7 @@ export default {
         let data = {
           ...this.params(["orderGoodsId", "goodsId", "courseId", "gradeId"]),
           photo: this.ossAvatarUrl,
-          sectionId: this.playSectionId,
+          sectionId: this.sectionId,
           photoTime: this.playTime || 0,
           photoIndex: postTime ? -2 : this.photoIndex, //从0算起,-2只提交随机时间
           photoNum: this.photoNum,
@@ -1372,10 +1287,6 @@ export default {
     async playVideo(item) {
       this.sectionItem = item;
       let { learning, videoCurrentTime, sectionId, recordingUrl } = item;
-      console.log(this.sectionItem, "this.sectionItem");
-      if (this.timer) {
-        clearInterval(this.timer);
-      }
       this.recordObj = videoCurrentTime
         ? { videoCurrentTime }
         : await this.getRecordLast(item);
@@ -1383,13 +1294,9 @@ export default {
       if ((this.photoNum > 0 || this.jjShiGongYuan) && learning != 1) {
         await this.getPhotoLastRecord();
       }
-      this.$store.commit("setPlayVID", {
-        playVID: recordingUrl,
-      });
       this.$store.commit("setPlaySectionId", {
         playSectionId: sectionId,
       });
-      this.startStatus = true;
       if (this.refPlv) {
         this.refPlv.changeVid({
           vid: recordingUrl,
@@ -1416,7 +1323,7 @@ export default {
 
     jumpNote(item) {
       this.$u.toast("即将跳到笔记位置");
-      if (this.playSectionId != item.sectionId) {
+      if (this.sectionId != item.sectionId) {
         this.initPlayVideo({
           sectionType: 1,
           ...item,
@@ -1459,9 +1366,6 @@ export default {
       if (currentTime < 10 && !this.ossAvatarUrl) {
         return;
       }
-      if (this.playChannelId > 0) {
-        currentTime = 2; //直播无法获取,无论开始结束都传2秒
-      }
       let self = this;
       let data = {
         ...this.params([
@@ -1498,16 +1402,9 @@ export default {
             let { code, msg } = res.data;
             if (code == 200) {
               if (status > 0) {
+                // 刷新数据
+                uni.$emit("playEnd");
                 this.studyRecordMenuAllList();
-                let moduleId = this.moduleId || 0;
-                let chapterId = this.chapterId || 0;
-                let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
-                let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
-
-                uni.$emit("playNext" + playNextIdisRebuild, {
-                  fromRebuild: this.isRebuild,
-                }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
-                uni.$emit("playNext" + playNextId); //通知播放结束
               }
               self.ossAvatarUrl = "";
             } else if (code == 600) {
@@ -1576,7 +1473,7 @@ export default {
           ...this.params(),
           moduleId: this.moduleId || 0,
           chapterId: this.chapterId || 0,
-          sectionId: this.playSectionId || 0,
+          sectionId: this.sectionId || 0,
           fromPlat: 1, //来源平台 1小程序 2PC网站
           goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
         },
@@ -1584,16 +1481,16 @@ export default {
     },
     timeupdate(time) {
       // console.log("播放中", time);
+      if (this.noticeShow) {
+        this.refPlv.playPause();
+        return;
+      }
       this.playTime = time;
       this.clearPauseTimer();
       this.timeEvent(time);
     },
     playing() {
       console.log("playing");
-      if (this.noticeShow) {
-        this.refPlv.playPause();
-        return;
-      }
       this.studyLog();
       if (!this.recordObj.videoCurrentTime) {
         this.postStudyRecord(0);
@@ -1609,17 +1506,17 @@ export default {
       this.refPlv.exitFullScreen();
     },
     pause() {
+      uni.$emit("playEnd");
       this.erJianErZaoPauseTip();
-      clearInterval(this.timer);
       clearInterval(this.studyTimer);
     },
     async ended() {
+      console.log("🚀 ~ file: detail.vue:1519 ~ ended ~ ended:", "结束");
       this.hasStart = false;
       uni.showToast({
         icon: "none",
         title: "播放完毕",
       });
-      clearInterval(this.timer);
       clearInterval(this.studyTimer);
       await this.postStudyRecord(1);
       this.nextSection();
@@ -1638,7 +1535,7 @@ export default {
         let i_chapterId = item.chapterId || 0;
         let i_moduleId = item.moduleId || 0;
         return (
-          i_sectionId == this.playSectionId &&
+          i_sectionId == this.sectionId &&
           i_chapterId == this.chapterId &&
           i_moduleId == this.moduleId
         );
@@ -1693,10 +1590,6 @@ export default {
                 this.$store.commit("setPlaySectionId", {
                   playSectionId: data.sectionId,
                 });
-                this.$store.commit("setPlayVID", {
-                  playVID: data.recordingUrl,
-                });
-
                 this.hasStart = false;
                 this.photoConfig = false;
                 this.sectionItem = data;
@@ -1709,9 +1602,6 @@ export default {
                 this.$store.commit("setPlaySectionId", {
                   playSectionId: data.sectionId,
                 });
-                this.$store.commit("setPlayVID", {
-                  playVID: data.recordingUrl,
-                });
                 this.sectionItem = data;
                 this.playVideo(data);
               }
@@ -1726,10 +1616,6 @@ export default {
     playError(e) {
       console.log(e);
     },
-    //拍照报错
-    error(e) {
-      console.log(e.detail);
-    },
     async userConfirmInfoDetail() {
       let info = await this.$api.userConfirmInfoDetail({
         orderGoodsId: this.orderGoodsId,

+ 5 - 5
store/index.js

@@ -36,11 +36,11 @@ const store = new Vuex.Store({
       return state.sysTime;
     },
     userInfo: (state) => {
-      // if (state.userInfo == null) {
-      // 	if (uni.getStorageSync('user_account')) {
-      // 		getUserInfo(state)
-      // 	}
-      // }
+      if (state.userInfo == null) {
+      	if (uni.getStorageSync('user_account')) {
+      		getUserInfo(state)
+      	}
+      }
       return state.userInfo;
     },
     dictObj: (state) => {