index.vue 7.3 KB

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