hot.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view>
  3. <view class="searchBar">
  4. <search-bar :disabled="false" @onSearch="onSearch"></search-bar>
  5. </view>
  6. <block v-for="(item, index) in hotList" :key="index">
  7. <u-line color="#e8e8e8"></u-line>
  8. <view class="padding-sm flex justify-between align-center bg-white"
  9. @click="navWithParm(item.id)">
  10. <view class="flex justify-around align-center">
  11. <view class="padding-right text-center text-black text-bold" style="width: 60upx;">
  12. {{item.rank}}</view>
  13. <view class="padding-right">
  14. <u-avatar :src="item.avatar" size="130"></u-avatar>
  15. </view>
  16. <view>
  17. <view class="text-bold text-black">{{item.nickName}}</view>
  18. <view class="margin-tb-xs">{{+item.score}} 热力值</view>
  19. </view>
  20. </view>
  21. <view class="padding-right">
  22. <button class="cu-btn round text-white" style="background-color: #583ce6;height: 68upx;">
  23. <text class="cuIcon-hotfill padding-right-xs"></text>
  24. <text>打榜</text>
  25. </button>
  26. </view>
  27. </view>
  28. </block>
  29. <view style="height: 80rpx;" v-if="status">
  30. <u-divider bgColor="#f1f1f1;" height="80">到底了</u-divider>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import searchBar from "@/components/basic/search-bar.vue";
  36. export default {
  37. components: {
  38. searchBar,
  39. },
  40. data() {
  41. return {
  42. activityId: '',
  43. hotList: [],
  44. current: 1,
  45. size: 30,
  46. status: false,
  47. searchName:'',
  48. }
  49. },
  50. onLoad(options) {
  51. this.activityId = options.activityId;
  52. this.getRankList();
  53. },
  54. onReachBottom() {
  55. if (this.hotList.length < this.current * this.size) {
  56. this.status = true;
  57. } else {
  58. this.current += 1;
  59. this.getRankList();
  60. }
  61. },
  62. methods: {
  63. getRankList() {
  64. let params = {
  65. activityId: this.activityId,
  66. size: this.size,
  67. current: this.current,
  68. type:0,//选手排名
  69. }
  70. if (!this.$u.test.isEmpty(this.searchName)) {
  71. params.nickName=this.searchName
  72. }
  73. this.$u.api.activity.rankList(params).then(res => {
  74. this.hotList = [...this.hotList, ...res.records];
  75. })
  76. },
  77. //跳转需要带惨方法
  78. navWithParm(id) {
  79. uni.navigateTo({
  80. url: "/pages/activityList/activity/authorBoost?activityId=" + this.activityId +
  81. "&receiverId=" + id,
  82. })
  83. },
  84. onSearch(value) {
  85. this.searchName=value
  86. console.log(this.searchName);
  87. this.hotList=[]
  88. this.getRankList()
  89. }
  90. }
  91. }
  92. </script>
  93. <style>
  94. </style>