detail2.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div id="detail2">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <el-col :span="24" class="title">{{ detailinfo.title }}</el-col>
  10. <el-col :span="24" class="info">
  11. <span>时间:{{ detailinfo.publish_time }}</span>
  12. <span>来源:{{ detailinfo.orgin }}</span>
  13. </el-col>
  14. <el-col :span="24" class="img">
  15. <el-image :src="detailinfo.picture" style="width:100%; height: 100%"></el-image>
  16. </el-col>
  17. <el-col :span="24" class="video">
  18. <video :src="detailinfo.filepath" controls="controls">
  19. 您的浏览器不支持 video 标签。
  20. </video>
  21. </el-col>
  22. <el-col :span="24" class="content">
  23. <p v-html="detailinfo.content"></p>
  24. </el-col>
  25. </el-col>
  26. </el-col>
  27. </el-row>
  28. </div>
  29. </template>
  30. <script>
  31. import { mapState, createNamespacedHelpers } from 'vuex';
  32. import NavBar from '@/layout/common/topInfo.vue';
  33. const { mapActions: newsguidance } = createNamespacedHelpers('newsguidance');
  34. const { mapActions: newsroadshow } = createNamespacedHelpers('newsroadshow');
  35. export default {
  36. metaInfo() {
  37. return { title: this.$route.meta.title };
  38. },
  39. name: 'detail2',
  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. detailinfo: {},
  54. };
  55. },
  56. created() {
  57. if (this.id) {
  58. this.search();
  59. }
  60. },
  61. methods: {
  62. ...newsguidance({ newsguidancefetch: 'fetch' }),
  63. ...newsroadshow({ newsroadshowfetch: 'fetch' }),
  64. async search() {
  65. if (this.type === '1') {
  66. let res = await this.newsguidancefetch(this.id);
  67. if (this.$checkRes(res)) {
  68. this.$set(this, `detailinfo`, res.data);
  69. }
  70. } else {
  71. let res = await this.newsroadshowfetch(this.id);
  72. if (this.$checkRes(res)) {
  73. this.$set(this, `detailinfo`, res.data);
  74. }
  75. }
  76. },
  77. },
  78. computed: {
  79. ...mapState(['user']),
  80. id() {
  81. return this.$route.query.id;
  82. },
  83. type() {
  84. return this.$route.query.type;
  85. },
  86. },
  87. mounted() {
  88. this.title = this.$route.meta.title;
  89. this.isleftarrow = this.$route.meta.isleftarrow;
  90. },
  91. };
  92. </script>
  93. <style lang="less" scoped>
  94. .top {
  95. height: 46px;
  96. overflow: hidden;
  97. position: relative;
  98. z-index: 999;
  99. }
  100. .main {
  101. .title {
  102. color: #409eff;
  103. font-size: 18px;
  104. text-align: center;
  105. margin-top: 20px;
  106. }
  107. .info {
  108. text-align: center;
  109. margin-top: 10px;
  110. border-bottom: 1px solid gray;
  111. padding-bottom: 10px;
  112. span:nth-child(2) {
  113. margin-left: 15px;
  114. }
  115. }
  116. .img {
  117. padding: 0px 10px;
  118. height: 200px;
  119. text-align: center;
  120. margin-top: 10px;
  121. }
  122. .video {
  123. video {
  124. width: 100%;
  125. margin-top: 10px;
  126. height: 250px;
  127. }
  128. }
  129. .content {
  130. margin-top: 10px;
  131. padding: 0px 10px;
  132. }
  133. }
  134. </style>