rankList.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="rank_list">
  3. <nav-bar title="打卡排行榜"></nav-bar>
  4. <view class="rank_bg">
  5. <image src="/pages2/static/daily/rank_bg.png" class="rank_bg"></image>
  6. <text class="tips">打卡PK榜</text>
  7. </view>
  8. <view class="contents">
  9. <view class="header_cons">
  10. <view class="header_left">
  11. <text class="rank">排名</text>
  12. <text>用户ID</text>
  13. </view>
  14. <view class="header_right">
  15. <text>打卡天数</text>
  16. </view>
  17. </view>
  18. <view class="rank_con">
  19. <view v-for="(item, index) in rankList" :key="index" class="rank_item">
  20. <view class="rank_left">
  21. <view class="rank_num">
  22. <image v-if="index == 0" src="/pages2/static/daily/rank_one.png" class="nums"></image>
  23. <image v-else-if="index == 1" src="/pages2/static/daily/rank_two.png" class="nums"></image>
  24. <image v-else-if="index == 2" src="/pages2/static/daily/rank_three.png" class="nums"></image>
  25. <text v-else>{{ '0' + (index + 1) }}</text>
  26. </view>
  27. <view class="header_name">
  28. <!-- <image :src="form.avatar ? $method.splitImgHost(form.avatar, true) : ''" class="avatar"></image> -->
  29. <text>{{ item.userName }}</text>
  30. </view>
  31. </view>
  32. <view class="rank_right">
  33. <text>{{ item.recordCount }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. name: 'rankList',
  43. data() {
  44. return {
  45. rankList: [],
  46. goodsId: '',
  47. }
  48. },
  49. onLoad(option) {
  50. this.goodsId = option.goodsId
  51. this.getRank()
  52. },
  53. methods: {
  54. getRank() {
  55. this.$http({
  56. url: `/bank/question/todayExam/tob/${this.goodsId}`,
  57. method: 'get',
  58. }).then((res) => {
  59. if (res.data.code == 200) {
  60. this.rankList = res.data.data || []
  61. }
  62. })
  63. },
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .rank_bg {
  69. width: 100%;
  70. height: 280rpx;
  71. position: relative;
  72. top: 0rpx;
  73. left: 0rpx;
  74. .rank_bg {
  75. width: 100%;
  76. height: 280rpx;
  77. position: absolute;
  78. top: 0rpx;
  79. left: 0rpx;
  80. }
  81. .tips {
  82. position: absolute;
  83. top: 68rpx;
  84. left: 56rpx;
  85. font-size: 52rpx;
  86. font-weight: 800;
  87. color: #33558F;
  88. }
  89. }
  90. .contents {
  91. width: 100%;
  92. height: 100%;
  93. background-color: #fff;
  94. border-radius: 24rpx 24rpx 0rpx 0rpx;
  95. padding: 40rpx 26rpx;
  96. position: relative;
  97. top: -20rpx;
  98. left: 0rpx;
  99. .header_cons {
  100. width: 100%;
  101. height: 88rpx;
  102. background: #F8F8FA;
  103. border-radius: 24rpx;
  104. padding: 0rpx 32rpx;
  105. display: flex;
  106. justify-content: space-between;
  107. align-items: center;
  108. }
  109. .header_left, .header_right {
  110. font-size: 28rpx;
  111. font-weight: 500;
  112. color: #888691;
  113. .rank {
  114. margin-right: 50rpx;
  115. }
  116. }
  117. .rank_con {
  118. width: 100%;
  119. margin-top: 32rpx;
  120. }
  121. .rank_item {
  122. width: 100%;
  123. padding: 0rpx 32rpx;
  124. margin-bottom: 48rpx;
  125. display: flex;
  126. align-items: center;
  127. justify-content: space-between;
  128. .rank_left {
  129. display: flex;
  130. align-items: center;
  131. .rank_num {
  132. font-size: 36rpx;
  133. font-family: DIN Alternate-Bold, DIN Alternate;
  134. font-weight: bold;
  135. color: #6C7386;
  136. margin-right: 56rpx;
  137. }
  138. .nums {
  139. width: 50rpx;
  140. height: 56rpx;
  141. }
  142. .header_name {
  143. // .avatar {
  144. // width: 72rpx;
  145. // height: 72rpx;
  146. // border-radius: 50%;
  147. // }
  148. font-size: 28rpx;
  149. font-weight: 500;
  150. color: #222222;
  151. height: 56rpx;
  152. line-height: 45rpx;
  153. }
  154. }
  155. .rank_right {
  156. font-size: 40rpx;
  157. font-family: DIN Alternate-Bold, DIN Alternate;
  158. font-weight: bold;
  159. color: #222222;
  160. }
  161. }
  162. }
  163. </style>