rankingList.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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.getList();
  71. },
  72. methods: {
  73. getList(){
  74. uni.showLoading({
  75. title: "加载中",
  76. mask: true,
  77. })
  78. API.pointsNotes({
  79. year:new Date().getFullYear()
  80. }).then((res) => {
  81. this.list = res.data;
  82. var userInfo=this.carhelp.getPersonInfo()
  83. if(userInfo){
  84. for(var i in this.list){
  85. var item=this.list[i]
  86. if(item.userId==userInfo.id){
  87. this.top=item
  88. this.top.rank=parseInt(i)+1;
  89. break
  90. }
  91. }
  92. }
  93. uni.hideLoading();
  94. }).catch(error => {
  95. uni.showToast({
  96. title: error,
  97. icon: "none"
  98. })
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .background{
  106. height: 224rpx;
  107. color: rgba(255, 255, 255, 1);
  108. font-size: 24px;
  109. padding: 44rpx 32rpx;
  110. display: flex;
  111. background:url("../../../assets/img/Group Copy@1x.png" ),url("../../../assets/img/Group@1x.png"),
  112. linear-gradient(180deg, rgba(255,150,0,1) 0%,rgba(255,61,0,1) 100%) ;
  113. background-repeat: no-repeat,no-repeat;
  114. background-position: 85% 50%,105% 40%;
  115. font-family: 'SemiBold';
  116. }
  117. .self{
  118. background-color: #fff;
  119. margin: 0 32rpx 24rpx;
  120. margin-top: -90rpx;
  121. height: 64px;
  122. z-index: 999;
  123. overflow: hidden;
  124. position: relative;
  125. border-radius: 8px;
  126. padding: 36rpx 42rpx;
  127. display: flex;
  128. align-items: center;
  129. .rank{
  130. color: rgba(31, 74, 153, 1);
  131. font-size: 16px;
  132. }
  133. .photo{
  134. width: 80rpx;
  135. height: 80rpx;
  136. border-radius: 8px;
  137. overflow: hidden;
  138. margin-left: 24rpx;
  139. img{
  140. width: 100%;
  141. height: 100%;
  142. }
  143. }
  144. .name{
  145. color: rgba(51, 51, 51, 1);
  146. font-size: 16px;
  147. margin-left: 24rpx;
  148. font-family: 'Medium';
  149. }
  150. .points{
  151. color: rgba(31, 74, 153, 1);
  152. font-size: 16px;
  153. margin-left: auto;
  154. font-family: 'Regular';
  155. }
  156. }
  157. .else{
  158. background: #fff;
  159. border-radius: 8px;
  160. padding: 24rpx 48rpx;
  161. margin: 20rpx 32rpx 24rpx;
  162. .item{
  163. display: flex;
  164. align-items: center;
  165. height: 128rpx;
  166. }
  167. .rank{
  168. color: rgba(31, 74, 153, 1);
  169. font-size: 16px;
  170. width: 48rpx;
  171. height: 48rpx;
  172. img{
  173. width: 100%;
  174. height: 100%;
  175. }
  176. }
  177. .photo{
  178. width: 80rpx;
  179. height: 80rpx;
  180. border-radius: 8px;
  181. overflow: hidden;
  182. margin-left: 24rpx;
  183. img{
  184. width: 100%;
  185. height: 100%;
  186. }
  187. }
  188. .name{
  189. color: rgba(51, 51, 51, 1);
  190. font-size: 16px;
  191. margin-left: 24rpx;
  192. font-family: 'Medium';
  193. }
  194. .points{
  195. color: rgba(31, 74, 153, 1);
  196. font-size: 16px;
  197. margin-left: auto;
  198. font-family: 'Regular';
  199. }
  200. .points1{
  201. color: rgba(226, 14, 22, 1);
  202. }
  203. .points2{
  204. color: rgba(255, 94, 0, 1);
  205. }
  206. .points3{
  207. color: rgba(255, 150, 0, 1);
  208. }
  209. }
  210. </style>