|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div id="newsList">
|
|
|
- <list-detail :menuList="menu" :info="site" :backColor="backColor" :Color="Color" :newsList="newsList"></list-detail>
|
|
|
+ <list-detail :menuList="menu" :info="site" :backColor="backColor" :Color="Color" :newsList="newsList" :sideMenu="sideMenu" :title="title"></list-detail>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -33,92 +33,7 @@ export default {
|
|
|
},
|
|
|
backColor: '#0457c7',
|
|
|
Color: '#0457c7',
|
|
|
- newsList: [
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- {
|
|
|
- pic: require('@/assets/news.png'),
|
|
|
- title: '我省成功举办“创业有我•就在吉林',
|
|
|
- date: '2019-12-03',
|
|
|
- content: '我省成功举办“创业有我•就在吉林我省成功举办“创业有我•就在吉林',
|
|
|
- },
|
|
|
- ],
|
|
|
+ newsList: [],
|
|
|
menu: [],
|
|
|
sideMenu: [],
|
|
|
site: {},
|
|
@@ -126,7 +41,8 @@ export default {
|
|
|
}),
|
|
|
async created() {
|
|
|
await this.toGetSite(); //获取主站信息
|
|
|
- this.loadMenu(); //获取菜单信息
|
|
|
+ await this.loadMenu(); //获取菜单信息
|
|
|
+ this.toGetNews(); //获取数据
|
|
|
},
|
|
|
computed: {
|
|
|
type() {
|
|
@@ -135,12 +51,15 @@ export default {
|
|
|
id() {
|
|
|
return this.$route.params.id;
|
|
|
},
|
|
|
+ title() {
|
|
|
+ return this.$route.query.title;
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
type: 'getSubMenu',
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapActions(['getSite', 'getMenu', 'getColumn']),
|
|
|
+ ...mapActions(['getSite', 'getMenu', 'getColumn', 'getNews']),
|
|
|
//站点信息
|
|
|
async toGetSite() {
|
|
|
let site = sessionStorage.getItem('site');
|
|
@@ -168,9 +87,9 @@ export default {
|
|
|
let menu = sessionStorage.getItem('menu');
|
|
|
if (menu) {
|
|
|
this.$set(this, `menu`, JSON.parse(menu));
|
|
|
- this.finishedMenu();
|
|
|
- return;
|
|
|
+ await this.finishedMenu();
|
|
|
} else this.toGetMenu();
|
|
|
+ this.getSubMenu();
|
|
|
},
|
|
|
async toGetMenu() {
|
|
|
let result = await this.getMenu({ type: `list` });
|
|
@@ -211,14 +130,30 @@ export default {
|
|
|
},
|
|
|
//侧菜单
|
|
|
getSubMenu() {
|
|
|
- console.log('in function:');
|
|
|
let data;
|
|
|
- if (this.type === `module`) data = sessionStorage.getItem(`module`);
|
|
|
- else {
|
|
|
- for (const item of this.menu) {
|
|
|
- let res = item.children.filter(fil => fil.id === this.id);
|
|
|
- console.log(res);
|
|
|
+ if (this.type === `module`) {
|
|
|
+ data = sessionStorage.getItem(`modules`);
|
|
|
+ this.$set(this, `sideMenu`, []);
|
|
|
+ } else {
|
|
|
+ let res = this.menu.filter(fil => {
|
|
|
+ if (fil.children) {
|
|
|
+ let res = fil.children.filter(filc => filc.id === this.id);
|
|
|
+ return res.length > 0;
|
|
|
+ } else return false;
|
|
|
+ });
|
|
|
+ this.$set(this, `sideMenu`, res.length > 0 ? res[0].children : []);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //请求数据
|
|
|
+ async toGetNews() {
|
|
|
+ let result = await this.getNews({ type: 'list', data: { parent_id: this.id } });
|
|
|
+ if (result.errcode === 0) {
|
|
|
+ let data = result.data;
|
|
|
+ for (const item of data) {
|
|
|
+ let info = await this.getNews({ type: 'fetch', data: { id: item.id } });
|
|
|
+ if (info.errcode === 0) item.content = info.data.content;
|
|
|
}
|
|
|
+ this.$set(this, `newsList`, result.data);
|
|
|
}
|
|
|
},
|
|
|
},
|