index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class="default-width">
  3. <div style="background-color: #fff; position: sticky;" class="pb-4">
  4. <buttons :current="3"></buttons>
  5. <v-breadcrumbs v-if="breadcrumbs?.length" :items="breadcrumbs">
  6. <template v-slot:item="{ item, index }">
  7. <span class="breadcrumbsText" :class="{ active: !item.disabled && index !== breadcrumbs.length-1 }" @click="breadcrumbsClickDeal({ e: item, breadcrumbs, index })">{{ item.text }}</span>
  8. </template>
  9. </v-breadcrumbs>
  10. <headSearch v-model="query.keyword" placeholder="搜索公司关键字" @handleSearch="handleSearch"></headSearch>
  11. </div>
  12. <Empty v-if="!items.length" :message="loadingType === 1 ? loadingText[loadingType] : '该招聘会暂无企业参与,前往其他招聘会看看吧~'" class="mt-3 py-15"></Empty>
  13. <template v-else>
  14. <div class="d-flex">
  15. <div class="mt-3">
  16. <EntCard :list="items" @selectChange="selectChange" />
  17. <div :class="['loading', {'defaultLink-i': !loadingType}]" @click="handleChangePage">{{ loadingText[loadingType] }}</div>
  18. </div>
  19. <div class="position-details ml-3" style="flex: 1; overflow: hidden;">
  20. <div class="position-content pa-3">
  21. <JobCard :enterpriseId="enterpriseId" :enterpriseName="enterpriseName" :jobFairId="route.params.id" />
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. </div>
  27. </template>
  28. <script setup>
  29. defineOptions({ name: 'personalPositionRecommend'})
  30. import buttons from '@/views/recruit/personal/components/buttons.vue'
  31. import { ref, reactive } from 'vue'
  32. import { getJobFairEnterprisePage } from '@/api/recruit/personal/jobFair'
  33. import EntCard from './components/entCard.vue'
  34. import JobCard from './components/jobCard.vue'
  35. import { useRoute } from 'vue-router'; const route = useRoute()
  36. import { breadcrumbsClickDeal, getJobFairBreadcrumbs } from '@/utils/index'
  37. import { formatName } from '@/utils/getText'
  38. import { dealDictArrayData } from '@/utils/position'
  39. const breadcrumbs = ref(getJobFairBreadcrumbs(route?.query) || [])
  40. // 切换企业选中
  41. const enterpriseId = ref('')
  42. const enterpriseName = ref('')
  43. const selectChange = (val) => {
  44. enterpriseId.value = val.id
  45. enterpriseName.value = formatName(val.anotherName || val.name)
  46. }
  47. const query = reactive({
  48. pageNo: 1,
  49. pageSize: 10,
  50. jobFairId: route.params.id,
  51. keyword: ''
  52. })
  53. const items = ref([])
  54. const loadingText = ['加载更多', '加载中...', '没有更多数据了']
  55. const loadingType = ref(0)
  56. // 参与招聘会的企业
  57. const getList = async () => {
  58. loadingType.value = 1
  59. try {
  60. const result = await getJobFairEnterprisePage(query)
  61. const list = result?.list || []
  62. if (list.length) {
  63. items.value = items.value.concat(dealDictArrayData([], list))
  64. loadingType.value = list.length === result.total ? 2 : 0
  65. enterpriseId.value = items.value[0].id
  66. enterpriseName.value = formatName(items.value[0].anotherName || items.value[0].name)
  67. } else {
  68. loadingType.value = 2
  69. }
  70. } catch {}
  71. }
  72. getList()
  73. const handleSearch = (val) => {
  74. query.keyword = val
  75. query.pageNo = 1
  76. items.value = []
  77. getList()
  78. }
  79. const handleChangePage = () => {
  80. if (loadingType.value) return // 没有更多数据了
  81. // 加载更多
  82. query.pageNo++
  83. getList()
  84. }
  85. </script>
  86. <style scoped lang="scss">
  87. .position-details {
  88. position: sticky;
  89. top: 62px;
  90. border-radius: 12px;
  91. background-color: #fff;
  92. margin-top: 12px;
  93. height: calc(100vh - 127px);
  94. widows: 100%;
  95. overflow: hidden;
  96. .position-content {
  97. height: 100%;
  98. width: 100%;
  99. padding-right: 4px;
  100. overflow-y: auto;
  101. }
  102. }
  103. .loading {
  104. margin-top: 8px;
  105. text-align: center;
  106. font-size: 13px;
  107. color: gray;
  108. }
  109. .breadcrumbsText {
  110. color: var(--color-999);
  111. font-size: 15px;
  112. &.active {
  113. color: var(--v-primary-base);
  114. cursor: pointer;
  115. }
  116. }
  117. ::-webkit-scrollbar {
  118. width: 4px;
  119. height: 10px;
  120. }
  121. ::-webkit-scrollbar-thumb, .temporaryAdd ::-webkit-scrollbar-thumb, .details_edit ::-webkit-scrollbar-thumb {
  122. // 滚动条-颜色
  123. background: #c3c3c379;
  124. }
  125. ::-webkit-scrollbar-track, .temporaryAdd ::-webkit-scrollbar-track, .details_edit ::-webkit-scrollbar-track {
  126. // 滚动条-底色
  127. background: #e5e5e58f;
  128. }
  129. </style>