谢杰标 2 anni fa
parent
commit
129c37aa47

+ 18 - 6
src/components/courseTree/CourseTree.vue

@@ -593,7 +593,10 @@ export default {
         (e) =>
           e[moduleId * 1 || chapterId * 1 ? "sectionId" : "id"] == sectionId
       );
-      this.$emit("getResource", sectionItem);
+      if (sectionType == 1) {
+        this.$emit("getResource", sectionItem);
+      }
+      this.refreshList();
     },
     activeFunc(courseId, index) {
       let { courseId: nowCourseId, courseList } = this.treeList[index];
@@ -672,7 +675,7 @@ export default {
           return Promise.resolve(res.data);
         });
     },
-    openChapter(chapter) {
+    openChapter(chapter, isFresh = false) {
       let {
         chapterId,
         menuId,
@@ -684,7 +687,7 @@ export default {
         showList,
       } = chapter;
       chapter.showList = !showList;
-      if (list.length) {
+      if (list.length && !isFresh) {
         return;
       }
       this.$request
@@ -983,9 +986,18 @@ export default {
       return _data.some((section) => section.sectionId == sectionId);
     },
     // 刷新数据
-    refreshList(){
-        
-    }
+    refreshList() {
+      setTimeout(() => {
+        console.log(this.treeList[0].list, 999);
+        let { parent, courseId, menuId } = this.sectionItem;
+        if (menuId) {
+          let index = this.treeList.findIndex((e) => e.courseId == courseId);
+          this.getMenuList(this.treeList[index]);
+        } else {
+          this.openChapter(parent);
+        }
+      }, 999);
+    },
   },
   computed: {
     gradeId() {

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

@@ -2680,7 +2680,6 @@ export default {
     this.getbaseprofiletplists().then(async (res) => {
       await this.courseCourseList();
     });
-    this.refreshParentList1()
     document.addEventListener("visibilitychange", this.pauseVideo);
   },
   beforeDestroy() {