|
@@ -47,23 +47,27 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<!-- list部分 -->
|
|
|
- <div class="list">
|
|
|
+ <div class="list" v-for="(mod, index) in modules" :key="`mod${index}`">
|
|
|
<el-row class="tip" type="flex">
|
|
|
<el-col :span="16">
|
|
|
- {{ news.title }}<b class="tip_en">{{ news.title }}</b>
|
|
|
+ {{ mod.title }}<b class="tip_en">{{ mod.title }}</b>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" class="more" @click.native="toHtml(`newsList.html#/${news.id}?title=${news.title}`)">
|
|
|
+ <el-col :span="8" class="more" @click.native="toHtml(`newsList.html#/${mod.id}?title=${mod.title}`)">
|
|
|
查看更多
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row type="flex" @click.native="toHtml(`news.html#/${item.id}`)" v-for="(item, index) in news.infoList" :key="index" class="data_list">
|
|
|
- <el-col :span="7"> 【{{ news.title }}】 </el-col>
|
|
|
- <el-col :span="17">
|
|
|
- <p class="textOver">{{ item.title }}</p>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <template v-for="(col, colIndex) in mod.children">
|
|
|
+ <template v-for="(news, newsIndex) in col.children">
|
|
|
+ <el-row type="flex" @click.native="toHtml(`news.html#/${news.id}`)" :key="`col${newsIndex}${colIndex}`" class="data_list" :gutter="10">
|
|
|
+ <el-col :span="7" :key="`newsCol${newsIndex}`" style="text-overflow: ellipsis;overflow: hidden;white-space: nowrap;"> 【{{ col.title }}】 </el-col>
|
|
|
+ <el-col :span="17" :key="`newsTitle${newsIndex}`">
|
|
|
+ <p class="textOver">{{ news.title }}</p>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
- <div class="list">
|
|
|
+ <!-- <div class="list">
|
|
|
<el-row class="tip" type="flex">
|
|
|
<el-col :span="16">
|
|
|
{{ notice.title }}<b class="tip_en">{{ notice.title }}</b>
|
|
@@ -78,7 +82,7 @@
|
|
|
<p class="textOver">{{ item.title }}</p>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<div class="list">
|
|
|
<el-row class="tip" type="flex">
|
|
|
<el-col :span="24"> 联系我们<b class="tip_en">CONTACT</b> </el-col>
|
|
@@ -122,8 +126,7 @@ export default {
|
|
|
drawerJobfair: false,
|
|
|
drawerCenter: false,
|
|
|
site: {},
|
|
|
- news: {},
|
|
|
- notice: {},
|
|
|
+ modules: {},
|
|
|
siteTitle: '',
|
|
|
}),
|
|
|
async created() {
|
|
@@ -139,7 +142,7 @@ export default {
|
|
|
}),
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapActions(['siteOperation', 'moduleOperation', 'columnOperation', 'newsOperation']),
|
|
|
+ ...mapActions(['siteOperation', 'moduleOperation', 'columnOperation', 'newsOperation', 'getAllColumn', 'getAllNews']),
|
|
|
toHtml(uri, type) {
|
|
|
if (type) {
|
|
|
let url = '';
|
|
@@ -172,17 +175,41 @@ export default {
|
|
|
},
|
|
|
//获取固定的4个模块
|
|
|
async getModule() {
|
|
|
- //获取分站所有模块 TODO:site=>_tenant
|
|
|
- let result = await this.moduleOperation({ type: 'list' });
|
|
|
+ //获取手机可以使用的所有模块
|
|
|
+ let result = await this.moduleOperation({ type: 'list', data: { is_mobile: '0' } });
|
|
|
if (`${result.errcode}` === '0') {
|
|
|
- let moduleList = result.data;
|
|
|
- for (let item of moduleList) {
|
|
|
- //item为模块信息,拿着模块信息去查该模块下有什么栏目
|
|
|
- if (`${item.is_use}` === '0') {
|
|
|
- item = await this.getColumn(item);
|
|
|
- await this.makeList(item);
|
|
|
- } // console.log(item);
|
|
|
- }
|
|
|
+ let modules = result.data;
|
|
|
+ //获取模块下的所有栏目
|
|
|
+ let columns = await this.getAllColumn(modules.map(i => i.id));
|
|
|
+ //获取栏目下的所有信息
|
|
|
+ let news = await this.getAllNews(columns);
|
|
|
+ //合并栏目和信息
|
|
|
+ columns = columns.map(item => {
|
|
|
+ let newsList = news.filter(fil => fil.parent_id === item.id);
|
|
|
+ item.children = newsList;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ modules = modules.map(item => {
|
|
|
+ let children = columns.filter(fil => fil.parent_id === item.id);
|
|
|
+ item.children = children;
|
|
|
+ for (const sc of item.children) {
|
|
|
+ let schildren = _.get(sc, `children`, []);
|
|
|
+ sc.children = _.sortBy(schildren, i => {
|
|
|
+ return new Date(_.get(i, `meta.createdA`)).getTime();
|
|
|
+ });
|
|
|
+ sc.children = sc.children.filter(f => f.is_use === '0');
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ this.$set(this, `modules`, modules);
|
|
|
+ console.log(modules);
|
|
|
+ // for (let item of moduleList) {
|
|
|
+ // //item为模块信息,拿着模块信息去查该模块下有什么栏目
|
|
|
+ // if (`${item.is_use}` === '0') {
|
|
|
+ // item = await this.getColumn(item);
|
|
|
+ // await this.makeList(item);
|
|
|
+ // } // console.log(item);
|
|
|
+ // }
|
|
|
}
|
|
|
},
|
|
|
//根据条件获取栏目
|