liveBroadcast.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. <template>
  2. <!-- #ifdef MP -->
  3. <view v-show="!isSortType">
  4. <view :style="[{'margin-top': mbConfig + 'rpx'},{'background':bg}]" v-if="liveList.length > 0" style="padding-bottom: 20rpx;">
  5. <view class="title-box">
  6. <text>{{$t(`推荐好货`)}}</text>
  7. <navigator hover-class="none" url="/pages/columnGoods/live_list/index" class="more">{{$t(`更多`)}}<text class="iconfont icon-jiantou"></text></navigator>
  8. </view>
  9. <!-- -->
  10. <block v-if="listStyle == 0">
  11. <view class="live-wrapper-a">
  12. <navigator class="live-item-a" v-for="(item,index) in liveList" :key="index" :url="'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=' + item.room_id+'&custom_params='+custom_params" hover-class="none" :style="[{'box-shadow':`0px 1px 20px ${boxShadow}`}]">
  13. <view class="img-box">
  14. <view class="label bgblue" v-if="item.live_status == 102">
  15. <view class="txt">{{$t(`预告`)}}</view>
  16. <view class="msg">{{item.show_time}}</view>
  17. </view>
  18. <view class="label bggary" v-if="item.live_status==103">
  19. <image src="/static/images/live-02.png" mode="" style="width: 20rpx; height: 20rpx;"></image>
  20. <text>{{$t(`回放`)}}</text>
  21. </view>
  22. <view class="label bgred" v-if="item.live_status==101">
  23. <image src="/static/images/live-01.png" mode="" style="width: 21rpx; height: 22rpx;"></image>
  24. <text>{{$t(`进行中`)}}</text>
  25. </view>
  26. <image :src="item.share_img"></image>
  27. </view>
  28. <view class="info">
  29. <view class="title line2">{{item.name}}</view>
  30. <view class="people">
  31. <image :src="item.anchor_img" alt="">
  32. <text>{{item.anchor_name}}</text>
  33. </view>
  34. <view class="goods-wrapper">
  35. <block v-if="item.goods.length <= 3">
  36. <view class="goods-item" v-for="(goods,index) in item.goods" :key="index">
  37. <image :src="goods.cover_img" alt="">
  38. <text class="line1">{{$t(`¥`)}}{{goods.price}}</text>
  39. </view>
  40. </block>
  41. <block v-if=" item.goods.length > 3">
  42. <view class="goods-item" v-for="(goods,index) in item.goods" :key="index" v-if="index<2">
  43. <image :src="goods.cover_img" alt="">
  44. <text class="line1">{{$t(`¥`)}}{{goods.price}}</text>
  45. </view>
  46. <view class="goods-item">
  47. <image :src="item.goods[item.goods.length-1].cover_img" alt="">
  48. <view class="num">+{{item.goods.length}}</view>
  49. </view>
  50. </block>
  51. <block v-if="item.goods.length == 0">
  52. <view class="empty-goods" >{{$t(`暂无商品`)}}</view>
  53. </block>
  54. </view>
  55. </view>
  56. </navigator>
  57. </view>
  58. </block>
  59. <block v-if="listStyle == 1">
  60. <view class="live-wrapper-b">
  61. <navigator class="live-item-b" v-for="(item,index) in liveList" :key="index" :url="'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=' + item.room_id+'&custom_params='+custom_params" hover-class="none" :style="[{'box-shadow':`0px 1px 20px ${boxShadow}`}]">
  62. <view class="img-box">
  63. <view class="label bgblue" v-if="item.live_status == 102">
  64. <view class="txt">{{$t(`预告`)}}</view>
  65. <view class="msg">{{item.show_time}}</view>
  66. </view>
  67. <view class="label bggary" v-if="item.live_status==103">
  68. <image src="/static/images/live-02.png" mode="" style="width: 20rpx; height: 20rpx;"></image>
  69. <text>{{$t(`回放`)}}</text>
  70. </view>
  71. <view class="label bgred" v-if="item.live_status==101">
  72. <image src="/static/images/live-01.png" mode="" style="width: 21rpx; height: 22rpx;"></image>
  73. <text>{{$t(`进行中`)}}</text>
  74. </view>
  75. <image :src="item.share_img"></image>
  76. </view>
  77. <view class="info">
  78. <view class="title line2">{{item.name}}</view>
  79. <view class="people">
  80. <image :src="item.anchor_img" alt="">
  81. <text>{{item.anchor_name}}</text>
  82. </view>
  83. </view>
  84. </navigator>
  85. </view>
  86. </block>
  87. <block v-if="listStyle == 2">
  88. <view class="live-wrapper-a live-wrapper-c">
  89. <navigator class="live-item-a" v-for="(item,index) in liveList" :key="index" :url="'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=' + item.room_id+'&custom_params='+custom_params" hover-class="none" :style="[{'box-shadow':`0px 1px 20px ${boxShadow}`}]">
  90. <view class="img-box">
  91. <view class="label bgblue" v-if="item.live_status == 102">
  92. <view class="txt">{{$t(`预告`)}}</view>
  93. <view class="msg">{{item.show_time}}</view>
  94. </view>
  95. <view class="label bggary" v-if="item.live_status==103">
  96. <image src="/static/images/live-02.png" mode="" style="width: 20rpx; height: 20rpx;"></image>
  97. <text>{{$t(`回放`)}}</text>
  98. </view>
  99. <view class="label bgred" v-if="item.live_status==101">
  100. <image src="/static/images/live-01.png" mode="" style="width: 21rpx; height: 22rpx;"></image>
  101. <text>{{$t(`进行中`)}}</text>
  102. </view>
  103. <image :src="item.share_img"></image>
  104. </view>
  105. <view class="info">
  106. <view class="left">
  107. <view class="title line2">{{item.name}}</view>
  108. <view class="people">
  109. <image :src="item.anchor_img" alt="">
  110. <text>{{item.anchor_name}}</text>
  111. </view>
  112. </view>
  113. <view class="goods-wrapper">
  114. <block v-if="item.goods.length <= 2">
  115. <view class="goods-item" v-for="(goods,index) in item.goods" :key="index">
  116. <image :src="goods.cover_img" alt="">
  117. <text class="line1">{{$t(`¥`)}}{{goods.price}}</text>
  118. </view>
  119. </block>
  120. <block v-if=" item.goods.length > 2">
  121. <view class="goods-item" v-for="(goods,index) in item.goods" :key="index" v-if="index<1">
  122. <image :src="goods.cover_img" alt="">
  123. <text class="line1">{{$t(`¥`)}}{{goods.price}}</text>
  124. </view>
  125. <view class="goods-item">
  126. <image :src="item.goods[item.goods.length-1].cover_img" alt="">
  127. <view class="num">+{{item.goods.length}}</view>
  128. </view>
  129. </block>
  130. </view>
  131. </view>
  132. </navigator>
  133. </view>
  134. </block>
  135. </view>
  136. </view>
  137. <!-- #endif -->
  138. </template>
  139. <script>
  140. import {
  141. getLiveList
  142. } from '@/api/api.js';
  143. export default {
  144. name: 'liveBroadcast',
  145. props: {
  146. dataConfig: {
  147. type: Object,
  148. default: () => {}
  149. },
  150. isSortType:{
  151. type: String | Number,
  152. default:0
  153. }
  154. },
  155. data() {
  156. return {
  157. // endBg: this.dataConfig.endBg.color[0].item,
  158. // notBg: this.dataConfig.notBg.color[0].item,
  159. // playBg: this.dataConfig.playBg.color[0].item,
  160. listStyle: this.dataConfig.listStyle.type,
  161. mbConfig: this.dataConfig.mbConfig.val,
  162. liveList: [],
  163. custom_params:'',
  164. // bg:this.dataConfig.bg.color[0].item,
  165. // boxShadow: this.dataConfig.boxShadow.color[0].item,
  166. limit:this.dataConfig.limit.val
  167. };
  168. },
  169. created() {},
  170. mounted() {
  171. this.custom_params= encodeURIComponent(JSON.stringify({spid:this.$store.state.app.uid}))
  172. this.getLiveList();
  173. },
  174. methods: {
  175. //
  176. getLiveList: function() {
  177. let limit = this.$config.LIMIT;
  178. getLiveList(1, this.limit == undefined ? 10 : this.limit)
  179. .then(res => {
  180. this.liveList = res.data;
  181. })
  182. .catch(res => {
  183. });
  184. }
  185. }
  186. };
  187. </script>
  188. <style lang="scss">
  189. .live-wrapper {
  190. position: relative;
  191. width: 100%;
  192. overflow: hidden;
  193. border-radius: 16rpx;
  194. image {
  195. width: 100%;
  196. height: 400rpx;
  197. }
  198. .live-top {
  199. z-index: 20;
  200. position: absolute;
  201. left: 0;
  202. top: 0;
  203. display: flex;
  204. align-items: center;
  205. justify-content: center;
  206. color: #fff;
  207. width: 180rpx;
  208. height: 54rpx;
  209. border-radius: 0rpx 0px 18rpx 0px;
  210. image {
  211. width: 30rpx;
  212. height: 30rpx;
  213. margin-right: 10rpx;
  214. /* #ifdef H5 */
  215. display: block;
  216. /* #endif */
  217. }
  218. }
  219. .live-title {
  220. position: absolute;
  221. left: 0;
  222. bottom: 6rpx;
  223. width: 100%;
  224. height: 70rpx;
  225. line-height: 70rpx;
  226. text-align: center;
  227. font-size: 30rpx;
  228. color: #fff;
  229. background: rgba(0, 0, 0, 0.35);
  230. }
  231. &.mores {
  232. width: 100%;
  233. .item {
  234. position: relative;
  235. width: 320rpx;
  236. display: inline-block;
  237. border-radius: 16rpx;
  238. overflow: hidden;
  239. margin-right: 20rpx;
  240. image {
  241. width: 320rpx;
  242. height: 180rpx;
  243. border-radius: 16rpx;
  244. }
  245. .live-title {
  246. height: 40rpx;
  247. line-height: 40rpx;
  248. text-align: center;
  249. font-size: 22rpx;
  250. }
  251. .live-top {
  252. width: 120rpx;
  253. height: 36rpx;
  254. font-size: 22rpx;
  255. image {
  256. width: 20rpx;
  257. height: 20rpx;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. .live-wrapper-a{
  264. padding: 0rpx 20rpx 0;
  265. .live-item-a{
  266. display: flex;
  267. background: #fff;
  268. margin-bottom: 20rpx;
  269. border-radius: 16rpx;
  270. overflow: hidden;
  271. &:last-child{
  272. margin-bottom: 0;
  273. }
  274. .img-box{
  275. position: relative;
  276. width: 340rpx;
  277. height: 270rpx;
  278. image{
  279. width: 100%;
  280. height: 100%;
  281. }
  282. }
  283. .info{
  284. flex: 1;
  285. display: flex;
  286. flex-direction: column;
  287. justify-content: space-between;
  288. padding: 15rpx 20rpx;
  289. .title{
  290. font-size: 30rpx;
  291. color: #333;
  292. }
  293. .people{
  294. display: flex;
  295. align-items: center;
  296. color: #999;
  297. font-size: 24rpx;
  298. margin-top: 10rpx;
  299. image{
  300. width: 32rpx;
  301. height: 32rpx;
  302. border-radius: 50%;
  303. margin-right: 10rpx;
  304. }
  305. }
  306. .goods-wrapper{
  307. display: flex;
  308. .goods-item{
  309. position: relative;
  310. width: 96rpx;
  311. height: 96rpx;
  312. margin-right: 20rpx;
  313. overflow: hidden;
  314. border-radius: 16rpx;
  315. &:last-child{
  316. margin-right: 0;
  317. }
  318. image{
  319. width: 100%;
  320. height: 100%;
  321. border-radius: 16rpx;
  322. }
  323. .bg{
  324. position: absolute;
  325. left: 0;
  326. top: 0;
  327. width: 100%;
  328. height: 100%;
  329. border-radius: 16rpx;
  330. background: rgba(0, 0, 0, 0.3);
  331. }
  332. text{
  333. position: absolute;
  334. left: 0;
  335. bottom: 0;
  336. width: 100%;
  337. height: 60rpx;
  338. line-height: 70rpx;
  339. color: #fff;
  340. background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.75) 100%);
  341. }
  342. .num{
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. position: absolute;
  347. left: 0;
  348. top: 0;
  349. width: 100%;
  350. height: 100%;
  351. background: rgba(0, 0, 0, 0.3);
  352. color: #fff;
  353. font-size: 28rpx;
  354. }
  355. }
  356. }
  357. .empty-goods{
  358. width: 96rpx;
  359. height: 96rpx;
  360. border-radius: 6rpx;
  361. background-color: #B2B2B2;
  362. color: #fff;
  363. font-size: 20rpx;
  364. text-align: center;
  365. line-height: 96rpx;
  366. }
  367. }
  368. }
  369. &.live-wrapper-c{
  370. .live-item-a{
  371. display: flex;
  372. flex-direction: column;
  373. .img-box{
  374. width: 100%;
  375. border-radius: 8px 8px 0 0;
  376. }
  377. .info{
  378. display: flex;
  379. justify-content: space-between;
  380. align-items: center;
  381. flex-direction: initial;
  382. .left{
  383. width: 69%;
  384. }
  385. .goods-wrapper{
  386. flex: 1;
  387. }
  388. }
  389. }
  390. }
  391. }
  392. .live-wrapper-b{
  393. padding: 0rpx 20rpx 0;
  394. display: flex;
  395. justify-content: space-between;
  396. flex-wrap: wrap;
  397. .live-item-b{
  398. width: 345rpx;
  399. background-color: #fff;
  400. border-radius: 16rpx;
  401. overflow: hidden;
  402. margin-bottom: 20rpx;
  403. overflow: hidden;
  404. .img-box{
  405. position: relative;
  406. image{
  407. width: 100%;
  408. height: 274rpx;
  409. }
  410. }
  411. .info{
  412. display: flex;
  413. flex-direction: column;
  414. padding: 20rpx;
  415. .title{
  416. font-size: 30rpx;
  417. color: #333;
  418. }
  419. .people{
  420. display: flex;
  421. margin-top: 10rpx;
  422. color: #999;
  423. image{
  424. width: 36rpx;
  425. height: 36rpx;
  426. border-radius: 50%;
  427. margin-right: 10rpx;
  428. }
  429. }
  430. }
  431. }
  432. }
  433. .label{
  434. display: flex;
  435. align-items: center;
  436. justify-content: center;
  437. position: absolute;
  438. left: 20rpx;
  439. top: 20rpx;
  440. border-radius: 22rpx 0px 22rpx 22rpx;
  441. font-size: 24rpx;
  442. color: #fff;
  443. image{
  444. margin-right: 10rpx;
  445. }
  446. text{
  447. font-size: 22rpx;
  448. }
  449. }
  450. .bgred{
  451. width: 132rpx;
  452. height: 38rpx;
  453. background: linear-gradient(270deg, #F5742F 0%, #FF1717 100%)
  454. }
  455. .bggary{
  456. width: 108rpx;
  457. height: 38rpx;
  458. background: linear-gradient(270deg, #999999 0%, #666666 100%)
  459. }
  460. .bgblue{
  461. width: 220rpx;
  462. height: 38rpx;
  463. background: rgba(0,0,0,0.36);
  464. overflow: hidden;
  465. .txt{
  466. position: relative;
  467. left: -5rpx;
  468. display: flex;
  469. align-items: center;
  470. justify-content: center;
  471. width: 38px;
  472. height: 100%;
  473. text-align: center;
  474. background: linear-gradient(270deg, #2FA1F5 0%, #0076FF 100%);
  475. }
  476. }
  477. .title-box{
  478. display: flex;
  479. justify-content: space-between;
  480. align-items: center;
  481. padding: 20rpx;
  482. font-size: 32rpx;
  483. .more{
  484. display: flex;
  485. align-items: center;
  486. justify-content: center;
  487. font-size: 26rpx;
  488. color: #666;
  489. .iconfont{
  490. font-size: 26rpx;
  491. margin-top: 8rpx;
  492. }
  493. }
  494. }
  495. </style>