sh-live.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="live-el u-m-p-20 u-m-b-10" v-if="showLive">
  3. <view class="head">
  4. <text class="head-title">{{ detail.name }}</text>
  5. <view class="head-more u-flex u-col-center" @tap="$Router.push('/pages/app/live/list')">
  6. <text class="u-m-r-10 more-text">更多直播</text>
  7. <text class="iconfont icon-youjiantou-tianchong more-icon"></text>
  8. </view>
  9. </view>
  10. <!-- 大图 -->
  11. <view v-if="liveType == 1" v-for="live in liveList" :key="live.id"><shopro-live-card :type="1" :detail="live"></shopro-live-card></view>
  12. <!-- 小图 -->
  13. <view class="content-two" v-if="liveType == 2">
  14. <view class="content-two__item" v-for="live in liveList" :key="live.id">
  15. <shopro-live-card :type="2" :detail="live" :wh="345">
  16. <block slot="liveGoods"><text></text></block>
  17. </shopro-live-card>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. /**
  24. * 自定义之直播卡片
  25. * @property {Object} detail - 直播信息
  26. */
  27. export default {
  28. components: {},
  29. data() {
  30. return {
  31. liveList: [],
  32. showLive: this.detail.ids,
  33. liveType: this.detail.style
  34. };
  35. },
  36. props: {
  37. detail: {}
  38. },
  39. created() {
  40. this.showLive && this.getLiveList();
  41. },
  42. computed: {},
  43. methods: {
  44. // 直播列表
  45. getLiveList() {
  46. let that = this;
  47. that.$http('common.live', {
  48. type: 'all',
  49. ids: that.detail.ids
  50. }).then(res => {
  51. if (res.code === 1) {
  52. that.liveList = res.data;
  53. }
  54. });
  55. },
  56. goRoom(live) {
  57. wx.navigateTo({
  58. url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${live.room_id}`
  59. });
  60. }
  61. }
  62. };
  63. </script>
  64. <style lang="scss">
  65. .live-el {
  66. background: #fff;
  67. padding: 30rpx 20rpx;
  68. .head {
  69. display: flex;
  70. justify-content: space-between;
  71. align-items: center;
  72. &-title {
  73. font-size: 32rpx;
  74. font-weight: bold;
  75. color: rgba(51, 51, 51, 1);
  76. }
  77. &-more {
  78. .more-text {
  79. font-size: 22rpx;
  80. font-weight: 500;
  81. color: #333333;
  82. }
  83. .more-icon {
  84. font-size: 24rpx;
  85. color: #333333;
  86. }
  87. }
  88. }
  89. // 双图直播
  90. .content-two {
  91. width: 710rpx;
  92. display: flex;
  93. flex-wrap: wrap;
  94. &__item {
  95. margin-right: 20rpx;
  96. margin-top: 20rpx;
  97. width: 345rpx;
  98. &:nth-child(2n) {
  99. margin-right: 0;
  100. }
  101. }
  102. }
  103. }
  104. </style>