alive.vue 13 KB

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