ranking.vue 7.4 KB

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