谢杰标 2 年之前
父節點
當前提交
150d65842a
共有 1 個文件被更改,包括 62 次插入34 次删除
  1. 62 34
      components/course/courseChapter.vue

+ 62 - 34
components/course/courseChapter.vue

@@ -8,8 +8,13 @@
       </view>
 
       <view class="fl">
-        <view class="title_status gre" v-if="menuItem.commonSign == 1">公共章</view>
-        <view class="title_status" :class="['grey', 'blue', 'gre'][learnStatus + 1]">
+        <view class="title_status gre" v-if="menuItem.commonSign == 1"
+          >公共章</view
+        >
+        <view
+          class="title_status"
+          :class="['grey', 'blue', 'gre'][learnStatus + 1]"
+        >
           {{ ["待学习", "学习中", "已学完"][learnStatus + 1] }}
         </view>
       </view>
@@ -17,39 +22,61 @@
     <view v-show="!down">
       <view v-for="(itemM, indexM) in list" :key="indexM">
         <view v-if="itemM.type != 2">
-          <courseSection ref="ChapterSection" :isLive="isLive" :orderGoodsId="orderGoodsId" :sectionMaxNum="sectionMaxNum"
-            :preItem="list[indexM - 1] || preItem" :learningOrder="learningOrder" :courseId="courseId"
-            @playEnd="refreshList($event)" :goodsId="goodsId" :isBuy="isBuy" :nextMenuItem="findNextSection(indexM)"
-            :isRebuild="isRebuild" :gradeId="gradeId" :menuItem="itemM" :levelId="levelId + '-' + itemM.sectionId"
-            :testType="2" :ChapterSectionExam="sectionExam" :menuAllList="menuAllList"></courseSection>
+          <courseSection
+            ref="ChapterSection"
+            :isLive="isLive"
+            :orderGoodsId="orderGoodsId"
+            :sectionMaxNum="sectionMaxNum"
+            :preItem="list[indexM - 1] || preItem"
+            :learningOrder="learningOrder"
+            :courseId="courseId"
+            @playEnd="refreshList($event)"
+            :goodsId="goodsId"
+            :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>
         </view>
         <!-- 章卷 -->
         <view v-if="itemM.type == 2">
           <u-line></u-line>
-          <view class="examBox" @click="
-            toDo(
-              itemM.typeId,
-              goodsId,
-              itemM.moduleId,
-              itemM.chapterId,
-              itemM,
-              indexM
-            )
-            ">
+          <view
+            class="examBox"
+            @click="
+              toDo(
+                itemM.typeId,
+                goodsId,
+                itemM.moduleId,
+                itemM.chapterId,
+                itemM,
+                indexM
+              )
+            "
+          >
             <view class="exam">
               <view class="eTag">
                 {{ itemM.doType == 1 ? "练习" : "考试" }}
               </view>
               <view style="margin-left: 15rpx; flex: 1">{{ itemM.name }}</view>
             </view>
-            <view v-if="isRebuild || itemM.rebuild > 0" class="tagRe">待重修</view>
+            <view v-if="isRebuild || itemM.rebuild > 0" class="tagRe"
+              >待重修</view
+            >
             <view v-else>
-              <view :class="{
-                tagGreen: itemM.learning == 1,
-                tagRe: itemM.learning == 0 || itemM.rebuild > 0,
-              }">
+              <view
+                :class="{
+                  tagGreen: itemM.learning == 1,
+                  tagRe: itemM.learning == 0 || itemM.rebuild > 0,
+                }"
+              >
                 <text v-if="itemM.rebuild > 0">待重测</text>
                 <text v-else-if="itemM.learning == 1">合格</text>
                 <text v-else-if="itemM.learning == 0">不及格(需重考)</text>
@@ -129,7 +156,7 @@ export default {
     sectionItem: {
       // 用户最后一次看的录播的信息
       type: Object,
-      default: () => { },
+      default: () => {},
     },
   },
   components: {
@@ -144,8 +171,8 @@ export default {
       sectionExam: [],
     };
   },
-  onLoad() { },
-  created() { },
+  onLoad() {},
+  created() {},
   mounted() {
     // console.log('needOpen:', this.needOpen, this.chapterOpen);
     if (this.needOpen && this.chapterOpen) {
@@ -170,7 +197,7 @@ export default {
           .goodsTodayStudySectionNum({
             goodsId: this.goodsId,
             gradeId: this.gradeId,
-            orderGoodsId: this.orderGoodsId
+            orderGoodsId: this.orderGoodsId,
           })
           .then((res) => {
             if (res.data.code == 200) {
@@ -216,7 +243,7 @@ export default {
             courseId: this.courseId,
             gradeId: this.gradeId,
             goodsId: this.goodsId,
-            orderGoodsId: this.orderGoodsId
+            orderGoodsId: this.orderGoodsId,
           })
           .then((res) => {
             if (res.data.code == 200) {
@@ -237,7 +264,7 @@ export default {
             moduleId: this.menuItem.moduleId || 0,
             chapterId: this.menuItem.chapterId || 0,
             examId: id,
-            orderGoodsId: this.orderGoodsId
+            orderGoodsId: this.orderGoodsId,
           })
           .then((res) => {
             resolve(res.data.data);
@@ -537,7 +564,7 @@ export default {
             courseId: this.courseId,
             moduleId: 0,
             examId: examId,
-            orderGoodsId: this.orderGoodsId
+            orderGoodsId: this.orderGoodsId,
           })
           .then((res) => {
             resolve(res.data.data);
@@ -561,7 +588,7 @@ export default {
               chapterId: item.chapterId || item.menuId,
               courseId: item.courseId,
               gradeId: item.gradeId,
-              orderGoodsId: this.orderGoodsId
+              orderGoodsId: this.orderGoodsId,
             })
             .then((res) => {
               if (res.data.code == 200) {
@@ -637,7 +664,7 @@ export default {
           courseId: courseId,
           rebuild: 1,
           moduleId: moduleId,
-          orderGoodsId: this.orderGoodsId
+          orderGoodsId: this.orderGoodsId,
         })
         .then((res) => {
           if (res.data.code == 200) {
@@ -675,7 +702,7 @@ export default {
           gradeId: this.gradeId,
           courseId: courseId,
           moduleId: moduleId,
-          orderGoodsId: this.orderGoodsId
+          orderGoodsId: this.orderGoodsId,
         })
         .then((res) => {
           if (res.data.code == 200) {
@@ -712,9 +739,10 @@ export default {
       if (!this.isBuy) {
         return;
       }
+      if (!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) &&