index.vue 8.0 KB

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