index.vue 8.0 KB

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