|
@@ -7,7 +7,7 @@
|
|
|
:key="index"
|
|
|
:title="item.name"
|
|
|
>
|
|
|
- <PageLearnChild v-if="index !== 0" :learnChildList="learnChildList">
|
|
|
+ <PageLearnChild v-if="index !== 0" :parentId="parentId">
|
|
|
</PageLearnChild>
|
|
|
<PageLearnRecommend v-if="index === 0" :swiperList="swiperList">
|
|
|
</PageLearnRecommend>
|
|
@@ -32,8 +32,8 @@ export default {
|
|
|
active: 0,
|
|
|
learnRootList: [],
|
|
|
choosedRootIndex: 0,
|
|
|
- learnChildList: [],
|
|
|
- swiperList: []
|
|
|
+ swiperList: [],
|
|
|
+ parentId: ""
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -61,6 +61,9 @@ export default {
|
|
|
this.learnRootList = [{ id: "0", name: "推荐", parentId: null }];
|
|
|
this.learnRootList = [...this.learnRootList, ...res.data];
|
|
|
// 查询子目录
|
|
|
+ if (this.choosedRootIndex === 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.getChildList();
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -69,21 +72,7 @@ export default {
|
|
|
},
|
|
|
// 查询子目录
|
|
|
getChildList() {
|
|
|
- if (this.choosedRootIndex === 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- let path = {
|
|
|
- categoryId: this.learnRootList[this.choosedRootIndex].id
|
|
|
- };
|
|
|
- this.$_http
|
|
|
- .get(this.$pathParams(this.$_API.JTXT_GET_CATEGORIES_CATEGROYID, path))
|
|
|
- .then(res => {
|
|
|
- res.data.shift();
|
|
|
- this.learnChildList = res.data;
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.$store.commit("toggleLoading", false);
|
|
|
- });
|
|
|
+ this.parentId = this.learnRootList[this.choosedRootIndex].id;
|
|
|
},
|
|
|
// 切换根目录
|
|
|
rootChange(index, title) {
|