myBoost.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view>
  3. <view class="bg-img" style="background-image: url('https://upload-file-data.obs.cn-south-1.myhuaweicloud.com/5f263a5a6e7c4f2493e0325f28ab659a-bgimg.png');height: 310upx;"></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.time}}</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>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. boostList: [],
  27. userId: '',
  28. current: 0,
  29. size: 30,
  30. }
  31. },
  32. onLoad() {
  33. this.userId = uni.getStorageSync("userId")
  34. if (!this.userId) {
  35. this.$u.toast('用户未登录')
  36. return
  37. }
  38. this.getMyBoostList()
  39. },
  40. onReachBottom() {
  41. if (this.boostList.length < this.current * this.size) {
  42. this.status = true;
  43. } else {
  44. this.current += 1;
  45. this.getMyBoostList();
  46. }
  47. },
  48. methods: {
  49. getMyBoostList() {
  50. this.$u.api.boost.myBoost({senderId: this.userId, current: this.current, size: this.size}).then(res => {
  51. this.boostList = [...this.boostList,...res.records];
  52. })
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .name {
  59. font-size: 26upx;
  60. font-family: PingFang SC;
  61. font-weight: bold;
  62. color: #111111;
  63. }
  64. .time {
  65. font-size: 16upx;
  66. font-family: PingFang SC;
  67. color: #9E9E9E;
  68. }
  69. .boder {
  70. margin: 20upx;
  71. box-shadow: -1upx -1upx 60upx #d0d0d0;
  72. border-radius: 30upx;
  73. }
  74. </style>