|
@@ -152,7 +152,7 @@ export default {
|
|
|
this.$set(this, `site`, result.data);
|
|
|
}
|
|
|
} else {
|
|
|
- console.log(JSON.parse(site));
|
|
|
+ // console.log(JSON.parse(site));
|
|
|
this.$set(this, `site`, JSON.parse(site));
|
|
|
let arr = this.site;
|
|
|
if (arr.custom) {
|
|
@@ -218,37 +218,29 @@ export default {
|
|
|
},
|
|
|
//根据条件获取栏目
|
|
|
async getColumn(item) {
|
|
|
- // console.log(item);
|
|
|
- // console.log(this.site);
|
|
|
- if (!item.category.includes('self')) {
|
|
|
- let res = await this.columnOperation({ type: 'list', data: { parent_id: item.id } });
|
|
|
- if (`${res.errcode}` === '0') {
|
|
|
- //组合path:res.data内容都为栏目.所以,点击这些栏目显示的列表应该是信息列表,需要用栏目的id作为查询信息的parten_id查出不同栏目的信息
|
|
|
- for (const col of res.data) {
|
|
|
+ let res = await this.columnOperation({ type: 'list', data: { parent_id: item.id } });
|
|
|
+ //查詢模块下所有的栏目(因为修改关联方是:抓取栏目和正常栏目关联,栏目类型(type)为bugList.所以bugList需要用content_id再去查下面关联的信息
|
|
|
+ if (`${res.errcode}` === '0') {
|
|
|
+ for (const col of res.data) {
|
|
|
+ if (col.type === 'bugList') {
|
|
|
+ col.path = `/info/list/${col.content_id}`;
|
|
|
+ col.children = await this.getNewsList(col, '0');
|
|
|
+ } else if (col.type === 'column') {
|
|
|
col.path = `/info/list/${col.id}`;
|
|
|
- //再将栏目下的前几条数据查出来(暂定limit=6)
|
|
|
- col.children = await this.getNews(col, '1');
|
|
|
+ col.children = await this.getNewsList(col, '1');
|
|
|
+ } else if (col.type === 'content') {
|
|
|
+ col.path = `/info/detail?id=${col.content_id}`;
|
|
|
}
|
|
|
- item.children = res.data;
|
|
|
- }
|
|
|
- } else if (this.site && this.site.bug_column) {
|
|
|
- let selfUseList = JSON.parse(this.site.bug_column);
|
|
|
- let res = selfUseList.filter(fil => {
|
|
|
- if (fil) return fil.parent_id === item.id;
|
|
|
- });
|
|
|
- for (const col of res) {
|
|
|
- col.id = col.column;
|
|
|
- col.path = `/info/list/${col.id}`;
|
|
|
- col.children = await this.getNews(col, '0');
|
|
|
}
|
|
|
- item.children = res;
|
|
|
+ item.children = res.data;
|
|
|
}
|
|
|
return item;
|
|
|
},
|
|
|
//根据条件获取信息
|
|
|
- async getNews(item, news_type) {
|
|
|
- //这个item是栏目列表,循环查每个栏目6条信息
|
|
|
- let res = await this.newsOperation({ type: 'list', data: { parent_id: item.id, skip: 0, limit: 4, news_type: news_type } });
|
|
|
+ async getNewsList(item, news_type) {
|
|
|
+ let data = { skip: 0, limit: 4, news_type: news_type };
|
|
|
+ data.parent_id = news_type === '1' ? item.id : item.content_id;
|
|
|
+ let res = await this.newsOperation({ type: 'list', data: data });
|
|
|
if (`${res.errcode}` === '0') {
|
|
|
res.data.forEach(async val => {
|
|
|
let result = await this.newsOperation({ type: 'search', data: { id: val.id } });
|
|
@@ -287,7 +279,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
let object = { ...JSON.parse(JSON.stringify(item)), infoList: arr, column: colObject };
|
|
|
- console.log(object);
|
|
|
+ // console.log(object);
|
|
|
this.$set(this, `notice`, object);
|
|
|
} else if (item.category === 'self1') {
|
|
|
this.$set(this, `self1List`, item.children);
|
|
@@ -360,7 +352,7 @@ export default {
|
|
|
this.$set(this.master, `bannerinfo`, { banner: this.site.banner });
|
|
|
//获取入驻企业
|
|
|
let result = await this.corpListOperation();
|
|
|
- console.log(result);
|
|
|
+ // console.log(result);
|
|
|
if (`${result.errcode}` === '0') {
|
|
|
this.$set(this, `corpList`, result.data);
|
|
|
}
|