rank1.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="cu-modal bottom-modal" :class="{'show': visible}">
  3. <view class="mask" @click="close"></view>
  4. <view class="cu-dialog wrapper">
  5. <view class="paddingY25 flex-align-center relative">
  6. <view class="font6 bold color-1">实时榜单</view>
  7. <image :src="resource.icon_x" class="x" @click="close" />
  8. </view>
  9. <view style="height: 400px">
  10. <scroll-view style="height: 350px" scroll-y v-if="tableData && tableData.length > 0">
  11. <view v-for="(item, index) in tableData" :key="index" class="cell flex-align" style="margin-bottom: 10px">
  12. <view class="index bold color-white">{{index + 1}}</view>
  13. <image v-if="index === 0" class="rank_flag translateY" :src="resource.prince_rank_1" />
  14. <image v-if="index === 1" class="rank_flag translateY" :src="resource.prince_rank_2" />
  15. <image v-if="index === 2" class="rank_flag translateY" :src="resource.prince_rank_3" />
  16. <image :src="item.avatar" style="width: 52rpx;height:52rpx;border-radius: 26rpx" />
  17. <view class="color-white font2 marginL12 flex1">{{item.nickname}}</view>
  18. <view class="flex-shrink0 num">{{item.quantity}}源力值</view>
  19. </view>
  20. </scroll-view>
  21. <empty v-if="!tableData || tableData.length === 0" :top="100"/>
  22. <view v-if="myData" class="cell my flex-align">
  23. <image v-if="myData.index === 0" class="rank_flag translateY" :src="resource.prince_rank_1" />
  24. <image v-else-if="myData.index === 1" class="rank_flag translateY" :src="resource.prince_rank_2" />
  25. <image v-else-if="myData.index === 2" class="rank_flag translateY" :src="resource.prince_rank_3" />
  26. <view v-if="myData.index < 50" class="index bold color-white">{{myData.index + 1}}</view>
  27. <view v-else class="index color-white">暂无排名</view>
  28. <image :src="myData.avatar" style="width: 52rpx;height:52rpx;border-radius: 26rpx" />
  29. <view class="color-white font2 marginL12 flex1">{{myData.nickname}}</view>
  30. <view class="flex-shrink0 num">{{myData.quantity}}源力值</view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import resource from '@/utils/resource'
  38. import empty from '@/components/empty'
  39. export default {
  40. components: { empty },
  41. data() {
  42. return {
  43. tableData: null,
  44. resource,
  45. visible: false,
  46. myData: null
  47. }
  48. },
  49. methods: {
  50. show() {
  51. this.$parent.$parent.$parent.lock = true
  52. this.visible = true
  53. this.refresh()
  54. },
  55. close() {
  56. this.$parent.$parent.$parent.lock = false
  57. this.visible = false
  58. this.tableData = null
  59. this.myData = null
  60. },
  61. refresh() {
  62. this.loadData()
  63. },
  64. async loadData(loading = false) {
  65. // const res = await this.$service.award.kingUser(this.poolId, loading)
  66. // if (res) {
  67. // this.tableData = res.periodKingList
  68. // if (res.myPeriodKing) {
  69. // let my = res.myPeriodKing
  70. // let flag = 50
  71. // for (let i = 0; i < this.tableData.length; i++) {
  72. // if (my.userId === this.tableData[i].userId) {
  73. // flag = i
  74. // break
  75. // }
  76. // }
  77. // my.index = flag
  78. // this.myData = my
  79. // }
  80. // }
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .mask {
  87. position: absolute;
  88. left: 0;
  89. right: 0;
  90. top: 0;
  91. bottom: 0;
  92. }
  93. .wrapper {
  94. padding: 0 28rpx 64rpx;
  95. background: #fff;
  96. border-radius: 15px 15px 2px 2px !important;
  97. .x {
  98. position: absolute;
  99. right: 28rpx;
  100. top: 50%;
  101. margin-top: -16rpx;
  102. width: 32rpx;
  103. height: 32rpx;
  104. }
  105. .cell {
  106. position: relative;
  107. height: 48px;
  108. background: rgba($color: #8F4BF1, $alpha: 0.1);
  109. border-radius: 4px;
  110. padding-left: 13px;
  111. padding-right: 48px;
  112. .index {
  113. width: 70px;
  114. }
  115. .num {
  116. color: #333;
  117. font-size: 12px;
  118. }
  119. &.my {
  120. background: #8F4BF1;
  121. .num {
  122. color: #fff
  123. }
  124. }
  125. .rank_flag {
  126. width: 21px;
  127. height: 20px;
  128. position: absolute;
  129. left: 35px;
  130. }
  131. }
  132. }
  133. </style>