entJobCard.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <!-- 企业 -->
  2. <template>
  3. <div class="position-relative">
  4. <div v-if="jobFair?.contentImg" class="position-fixed" style="right: 24px; top: 20px; z-index: 999">
  5. <v-btn icon="mdi-share-all" color="primary" size="x-large" @click.stop="handleShare"></v-btn>
  6. </div>
  7. <div :style="{'background-color': jobFair.backgroundColour || '#fff', 'min-height': '100vh'}" class="pt-10">
  8. <div :class="{'default-width': !isMobile}">
  9. <h2 class="color-white pt-5 enterpriseName" :class="{'ml-3': isMobile}">{{ enterpriseName }}</h2>
  10. <div v-if="!items.length" class="emptyText">{{ loadingType === 1 ? loadingText[loadingType] : '暂无数据,去看看其他吧~' }}</div>
  11. <template v-else>
  12. <JobCard :jobFairId="jobFair?.id" :list="items" :isMobile="isMobile" class="pt-5" />
  13. <div :class="['loading', {'loadMoreText': !loadingType}]" class="pb-5" @click="handleChangePage">{{ loadingText[loadingType] }}</div>
  14. </template>
  15. </div>
  16. </div>
  17. <div class="hideCanvasView">
  18. <JobFairEntShare
  19. :show="showShare"
  20. :enterpriseName="enterpriseName"
  21. :logoUrl="logoUrl"
  22. :positionList="positionList"
  23. :bgImg="jobFair?.contentImg"
  24. @success="handlePreview"
  25. ></JobFairEntShare>
  26. </div>
  27. </div>
  28. <PreviewImage v-if="showPreview" :urlList="[previewSrc]" :fileName="enterpriseName" @close="showPreview = !showPreview, showShare = false" />
  29. </template>
  30. <script setup>
  31. defineOptions({name: 'jobFair-enterprises-job-card'})
  32. import { ref, reactive, onMounted } from 'vue'
  33. import { getJobFair, getJobFairEntJobPage } from '@/api/recruit/personal/jobFair'
  34. import JobCard from './components/jobCard1.vue'
  35. import { useRoute } from 'vue-router'; const route = useRoute();
  36. import { dealDictObjData } from '@/utils/position'
  37. import { getEnterpriseDetails } from '@/api/enterprise'
  38. import { formatName } from '@/utils/getText'
  39. import JobFairEntShare from '@/views/recruit/components/jobFairEntShare'
  40. const query = reactive({
  41. pageNo: 1,
  42. pageSize: 20,
  43. jobFairId: route.params.id,
  44. enterpriseId: route.query.enterpriseId
  45. })
  46. const logoUrl = ref('')
  47. const showPreview = ref(false)
  48. const showShare = ref(false)
  49. const previewSrc = ref('')
  50. const positionList = ref([])
  51. const isMobile = ref(false)
  52. onMounted(() => {
  53. const userAgent = navigator.userAgent
  54. isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
  55. })
  56. const items = ref([])
  57. const loadingText = ['点击加载更多', '加载中...', '']
  58. const loadingType = ref(0)
  59. // 参与招聘会的企业
  60. const getList = async () => {
  61. loadingType.value = 1
  62. try {
  63. const result = await getJobFairEntJobPage(query)
  64. const list = result?.list || []
  65. if (list.length) {
  66. items.value.push(...list.map(e => {
  67. e.enterprise = dealDictObjData({}, e.enterprise)
  68. e = dealDictObjData({}, e)
  69. return e
  70. }))
  71. loadingType.value = items.value.length === result.total ? 2 : 0
  72. } else {
  73. loadingType.value = 2
  74. }
  75. } catch {}
  76. }
  77. // 招聘会详情
  78. const jobFair = ref([])
  79. const enterpriseName = ref('')
  80. const getJobFairDetail = async () => {
  81. const data = await getJobFair(route?.params?.id)
  82. if (!data) return
  83. jobFair.value = data
  84. const { enterprise } = await getEnterpriseDetails({ id: route.query.enterpriseId })
  85. enterpriseName.value = formatName(enterprise.anotherName || enterprise.name)
  86. logoUrl.value = enterprise.logoUrl
  87. document.title = enterpriseName.value + ' - 招聘会职位'
  88. getList()
  89. }
  90. getJobFairDetail()
  91. const handleChangePage = () => {
  92. if (loadingType.value) return // 没有更多数据了
  93. // 加载更多
  94. query.pageNo++
  95. getList()
  96. }
  97. // 海报预览
  98. const handlePreview = (src) => {
  99. if (!src) return
  100. previewSrc.value = src
  101. showPreview.value = true
  102. }
  103. const handleShare = () => {
  104. positionList.value = items.value && items.value.length > 0 ? items.value.map(e => formatName(e.name)).slice(0, 2) : []
  105. showShare.value = true
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. .hideCanvasView {
  110. position: fixed;
  111. top: -99999px;
  112. left: -99999px;
  113. z-index: -99999;
  114. }
  115. .enterpriseName {
  116. position: relative;
  117. padding-left: 20px;
  118. &::before {
  119. display: block;
  120. content: '';
  121. width: 6px;
  122. height: 30px;
  123. background-color: #fff;
  124. position: absolute;
  125. top: 25px;
  126. left: 0;
  127. border-radius: 2px;
  128. }
  129. }
  130. .emptyText {
  131. color: #fff;
  132. height: calc(100vh - 574px);
  133. line-height: calc(100vh - 574px);
  134. text-align: center;
  135. }
  136. .loading {
  137. margin-top: 8px;
  138. text-align: center;
  139. font-size: 18px;
  140. color: #fff;
  141. }
  142. .loadMoreText {
  143. color: #fff;
  144. cursor: pointer;
  145. }
  146. ::-webkit-scrollbar {
  147. width: 0;
  148. height: 0;
  149. }
  150. ::-webkit-scrollbar-thumb, .temporaryAdd ::-webkit-scrollbar-thumb, .details_edit ::-webkit-scrollbar-thumb {
  151. // 滚动条-颜色
  152. background: #c3c3c379;
  153. }
  154. ::-webkit-scrollbar-track, .temporaryAdd ::-webkit-scrollbar-track, .details_edit ::-webkit-scrollbar-track {
  155. // 滚动条-底色
  156. background: #e5e5e58f;
  157. }
  158. </style>