多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
1.9 KiB

2 years ago
  1. <template>
  2. <view class="live-list-page">
  3. <view class="live-list">
  4. <LiveBox class="live-item"
  5. v-for="item in roomList"
  6. :key="item.roomid"
  7. :liveData="item"
  8. />
  9. </view>
  10. <view v-if="ifShow" class="emptyCart-box">
  11. <image class="emptyCart-img" src="https://ceres.zkthink.com/static/images/collectEmpty.png"></image>
  12. <label class="text font-color-999 fs26 mar-top-30">暂无直播~</label>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. const NET = require('@/utils/request')
  18. const API = require('@/config/api')
  19. import LiveBox from './components/liveBox.vue'
  20. export default {
  21. components: {
  22. LiveBox
  23. },
  24. data() {
  25. return {
  26. page: {
  27. page: 1,
  28. pageSize: 10,
  29. },
  30. isLoading: false,
  31. roomList: [],
  32. ifShow: false
  33. }
  34. },
  35. onLoad() {
  36. this.getLiveRooms()
  37. },
  38. onReachBottom() {
  39. this.page.page ++
  40. this.getLiveRooms()
  41. },
  42. methods: {
  43. // 获取直播间列表
  44. getLiveRooms () {
  45. if (this.isLoading) { return }
  46. this.isLoading = true
  47. NET.request(API.LiveRoomes, this.page, 'get').then(res => {
  48. if (this.page.page === 1) { // 第一次查询
  49. this.roomList = res.data.list
  50. if (this.roomList.length === 0) {
  51. this.ifShow = true
  52. }
  53. } else { // 下拉继续查询
  54. this.roomList = this.roomList.concat(res.data.list)
  55. }
  56. this.isLoading = false
  57. }).catch(err => {
  58. this.isLoading = false
  59. })
  60. },
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .live-list-page{
  66. .live-list{
  67. width: 100%;
  68. display: flex;
  69. flex-wrap: wrap;
  70. .live-item{
  71. width: 48%;
  72. height: 460rpx;
  73. margin: 1%;
  74. border-radius: 8rpx;
  75. overflow: hidden;
  76. }
  77. }
  78. .emptyCart-box{
  79. position: absolute;
  80. top: 0;
  81. bottom: 0;
  82. left: 0;
  83. right: 0;
  84. display: flex;
  85. flex-direction: column;
  86. justify-content: center;
  87. align-items: center;
  88. .emptyCart-img{
  89. width: 198upx;
  90. height: 183upx;
  91. }
  92. }
  93. }
  94. </style>