index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <div class="default-width banner px-6">
  3. <!-- 面包屑 -->
  4. <div class="py-5">
  5. <v-breadcrumbs v-if="breadcrumbs?.length" :items="breadcrumbs" elevation="3">
  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. </div>
  11. <div v-if="Object.keys(info).length">
  12. <div class="banner-title pt-3" v-if="Object.keys(info).length">
  13. <div class="float-left d-flex align-center">
  14. <v-img width="60" height="60" :src="info.enterprise.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></v-img>
  15. <div class="ml-4">
  16. <div class="contact-name">{{ formatName(info.enterprise.anotherName || info.enterprise.name) }}</div>
  17. <div class="contact-info">
  18. {{ info.scaleName }}
  19. <span v-if="info.industryName && info.scaleName">·</span>
  20. {{ info.industryName }}
  21. </div>
  22. </div>
  23. </div>
  24. <!-- <div class="float-right d-flex">
  25. <v-btn color="primary" variant="text" size="large" @click.stop="handleReturn" prepend-icon="mdi-chevron-triple-left">返回上一页</v-btn>
  26. </div> -->
  27. </div>
  28. <!-- <div class="text-end mb-3">
  29. <v-tooltip location="bottom">
  30. <template v-slot:activator="{ props }">
  31. <v-icon v-bind="props" class="ml-5 mr-2" size="25" :color="isCollection ? 'error' : ''" @click.stop="handleFollow">{{ isCollection ? 'mdi-heart' : 'mdi-heart-outline' }}</v-icon>
  32. </template>
  33. <span>关注该企业</span>
  34. </v-tooltip>
  35. </div>
  36. <v-divider></v-divider> -->
  37. <div class="mt-3">
  38. <v-tabs v-model="tab" align-tabs="start" color="primary" bg-color="#f3f3f3" @update:model-value="handleTabClick">
  39. <v-tab :value="2">在招职位</v-tab>
  40. <v-tab :value="1">公司简介</v-tab>
  41. </v-tabs>
  42. <div class="d-flex" v-if="Object.keys(info).length">
  43. <div class="content-left">
  44. <EnterpriseIntroduction v-if="tab === 1" :info="info" />
  45. <recruitmentPositions v-else :info="info"/>
  46. </div>
  47. <div class="content-right">
  48. <div class="welfare mb-3">
  49. <h4>福利</h4>
  50. <div v-if="info?.enterprise?.welfareList?.length" class="welfare-tags mt-3">
  51. <v-chip size="small" label v-for="(k, i) in info?.enterprise?.welfareList?.slice(0, 6)" :key="i" class="mb-2 welfare-tags-item ellipsis" color="primary">{{ k }}</v-chip>
  52. </div>
  53. <div v-else class="color-666 font-size-14 mt-3">暂无</div>
  54. </div>
  55. <div class="welfare">
  56. <h4>工商信息</h4>
  57. <div :class="['mt-2', 'business-item']" v-for="val in businessList" :key="val.value">
  58. <div>{{ val.label }}</div>
  59. <div class="business-value ellipsis">
  60. {{ info?.business ? info.business[val.value] : '暂无' }}
  61. <span v-if="info?.business && val.value === 'registeredCapital' && info?.business[val.value] && info?.business[val.value].indexOf('万元') === -1">万元</span>
  62. </div>
  63. <div :class="['my-3']"></div>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <!-- 快速登录 -->
  71. <loginPage v-if="showLogin" @loginSuccess="loginSuccess" @close="loginClose"></loginPage>
  72. </div>
  73. </template>
  74. <script setup>
  75. defineOptions({name: 'jobFair-enterprise'})
  76. import { ref } from 'vue'
  77. import EnterpriseIntroduction from './introduction.vue'
  78. import recruitmentPositions from './positions.vue'
  79. import { getEnterpriseDetails, getEnterpriseSubscribeCheck, getEnterpriseSubscribe, getEnterpriseUnsubscribe, enterpriseClick } from '@/api/enterprise'
  80. import { timesTampChange } from '@/utils/date'
  81. import { dealDictObjData } from '@/utils/position'
  82. import { useRoute, useRouter } from 'vue-router'
  83. import { getToken } from '@/utils/auth'
  84. import Snackbar from '@/plugins/snackbar'
  85. import loginPage from '@/views/common/loginDialog.vue'
  86. import { formatName } from '@/utils/getText'
  87. import { breadcrumbsClickDeal, getJobFairBreadcrumbs } from '@/utils/index'
  88. const route = useRoute()
  89. const router = useRouter()
  90. const { id } = router.currentRoute.value.params
  91. const breadcrumbs = ref(getJobFairBreadcrumbs(route?.query) || [])
  92. const tab = ref(2)
  93. const savedTab = new URLSearchParams(window.location.search).get('key')
  94. tab.value = savedTab ? (savedTab === 'briefIntroduction' ? 1 : 2) : 2
  95. const handleTabClick = () => {
  96. // router.push(`${route.path}?key=${tab.value === 1 ? 'briefIntroduction' : 'recruitmentPositions'}`)
  97. const key = tab.value === 1 ? 'briefIntroduction' : 'recruitmentPositions'
  98. const query = { ...route?.query, key }
  99. router.push({ path, query })
  100. }
  101. // 返回上一页
  102. const handleReturn = () => {
  103. if (window.history.state.back) {
  104. router.back()
  105. } else router.push('/recruitHome')
  106. }
  107. // 企业埋点
  108. const handleEnterpriseClick = async () => {
  109. if (id) return
  110. await enterpriseClick({ id })
  111. }
  112. handleEnterpriseClick()
  113. // 企业详情
  114. const info = ref({})
  115. const getDetails = async () => {
  116. if (!id) return
  117. const data = await getEnterpriseDetails({ id })
  118. // 成立日期
  119. if (data?.business?.establishmentTime) {
  120. data.business.establishmentTime = timesTampChange(data.business.establishmentTime, 'Y-M-D')
  121. }
  122. info.value = { ...data, ...dealDictObjData({}, data.enterprise) }
  123. getCollectionStatus(id)
  124. }
  125. getDetails()
  126. // 效验求职者是否关注该企业
  127. const isCollection = ref(false)
  128. const getCollectionStatus = async (id) => {
  129. if (!getToken()) return isCollection.value = false
  130. const data = await getEnterpriseSubscribeCheck({ enterpriseId: id })
  131. isCollection.value = data
  132. }
  133. // 关注&取消关注企业
  134. const handleFollow = async () => {
  135. if (!getToken()) {
  136. showLogin.value = true // 打开快速登录弹窗
  137. Snackbar.warning('您还未登录,请先登录后再试')
  138. nextFunc.value = handleFollow // 登录成功后要执行的操作
  139. loginCloseWarningWord = '您已取消登录,无法关注企业' // 取消登录提示语
  140. return
  141. }
  142. const api = isCollection.value ? getEnterpriseUnsubscribe : getEnterpriseSubscribe
  143. await api(isCollection.value ? id : { enterpriseId: id })
  144. getCollectionStatus(id)
  145. }
  146. // 工商信息
  147. const businessList = [
  148. { label: '企业类型:', value: 'type' },
  149. { label: '统一社会信用代码:', value: 'code' },
  150. { label: '成立日期:', value: 'establishmentTime' },
  151. { label: '注册资本:', value: 'registeredCapital' }
  152. ]
  153. const showLogin = ref(false)
  154. const nextFunc = ref(null)
  155. let loginCloseWarningWord = ''
  156. // 快速登录
  157. const loginSuccess = () => {
  158. showLogin.value = false
  159. Snackbar.success('登录成功')
  160. if (nextFunc.value) nextFunc.value()
  161. }
  162. const loginClose = () => {
  163. showLogin.value = false
  164. Snackbar.warning(loginCloseWarningWord)
  165. }
  166. </script>
  167. <style scoped lang="scss">
  168. .banner {
  169. background-color: #fff;
  170. padding: 0 0 20px;
  171. }
  172. .banner-title {
  173. display: flex;
  174. align-items: center;
  175. justify-content: space-between;
  176. height: 125px;
  177. }
  178. .content-left {
  179. width: 844px;
  180. padding: 20px;
  181. }
  182. .content-right {
  183. flex: 1;
  184. padding: 20px 20px 0 0;
  185. }
  186. .contact {
  187. height: 60px;
  188. line-height: 60px;
  189. }
  190. .contact-name {
  191. font-size: 28px;
  192. font-weight: 700;
  193. color: #37576c;
  194. line-height: 28px;
  195. }
  196. .contact-info {
  197. font-size: 15px;
  198. font-weight: 500;
  199. color: var(--color-222);
  200. line-height: 21px;
  201. margin-top: 8px;
  202. }
  203. .tools-box {
  204. height: 80px;
  205. width: 80px;
  206. background-color: var(--color-d5e6e8);
  207. border-radius: 5px;
  208. }
  209. .tools-box-number {
  210. font-size: 30px;
  211. font-weight: 700;
  212. color: var(--v-primary-base);
  213. }
  214. .tools-box-text {
  215. color: var(--v-primary-base);
  216. font-size: 14px;
  217. }
  218. .welfare {
  219. background-color: var(--color-f3);
  220. border-radius: 8px;
  221. padding: 12px;
  222. }
  223. .welfare-tags {
  224. display: flex;
  225. width: 242px;
  226. flex-wrap: wrap;
  227. height: 100px;
  228. overflow: hidden;
  229. text-align: center;
  230. }
  231. .welfare-tags-item {
  232. display: block;
  233. width: 117px;
  234. max-width: 117px;
  235. text-align: center;
  236. line-height: 26px;
  237. margin-right: 8px;
  238. &:nth-child(2n) {
  239. margin-right: 0;
  240. }
  241. }
  242. .business-item {
  243. font-size: 14px;
  244. color: var(--color-666);
  245. font-weight: 600;
  246. }
  247. .business-value {
  248. width: 228px;
  249. color: #000;
  250. font-weight: 500;
  251. }
  252. .business-source {
  253. font-size: 14px;
  254. color: var(--color-666);
  255. }
  256. .desc {
  257. width: 180px;
  258. color: var(--color-666);
  259. font-weight: 500;
  260. font-size: 12px;
  261. }
  262. .position-name {
  263. width: 180px;
  264. font-size: 14px;
  265. font-weight: 600;
  266. }
  267. .breadcrumbsText {
  268. color: var(--color-999);
  269. font-size: 14px;
  270. &.active {
  271. color: var(--v-primary-base);
  272. cursor: pointer;
  273. }
  274. }
  275. </style>