rank.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="sub-base-container">
  3. <view class="gradient-reflection" data-text="好友排行榜">好友排行榜</view>
  4. <view class="rank-card">
  5. <view class="tabs">
  6. <view :class="['tab-item',{active:active === item.speciesId}]" v-for="(item,index) in tabsList" :key="index"
  7. @click="handleTab(item)">{{item.name}}</view>
  8. </view>
  9. <view class="rank-list">
  10. <view :class="['rank-item',{bg:(index + 1) <=3}]" v-for="(item,index) in rankList" :key="index">
  11. <view class="rank-info">
  12. <text :class="['num',`num-${(index + 1)}`]">{{item.ranking}}</text>
  13. <up-image class="avatar" :fade="false" :src="item.icon" width="92rpx" height="92rpx"
  14. shape="circle"></up-image>
  15. <view class="info">
  16. <view class="name">
  17. <text>{{item.treeName}}</text>
  18. <view :class="['level',{levelBlue:item.level.id >3}]">
  19. V{{item.level.id}}.{{item.level.name}}</view>
  20. </view>
  21. <text class="nickname ellipsis-l1">昵称:{{item.nickname}}</text>
  22. </view>
  23. </view>
  24. <view class="button">去看看</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup>
  31. import {
  32. ref
  33. } from "vue"
  34. import TREE from '@/api/tree.js'
  35. import {
  36. onLoad
  37. } from '@dcloudio/uni-app'
  38. onLoad(() => {
  39. getCategoryList()
  40. getRankingList()
  41. })
  42. const active = ref(null)
  43. const tabsList = ref([])
  44. const handleTab = (item) => {
  45. active.value = item.speciesId
  46. getRankingList()
  47. }
  48. const getCategoryList = () => {
  49. TREE.categoryList().then(res => {
  50. tabsList.value = res.data || []
  51. tabsList.value.unshift({
  52. name: '总榜',
  53. speciesId: null
  54. })
  55. })
  56. }
  57. const rankList = ref([])
  58. const getRankingList = () => {
  59. const params = {
  60. speciesId: active.value,
  61. page: 1,
  62. limit: 20
  63. }
  64. TREE.rankingList(params).then(res => {
  65. rankList.value = res.data || []
  66. })
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. @import "@/static/style/mixin.scss";
  71. .sub-base-container {
  72. @include ossBg("subTreePage/rank-bg.png");
  73. .gradient-reflection {
  74. width: 100%;
  75. position: relative;
  76. font-size: 86rpx;
  77. color: #fff;
  78. font-family: "PangMenZhengDao";
  79. text-align: center;
  80. }
  81. .gradient-reflection::after {
  82. content: attr(data-text);
  83. position: absolute;
  84. top: 75%;
  85. left: calc(50% - 430rpx / 2);
  86. transform: scaleY(-1);
  87. background: rgba(255, 255, 255, 0.5);
  88. -webkit-background-clip: text;
  89. background-clip: text;
  90. color: transparent;
  91. opacity: 0.5;
  92. }
  93. .rank-card {
  94. margin-top: 90rpx;
  95. background: rgba(255, 255, 255, 0.74);
  96. border-radius: 20rpx 20rpx 0 0;
  97. padding: 20rpx;
  98. .tabs {
  99. display: flex;
  100. .tab-item {
  101. flex: 1;
  102. text-align: center;
  103. color: rgba(0, 0, 0, 0.5);
  104. font-size: 28rpx;
  105. padding: 10rpx 0;
  106. &.active {
  107. border-radius: 50rpx;
  108. color: #000;
  109. background: #fff;
  110. }
  111. }
  112. }
  113. .rank-list {
  114. .rank-item {
  115. display: flex;
  116. align-items: center;
  117. justify-content: space-between;
  118. padding: 14rpx 20rpx;
  119. border-radius: 10rpx;
  120. margin-top: 20rpx;
  121. &.bg {
  122. background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.6), transparent);
  123. }
  124. .rank-info {
  125. display: flex;
  126. align-items: center;
  127. font-size: 24rpx;
  128. .num {
  129. margin-right: 28rpx;
  130. color: #724E02;
  131. font-family: 'SweiSpringCJKtc';
  132. &-1 {
  133. background: linear-gradient(to bottom, #724E02 0%, #F3C11D 100%);
  134. -webkit-background-clip: text;
  135. background-clip: text;
  136. color: transparent;
  137. font-size: 52rpx;
  138. font-family: 'SMILEYSANS';
  139. }
  140. &-2 {
  141. background: linear-gradient(to bottom, #898989 0%, #fff 100%);
  142. -webkit-background-clip: text;
  143. background-clip: text;
  144. color: transparent;
  145. font-size: 52rpx;
  146. font-family: 'SMILEYSANS';
  147. }
  148. &-3 {
  149. background: linear-gradient(to bottom, #F2BF16 0%, #FF8400 100%);
  150. -webkit-background-clip: text;
  151. background-clip: text;
  152. color: transparent;
  153. font-size: 52rpx;
  154. font-family: 'SMILEYSANS';
  155. }
  156. }
  157. .info {
  158. margin-left: 10rpx;
  159. .name {
  160. font-size: 28rpx;
  161. font-weight: 500;
  162. display: flex;
  163. align-items: center;
  164. margin-bottom: 4rpx;
  165. }
  166. .level {
  167. background: rgba(81, 81, 81, 0.1);
  168. color: #444444;
  169. border-radius: 4rpx;
  170. font-size: 24rpx;
  171. padding: 4rpx 10rpx;
  172. margin-left: 20rpx;
  173. &.levelBlue {
  174. background: #fff;
  175. color: #2199F8;
  176. }
  177. }
  178. .nickname {
  179. max-width: 320rpx;
  180. color: rgba(0, 0, 0, 0.5);
  181. }
  182. }
  183. }
  184. .button {
  185. font-size: 24rpx;
  186. padding: 10rpx 20rpx;
  187. border-radius: 50rpx;
  188. border: 2rpx solid rgba(0, 0, 0, 0.3);
  189. background: #fff;
  190. }
  191. }
  192. }
  193. }
  194. }
  195. </style>