detail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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="main">
  9. <el-col :span="24" class="video">
  10. <video autoplay controls :src="videoUrl" style="width:100%;height:100%"></video>
  11. </el-col>
  12. <el-col :span="24" class="text">
  13. <van-collapse v-model="activeNames">
  14. <van-collapse-item name="1">
  15. <template #title>
  16. <div class="title">{{ form.title }}</div>
  17. </template>
  18. <el-col :span="24" class="con">
  19. <p><span>更新时间:</span>{{ form.create_time }}</p>
  20. <p><span>来源:</span>{{ form.orgin }}</p>
  21. <p><span>简介:</span>{{ form.desc }}</p>
  22. </el-col>
  23. </van-collapse-item>
  24. </van-collapse>
  25. </el-col>
  26. <el-col :span="24" class="choose">
  27. <el-col :span="24" class="one">
  28. <span></span>
  29. <span>选集</span>
  30. </el-col>
  31. <el-col :span="24" class="two">
  32. <van-swipe :loop="false" :width="300">
  33. <van-swipe-item
  34. class="videodata"
  35. v-for="(item, index) in form.videodata"
  36. :key="index"
  37. @click.native="change(index, item)"
  38. :class="{ active: changeColor == index }"
  39. >
  40. {{ item.name }}
  41. </van-swipe-item>
  42. </van-swipe>
  43. </el-col>
  44. </el-col>
  45. </el-col>
  46. </el-col>
  47. </el-row>
  48. </div>
  49. </template>
  50. <script>
  51. import { mapState, createNamespacedHelpers } from 'vuex';
  52. import NavBar from '@/layout/common/topInfo.vue';
  53. const { mapActions: channel } = createNamespacedHelpers('channel');
  54. export default {
  55. metaInfo() {
  56. return { title: this.$route.meta.title };
  57. },
  58. name: 'detail',
  59. props: {},
  60. components: {
  61. NavBar,
  62. },
  63. data: function() {
  64. return {
  65. // 头部标题
  66. title: '',
  67. // meta为true
  68. isleftarrow: '',
  69. // 返回
  70. navShow: true,
  71. activeNames: ['1'],
  72. form: {},
  73. changeColor: 0,
  74. videoUrl: '',
  75. };
  76. },
  77. async created() {
  78. await this.search();
  79. },
  80. methods: {
  81. ...channel(['query', 'fetch']),
  82. async search() {
  83. const res = await this.fetch(this.id);
  84. if (this.$checkRes(res)) {
  85. this.$set(this, `form`, res.data);
  86. }
  87. },
  88. change(index, item) {
  89. console.log(index, item);
  90. },
  91. back() {
  92. this.$router.push({ path: 'index' });
  93. },
  94. },
  95. computed: {
  96. ...mapState(['user']),
  97. id() {
  98. return this.$route.query.id;
  99. },
  100. },
  101. mounted() {
  102. this.title = this.$route.meta.title;
  103. this.isleftarrow = this.$route.meta.isleftarrow;
  104. },
  105. metaInfo() {
  106. return { title: this.$route.meta.title };
  107. },
  108. };
  109. </script>
  110. <style lang="less" scoped>
  111. .active {
  112. color: #409eff;
  113. }
  114. .style {
  115. width: 100%;
  116. min-height: 667px;
  117. position: relative;
  118. background-color: #f9fafc;
  119. }
  120. .top {
  121. height: 46px;
  122. overflow: hidden;
  123. }
  124. .main {
  125. .text {
  126. padding: 5px 10px;
  127. .title {
  128. font-size: 16px;
  129. font-weight: bold;
  130. }
  131. .con {
  132. p {
  133. span {
  134. font-weight: bold;
  135. padding: 10px 0 0 0;
  136. }
  137. }
  138. }
  139. }
  140. .choose {
  141. padding: 0 10px;
  142. .one {
  143. height: 30px;
  144. span:nth-child(1) {
  145. display: inline-block;
  146. width: 2px;
  147. height: 30px;
  148. background: #409eff;
  149. }
  150. span:nth-child(2) {
  151. position: relative;
  152. top: -8px;
  153. left: 5px;
  154. font-size: 18px;
  155. font-weight: bold;
  156. }
  157. }
  158. .two {
  159. margin-top: 5px;
  160. .videodata {
  161. height: 100px;
  162. background-color: #f1f1f1;
  163. margin-right: 10px;
  164. font-size: 16px;
  165. font-weight: bold;
  166. text-align: center;
  167. line-height: 100px;
  168. border-radius: 5px;
  169. }
  170. }
  171. }
  172. }
  173. /deep/.van-cell {
  174. background-color: transparent;
  175. padding: 5px 10px;
  176. }
  177. /deep/.van-collapse-item__content {
  178. background-color: transparent;
  179. color: black;
  180. padding: 0 10px;
  181. }
  182. /deep/.van-swipe__indicators {
  183. display: none;
  184. }
  185. /deep/.van-collapse-item {
  186. border-bottom: 1px solid #f1f1f1;
  187. }
  188. /deep/.van-cell::after {
  189. border: 0;
  190. }
  191. /deep/[class*='van-hairline']::after {
  192. border: 0;
  193. }
  194. </style>