|
@@ -32,7 +32,7 @@
|
|
<span>{{ columnName }}</span>
|
|
<span>{{ columnName }}</span>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="24" class="list">
|
|
<el-col :span="24" class="list">
|
|
- <newsList :list="list" :total="total" @detailBtn="detailBtn"></newsList>
|
|
|
|
|
|
+ <newsList :list="list" :total="total" @detailBtn="detailBtn" :limit="limit" @query="changeMenu"></newsList>
|
|
</el-col>
|
|
</el-col>
|
|
</span>
|
|
</span>
|
|
<span v-else>
|
|
<span v-else>
|
|
@@ -58,6 +58,7 @@ import foot from '@/layout/common/foot.vue';
|
|
import newsList from './parts/newsList.vue';
|
|
import newsList from './parts/newsList.vue';
|
|
import newsDetail from './parts/newsDetail.vue';
|
|
import newsDetail from './parts/newsDetail.vue';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
+const { mapActions: news } = createNamespacedHelpers('news');
|
|
export default {
|
|
export default {
|
|
name: 'listDetail',
|
|
name: 'listDetail',
|
|
props: {},
|
|
props: {},
|
|
@@ -87,7 +88,8 @@ export default {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
// 总数
|
|
// 总数
|
|
- total: 10,
|
|
|
|
|
|
+ total: 0,
|
|
|
|
+ limit: 14,
|
|
// 详情
|
|
// 详情
|
|
details: {
|
|
details: {
|
|
title: '信息标题',
|
|
title: '信息标题',
|
|
@@ -101,40 +103,61 @@ export default {
|
|
this.changeColumn();
|
|
this.changeColumn();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ ...news({ newsQuery: 'query', newsFetch: 'fetch' }),
|
|
// 选择栏目
|
|
// 选择栏目
|
|
- changeColumn() {
|
|
|
|
|
|
+ async changeColumn() {
|
|
if (this.col_name == '科技资讯') {
|
|
if (this.col_name == '科技资讯') {
|
|
this.menuIndex = 0;
|
|
this.menuIndex = 0;
|
|
this.columnName = this.col_name;
|
|
this.columnName = this.col_name;
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
|
|
+ let name = this.columnName;
|
|
|
|
+ this.changeMenu(name);
|
|
this.$set(this, `displays`, this.display);
|
|
this.$set(this, `displays`, this.display);
|
|
} else if (this.col_name == '技术前沿') {
|
|
} else if (this.col_name == '技术前沿') {
|
|
this.menuIndex = 1;
|
|
this.menuIndex = 1;
|
|
this.columnName = this.col_name;
|
|
this.columnName = this.col_name;
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
|
|
+ let name = this.columnName;
|
|
|
|
+ this.changeMenu(name);
|
|
this.$set(this, `displays`, this.display);
|
|
this.$set(this, `displays`, this.display);
|
|
} else if (this.col_name == '工作动态') {
|
|
} else if (this.col_name == '工作动态') {
|
|
this.menuIndex = 2;
|
|
this.menuIndex = 2;
|
|
this.columnName = this.col_name;
|
|
this.columnName = this.col_name;
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
|
|
+ let name = this.columnName;
|
|
|
|
+ this.changeMenu(name);
|
|
this.$set(this, `displays`, this.display);
|
|
this.$set(this, `displays`, this.display);
|
|
} else if (this.col_name == '通知通告') {
|
|
} else if (this.col_name == '通知通告') {
|
|
this.menuIndex = 3;
|
|
this.menuIndex = 3;
|
|
this.columnName = this.col_name;
|
|
this.columnName = this.col_name;
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
|
|
+ let name = this.columnName;
|
|
|
|
+ this.changeMenu(name);
|
|
this.$set(this, `displays`, this.display);
|
|
this.$set(this, `displays`, this.display);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 点击选择菜单
|
|
// 点击选择菜单
|
|
- changeMenu(name, index) {
|
|
|
|
|
|
+ async changeMenu(name, index) {
|
|
|
|
+ if (this.display == '0') {
|
|
|
|
+ let res = await this.newsQuery({ skip: 0, limit: 14, col_name: name, status: 2 });
|
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `list`, res.data);
|
|
|
|
+ } else {
|
|
|
|
+ let res = await this.newsFetch(this.id);
|
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `details`, res.data);
|
|
|
|
+ }
|
|
|
|
+
|
|
this.menuIndex = index;
|
|
this.menuIndex = index;
|
|
this.columnName = name;
|
|
this.columnName = name;
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
this.menuColor = 'rgb(5,73,130)';
|
|
this.$set(this, `displays`, 0);
|
|
this.$set(this, `displays`, 0);
|
|
},
|
|
},
|
|
// 点击详情
|
|
// 点击详情
|
|
- detailBtn(id) {
|
|
|
|
|
|
+ async detailBtn(id) {
|
|
|
|
+ let res = await this.newsFetch(id);
|
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `details`, res.data);
|
|
|
|
+
|
|
this.$set(this, `displays`, 1);
|
|
this.$set(this, `displays`, 1);
|
|
|
|
+ console.log(id);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|