myLike.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <zj-page-layout
  3. :hasFooter="false"
  4. :isScroll="true"
  5. :refresherTriggered="refresherTriggered"
  6. @refresherrefresh="refresherrefresh"
  7. @scrolltolower="scrolltolower">
  8. <view class="list-container">
  9. <view class="item">
  10. <view class="top">
  11. <image src="@/static/common/logo.png"></image>
  12. <view class="user">
  13. <view class="name">张三</view>
  14. <view class="time">23小时前发布</view>
  15. </view>
  16. <view class="price">¥1888.00</view>
  17. </view>
  18. <view class="title">商品名称</view>
  19. <view class="des">商品描述</view>
  20. <view class="imgs">
  21. <image src="@/static/user/other_speech.png"></image>
  22. <image src="@/static/user/other_speech.png"></image>
  23. <image src="@/static/user/other_speech.png"></image>
  24. </view>
  25. <view class="bottom">
  26. <view class="location">天河区棠下</view>
  27. <view class="right">
  28. <u-button text="取消点赞" shape="circle"></u-button>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </zj-page-layout>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. imgUrl: this.$imageUrl,
  40. dataList: [],
  41. pageNum: 1,
  42. refresherTriggered: false,
  43. }
  44. },
  45. async onLoad() {
  46. // await this.getList()
  47. },
  48. methods: {
  49. //获取列表数据
  50. async getList() {
  51. this.$api.post('/xxx/xxxlist', {
  52. pageNum: this.pageNum,
  53. pageSize: 10,
  54. }).then(res => {
  55. this.loadStatus = 0;
  56. let list = res.data.records;
  57. if(list.length < 10){
  58. this.loadStatus = 2;
  59. }
  60. this.dataList = this.dataList.concat(list);
  61. }).catch(() => {
  62. this.loadStatus = 2;
  63. }).finally(res => {
  64. this.refresherTriggered = false;
  65. })
  66. },
  67. // 滚动到底部
  68. scrolltolower(e) {
  69. if (this.loadStatus === 0) {
  70. this.pageNum++;
  71. this.getList();
  72. }
  73. },
  74. // 触发下拉刷新
  75. refresherrefresh(e) {
  76. this.refresherTriggered = true;
  77. this.dataList = [];
  78. this.pageNum = 1;
  79. this.getList();
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .list-container {
  86. .item {
  87. margin-top: 30rpx;
  88. background: #ffffff;
  89. padding: 20rpx 30rpx;
  90. .top {
  91. display: flex;
  92. align-items: center;
  93. image {
  94. width: 88rpx;
  95. height: 88rpx;
  96. border-radius: 50%;
  97. flex-shrink: 0;
  98. }
  99. .user {
  100. margin-left: 20rpx;
  101. flex: 1;
  102. .name {
  103. }
  104. .time {
  105. color: $sec-font;
  106. font-size: 24rpx;
  107. margin-top: 8rpx;
  108. }
  109. }
  110. .price {
  111. color: $assist-color;
  112. }
  113. }
  114. .title {
  115. margin-top: 20rpx;
  116. }
  117. .des {
  118. margin-top: 20rpx;
  119. }
  120. .imgs {
  121. display: flex;
  122. flex-wrap: wrap;
  123. image {
  124. width: 140rpx;
  125. height: 140rpx;
  126. margin-right: 20rpx;
  127. margin-top: 20rpx;
  128. }
  129. }
  130. .bottom {
  131. border-top: 1px solid #eaeaea;
  132. margin-top: 20rpx;
  133. padding-top: 20rpx;
  134. display: flex;
  135. align-items: center;
  136. justify-content: space-between;
  137. .location {
  138. font-size: 24rpx;
  139. color: $sec-font;
  140. }
  141. .u-button {
  142. height: 60rpx;
  143. }
  144. }
  145. }
  146. }
  147. </style>