video-list.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="margin-bottom zaiui-video-list-box" :class="show?'show':''">
  3. <view class="flex flex-wrap">
  4. <view class="basis-df padding-sm padding-right-xs">
  5. <block v-for="(item,index) in list_data" :key="index" v-if="index%2==0">
  6. <view class="margin-bottom-sm img-itme" @tap="listTap(item,index)">
  7. <!--背景图-->
  8. <image class="cover-img" :src="item.cover_img" lazy-load mode="widthFix"/>
  9. <!--标题-->
  10. <view class="text-cut video-title" v-if="item.title">{{item.title}}</view>
  11. <!--用户信息-->
  12. <view class="video-user-info-box" v-if="item.name">
  13. <view class="user-box">
  14. <!--头像-->
  15. <image :src="item.avatar" mode="aspectFill" lazy-load class="cu-avatar sm round" v-if="item.avatar"/>
  16. <!--名称-->
  17. <view class="text-cut text-sm user-name">{{item.name}}</view>
  18. <!--点赞-->
  19. <view class="text-sm text-right video-appreciate" v-if="item.appreciate">
  20. <text class="cuIcon-appreciate"/>
  21. <text class="margin-left-xs">{{item.appreciate}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </block>
  27. </view>
  28. <view class="basis-df padding-sm padding-left-xs">
  29. <block v-for="(item,index) in list_data" :key="index" v-if="index%2!=0">
  30. <view class="margin-bottom-sm img-itme" @tap="listTap(item,index)">
  31. <!--背景图-->
  32. <image class="cover-img" :src="item.cover_img" lazy-load mode="widthFix"/>
  33. <!--标题-->
  34. <view class="text-cut video-title" v-if="item.title">{{item.title}}</view>
  35. <!--用户信息-->
  36. <view class="video-user-info-box" v-if="item.name">
  37. <view class="user-box">
  38. <!--头像-->
  39. <image :src="item.avatar" mode="aspectFill" lazy-load class="cu-avatar sm round" v-if="item.avatar"/>
  40. <!--名称-->
  41. <view class="text-cut text-sm user-name">{{item.name}}</view>
  42. <!--点赞-->
  43. <view class="text-sm text-right video-appreciate" v-if="item.appreciate">
  44. <text class="cuIcon-appreciate"/>
  45. <text class="margin-left-xs">{{item.appreciate}}</text>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </block>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import _tool from '@/static/zaiui/util/tools.js';
  57. export default {
  58. name: 'video-list',
  59. props: {
  60. list_data: {
  61. type: Array,
  62. default: () => {
  63. return []
  64. }
  65. },
  66. show: {
  67. type: Boolean,
  68. default: true
  69. }
  70. },
  71. methods: {
  72. listTap(data,index) {
  73. this.$emit('listTap', {
  74. data,
  75. index
  76. });
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .zaiui-video-list-box {
  83. position: relative;
  84. width: 100%;
  85. display: none;
  86. .img-itme {
  87. position: relative;
  88. width: 100%;
  89. .cover-img {
  90. width: 100%;
  91. border-radius: 3%;
  92. }
  93. .video-title {
  94. position: absolute;
  95. bottom: 72.72upx;
  96. left: 0;
  97. width: 100%;
  98. padding: 0 18.18upx;
  99. color: #FFFFFF;
  100. }
  101. .video-user-info-box {
  102. position: absolute;
  103. bottom: 18.18upx;
  104. left: 0;
  105. width: 100%;
  106. color: #FFFFFF;
  107. .user-box {
  108. position: relative;
  109. width: 100%;
  110. .cu-avatar {
  111. margin-left: 18.18upx;
  112. width: 43.63upx;
  113. height: 43.63upx;
  114. }
  115. .user-name {
  116. position: absolute;
  117. top: 3.63upx;
  118. width: 145.45upx;
  119. left: 72.72upx;
  120. }
  121. .video-appreciate {
  122. position: absolute;
  123. top: 3.63upx;
  124. right: 18.18upx;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. .zaiui-video-list-box.show {
  131. display: block;
  132. }
  133. </style>