index.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <slot name="header"></slot>
  3. <view class="content">
  4. <view v-for="(item,index) in items" :key="item.label" class="content-box" @tap="handleTo(item)">
  5. <view class="content-box-value">
  6. {{ item.count }}
  7. </view>
  8. <view class="content-box-title">
  9. {{ item.label }}
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script setup>
  15. import { ref } from 'vue';
  16. import { getRecommendCount } from '@/api/position.js'
  17. import { getDict } from '@/hooks/useDictionaries.js'
  18. // const props = defineProps({
  19. // type: {
  20. // type: String,
  21. // default: 'menduner_hire_job_cv_status'
  22. // }
  23. // })
  24. const items = ref([])
  25. const handleTo = (item) => {
  26. uni.navigateTo({
  27. url: "/pagesA/recommendation/index"
  28. })
  29. }
  30. async function recommendCount () {
  31. try {
  32. const { data: dict } = await getDict('menduner_hire_job_cv_status')
  33. if (!dict?.data) {
  34. return
  35. }
  36. items.value = dict.data.map(e => {
  37. return {
  38. ...e,
  39. count: 0
  40. }
  41. })
  42. console.log(items)
  43. const { data } = await getRecommendCount()
  44. if (!data) {
  45. return
  46. }
  47. items.value.forEach(e => {
  48. e.count = data.find(_e => _e.key === e.value)?.value || 0
  49. })
  50. } catch (error) {
  51. console.log(error)
  52. }
  53. }
  54. recommendCount()
  55. </script>
  56. <style scoped lang="scss">
  57. .content {
  58. display: flex;
  59. justify-content: space-around;
  60. padding: 36rpx 12rpx;
  61. &-box {
  62. font-size: 20rpx;
  63. color: #999;
  64. text-align: center;
  65. &-value {
  66. font-size: 1.8em;
  67. color: #000;
  68. }
  69. }
  70. }
  71. </style>