index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <div class="video-container">
  3. <div class="video-list">
  4. <div class="video" v-for="(item, index) in list" :key="index" @click="onPlay(item)">
  5. <div class="cover">
  6. <!-- <video :src="item.ossUrl" :poster="item.cover" crossorigin="anonlymous" autoplay="true"></video> -->
  7. <img :src="item.cover" alt="item.title" />
  8. <div class="name">
  9. <span>{{ item.title }}</span>
  10. </div>
  11. <div class="play"></div>
  12. </div>
  13. <div class="info">
  14. <div class="club-name">{{ item.authParty }}</div>
  15. <div class="mobile">{{ item.userName | mobileFormat }}</div>
  16. </div>
  17. <div class="foot">
  18. <div class="date">{{ item.releaseTime | dateFormat }}</div>
  19. <div class="praise" :class="{ active: item.diggStatus === 1 }" @click.stop="$emit('praise', item)">
  20. {{ item.diggCount }}
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. <!-- 视频播放组件 -->
  26. <SimpleVideoPlayer :videoSrc="videoUrl" :description="description" ref="videoPlayer"></SimpleVideoPlayer>
  27. </div>
  28. </template>
  29. <script>
  30. export default {
  31. filters: {
  32. mobileFormat(mobile) {
  33. return mobile ? mobile.replace(/^(\w{3})\w+(\w{4})$/, '$1****$2') : ''
  34. },
  35. },
  36. props: {
  37. list: {
  38. type: Array,
  39. default: () => [],
  40. },
  41. },
  42. data() {
  43. return {
  44. videoUrl: '',
  45. description: '',
  46. }
  47. },
  48. methods: {
  49. // 播放视频
  50. onPlay(row) {
  51. this.videoUrl = row.ossUrl
  52. this.description = row.title
  53. this.$refs.videoPlayer.open()
  54. },
  55. },
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. @media screen and (min-width: 768px) {
  60. .video-list {
  61. display: grid;
  62. grid-template-columns: repeat(6, 1fr);
  63. grid-column-gap: 16px;
  64. grid-row-gap: 16px;
  65. .video {
  66. height: 358px;
  67. background: #fff;
  68. box-sizing: border-box;
  69. border: 1px solid #efefef;
  70. &:hover {
  71. .info {
  72. .club-name {
  73. color: #f3920d;
  74. }
  75. }
  76. }
  77. &:nth-child(4n) {
  78. margin-right: 0;
  79. }
  80. .cover {
  81. height: 248px;
  82. position: relative;
  83. // video {
  84. // display: block;
  85. // width: 100%;
  86. // height: 100%;
  87. // background: #000;
  88. // }
  89. img {
  90. display: block;
  91. width: 100%;
  92. height: 100%;
  93. background: #000;
  94. }
  95. .play {
  96. position: absolute;
  97. z-index: 2;
  98. width: 32px;
  99. height: 32px;
  100. background: url(~assets/theme-images/common/pc-icon-play.png) no-repeat center;
  101. background-size: 32px;
  102. left: 50%;
  103. top: 50%;
  104. transform: translate(-50%, -50%);
  105. cursor: pointer;
  106. }
  107. .name {
  108. display: flex;
  109. align-items: flex-end;
  110. width: 100%;
  111. height: 75px;
  112. padding: 17px 16px;
  113. box-sizing: border-box;
  114. position: absolute;
  115. left: 0;
  116. bottom: 0;
  117. background: linear-gradient(180deg, rgba(51, 51, 51, 0) 0%, #333333 100%);
  118. span {
  119. color: #fff;
  120. font-size: 14px;
  121. line-height: 20px;
  122. max-height: 40px;
  123. @include ellipsis(2);
  124. }
  125. }
  126. }
  127. .info {
  128. padding: 10px;
  129. .club-name {
  130. font-size: 14px;
  131. color: #282828;
  132. @include ellipsis(1);
  133. cursor: pointer;
  134. height: 18px;
  135. line-height: 18px;
  136. }
  137. .mobile {
  138. font-size: 14px;
  139. color: #666;
  140. margin-top: 8px;
  141. }
  142. }
  143. .foot {
  144. color: #999999;
  145. font-size: 14px;
  146. display: flex;
  147. justify-content: space-between;
  148. align-items: center;
  149. border-top: 1px solid #efefef;
  150. margin: 0 10px;
  151. padding-top: 8px;
  152. .praise {
  153. flex-shrink: 0;
  154. line-height: 16px;
  155. cursor: pointer;
  156. }
  157. .praise {
  158. position: relative;
  159. padding-left: 22px;
  160. &::after {
  161. content: '';
  162. display: block;
  163. width: 16px;
  164. height: 16px;
  165. background-size: 16px;
  166. position: absolute;
  167. left: 0;
  168. top: 50%;
  169. transform: translateY(-50%);
  170. background-repeat: no-repeat;
  171. background-position: center;
  172. background-image: url(~assets/theme-images/common/icon-praise.png);
  173. }
  174. &.active {
  175. color: #f3920d;
  176. &::after {
  177. background-image: url(~assets/theme-images/common/icon-praise-active.png);
  178. }
  179. }
  180. }
  181. }
  182. }
  183. }
  184. }
  185. @media screen and (max-width: 768px) {
  186. .video-list {
  187. display: grid;
  188. grid-template-columns: repeat(2, 1fr);
  189. grid-column-gap: 2.4vw;
  190. grid-row-gap: 2.4vw;
  191. .video {
  192. height: 89.2vw;
  193. background: #fff;
  194. box-sizing: border-box;
  195. border: 0.1vw solid #efefef;
  196. &:hover {
  197. .info {
  198. .club-name {
  199. color: #f3920d;
  200. }
  201. }
  202. }
  203. &:nth-child(4n) {
  204. margin-right: 0;
  205. }
  206. .cover {
  207. height: 64.4vw;
  208. position: relative;
  209. // video {
  210. // display: block;
  211. // width: 100%;
  212. // height: 100%;
  213. // background: #000;
  214. // }
  215. img {
  216. display: block;
  217. width: 100%;
  218. height: 100%;
  219. background: #000;
  220. }
  221. .play {
  222. position: absolute;
  223. z-index: 2;
  224. width: 7.2vw;
  225. height: 7.2vw;
  226. background: url(~assets/theme-images/common/h5-icon-play.png) no-repeat center;
  227. background-size: 7.2vw;
  228. left: 50%;
  229. top: 50%;
  230. transform: translate(-50%, -50%);
  231. cursor: pointer;
  232. }
  233. .name {
  234. display: flex;
  235. align-items: flex-end;
  236. width: 100%;
  237. height: 16vw;
  238. padding: 4.4vw 3vw;
  239. box-sizing: border-box;
  240. position: absolute;
  241. left: 0;
  242. bottom: 0;
  243. background: linear-gradient(180deg, rgba(51, 51, 51, 0) 0%, #333333 100%);
  244. span {
  245. color: #fff;
  246. font-size: 3vw;
  247. line-height: 3.6vw;
  248. max-height: 7.2vw;
  249. @include ellipsis(2);
  250. }
  251. }
  252. }
  253. .info {
  254. padding: 2.4vw;
  255. .club-name {
  256. font-size: 3.4vw;
  257. color: #282828;
  258. @include ellipsis(1);
  259. cursor: pointer;
  260. height: 3.6vw;
  261. line-height: 3.6vw;
  262. }
  263. .mobile {
  264. font-size: 3vw;
  265. color: #666;
  266. margin-top: 1.6vw;
  267. }
  268. }
  269. .foot {
  270. color: #999999;
  271. font-size: 14px;
  272. display: flex;
  273. justify-content: space-between;
  274. align-items: center;
  275. border-top: 1px solid #efefef;
  276. margin: 0 2.4vw;
  277. padding-top: 2.4vw;
  278. line-height: 3.6vw;
  279. font-size: 2.6vw;
  280. .praise {
  281. flex-shrink: 0;
  282. cursor: pointer;
  283. }
  284. .praise {
  285. position: relative;
  286. padding-left: 4.4vw;
  287. &::after {
  288. content: '';
  289. display: block;
  290. width: 3.6vw;
  291. height: 3.6vw;
  292. background-size: 3.6vw;
  293. position: absolute;
  294. left: 0;
  295. top: 50%;
  296. transform: translateY(-50%);
  297. background-image: url(~assets/theme-images/common/icon-praise.png);
  298. background-position: center;
  299. background-repeat: no-repeat;
  300. }
  301. &.active {
  302. color: #f3920d;
  303. &::after {
  304. background-image: url(~assets/theme-images/common/icon-praise-active.png);
  305. }
  306. }
  307. }
  308. }
  309. }
  310. }
  311. }
  312. </style>