detail.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div id="detail">
  3. <el-row>
  4. <el-col :span="24" class="detail">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow" @onClickLeft="onClickLeft"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <el-col :span="24" class="title">{{ info.title }}</el-col>
  10. <el-col :span="24" class="other">
  11. <span class="textOver">信息来源:{{ info.orgin || '暂无' }}</span>
  12. <span class="textOver">发布时间:{{ info.publish_time || '暂无' }}</span>
  13. </el-col>
  14. <el-col :span="24" v-if="info.picture != null || undefined" class="img">
  15. <van-image :src="info.picture">
  16. <div slot="error" class="image-slot">
  17. <i class="el-icon-picture-outline"></i>
  18. </div>
  19. </van-image>
  20. </el-col>
  21. <el-col :span="24" class="con" v-html="info.content"> </el-col>
  22. <el-col :span="24" class="four" v-if="info.filepath">
  23. <h4>附件:</h4>
  24. <el-link :href="info.filepath" :underline="false">{{ info.filepathname || '附件下载' }}</el-link>
  25. </el-col>
  26. </el-col>
  27. </el-col>
  28. </el-row>
  29. </div>
  30. </template>
  31. <script>
  32. import { mapState, createNamespacedHelpers } from 'vuex';
  33. import NavBar from '@/layout/common/topInfo.vue';
  34. const { mapActions: journnews } = createNamespacedHelpers('journnews');
  35. export default {
  36. metaInfo() {
  37. return { title: this.$route.meta.title };
  38. },
  39. name: 'detail',
  40. props: {},
  41. components: {
  42. NavBar,
  43. },
  44. data: function() {
  45. return {
  46. // 头部标题
  47. title: '',
  48. // meta为true
  49. isleftarrow: '',
  50. // 返回
  51. navShow: true,
  52. //详情
  53. info: {},
  54. };
  55. },
  56. created() {
  57. this.search();
  58. },
  59. methods: {
  60. ...journnews({ newsquery: 'query', newsfetch: 'fetch' }),
  61. //查询详情
  62. async search() {
  63. const res = await this.newsfetch(this.id);
  64. if (this.$checkRes(res)) {
  65. this.$set(this, `info`, res.data);
  66. }
  67. },
  68. // 返回
  69. onClickLeft() {
  70. this.$router.push({ path: '/journ/index' });
  71. },
  72. },
  73. computed: {
  74. ...mapState(['user']),
  75. id() {
  76. return this.$route.query.id;
  77. },
  78. },
  79. mounted() {
  80. this.title = this.$route.meta.title;
  81. this.isleftarrow = this.$route.meta.isleftarrow;
  82. },
  83. };
  84. </script>
  85. <style lang="less" scoped>
  86. .detail {
  87. width: 100%;
  88. min-height: 667px;
  89. position: relative;
  90. background-color: #f9fafc;
  91. }
  92. .top {
  93. height: 46px;
  94. overflow: hidden;
  95. }
  96. .main {
  97. // min-height: 570px;
  98. // margin: 0 0 50px 0;
  99. padding: 10px;
  100. .title {
  101. text-align: center;
  102. color: #044b79;
  103. font-size: 18px;
  104. font-weight: bolder;
  105. }
  106. .other {
  107. font-size: 16px;
  108. color: #666;
  109. padding: 20px 0;
  110. border-bottom: 1px dashed #ccc;
  111. span {
  112. display: inline-block;
  113. width: 50%;
  114. }
  115. }
  116. .img {
  117. text-align: center;
  118. margin: 0 0 15px 0;
  119. .el-image {
  120. width: 60%;
  121. }
  122. }
  123. .con {
  124. margin-top: 20px;
  125. }
  126. }
  127. /deep/table {
  128. width: 100%;
  129. }
  130. /deep/.con p img {
  131. width: 100%;
  132. height: 300px;
  133. margin: 5px 0px;
  134. display: block;
  135. }
  136. /deep/.con div img {
  137. width: 100%;
  138. height: 260px;
  139. display: block;
  140. }
  141. /deep/.con p {
  142. font-size: 14px;
  143. color: #444;
  144. }
  145. </style>