myRecommendation.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!-- 我的推荐 -->
  2. <template>
  3. <div class="d-flex">
  4. <div class="pa-3 mr-3 white-bgc" style="border-radius: 5px; flex: 1;">
  5. <div style="width: 100%;">
  6. <!-- 统计 -->
  7. <div class="statisticsBox">
  8. <div class="statisticsBox-item" :class="{'act': index === active}" v-for="(item, index) in statisticsList" :key="item.value" @click="handleStatisticsItem(item, index)">
  9. <div style="font-size: 18px; color: var(--color-333); font-family: 'MiSans-Bold';">{{ item.count }}</div>
  10. <div style="font-size: 13px; color: var(--color-666);">{{ item.label }}</div>
  11. </div>
  12. </div>
  13. <div class="topTip">推荐好友入职得赏金</div>
  14. <!-- 数据 -->
  15. <TablePage :items="items" :total="total" :pageInfo="query" @page="handleChangePage"></TablePage>
  16. </div>
  17. </div>
  18. <!-- 滚动区域 -->
  19. <!-- <div class="pa-3 white-bgc" style="height: 300px; border-radius: 5px; width: 260px;">
  20. <bountyDisplay></bountyDisplay>
  21. </div> -->
  22. </div>
  23. </template>
  24. <script setup>
  25. defineOptions({name: 'defineOptions-name'})
  26. import { ref } from 'vue'
  27. import { getDict } from '@/hooks/web/useDictionaries'
  28. import {
  29. getHireJobCvRelCount,
  30. getHireJobCvRelPage
  31. } from '@/api/publicRecruitment'
  32. import TablePage from './components/table.vue'
  33. // import bountyDisplay from './components/bountyDisplay.vue'
  34. import { useUserStore } from '@/store/user'
  35. const active = ref(0)
  36. // 数据统计
  37. const statisticsList = ref([])
  38. const getData = async () => {
  39. const data = await getHireJobCvRelCount()
  40. if (!data || !data.length) return
  41. statisticsList.value.forEach(e => {
  42. const obj = data.find(k => k.key === e.value)
  43. if (!obj) return
  44. e.count = obj.value
  45. })
  46. }
  47. // 列表
  48. const items = ref([])
  49. const total = ref(0)
  50. const query = ref({
  51. pageSize: 10,
  52. pageNo: 1,
  53. status: null
  54. })
  55. const getTableList = async () => {
  56. const res = await getHireJobCvRelPage(query.value)
  57. items.value = res.list
  58. total.value = res.total
  59. }
  60. // 状态
  61. const getStatusData = () => {
  62. getDict('menduner_hire_job_cv_status').then(({ data }) => {
  63. data = data?.length && data || []
  64. statisticsList.value = data.map(e => {
  65. return { ...e, count: 0 }
  66. })
  67. query.value.status = data[0].value
  68. getData()
  69. getTableList()
  70. })
  71. }
  72. getStatusData()
  73. // 分页
  74. const handleChangePage = (e) => {
  75. query.value.pageNo = e
  76. getTableList()
  77. }
  78. // 钻取
  79. const handleStatisticsItem = (item, index) => {
  80. active.value = index
  81. query.value.pageNo = 1
  82. query.value.status = item.value
  83. getTableList()
  84. }
  85. // 更新账户信息
  86. const store = useUserStore()
  87. const updateAccountInfo = async () => {
  88. await store.getUserAccountInfo()
  89. }
  90. updateAccountInfo()
  91. </script>
  92. <style lang="scss" scoped>
  93. .topTip {
  94. color: var(--color-999);
  95. margin-top: 8px;
  96. font-size: 14px;
  97. padding: 5px 10px;
  98. width: 100%;
  99. // background-color: var(--default-bgc);
  100. }
  101. .statisticsBox {
  102. display: flex;
  103. justify-content: space-around;
  104. border-radius: 10px;
  105. text-align: center;
  106. padding: 10px 0;
  107. background-color: var(--default-bgc);
  108. .act {
  109. div, span { color: var(--v-primary-base) !important; }
  110. }
  111. .statisticsBox-item {
  112. cursor: pointer;
  113. &:hover {
  114. div { color: var(--v-primary-base) !important; }
  115. }
  116. }
  117. }
  118. </style>