|
@@ -160,23 +160,9 @@ export default {
|
|
|
},
|
|
|
async finishedModule() {
|
|
|
let modules = JSON.parse(JSON.stringify(this.modules));
|
|
|
- let object = {};
|
|
|
- for (const item of modules) {
|
|
|
- if (item.category === 'member') {
|
|
|
- if (`${item.is_use}` === `0`) {
|
|
|
- let res = await this.completeModules(item);
|
|
|
- item.children = res;
|
|
|
- // object = item;
|
|
|
- for (const items of item.children) {
|
|
|
- this.$set(this, `${items.category}List`, items);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // for (const item of object.children) {
|
|
|
- // this.$set(this, `${item.category}List`, item);
|
|
|
- // }
|
|
|
+ let res = await this.completeAllModules(modules);
|
|
|
},
|
|
|
+ //弃用
|
|
|
async completeModules(item) {
|
|
|
let result = await this.getColumn({
|
|
|
type: `list`,
|
|
@@ -198,6 +184,7 @@ export default {
|
|
|
return columns;
|
|
|
}
|
|
|
},
|
|
|
+ //弃用
|
|
|
async completeColumn(item) {
|
|
|
let data = { skip: 0, limit: 8 };
|
|
|
if (item.type === `bugList`) {
|
|
@@ -212,6 +199,33 @@ export default {
|
|
|
return result.data;
|
|
|
}
|
|
|
},
|
|
|
+ //合并请求模块
|
|
|
+ async completeAllModules(modules) {
|
|
|
+ let ids = modules.map(item => item.id);
|
|
|
+ let result = await this.getAllColumn(ids);
|
|
|
+ if (result.length > 0) {
|
|
|
+ //整理栏目
|
|
|
+ result = result.map(item => {
|
|
|
+ if (item.type === 'column') item.path = `/newsList/module/${item.id}`;
|
|
|
+ else item.path = `/newsList/module/${item.content_id}`;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ //请求信息
|
|
|
+ let res = await this.getAllNews(result);
|
|
|
+ //合并栏目和信息
|
|
|
+ result = result.map(item => {
|
|
|
+ let newsList = res.filter(fil => fil.parent_id === item.id);
|
|
|
+ item.children = newsList;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ modules = modules.map(item => {
|
|
|
+ let children = result.filter(fil => fil.parent_id === item.id);
|
|
|
+ item.children = children;
|
|
|
+ this.$set(this, `${item.category}List`, item);
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|