rankingList.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view>
  3. <u-navbar title="积分排行榜">
  4. </u-navbar>
  5. <view class="background">
  6. 积分排行榜
  7. </view>
  8. <view class="self" v-if="plusInfo" >
  9. <view class="rank" v-if="top">
  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="userInfo.headImg" :src="userInfo.headImg" alt="">
  17. <u-avatar v-else size="80" ></u-avatar>
  18. </view>
  19. <view class="name">
  20. {{userInfo.name}}
  21. </view>
  22. <view class="points">
  23. {{top?top.userScore:plusInfo.userPoints}}积分
  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">只显示前{{recordsTotal}}条</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. userInfo:{},
  68. plusInfo:{}
  69. }
  70. },
  71. onLoad() {
  72. this.listForm.year=new Date().getFullYear()
  73. this.getList();
  74. this.userInfo=this.carhelp.getPersonInfo()
  75. this.plusInfo=this.carhelp.getPersonInfoPlus()
  76. if(this.userInfo){
  77. this.myPointsSort();
  78. }
  79. },
  80. onReachBottom() {
  81. // if (this.list.length < this.recordsTotal) {
  82. // this.myLoadmore();
  83. // }
  84. },
  85. methods: {
  86. myLoadmore(){
  87. this.listForm.pageIndex += 1;
  88. this.getList();
  89. },
  90. myPointsSort(){
  91. API.myPointsSort(this.listForm).then((res) => {
  92. if(res.data.myPoint){
  93. this.top=res.data.myPoint
  94. if(res.data.myPoint.userSortNo){
  95. this.top.rank=parseInt(res.data.myPoint.userSortNo)
  96. }
  97. }
  98. }).catch(error => {
  99. uni.showToast({
  100. title: error,
  101. icon: "none"
  102. })
  103. })
  104. },
  105. getList(){
  106. uni.showLoading({
  107. title: "加载中",
  108. mask: true,
  109. })
  110. API.pointsNotes(this.listForm).then((res) => {
  111. this.list = [
  112. ...this.list,
  113. ...res.data.pointsList.data
  114. ];
  115. this.recordsTotal = res.data.pointsList.pageSize;
  116. // if(res.data.myPoint){
  117. // this.top=res.data.myPoint
  118. // if(res.data.myPoint.userSortNo){
  119. // this.top.rank=parseInt(res.data.myPoint.userSortNo)
  120. // }
  121. // }
  122. uni.hideLoading();
  123. }).catch(error => {
  124. uni.showToast({
  125. title: error,
  126. icon: "none"
  127. })
  128. })
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .background{
  135. height: 224rpx;
  136. color: rgba(255, 255, 255, 1);
  137. font-size: 24px;
  138. padding: 44rpx 32rpx;
  139. display: flex;
  140. background:url("../../../assets/img/Group Copy@1x.png" ),url("../../../assets/img/Group@1x.png"),
  141. linear-gradient(180deg, rgba(255,150,0,1) 0%,rgba(255,61,0,1) 100%) ;
  142. background-repeat: no-repeat,no-repeat;
  143. background-position: 85% 50%,105% 40%;
  144. font-family: 'SemiBold';
  145. }
  146. .self{
  147. background-color: #fff;
  148. margin: 0 32rpx 24rpx;
  149. margin-top: -90rpx;
  150. height: 64px;
  151. z-index: 999;
  152. overflow: hidden;
  153. position: relative;
  154. border-radius: 8px;
  155. padding: 36rpx 42rpx;
  156. display: flex;
  157. align-items: center;
  158. .rank{
  159. color: rgba(31, 74, 153, 1);
  160. font-size: 16px;
  161. }
  162. .photo{
  163. width: 80rpx;
  164. height: 80rpx;
  165. border-radius: 8px;
  166. overflow: hidden;
  167. margin-left: 24rpx;
  168. img{
  169. width: 100%;
  170. height: 100%;
  171. }
  172. }
  173. .name{
  174. color: rgba(51, 51, 51, 1);
  175. font-size: 16px;
  176. margin-left: 24rpx;
  177. width: 100px;
  178. font-family: 'Medium';
  179. }
  180. .points{
  181. color: rgba(31, 74, 153, 1);
  182. font-size: 16px;
  183. margin-left: auto;
  184. font-family: 'Regular';
  185. }
  186. }
  187. .else{
  188. background: #fff;
  189. border-radius: 8px;
  190. padding: 24rpx 48rpx;
  191. margin: 20rpx 32rpx 24rpx;
  192. .item{
  193. display: flex;
  194. align-items: center;
  195. height: 128rpx;
  196. }
  197. .rank{
  198. color: rgba(31, 74, 153, 1);
  199. font-size: 16px;
  200. width: 48rpx;
  201. height: 48rpx;
  202. img{
  203. width: 100%;
  204. height: 100%;
  205. }
  206. }
  207. .photo{
  208. width: 80rpx;
  209. height: 80rpx;
  210. border-radius: 8px;
  211. overflow: hidden;
  212. margin-left: 24rpx;
  213. img{
  214. width: 100%;
  215. height: 100%;
  216. }
  217. }
  218. .name{
  219. color: rgba(51, 51, 51, 1);
  220. font-size: 16px;
  221. margin-left: 24rpx;
  222. width: 100px;
  223. font-family: 'Medium';
  224. }
  225. .points{
  226. color: rgba(31, 74, 153, 1);
  227. font-size: 16px;
  228. margin-left: auto;
  229. font-family: 'Regular';
  230. }
  231. .points1{
  232. color: rgba(226, 14, 22, 1);
  233. }
  234. .points2{
  235. color: rgba(255, 94, 0, 1);
  236. }
  237. .points3{
  238. color: rgba(255, 150, 0, 1);
  239. }
  240. }
  241. </style>