Tang 2 лет назад
Родитель
Сommit
102f287628

+ 10 - 26
src/pages/course-detail/components/CourseTree.vue

@@ -219,6 +219,14 @@
 <script>
 export default {
   inject: ["getGoodsData", "getBusinessData"],
+  props: {
+    rebuild: {
+      type: Number,
+      default: () => {
+        return 0;
+      }
+    }
+  },
   data() {
     return {
       courseList: [], //商品的课程列表
@@ -410,31 +418,6 @@ export default {
             style: ""
           };
         }
-
-        // const Array1 = this.allSectionList.filter(
-        //   i =>
-        //     (i.chapterId == item.chapterId || i.chapterId == item.menuId) &&
-        //     (i.moduleId == item.moduleId || i.moduleId == 0)
-        // );
-        // var str = "";
-        // console.log("chapter", this.sectionItem, item);
-        // if (Array1.every(i => i.studyStatus == 1)) {
-        //   item.studyStatus = 1;
-        //   str = style_type ? 1 : "已学完";
-        // } else {
-        //   item.studyStatus = -1;
-        //   str = style_type ? -1 : "待学习";
-        // }
-        // if (
-        //   (item.menuId == this.sectionItem.chapterId &&
-        //     0 == this.sectionItem.moduleId) ||
-        //   (item.chapterId == this.sectionItem.chapterId &&
-        //     item.moduleId == this.sectionItem.moduleId)
-        // ) {
-        //   item.studyStatus = 0;
-        //   str = style_type ? 0 : "学习中";
-        // }
-        // return str;
       };
     }
   },
@@ -484,7 +467,8 @@ export default {
           .reMenuList({
             courseId: id,
             gradeId: this.goodsData.gradeId,
-            orderGoodsId: this.goodsData.orderGoodsId
+            orderGoodsId: this.goodsData.orderGoodsId,
+            rebuild: this.rebuild
           })
           .then(res => {
             this.courseDataList = res.rows.map(i => {

+ 12 - 19
src/pages/course-detail/components/coreContent.vue

@@ -16,21 +16,13 @@
           </div>
           <!-- 章节目录 -->
           <template v-if="tab.name == '1'">
-            <course-tree ref="courseTree" @backActiveSection="backActiveSection"> </course-tree>
+            <course-tree @backActiveSection="backActiveSection"> </course-tree>
           </template>
           <!-- 重修目录 -->
-          <!-- <template v-if="tab.name == '2' && rebuildCourseList.length">
-            <Course-tree
-              ref="courseTree"
-              :courseList="rebuildCourseList"
-              :goodsLearningOrder="businessData.goodsLearningOrder"
-              :rebuild="1"
-              :sectionItem.sync="sectionItem"
-              :sectionMaxNum="goodsData.sectionMaxNum"
-              @getResource="getResource"
-            >
-            </Course-tree>
-          </template> -->
+          <template v-if="tab.name == '2'">
+            <course-tree @backActiveSection="backActiveSection" :rebuild="1">
+            </course-tree>
+          </template>
           <template v-if="tab.name == '3'">
             <answer-questions ref="answerQuestions"></answer-questions>
           </template>
@@ -70,7 +62,7 @@ export default {
   provide() {
     return {
       getPlayer: () => this.player,
-      getActiveSection: () => this.activeSection,
+      getActiveSection: () => this.activeSection
     };
   },
   data() {
@@ -132,7 +124,6 @@ export default {
       }
       // await this.confirmInfoDetail(); //判断开通信息推送是否成功
       await this.getRebuildCourse(); //获取重修列表
-      this.courseTabIndex = "1";
     },
     //提交完资料返回判断是否已开班
     getGradeInfo() {
@@ -281,16 +272,18 @@ export default {
             goodsId: this.goodsData.goodsId,
             rebuild: 1,
             gradeId: this.goodsData.gradeId,
-            orderGoodsId:this.goodsData.orderGoodsId
+            orderGoodsId: this.goodsData.orderGoodsId
           })
           .then(async res => {
             if (res.data.length > 0) {
-              console.log(res.data,'resda')
-              // this.rebuildCourseList = [res.data[0]];
+              console.log(res.data, "resda");
               this.menuTab.splice(1, 0, {
                 name: "2",
                 label: "重修目录"
               });
+              this.courseTabIndex = "2";
+            } else {
+              this.courseTabIndex = "1";
             }
             resolve();
           })
@@ -307,7 +300,7 @@ export default {
       this.player = player;
     },
     backActiveSection(item) {
-      console.log(item,'ttt')
+      console.log(item, "ttt");
       this.activeSection = item;
     }
   }