index.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <div class="default-width">
  3. <buttons :current="3" style="position: sticky;" class="mx-4 mb-3"></buttons>
  4. <div v-if="list.length > 0">
  5. <div class="px-3 content">
  6. <v-card elevation="5" v-for="val in list" :key="val.id">
  7. <img :src="val.headImg" alt="" style="object-fit: contain; width: 100%;">
  8. <div class="pa-3">
  9. <div class="color-666">活动时间:{{ timesTampChange(val.startTime, 'Y-M-D') }}至{{ timesTampChange(val.endTime, 'Y-M-D') }}</div>
  10. <div class="text-end">
  11. <v-btn color="primary" variant="outlined" @click.stop="handleJoin(val)">查看详情</v-btn>
  12. </div>
  13. </div>
  14. </v-card>
  15. </div>
  16. </div>
  17. <Empty v-else message="暂无开启的招聘会,去看看其他吧~" />
  18. </div>
  19. </template>
  20. <script setup>
  21. defineOptions({ name: 'jobFair' })
  22. import { ref } from 'vue'
  23. import { timesTampChange } from '@/utils/date'
  24. import { getJobFairList } from '@/api/recruit/personal/jobFair'
  25. import buttons from '@/views/recruit/personal/components/buttons.vue'
  26. import { useRouter } from 'vue-router'; const router = useRouter()
  27. const list = ref([])
  28. // 招聘会列表
  29. const getList = async () => {
  30. const data = await getJobFairList()
  31. list.value = data || []
  32. }
  33. getList()
  34. const handleJoin = (val) => {
  35. if (!val?.id) return
  36. const path = '/recruit/personal/jobFair/details/' + val.id
  37. router.push(path)
  38. // 面包屑储存
  39. // let text = val.title ? val.title.replace(/<[^>]+>/g, ' ') : '' // 去掉所有 HTML 标签
  40. // text = text ? text.replace(/\s+/g, ' ').trim() : '' // 去掉多余的空格
  41. // const list = JSON.stringify([
  42. // { text: '招聘会' , path: '/recruit/personal/jobFair' },
  43. // { text, path }
  44. // ])
  45. // 跳转
  46. // router.push({ path, query: { breadcrumbs: list } })
  47. }
  48. </script>
  49. <style scoped lang="scss">
  50. .content {
  51. display: grid;
  52. grid-template-columns: repeat(2, 1fr);
  53. gap: 12px;
  54. min-height: auto;
  55. }
  56. </style>