|
@@ -0,0 +1,121 @@
|
|
|
+<template>
|
|
|
+ <div id="detail">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="detail">
|
|
|
+ <el-col :span="24" class="top">
|
|
|
+ <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow" @onClickLeft="back"> </NavBar>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <span v-if="type == 'tztg'">
|
|
|
+ <tztg :tztgInfo="tztgInfo"></tztg>
|
|
|
+ </span>
|
|
|
+ <span v-else-if="type == 'xwzx'">
|
|
|
+ <xwzx :xwzxInfo="xwzxInfo"></xwzx>
|
|
|
+ </span>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+//新闻资讯
|
|
|
+const { mapActions: scienceNews } = createNamespacedHelpers('scienceNews');
|
|
|
+//通知通告
|
|
|
+const { mapActions: journnews } = createNamespacedHelpers('journnews');
|
|
|
+import NavBar from '@/layout/common/topInfo.vue';
|
|
|
+//通知通告
|
|
|
+import tztg from './detailParts/tztgDetail.vue';
|
|
|
+//新闻资讯
|
|
|
+import xwzx from './detailParts/xwzxDetail.vue';
|
|
|
+export default {
|
|
|
+ name: 'detail',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ NavBar,
|
|
|
+ //通知通告详情
|
|
|
+ tztg,
|
|
|
+ //新闻资讯详情
|
|
|
+ xwzx,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ //头部标题
|
|
|
+ title: '',
|
|
|
+ // meta为true
|
|
|
+ isleftarrow: '',
|
|
|
+ // 返回
|
|
|
+ navShow: true,
|
|
|
+ //通知通告详情
|
|
|
+ tztgInfo: {},
|
|
|
+ //新闻资讯详情
|
|
|
+ xwzxInfo: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ await this.Detail();
|
|
|
+ await this.setTitle();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...journnews(['fetch']),
|
|
|
+ ...scienceNews({ xwzxFetch: 'fetch' }),
|
|
|
+ async Detail() {
|
|
|
+ let res = await this.fetch(this.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `tztgInfo`, res.data);
|
|
|
+ }
|
|
|
+ res = await this.xwzxFetch(this.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `xwzxInfo`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //设置标题
|
|
|
+ setTitle() {
|
|
|
+ let type = this.type;
|
|
|
+ if (type == 'tztg') {
|
|
|
+ this.$set(this, `title`, '通知通告详情');
|
|
|
+ } else if (type == 'xwzx') {
|
|
|
+ this.$set(this, `title`, '新闻资讯详情');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 返回首页
|
|
|
+ back() {
|
|
|
+ this.$router.push({ path: '/user/index' });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
+ },
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
+ type() {
|
|
|
+ return this.$route.query.type;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.isleftarrow = this.$route.meta.isleftarrow;
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.detail {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: relative;
|
|
|
+ background-color: #f9fafc;
|
|
|
+ .top {
|
|
|
+ height: 46px;
|
|
|
+ overflow: hidden;
|
|
|
+ position: relative;
|
|
|
+ z-index: 999;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|