index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="ranking-main">
  3. <view>
  4. <view class="ranking-title">
  5. <image src="@/static/img/容器@1x (1).png" mode="widthFix" class="ranking-title-img"></image>
  6. <view class="ranking-title-text">本月热门服务</view>
  7. </view>
  8. <view class="ranking-list" v-if="gitList && gitList.length > 0">
  9. <view v-for="(item, index) in gitList" :key="index" class="ranking-list-item">
  10. <image :src="item.businessIcon" mode="widthFix" class="ranking-list-item-img"></image>
  11. <view class="ranking-list-item-content">
  12. <view class="ranking-list-item-header">
  13. <view class="ranking-list-item-title">{{ item.businessName }}</view>
  14. <view class="ranking-list-item-rating">
  15. <view class="score-icons"><image src="@/static/img/容器@1x (3).png" mode="widthFix" class="star-icon" v-for="item in new Array(Number(item.score ))" :key="item"></image></view>
  16. <text class="score-text">{{ item.score }}星</text>
  17. </view>
  18. </view>
  19. <view class="ranking-list-item-bottom">
  20. <view class="ranking-list-item-tag">
  21. <view class="ranking-list-item-tag-text">
  22. {{ item.businessTierName }}
  23. </view>
  24. </view>
  25. <view class="ranking-list-item-count">本月已服务:{{ item.totalCount }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view v-else class="ranking-list">
  31. <NoneView value="暂无服务数据" />
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script setup>
  37. import { userSortShotService } from '@/api/VolunteerList.js'
  38. import { onMounted, ref } from 'vue';
  39. import NoneView from '@/components/NoneView/index.vue'
  40. const userType = uni.getStorageSync('userType'); //读取本地存储
  41. const gitList = ref([])
  42. const gitData = async () => {
  43. if (userType === 2) {
  44. const res = await userSortShotService()
  45. gitList.value = res.data
  46. }
  47. }
  48. onMounted(() => {
  49. gitData()
  50. })
  51. </script>
  52. <style scoped lang="scss">
  53. .ranking-main {
  54. padding: 30rpx;
  55. }
  56. .ranking-title {
  57. display: flex;
  58. align-items: center;
  59. justify-content: flex-start;
  60. margin-bottom: 30rpx;
  61. .ranking-title-img {
  62. width: 36rpx;
  63. height: 36rpx;
  64. margin-right: 10rpx;
  65. }
  66. .ranking-title-text {
  67. font-family: PingFang SC;
  68. font-size: 34rpx;
  69. font-weight: 500;
  70. color: rgba(0, 0, 0, 0.8);
  71. }
  72. }
  73. .score-icons {
  74. display: flex;
  75. }
  76. .ranking-list {
  77. min-height: 500rpx ;
  78. .ranking-list-item {
  79. display: flex;
  80. padding: 30rpx 0;
  81. border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);
  82. align-items: center;
  83. .ranking-list-item-img {
  84. width: 84rpx;
  85. height: 84rpx;
  86. border-radius: 50%;
  87. margin-right: 22rpx;
  88. flex-shrink: 0;
  89. // top: 33rpx;
  90. }
  91. .ranking-list-item-content {
  92. flex: 1;
  93. display: flex;
  94. flex-direction: column;
  95. .ranking-list-item-header {
  96. display: flex;
  97. justify-content: space-between;
  98. align-items: center;
  99. // margin-bottom: -3rpx;
  100. .ranking-list-item-title {
  101. height: 42rpx;
  102. font-family: PingFang SC;
  103. font-size: 32rpx;
  104. font-weight: normal;
  105. line-height: 42rpx;
  106. letter-spacing: normal;
  107. color: rgba(0, 0, 0, 0.8);
  108. margin-bottom: 16rpx;
  109. }
  110. .ranking-list-item-rating {
  111. display: flex;
  112. align-items: center;
  113. .star-icon {
  114. width: 44rpx;
  115. height: 44rpx;
  116. margin-right: 10rpx;
  117. }
  118. .score-text {
  119. color: #FF7043;
  120. font-size: 28rpx;
  121. font-weight: 500;
  122. }
  123. }
  124. }
  125. .ranking-list-item-bottom {
  126. display: flex;
  127. justify-content: space-between;
  128. align-items: center;
  129. .ranking-list-item-tag {
  130. /* 自动布局子元素 */
  131. // width: 252rpx;
  132. // height: 34rpx;
  133. /* 自动布局 */
  134. display: flex;
  135. flex-direction: column;
  136. justify-content: center;
  137. align-items: center;
  138. // padding: 8rpx 12rpx;
  139. z-index: 0;
  140. border-radius: 10rpx;
  141. box-sizing: border-box;
  142. border: 1rpx solid rgba(237, 93, 49, 0.8);
  143. padding: 8rpx 12rpx;
  144. .ranking-list-item-tag-text{
  145. /* 自动布局子元素 */
  146. // width: 228rpx;
  147. height: 22rpx;
  148. z-index: 0;
  149. font-family: PingFang SC;
  150. font-size: 26rpx;
  151. font-weight: normal;
  152. line-height: 22rpx;
  153. letter-spacing: 0.02em;
  154. color: #ED5D31;
  155. }
  156. }
  157. .ranking-list-item-count {
  158. font-size: 24rpx;
  159. color: rgba(0, 0, 0, 0.5);
  160. text-align: right;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. </style>