ranking.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view style="position: relative;height: 100%;">
  3. <view style="width: 100%;">
  4. <image src="/static/rank_bg.png" style="width: 100%;position: relative;top: -80rpx;"></image>
  5. </view>
  6. <view class="box">
  7. <view style="margin-top: 15rpx;">
  8. <u-row gutter="16" justify="center">
  9. <u-col span="2" text-align="center">
  10. <view class="r_t1" >
  11. 我的<br>
  12. 成绩
  13. </view>
  14. </u-col>
  15. <u-col span="6">
  16. <view style="vertical-align: middle;display: flex;">
  17. <image :src="userInfo!=null?$method.splitImgHost(userInfo.avatar):''" style="width: 80rpx;height: 80rpx;border-radius: 50%;"></image>
  18. <view class="r_t2">{{userInfo.nickname}}</view>
  19. </view>
  20. </u-col>
  21. <u-col span="4" v-if="current==0">
  22. <view style="color: #0183FE;font-size: 28rpx;" >
  23. <view style="line-height: 80rpx;" v-if="info.rank>0">
  24. <text>第{{info.rank}}名</text>
  25. <text style="margin-left: 30rpx;">{{info.hourse}}h</text>
  26. </view>
  27. <view style="line-height: 80rpx;" v-else>
  28. <text>暂未上榜</text>
  29. </view>
  30. </view>
  31. </u-col>
  32. <u-col span="5" v-if="current==1">
  33. <view style="color: #0183FE;font-size: 28rpx;">
  34. <view style="line-height: 80rpx;">
  35. <text>第{{info2.rank}}名</text>
  36. <text style="margin-left: 30rpx;">{{info2.hourse}}h</text>
  37. </view>
  38. </view>
  39. </u-col>
  40. </u-row>
  41. </view>
  42. <view >
  43. <view>
  44. <u-tabs :list="list" font-size="24" :current="current" @change="change" active-color="#32467B"></u-tabs>
  45. </view>
  46. <view >
  47. <u-row >
  48. <u-col span="2" text-align="center">
  49. <view class="rank_t3">排名</view>
  50. </u-col>
  51. <u-col span="8" >
  52. <view class="rank_t3">姓名</view>
  53. </u-col>
  54. <u-col span="2" >
  55. <view class="rank_t3">时长</view>
  56. </u-col>
  57. </u-row>
  58. </view>
  59. <scroll-view class='main-scroll' scroll-y >
  60. <view v-for="(item,index) in list2" :key="index" class="rank_item" v-if="current==0">
  61. <u-row >
  62. <u-col span="2" text-align="center">
  63. <view class="rank_t3">
  64. <image src="/static/sort_1.png" class="rank_img" v-if="index==0"></image>
  65. <image src="/static/sort_2.png" class="rank_img" v-if="index==1"></image>
  66. <image src="/static/sort_3.png" class="rank_img" v-if="index==2"></image>
  67. <view v-if="index>2" class="rank_t5">{{index+1}}</view>
  68. </view>
  69. </u-col>
  70. <u-col span="8" >
  71. <view style="vertical-align: middle;display: flex;">
  72. <image :src="$method.splitImgHost(item.avatar)" style="width: 80rpx;height: 80rpx;border-radius: 50%;"></image>
  73. <view class="rank_t4" style="padding-left: 30rpx;">{{item.nickname}}</view>
  74. </view>
  75. </u-col>
  76. <u-col span="2" text-align="left">
  77. <view class="rank_t4">{{item.hourse}}h</view>
  78. </u-col>
  79. </u-row>
  80. </view>
  81. <view v-for="(item,index) in list3" :key="index" class="rank_item" v-if="current==1">
  82. <u-row >
  83. <u-col span="2" text-align="center">
  84. <view class="rank_t3">
  85. <image src="/static/sort_1.png" class="rank_img" v-if="index==0"></image>
  86. <image src="/static/sort_2.png" class="rank_img" v-if="index==1"></image>
  87. <image src="/static/sort_3.png" class="rank_img" v-if="index==2"></image>
  88. <view v-if="index>2" class="rank_t5">{{index+1}}</view>
  89. </view>
  90. </u-col>
  91. <u-col span="8" >
  92. <view style="vertical-align: middle;display: flex;">
  93. <image :src="$method.splitImgHost(item.avatar)" style="width: 80rpx;height: 80rpx;border-radius: 50%;"></image>
  94. <view class="rank_t4" style="padding-left: 30rpx;">{{item.nickname}}</view>
  95. </view>
  96. </u-col>
  97. <u-col span="2" text-align="left">
  98. <view class="rank_t4">{{item.hourse}}h</view>
  99. </u-col>
  100. </u-row>
  101. </view>
  102. </scroll-view>
  103. </view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import {mapGetters} from 'vuex';
  109. export default {
  110. data() {
  111. return {
  112. list: [{
  113. name: '日榜'
  114. }, {
  115. name: '总榜'
  116. }],
  117. current: 0,
  118. list2:[],
  119. list3:[],
  120. info:{
  121. hourse:0,
  122. rank:0
  123. },
  124. info2:{
  125. hourse:0,
  126. rank:0
  127. },
  128. }
  129. },
  130. onLoad(option) {
  131. this.rankList()
  132. this.rankList2()
  133. },
  134. onShow(){
  135. },
  136. methods: {
  137. change(index) {
  138. this.current = index;
  139. },
  140. rankList(){
  141. let self = this
  142. this.$api.rankList({status:0}).then(res => {
  143. self.info = res.data.data
  144. self.list2 = res.data.data.ranKingUsers
  145. });
  146. },
  147. rankList2(){
  148. let self = this
  149. this.$api.rankList({status:1}).then(res => {
  150. self.info2 = res.data.data
  151. self.list3 = res.data.data.ranKingUsers
  152. console.log(self.info2,333)
  153. });
  154. },
  155. },
  156. computed: {...mapGetters(['userInfo'])}
  157. }
  158. </script>
  159. <style scope>
  160. .main-scroll{
  161. position: absolute;
  162. left: 0;
  163. right: 0;
  164. top: 300rpx;
  165. bottom: 0;
  166. }
  167. .rank_t5{
  168. color: #AAB1B9;
  169. text-align: center;
  170. }
  171. .rank_t3{
  172. line-height: 80rpx;
  173. }
  174. .rank_t4{
  175. line-height: 80rpx;
  176. font-size: 30rpx;
  177. font-family: PingFang SC;
  178. font-weight: bold;
  179. color: #32467B;
  180. }
  181. .rank_item{
  182. height: 100rpx;
  183. vertical-align: middle;
  184. padding: 0 25rpx;
  185. }
  186. .rank_img{
  187. width: 54rpx;
  188. height: 54rpx;
  189. }
  190. .rank_list{
  191. width: 100%;
  192. height: 100%;
  193. position: relative;
  194. }
  195. .rank_t3{
  196. font-size: 28rpx;
  197. font-family: PingFang SC;
  198. font-weight: 400;
  199. color: #959EA8;
  200. }
  201. .r_t2{
  202. font-size: 32rpx;
  203. font-family: PingFang SC;
  204. font-weight: bold;
  205. color: #32467B;
  206. line-height: 80rpx;
  207. margin-left: 30rpx;
  208. }
  209. .r_t1{
  210. font-size: 32rpx;
  211. font-family: PingFang SC;
  212. font-weight: 500;
  213. color: #0183FE;
  214. }
  215. page {
  216. background: #FFFFFF;
  217. height: 100%;
  218. }
  219. .box{
  220. height: 75%;
  221. width: 100%;
  222. border-top-right-radius: 32rpx;
  223. border-top-left-radius: 32rpx;
  224. z-index: 999;
  225. background-color: #FFFFFF;
  226. position: fixed;
  227. bottom: 0;
  228. padding: 25rpx;
  229. }
  230. </style>