wxlive.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="diy-live" :style="{ background: itemData.style.background }" v-if="itemData.data.length>0">
  3. <view class="diy-head d-e-c" :style="'background-image: url('+itemData.style.background_image+');'">
  4. <!-- <view class="right" @click="gotoList">
  5. <text class="white">更多</text>
  6. <text class="iconfont icon-jiantou mr20" style="font-size: 24rpx;color: #999999;"></text>
  7. </view> -->
  8. </view>
  9. <view class="list d-s-c f-w">
  10. <view class="item" v-for="(item, index) in itemData.data" :key="index" @click="gotoDetail(item)">
  11. <view class="pic pr">
  12. <text class="state"
  13. :class="{bg101:item.live_status==101,bg102:item.live_status==102,bg103:item.live_status==103}"
  14. v-if="item.live_status==101||item.live_status==102||item.live_status==103">
  15. {{convertStatus(item.live_status)}}
  16. </text>
  17. <image :src="item.share_img" mode="aspectFill"></image>
  18. <view class="anchor">{{item.anchor_name}}</view>
  19. </view>
  20. <view class="p20">
  21. <view class="text-ellipsis-2 f26">{{ item.name }}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. components: {},
  30. data() {
  31. return {};
  32. },
  33. props: ['itemData'],
  34. created() {},
  35. methods: {
  36. scroll(e) {},
  37. /*状态转换*/
  38. convertStatus(num) {
  39. let str = '';
  40. switch (num) {
  41. case 101:
  42. str = '直播中';
  43. break;
  44. case 102:
  45. str = '未开始';
  46. break;
  47. case 103:
  48. str = '已结束';
  49. break;
  50. case 104:
  51. str = '禁播';
  52. break;
  53. case 105:
  54. str = '暂停';
  55. break;
  56. case 106:
  57. str = '异常';
  58. break;
  59. case 107:
  60. str = '已过期';
  61. break;
  62. }
  63. return str;
  64. },
  65. /*跳转列表*/
  66. gotoList() {
  67. let url = '/pages/plus/live/wx/list';
  68. this.gotoPage(url);
  69. },
  70. /*跳转产品详情*/
  71. gotoDetail(item) {
  72. let roomId = item.roomid;
  73. let customParams = {
  74. path: 'pages/index/index'
  75. };
  76. wx.navigateTo({
  77. url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}&custom_params=${encodeURIComponent(JSON.stringify(customParams))}`
  78. });
  79. }
  80. }
  81. };
  82. </script>
  83. <style lang="scss">
  84. .diy-live {
  85. margin: 20rpx;
  86. border-radius: 20rpx;
  87. background: #ffffff;
  88. // box-shadow: 0 0 8rpx rgba(0, 0, 0, 0.1);
  89. overflow: hidden;
  90. }
  91. .diy-live .diy-head {
  92. height: 90rpx;
  93. align-items: center;
  94. background-size: 100% 100%;
  95. }
  96. .diy-live .diy-head .name {
  97. font-size: 36rpx;
  98. font-weight: bold;
  99. width: 200rpx;
  100. }
  101. .diy-live .list {
  102. padding: 20rpx;
  103. }
  104. .diy-live .list .item {
  105. width: 320rpx;
  106. margin-right: 30rpx;
  107. margin-bottom: 30rpx;
  108. height: 340rpx;
  109. background-color: #f6f6f6;
  110. border-radius: 12rpx;
  111. overflow: hidden;
  112. }
  113. .diy-live .list .item:nth-child(2n + 0) {
  114. margin-right: 0;
  115. }
  116. .diy-live .list .item .pic {
  117. width: 246rpx;
  118. height: 240rpx;
  119. }
  120. .diy-live .list .item .pic .state {
  121. position: absolute;
  122. z-index: 80;
  123. top: 20rpx;
  124. left: 20rpx;
  125. padding: 4rpx 8rpx;
  126. background: red;
  127. color: #FFFFFF;
  128. border-radius: 8rpx;
  129. }
  130. .diy-live .list .item .pic .state.bg101 {
  131. background: red;
  132. }
  133. .diy-live .list .item .pic .state.bg102 {
  134. background: #ffb100;
  135. }
  136. .diy-live .list .item .pic .state.bg103 {
  137. background: #333333;
  138. }
  139. .diy-live .list .item image {
  140. width: 320rpx;
  141. height: 240rpx;
  142. border-radius: 12rpx;
  143. }
  144. .diy-live .anchor {
  145. position: absolute;
  146. bottom: 12rpx;
  147. left: 18rpx;
  148. font-size: 24rpx;
  149. line-height: 24rpx;
  150. }
  151. </style>