index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="content">
  3. <view class="one">
  4. <video :src="info.vUrl" :poster="info.iUrl" :title="info.title" controls :show-center-play-btn="false"
  5. :show-mute-btn="true" :enable-play-gesture="true" :vslide-gesture-in-fullscreen="true"></video>
  6. </view>
  7. <view class="two">
  8. <view class="two_1">
  9. <view :class="['list',active==index?'active':'']" v-for="(item,index) in tabList" :key="index"
  10. @tap="tabChange(index)">
  11. <span>{{item.title}}</span>
  12. </view>
  13. </view>
  14. <view class="two_2">
  15. <view class="tab_1" v-if="active===0">
  16. <view class="title">
  17. <span>标题:</span>
  18. <span>{{info.title}}</span>
  19. </view>
  20. <view class="actor">
  21. 待写
  22. </view>
  23. <view class="brief">
  24. <span>简介:</span>
  25. <span>{{info.brief}}</span>
  26. </view>
  27. <view class="other">
  28. <view class="other_1">
  29. 相关视频
  30. </view>
  31. <view class="other_2">
  32. <view class="firmvideoList" v-for="(item,index) in firmvideoList" :key="index"
  33. @tap="videoView(item)">
  34. <image class="image" :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''"
  35. mode="">
  36. </image>
  37. <view class="name textOver">
  38. {{item.title}}
  39. </view>
  40. <view class="other">
  41. <view class="other_1">
  42. <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
  43. {{item.view_num}}
  44. </view>
  45. <view class="other_2">
  46. {{item.time_num}}
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="tab_2" v-else-if="active===1">
  54. 第二部分
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. id: '',
  65. info: {},
  66. // 相关视频
  67. firmvideoList: [],
  68. tabList: [ // 选项卡
  69. {
  70. title: '详情'
  71. },
  72. {
  73. title: '评论'
  74. }
  75. ],
  76. active: 0,
  77. }
  78. },
  79. onLoad(options) {
  80. const that = this;
  81. that.$set(that, `id`, options.id || '63fd915b134900004000482c')
  82. that.search()
  83. },
  84. methods: {
  85. async search() {
  86. const that = this;
  87. let res;
  88. res = await that.$api(`videos/${that.id}`, 'GET', {})
  89. if (res.errcode == '0') {
  90. // 赋值名字
  91. let data = res.data;
  92. uni.setNavigationBarTitle({
  93. title: data.title
  94. });
  95. if (data.video_url && data.video_url.length > 0) data.vUrl = data.video_url[0].url;
  96. if (data.img_url && data.img_url.length > 0) data.iUrl = data.img_url[0].url;
  97. if (data && data.head_actor) data.head_actor_name = await that.searchNmae(data.head_actor)
  98. that.$set(that, `info`, data);
  99. // 查询相关视频,相同厂商
  100. that.searchfirm(data.firm_id)
  101. }
  102. },
  103. // 其他信息
  104. async searchNmae(e) {
  105. const that = this;
  106. let res;
  107. res = await that.$api(`scenedata/${e}`, 'GET', {});
  108. if (res.errcode == '0') {
  109. if (res.data && res.data.title) return res.data.title
  110. else return '暂无'
  111. }
  112. },
  113. async searchfirm(firm_id) {
  114. const that = this;
  115. let res;
  116. res = await that.$api('videos', 'GET', {
  117. firm_id: firm_id,
  118. skip: 0,
  119. limit: 6
  120. })
  121. if (res.errcode == '0') {
  122. that.$set(that, `firmvideoList`, res.data)
  123. }
  124. },
  125. // 视频查看
  126. videoView(e) {
  127. uni.navigateTo({
  128. url: `/pagesVideo/video/index?id=${e._id}`
  129. })
  130. },
  131. tabChange(e) {
  132. const that = this;
  133. that.$set(that, `active`, e)
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. .content {
  140. background-color: var(--rgb111);
  141. overflow: hidden;
  142. .one {
  143. padding: 0 2vw;
  144. margin: 0 0 2vw 0;
  145. video {
  146. width: 100%;
  147. height: 210px;
  148. overflow: hidden;
  149. border: 1px solid var(--rgbf1f);
  150. }
  151. }
  152. .two {
  153. position: relative;
  154. flex-grow: 1;
  155. padding: 0 2vw;
  156. .two_1 {
  157. display: flex;
  158. justify-content: space-around;
  159. margin: 0 0 2vw 0;
  160. .list {
  161. span {
  162. background-color: var(--rgbfff);
  163. color: var(--rgb000);
  164. padding: 1vw 4vw;
  165. font-size: 14px;
  166. border-radius: 5px;
  167. }
  168. }
  169. .active {
  170. span {
  171. background-color: var(--rgbfa4);
  172. color: var(--rgbfff);
  173. }
  174. }
  175. }
  176. .two_2 {
  177. .tab_1 {
  178. display: flex;
  179. flex-direction: column;
  180. width: 96vw;
  181. height: 58vh;
  182. overflow-y: auto;
  183. .title {
  184. font-size: 15px;
  185. color: var(--rgbfff);
  186. margin: 0 0 2vw 0;
  187. }
  188. .actor {
  189. margin: 0 0 2vw 0;
  190. }
  191. .brief {
  192. font-size: 15px;
  193. color: var(--rgbfff);
  194. margin: 0 0 2vw 0;
  195. }
  196. .other {
  197. margin: 0 0 2vw 0;
  198. .other_1 {
  199. font-size: 15px;
  200. color: var(--rgbfff);
  201. margin: 0 0 2vw 0;
  202. }
  203. .other_2 {
  204. display: flex;
  205. flex-wrap: wrap;
  206. .firmvideoList {
  207. width: 48%;
  208. margin: 0 10px 5px 0;
  209. .image {
  210. width: 100%;
  211. height: 100px;
  212. overflow: hidden;
  213. border-radius: 5px;
  214. box-shadow: 0 0 5px var(--rgbf1f);
  215. margin: 0 0 5px 0;
  216. }
  217. .name {
  218. font-size: 14px;
  219. color: var(--rgbfff);
  220. margin: 0 0 5px 0;
  221. }
  222. .other {
  223. display: flex;
  224. color: var(--rgbfff);
  225. font-size: 12px;
  226. justify-content: space-between;
  227. }
  228. }
  229. .firmvideoList:nth-child(2n) {
  230. margin: 0 0 5px 0;
  231. }
  232. }
  233. }
  234. }
  235. .tab_2 {}
  236. }
  237. }
  238. }
  239. </style>