ranking-item.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="ranking-item" @tap="toself" :class="bg ? 'bg' : ''">
  3. <view class="left">
  4. <image v-if="index == 1" src="../static/icon/first.png" mode="scaleToFill"></image>
  5. <image v-else-if="index == 2" src="../static/icon/second.png" mode="scaleToFill"></image>
  6. <image v-else-if="index == 3" src="../static/icon/third.png" mode="scaleToFill"></image>
  7. <text class="ranking-num" v-else>{{ index }}</text>
  8. </view>
  9. <view class="center">
  10. <image :src="item.avatar" mode="scaleToFill"></image>
  11. <image v-if="item.score >= 200" class="hat" src="../static/new/hat.png" mode="scaleToFill"></image>
  12. <text style="text-align:left;">{{ item.name }}</text>
  13. </view>
  14. <view class="right">
  15. <view class="score">
  16. {{ item.score }}
  17. </view>
  18. <view class="float" v-if="item.float > 0 && (type === 0 || type === 1)">
  19. <image src="../static/icon/up.png" mode="scaleToFill"></image>
  20. <text>{{ item.float }}</text>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. item: Object,
  29. type: Number,
  30. index: Number,
  31. rank: Number,
  32. bg: Boolean
  33. },
  34. computed: {
  35. userServerInfo() {
  36. return this.$store.state.userServerInfo
  37. }
  38. },
  39. methods: {
  40. toself() { //点击排行榜列表时
  41. if (this.userServerInfo.type === 2) { //批发商可以查看个人榜和团队榜
  42. if (this.type === 0 || this.type === 2) {
  43. uni.navigateTo({
  44. url: `../self/self?from=ranking&id=${this.item.id}`
  45. })
  46. }
  47. } else if (this.userServerInfo.type === 3) { //客服只可以查看个人榜
  48. if (this.type === 0) {
  49. uni.navigateTo({
  50. url: `../self/self?from=ranking&id=${this.item.id}`
  51. })
  52. }
  53. }
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .ranking-item {
  60. width: 100%;
  61. background-color: #FFFFFF;
  62. height: 70px;
  63. line-height: 98rpx;
  64. box-sizing: border-box;
  65. padding: 0 30rpx;
  66. display: flex;
  67. color: #2A2A2A;
  68. position: relative;
  69. font-size: 30rpx;
  70. margin: 0 auto;
  71. &.bg {
  72. background: rgba(250, 99, 66, .2);
  73. }
  74. .left {
  75. height: 100%;
  76. width: 76rpx;
  77. display: flex;
  78. justify-content: center;
  79. align-items: center;
  80. image {
  81. width: 100%;
  82. height: 62rpx;
  83. }
  84. .ranking-num {
  85. font-size: 40rpx;
  86. }
  87. }
  88. .center {
  89. margin-left: 40rpx;
  90. height: 100%;
  91. width: 380rpx;
  92. display: flex;
  93. align-items: center;
  94. position: relative;
  95. image {
  96. width: 64rpx;
  97. height: 64rpx;
  98. border-radius: 50%;
  99. &.hat {
  100. position: absolute;
  101. top: 50%;
  102. margin-top: -44rpx;
  103. left: -11rpx;
  104. width: 80rpx;
  105. height: 80rpx;
  106. }
  107. }
  108. text {
  109. flex: 1;
  110. margin-left: 30rpx;
  111. overflow: hidden;
  112. white-space: nowrap;
  113. text-overflow: ellipsis;
  114. text-align: center;
  115. }
  116. }
  117. .right {
  118. flex: 1;
  119. display: flex;
  120. align-items: center;
  121. .score {
  122. width: 130rpx;
  123. height: 100%;
  124. display: flex;
  125. align-items: center;
  126. justify-content: center;
  127. text-align: center;
  128. color: #FA6342;
  129. }
  130. .float {
  131. flex: 1;
  132. display: flex;
  133. align-items: center;
  134. image {
  135. width: 24rpx;
  136. height: 30rpx;
  137. }
  138. text {
  139. margin-left: 10rpx;
  140. color: #FA6342;
  141. }
  142. }
  143. }
  144. }
  145. </style>