ranking.vue 7.6 KB

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