index.vue 8.1 KB

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