123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <div id="index">
- <el-row>
- <el-col :span="24" class="style">
- <el-col :span="24" class="top">
- <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
- </el-col>
- <el-col :span="24" class="main">
- <van-tabs v-model="active">
- <van-tab title="科技资讯">
- <kjzxList :list="kjzxLists" @detailBtn="detailBtn"></kjzxList>
- </van-tab>
- <van-tab title="工作动态">
- <kjzxList :list="gzdtLists" @detailBtn="detailBtn"></kjzxList>
- </van-tab>
- <van-tab title="通知通告">
- <kjzxList :list="tztgLists" @detailBtn="detailBtn"></kjzxList>
- </van-tab>
- <van-tab title="技术前沿">
- <kjzxList :list="jsqyLists" @detailBtn="detailBtn"></kjzxList>
- </van-tab>
- </van-tabs>
- </el-col>
- <!-- <el-col :span="24" class="foot">
- <footInfo></footInfo>
- </el-col> -->
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: journcolumn } = createNamespacedHelpers('journcolumn');
- const { mapActions: journnews } = createNamespacedHelpers('journnews');
- import NavBar from '@/layout/common/topInfo.vue';
- import footInfo from '@/layout/common/footInfo.vue';
- import kjzxList from './parts/kjzxList.vue';
- export default {
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- name: 'index',
- props: {},
- components: {
- NavBar,
- // footInfo,
- kjzxList,
- },
- data: function() {
- return {
- // 头部标题
- title: '',
- // meta为true
- isleftarrow: '',
- // 返回
- navShow: true,
- //菜单显示
- active: '1',
- //科技资讯
- kjzxLists: [],
- //科技动态
- gzdtLists: [],
- //通知通告
- tztgLists: [],
- //技术前沿
- jsqyLists: [],
- //栏目
- column: [],
- };
- },
- async created() {
- await this.searchColumn();
- await this.searchList();
- },
- methods: {
- ...journcolumn({ columnquery: 'query' }),
- ...journnews({ newsquery: 'query' }),
- async searchColumn() {
- const res = await this.columnquery();
- if (this.$checkRes(res)) {
- this.$set(this, `column`, res.data);
- }
- },
- async searchList() {
- let col = this.column.find(i => i.site == 'kjzx');
- if (col) {
- const res = await this.newsquery({ column_id: col.id });
- if (this.$checkRes(res)) {
- this.$set(this, `kjzxLists`, _.orderBy(res.data, ['publish_time'], ['desc']));
- }
- }
- let col2 = this.column.find(i => i.site == 'gzdt');
- if (col2) {
- const res = await this.newsquery({ column_id: col2.id });
- if (this.$checkRes(res)) {
- this.$set(this, `gzdtLists`, _.orderBy(res.data, ['publish_time'], ['desc']));
- }
- }
- let col3 = this.column.find(i => i.site == 'tztg');
- if (col3) {
- const res = await this.newsquery({ column_id: col3.id });
- if (this.$checkRes(res)) {
- this.$set(this, `tztgLists`, _.orderBy(res.data, ['publish_time'], ['desc']));
- }
- }
- let col4 = this.column.find(i => i.site == 'jsqy');
- if (col4) {
- const res = await this.newsquery({ column_id: col4.id });
- if (this.$checkRes(res)) {
- this.$set(this, `jsqyLists`, _.orderBy(res.data, ['publish_time'], ['desc']));
- }
- }
- },
- detailBtn(data) {
- this.$router.push({ path: '/journ/detail', query: { id: data.id } });
- },
- },
- computed: {
- ...mapState(['user']),
- },
- mounted() {
- this.title = this.$route.meta.title;
- this.isleftarrow = this.$route.meta.isleftarrow;
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- };
- </script>
- <style lang="less" scoped>
- .style {
- width: 100%;
- min-height: 667px;
- position: relative;
- background-color: #f9fafc;
- }
- .top {
- height: 46px;
- overflow: hidden;
- }
- .main {
- min-height: 570px;
- margin: 0 0 50px 0;
- }
- .foot {
- position: absolute;
- bottom: 0;
- }
- /deep/.van-tabs__line {
- width: 60px;
- }
- </style>
|