hot.vue 2.6 KB

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