index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="main">
  3. <view class='flash-sale'>
  4. <view class='list'>
  5. <view v-for="(item,index) in broadcastList" :key='index' >
  6. <navigator hover-class="none" :url="((item.live_status == 103 && item.replay_status) || item.live_status === 101 || item.live_status === 102) ? 'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=' + item.room_id : ''">
  7. <view class='item acea-row row-between-wrapper'>
  8. <view class="live-image">
  9. <img class="image" :src="item.share_img">
  10. <view class="live-top" :class="item.live_status == 102 ? 'playRadius' : 'notPlayRadius'" :style="'background:' + (item.live_status == 101 ? playBg : (item.live_status != 101 && item.live_status != 102) ? endBg : notBg) + ';'">
  11. <block v-if="item.live_status == 101">
  12. <image :src="`${domain}/static/images/live-01.png`" mode=""></image>
  13. <text>直播中</text>
  14. </block>
  15. <block v-if="item.live_status == 103 && item.replay_status === 1">
  16. <image :src="`${domain}/static/images/live-02.png`" mode=""></image>
  17. <text>回放</text>
  18. </block>
  19. <block v-if="(item.live_status != 101 && item.live_status != 102 && item.live_status != 103) || (item.live_status == 103 && item.replay_status == 0)">
  20. <image :src="`${domain}/static/images/live-02.png`" mode=""></image>
  21. <text>已结束</text>
  22. </block>
  23. <block v-if="item.live_status == 102">
  24. <image :src="`${domain}/static/images/live-03.png`" mode=""></image>
  25. <text>预告</text>
  26. </block>
  27. </view>
  28. <view v-if="item.live_status == 101 || item.live_status == 102" class="broadcast-time">{{ item.show_time }}</view>
  29. </view>
  30. <view class="live-wrapper">
  31. <view class="live-title">{{ item.name }}</view>
  32. <view class="live-store">{{ item.anchor_name }}</view>
  33. <view class="pro-count" style="white-space: nowrap; display: flex" v-if="item.broadcast.length > 0">
  34. <navigator hover-class="none" class="item" v-for="(itm, idx) in item.broadcast" :key="idx">
  35. <view class="pro-img" v-if="idx < 3">
  36. <image :src="itm.goods.cover_img"></image>
  37. <view class="price" v-if="idx < 2">¥{{itm.goods.price}}</view>
  38. <view v-else class="more">+{{ item.broadcast.length - 2 }}</view>
  39. </view>
  40. </navigator>
  41. </view>
  42. </view>
  43. </view>
  44. </navigator>
  45. </view>
  46. <view class='loadingicon acea-row row-center-wrapper'>
  47. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  48. </view>
  49. </view>
  50. </view>
  51. <home></home>
  52. </div>
  53. </template>
  54. <script>
  55. // +----------------------------------------------------------------------
  56. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  57. // +----------------------------------------------------------------------
  58. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  59. // +----------------------------------------------------------------------
  60. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  61. // +----------------------------------------------------------------------
  62. // | Author: CRMEB Team <admin@crmeb.com>
  63. // +----------------------------------------------------------------------
  64. import {
  65. getBroadcastListApi
  66. } from '../../../api/store.js';
  67. import home from '@/components/home/index.vue'
  68. import { HTTP_REQUEST_URL } from '@/config/app';
  69. export default {
  70. components: {
  71. home
  72. },
  73. data() {
  74. return {
  75. topImage: '',
  76. broadcastList: [],
  77. loadTitle: '加载更多',
  78. scrollLeft: 0,
  79. interval: 0,
  80. status: 1,
  81. page: 1,
  82. limit: 5,
  83. loading: false,
  84. loadend: false,
  85. pageloading: false,
  86. endBg: 'linear-gradient(#666666, #999999)',
  87. notBg: 'rgb(26, 163, 246)',
  88. playBg: 'linear-gradient(#FF0000, #FF5400)',
  89. domain: HTTP_REQUEST_URL,
  90. }
  91. },
  92. /**
  93. * 用户点击右上角分享
  94. */
  95. // #ifdef MP
  96. onShareAppMessage: function() {
  97. wx.showShareMenu({
  98. withShareTicket: true,
  99. menus: ['shareAppMessage', 'shareTimeline']
  100. })
  101. return {
  102. title: '直播',
  103. path: 'pages/activity/liveBroadcast/index',
  104. }
  105. },
  106. onShareTimeline: function() {
  107. return {
  108. title: '直播',
  109. query: {
  110. key: ''
  111. },
  112. imageUrl: ''
  113. }
  114. },
  115. // #endif
  116. onLoad() {
  117. this.getBroadcastList();
  118. },
  119. methods: {
  120. getBroadcastList() {
  121. var that = this;
  122. var data = {
  123. page: that.page,
  124. limit: that.limit,
  125. };
  126. if (that.loadend) return;
  127. if (that.pageloading) return;
  128. this.pageloading = true
  129. getBroadcastListApi(data).then(res => {
  130. var list = res.data.list;
  131. var loadend = list.length < that.limit;
  132. that.page++;
  133. that.broadcastList = that.broadcastList.concat(list),
  134. that.page = that.page;
  135. that.pageloading = false;
  136. that.loadend = loadend;
  137. that.loadTitle = loadend ? '我也是有底线的' : '加载更多';
  138. }).catch(err => {
  139. that.pageloading = false
  140. that.loadTitle = '我也是有底线的'
  141. });
  142. },
  143. },
  144. /**
  145. * 页面上拉触底事件的处理函数
  146. */
  147. onReachBottom: function() {
  148. this.getBroadcastList();
  149. }
  150. }
  151. </script>
  152. <style lang="scss">
  153. .main {
  154. padding: 0 20rpx;
  155. margin-top: 20rpx;
  156. .row-between-wrapper {
  157. margin-bottom: 20rpx;
  158. display: flex;
  159. flex-direction: row;
  160. flex-wrap: wrap;
  161. justify-content: space-between;
  162. border-radius: 18rpx;
  163. .live-image {
  164. position: relative;
  165. width: 355rpx;
  166. height: 272rpx;
  167. border-radius: 18rpx 0 0 18rpx;
  168. .image {
  169. width: 100%;
  170. height: 100%;
  171. border-radius: 18rpx 0 0 18rpx;
  172. }
  173. }
  174. .live-wrapper {
  175. width: 50%;
  176. height: 272rpx;
  177. padding: 20rpx;
  178. background: #fff;
  179. border-radius: 0 18rpx 18rpx 0;
  180. position: relative;
  181. .live-title {
  182. font-size: 30rpx;
  183. color: #282828;
  184. font-weight: bold;
  185. }
  186. .live-store {
  187. font-size: 24rpx;
  188. color: #666666;
  189. }
  190. .pro-count {
  191. width: 330rpx;
  192. height: 100rpx;
  193. white-space: nowrap;
  194. position: absolute;
  195. bottom: 20rpx;
  196. }
  197. .item {
  198. width: 100rpx;
  199. height: 100rpx;
  200. margin-right: 15rpx;
  201. border-radius: 8rpx;
  202. position: relative;
  203. .pro-img{
  204. width: 100rpx;
  205. height: 100rpx;
  206. }
  207. image {
  208. width: 100rpx;
  209. height: 100rpx;
  210. max-width: 100%;
  211. border-radius: 8rpx;
  212. }
  213. .price {
  214. text-align: center;
  215. color: #FEFEFE;
  216. position: absolute;
  217. bottom: 4rpx;
  218. left: 0;
  219. width: 100%;
  220. font-size: 22rpx;
  221. background: rgba(0,0,0,.5);
  222. border-radius: 0 0 8rpx 8rpx;
  223. }
  224. .more {
  225. width: 100rpx;
  226. height: 100rpx;
  227. line-height: 100rpx;
  228. text-align: center;
  229. font-size: 28rpx;
  230. color: #FEFEFE;
  231. font-weight: bold;
  232. position: absolute;
  233. top: 0;
  234. left: 0;
  235. background-color: rgba(0, 0, 0, .2);
  236. border-radius: 8rpx;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. .live-top {
  243. z-index: 20;
  244. position: absolute;
  245. left: 0;
  246. top: 0;
  247. display: flex;
  248. align-items: center;
  249. justify-content: center;
  250. color: #fff;
  251. min-width: 130rpx;
  252. max-width: 140rpx;
  253. height: 50rpx;
  254. font-size: 22rpx;
  255. &.playRadius {
  256. border-radius: 18rpx 0px 0 0px;
  257. }
  258. &.notPlayRadius {
  259. border-radius: 18rpx 0px 18rpx 0px;
  260. }
  261. image {
  262. width: 30rpx;
  263. height: 30rpx;
  264. margin-right: 10rpx;
  265. /* #ifdef H5 */
  266. display: block;
  267. /* #endif */
  268. }
  269. }
  270. .broadcast-time {
  271. z-index: 20;
  272. position: absolute;
  273. left: 130rpx;
  274. top: 0;
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. color: #fff;
  279. width: 160rpx;
  280. height: 50rpx;
  281. background: rgba(0,0,0,.4);
  282. font-size: 22rpx;
  283. border-radius: 0 0 18rpx 0;
  284. }
  285. </style>