rankingList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view>
  3. <u-navbar title="积分排行榜">
  4. </u-navbar>
  5. <view class="background">
  6. 积分排行榜
  7. </view>
  8. <view class="self" v-if="top" >
  9. <view class="rank">
  10. <img v-if="top.rank==1" src="../../../assets/img/Gold Medal@1x.png" alt="">
  11. <img v-else-if="top.rank==2" src="../../../assets/img/Silver Medal Copy@1x.png" alt="">
  12. <img v-else-if="top.rank==3" src="../../../assets/img/Bronze Medal Copy@1x.png" alt="">
  13. <span v-else>{{top.rank}}</span>
  14. </view>
  15. <view class="photo">
  16. <img v-if="top.userImg" :src="top.userImg" alt="">
  17. <u-avatar v-else size="80" ></u-avatar>
  18. </view>
  19. <view class="name">
  20. {{top.userName}}
  21. </view>
  22. <view class="points">
  23. {{top.userScore}}积分
  24. </view>
  25. </view>
  26. <view class="else" v-if="list.length" >
  27. <view class="item" v-for="(item,i) in list" :key="i" >
  28. <view class="rank">
  29. <img v-if="i==0" src="../../../assets/img/Gold Medal@1x.png" alt="">
  30. <img v-else-if="i==1" src="../../../assets/img/Silver Medal Copy@1x.png" alt="">
  31. <img v-else-if="i==2" src="../../../assets/img/Bronze Medal Copy@1x.png" alt="">
  32. <span v-else>{{i+1}}</span>
  33. </view>
  34. <view class="photo">
  35. <img v-if="item.userImg" :src="item.userImg" alt="">
  36. <u-avatar v-else size="80" ></u-avatar>
  37. </view>
  38. <view class="name">
  39. {{item.userName}}
  40. </view>
  41. <view class="points " :class="{
  42. points1:i==0,
  43. points2:i==1,
  44. points3:i==2
  45. }">
  46. {{item.userScore}}积分
  47. </view>
  48. </view>
  49. </view>
  50. <u-divider :isnone="!list.length" nonetext="统计中,敬请期待" bg-color="#F2F4F4" border-color="#CFD2D5">已经到底了</u-divider>
  51. </view>
  52. </template>
  53. <script>
  54. import * as API from '@/apis/pagejs/user.js'
  55. export default {
  56. data() {
  57. return {
  58. list:[],
  59. listForm:{
  60. pageIndex:1,
  61. typeId:"",
  62. title:"",
  63. pageSize:20,
  64. },
  65. recordsTotal:0,
  66. top:null,
  67. }
  68. },
  69. onLoad() {
  70. this.listForm.year=new Date().getFullYear()
  71. this.getList();
  72. },
  73. onReachBottom() {
  74. if (this.list.length < this.recordsTotal) {
  75. this.myLoadmore();
  76. }
  77. },
  78. methods: {
  79. myLoadmore(){
  80. this.listForm.pageIndex += 1;
  81. this.getList();
  82. },
  83. getList(){
  84. uni.showLoading({
  85. title: "加载中",
  86. mask: true,
  87. })
  88. API.pointsNotes(this.listForm).then((res) => {
  89. this.list = [
  90. ...this.list,
  91. ...res.data.pointsList.data
  92. ];
  93. this.recordsTotal = res.data.pointsList.recordsTotal;
  94. if(res.data.myPoint){
  95. this.top=res.data.myPoint
  96. if(res.data.myPoint.userSortNo){
  97. this.top.rank=parseInt(res.data.myPoint.userSortNo)
  98. }
  99. }
  100. uni.hideLoading();
  101. }).catch(error => {
  102. uni.showToast({
  103. title: error,
  104. icon: "none"
  105. })
  106. })
  107. }
  108. }
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. .background{
  113. height: 224rpx;
  114. color: rgba(255, 255, 255, 1);
  115. font-size: 24px;
  116. padding: 44rpx 32rpx;
  117. display: flex;
  118. background:url("../../../assets/img/Group Copy@1x.png" ),url("../../../assets/img/Group@1x.png"),
  119. linear-gradient(180deg, rgba(255,150,0,1) 0%,rgba(255,61,0,1) 100%) ;
  120. background-repeat: no-repeat,no-repeat;
  121. background-position: 85% 50%,105% 40%;
  122. font-family: 'SemiBold';
  123. }
  124. .self{
  125. background-color: #fff;
  126. margin: 0 32rpx 24rpx;
  127. margin-top: -90rpx;
  128. height: 64px;
  129. z-index: 999;
  130. overflow: hidden;
  131. position: relative;
  132. border-radius: 8px;
  133. padding: 36rpx 42rpx;
  134. display: flex;
  135. align-items: center;
  136. .rank{
  137. color: rgba(31, 74, 153, 1);
  138. font-size: 16px;
  139. }
  140. .photo{
  141. width: 80rpx;
  142. height: 80rpx;
  143. border-radius: 8px;
  144. overflow: hidden;
  145. margin-left: 24rpx;
  146. img{
  147. width: 100%;
  148. height: 100%;
  149. }
  150. }
  151. .name{
  152. color: rgba(51, 51, 51, 1);
  153. font-size: 16px;
  154. margin-left: 24rpx;
  155. font-family: 'Medium';
  156. }
  157. .points{
  158. color: rgba(31, 74, 153, 1);
  159. font-size: 16px;
  160. margin-left: auto;
  161. font-family: 'Regular';
  162. }
  163. }
  164. .else{
  165. background: #fff;
  166. border-radius: 8px;
  167. padding: 24rpx 48rpx;
  168. margin: 20rpx 32rpx 24rpx;
  169. .item{
  170. display: flex;
  171. align-items: center;
  172. height: 128rpx;
  173. }
  174. .rank{
  175. color: rgba(31, 74, 153, 1);
  176. font-size: 16px;
  177. width: 48rpx;
  178. height: 48rpx;
  179. img{
  180. width: 100%;
  181. height: 100%;
  182. }
  183. }
  184. .photo{
  185. width: 80rpx;
  186. height: 80rpx;
  187. border-radius: 8px;
  188. overflow: hidden;
  189. margin-left: 24rpx;
  190. img{
  191. width: 100%;
  192. height: 100%;
  193. }
  194. }
  195. .name{
  196. color: rgba(51, 51, 51, 1);
  197. font-size: 16px;
  198. margin-left: 24rpx;
  199. font-family: 'Medium';
  200. }
  201. .points{
  202. color: rgba(31, 74, 153, 1);
  203. font-size: 16px;
  204. margin-left: auto;
  205. font-family: 'Regular';
  206. }
  207. .points1{
  208. color: rgba(226, 14, 22, 1);
  209. }
  210. .points2{
  211. color: rgba(255, 94, 0, 1);
  212. }
  213. .points3{
  214. color: rgba(255, 150, 0, 1);
  215. }
  216. }
  217. </style>