index.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <slot name="header"></slot>
  3. <view class="content">
  4. <view v-for="(item,index) in items" :key="item.title" class="content-box">
  5. <view class="content-box-value">
  6. {{ item.value }}
  7. </view>
  8. <view class="content-box-title">
  9. {{ item.title }}
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script setup>
  15. import { reactive } from 'vue';
  16. import { getRecommendCount } from '@/api/position.js'
  17. const items = reactive([
  18. {
  19. value: 0,
  20. title: '已推荐',
  21. key: '0'
  22. },
  23. {
  24. value: 0,
  25. title: '已入职',
  26. key: '1'
  27. },
  28. {
  29. value: 0,
  30. title: '已结算',
  31. key: '2'
  32. }
  33. ])
  34. async function recommendCount () {
  35. const { data } = await getRecommendCount()
  36. items.forEach(e => {
  37. e.value = data.find(e => e.key === e.key)?.value || 0
  38. })
  39. }
  40. recommendCount()
  41. </script>
  42. <style scoped lang="scss">
  43. .content {
  44. display: flex;
  45. justify-content: space-around;
  46. padding: 36rpx 12rpx;
  47. &-box {
  48. font-size: 20rpx;
  49. color: #999;
  50. text-align: center;
  51. &-value {
  52. font-size: 1.8em;
  53. color: #000;
  54. }
  55. }
  56. }
  57. </style>