detail.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div id="detail">
  3. <el-row>
  4. <el-col :span="24" class="style">
  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="info">
  9. <el-col :span="24" class="name">
  10. {{ info.title }}
  11. </el-col>
  12. <el-col :span="24" class="date">
  13. <span class="textOver">发布时间:{{ info.publish_time }}</span>
  14. <span class="textOver"> 信息来源:{{ info.orgin }}</span>
  15. </el-col>
  16. <el-col :span="24" class="image" v-if="info.picture != null">
  17. <el-image :src="info.picture">
  18. <div slot="error" class="image-slot">
  19. <i class="el-icon-picture-outline"></i></div
  20. ></el-image>
  21. </el-col>
  22. <el-col :span="24" class="video">
  23. <video
  24. autoplay="autoplay"
  25. controls="controls"
  26. preload="meta"
  27. x-webkit-airplay="true"
  28. webkit-playsinline="true"
  29. playsinline="true"
  30. x5-video-player-type="h5"
  31. x5-video-player-fullscreen="true"
  32. controlsList="nodownload"
  33. :src="info.filepath"
  34. loop="loop"
  35. >
  36. <source src="movie.ogg" type="video/ogg" />
  37. <source src="movie.mp4" type="video/mp4" />
  38. </video>
  39. </el-col>
  40. <el-col :span="24" class="content">
  41. <p v-html="info.content"></p>
  42. </el-col>
  43. </el-col>
  44. </el-col>
  45. </el-row>
  46. </div>
  47. </template>
  48. <script>
  49. import NavBar from '@/layout/common/topInfo.vue';
  50. import { mapState, createNamespacedHelpers } from 'vuex';
  51. const { mapActions: newsroadshow } = createNamespacedHelpers('newsroadshow');
  52. export default {
  53. name: 'detail',
  54. props: {},
  55. components: {
  56. NavBar,
  57. },
  58. data: function() {
  59. return {
  60. // 头部标题
  61. title: '',
  62. // meta为true
  63. isleftarrow: '',
  64. // 返回
  65. navShow: true,
  66. info: {},
  67. };
  68. },
  69. async created() {
  70. await this.search();
  71. },
  72. methods: {
  73. ...newsroadshow(['fetch']),
  74. async search() {
  75. if (this.id) {
  76. let res = await this.fetch(this.id);
  77. if (this.$checkRes(res)) {
  78. this.$set(this, `info`, res.data);
  79. }
  80. }
  81. },
  82. // 返回
  83. onClickLeft() {
  84. this.$router.push({ path: '/viewTwo/roadshow/index' });
  85. },
  86. },
  87. computed: {
  88. ...mapState(['user']),
  89. pageTitle() {
  90. return `${this.$route.meta.title}`;
  91. },
  92. id() {
  93. return this.$route.query.id;
  94. },
  95. },
  96. mounted() {
  97. this.title = this.$route.meta.title;
  98. this.isleftarrow = this.$route.meta.isleftarrow;
  99. },
  100. metaInfo() {
  101. return { title: this.$route.meta.title };
  102. },
  103. };
  104. </script>
  105. <style lang="less" scoped>
  106. .style {
  107. width: 100%;
  108. min-height: 667px;
  109. position: relative;
  110. background-color: #f9fafc;
  111. .top {
  112. height: 46px;
  113. overflow: hidden;
  114. }
  115. .info {
  116. .name {
  117. text-align: center;
  118. padding: 15px 10px 0 10px;
  119. font-size: 18px;
  120. font-weight: bold;
  121. }
  122. .date {
  123. margin: 15px 0;
  124. span {
  125. display: inline-block;
  126. width: 50%;
  127. text-align: center;
  128. color: #666;
  129. }
  130. }
  131. .image {
  132. padding: 10px;
  133. .el-image {
  134. width: 100%;
  135. height: 210px;
  136. }
  137. }
  138. .video {
  139. video {
  140. width: 100%;
  141. height: 215px;
  142. }
  143. }
  144. .content {
  145. padding: 10px 5px;
  146. }
  147. }
  148. }
  149. /deep/.content p img {
  150. width: 100%;
  151. height: 300px;
  152. margin: 5px 0px;
  153. display: block;
  154. }
  155. /deep/.content div img {
  156. width: 100%;
  157. height: 260px;
  158. display: block;
  159. }
  160. /deep/.content p {
  161. font-size: 14px;
  162. color: #444;
  163. }
  164. </style>