myBoost.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view>
  3. <view class="bg-img" style="background-image: url('https://upload-file-data.obs.cn-south-1.myhuaweicloud.com/97d63ec49f544a33a6a8cc3c0b64b17a-songRankBgImg.png');height: 200upx;"></view>
  4. <block v-for="(item, index) in boostList" :key="index">
  5. <view class="flex align-center justify-between boder">
  6. <view class="flex align-center">
  7. <view class="padding-sm">
  8. <u-avatar :src="item.avatar" size="82"></u-avatar>
  9. </view>
  10. <view>
  11. <view class="name">{{item.nickName}}</view>
  12. <view class="time padding-top-xs">{{item.createTime}}</view>
  13. </view>
  14. </view>
  15. <view class="text-sm" style="color: #757575;" v-if="item.typeSub==1">打榜</view>
  16. <view class="text-sm" style="color: #757575;" v-if="item.typeSub==2">打赏</view>
  17. <view class="name padding-right flex justify-end" style="width: 200upx;">{{item.totalHotValue}}热力值</view>
  18. </view>
  19. </block>
  20. <view style="height: 80rpx;" v-if="status">
  21. <u-divider bgColor="#f1f1f1;" height="80">到底了</u-divider>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. boostList: [],
  30. userId: '',
  31. current: 1,
  32. size: 30,
  33. status: false,
  34. }
  35. },
  36. onLoad() {
  37. this.userId = uni.getStorageSync("userId")
  38. if (!this.userId) {
  39. this.$u.toast('用户未登录')
  40. return
  41. }
  42. this.getMyBoostList()
  43. },
  44. onReachBottom() {
  45. if (this.boostList.length < this.current * this.size) {
  46. this.status = true;
  47. } else {
  48. this.current += 1;
  49. this.getMyBoostList();
  50. }
  51. },
  52. methods: {
  53. getMyBoostList() {
  54. this.$u.api.boost.myBoost({senderId: this.userId, current: this.current, size: this.size}).then(res => {
  55. this.boostList = [...this.boostList,...res.records];
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .name {
  63. font-size: 26upx;
  64. font-family: PingFang SC;
  65. font-weight: bold;
  66. color: #111111;
  67. }
  68. .time {
  69. font-size: 16upx;
  70. font-family: PingFang SC;
  71. color: #9E9E9E;
  72. }
  73. .boder {
  74. margin: 20upx;
  75. box-shadow: -1upx -1upx 60upx #d0d0d0;
  76. border-radius: 30upx;
  77. }
  78. </style>