index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div class="default-width banner px-6">
  3. <div v-if="Object.keys(info).length">
  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" :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. <div class="d-flex" v-if="Object.keys(info).length">
  31. <div class="content-left">
  32. <recruitmentPositions :info="info"/>
  33. </div>
  34. <div class="content-right">
  35. <div class="welfare mb-3">
  36. <h4>福利</h4>
  37. <div v-if="info?.enterprise?.welfareList?.length" class="welfare-tags mt-3">
  38. <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>
  39. </div>
  40. <div v-else class="color-666 font-size-14 mt-3">暂无</div>
  41. </div>
  42. <div class="welfare">
  43. <h4>工商信息</h4>
  44. <div :class="['mt-2', 'business-item']" v-for="val in businessList" :key="val.value">
  45. <div>{{ val.label }}</div>
  46. <div class="business-value ellipsis">
  47. {{ info?.business ? info.business[val.value] : '暂无' }}
  48. <span v-if="info?.business && val.value === 'registeredCapital' && info?.business[val.value] && info?.business[val.value].indexOf('万元') === -1">万元</span>
  49. </div>
  50. <div :class="['my-3']"></div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <!-- 快速登录 -->
  58. <loginPage v-if="showLogin" @loginSuccess="loginSuccess" @close="loginClose"></loginPage>
  59. </div>
  60. </template>
  61. <script setup>
  62. defineOptions({name: 'jobFair-enterprise'})
  63. import { ref } from 'vue'
  64. import {
  65. getEnterpriseDetails,
  66. getEnterpriseSubscribeCheck,
  67. getEnterpriseSubscribe,
  68. getEnterpriseUnsubscribe
  69. } from '@/api/enterprise'
  70. import { dealDictObjData } from '@/utils/position'
  71. import { timesTampChange } from '@/utils/date'
  72. import { useRouter } from 'vue-router'; const router = useRouter()
  73. import { formatName } from '@/utils/getText'
  74. import { getToken } from '@/utils/auth'
  75. import loginPage from '@/views/common/loginDialog.vue'
  76. import Snackbar from '@/plugins/snackbar'
  77. import recruitmentPositions from './positions.vue'
  78. const { id } = router.currentRoute.value.params
  79. // 企业详情
  80. const info = ref({})
  81. const getDetails = async () => {
  82. if (!id) return
  83. const data = await getEnterpriseDetails({ id })
  84. // 成立日期
  85. if (data?.business?.establishmentTime) {
  86. data.business.establishmentTime = timesTampChange(data.business.establishmentTime, 'Y-M-D')
  87. }
  88. info.value = { ...data, ...dealDictObjData({}, data.enterprise) }
  89. getCollectionStatus(id)
  90. }
  91. getDetails()
  92. // 返回上一页
  93. const handleReturn = () => {
  94. if (window.history.state.back) {
  95. router.back()
  96. } else router.push('/recruit/personal/jobFair')
  97. }
  98. // 效验求职者是否关注该企业
  99. const isCollection = ref(false)
  100. const getCollectionStatus = async (id) => {
  101. if (!getToken()) return isCollection.value = false
  102. const data = await getEnterpriseSubscribeCheck({ enterpriseId: id })
  103. isCollection.value = data
  104. }
  105. // 关注&取消关注企业
  106. const handleFollow = async () => {
  107. if (!getToken()) {
  108. showLogin.value = true // 打开快速登录弹窗
  109. Snackbar.warning('您还未登录,请先登录后再试')
  110. nextFunc.value = handleFollow // 登录成功后要执行的操作
  111. loginCloseWarningWord = '您已取消登录,无法关注企业' // 取消登录提示语
  112. return
  113. }
  114. const api = isCollection.value ? getEnterpriseUnsubscribe : getEnterpriseSubscribe
  115. await api(isCollection.value ? id : { enterpriseId: id })
  116. getCollectionStatus(id)
  117. }
  118. const showLogin = ref(false)
  119. const nextFunc = ref(null)
  120. let loginCloseWarningWord = ''
  121. // 快速登录
  122. const loginSuccess = () => {
  123. showLogin.value = false
  124. Snackbar.success('登录成功')
  125. if (nextFunc.value) nextFunc.value()
  126. }
  127. const loginClose = () => {
  128. showLogin.value = false
  129. Snackbar.warning(loginCloseWarningWord)
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .banner {
  134. background-color: #fff;
  135. padding: 0 0 20px;
  136. }
  137. .banner-title {
  138. display: flex;
  139. align-items: center;
  140. justify-content: space-between;
  141. height: 125px;
  142. }
  143. .content-left {
  144. width: 844px;
  145. padding: 20px;
  146. }
  147. .content-right {
  148. flex: 1;
  149. padding: 20px 20px 0 0;
  150. }
  151. .contact {
  152. height: 60px;
  153. line-height: 60px;
  154. }
  155. .contact-name {
  156. font-size: 28px;
  157. font-weight: 700;
  158. color: #37576c;
  159. line-height: 28px;
  160. }
  161. .contact-info {
  162. font-size: 15px;
  163. font-weight: 500;
  164. color: var(--color-222);
  165. line-height: 21px;
  166. margin-top: 8px;
  167. }
  168. .tools-box {
  169. height: 80px;
  170. width: 80px;
  171. background-color: var(--color-d5e6e8);
  172. border-radius: 5px;
  173. }
  174. .tools-box-number {
  175. font-size: 30px;
  176. font-weight: 700;
  177. color: var(--v-primary-base);
  178. }
  179. .tools-box-text {
  180. color: var(--v-primary-base);
  181. font-size: 14px;
  182. }
  183. .welfare {
  184. background-color: var(--color-f3);
  185. border-radius: 8px;
  186. padding: 12px;
  187. }
  188. .welfare-tags {
  189. display: flex;
  190. width: 242px;
  191. flex-wrap: wrap;
  192. height: 100px;
  193. overflow: hidden;
  194. text-align: center;
  195. }
  196. .welfare-tags-item {
  197. display: block;
  198. width: 117px;
  199. max-width: 117px;
  200. text-align: center;
  201. line-height: 26px;
  202. margin-right: 8px;
  203. &:nth-child(2n) {
  204. margin-right: 0;
  205. }
  206. }
  207. .business-item {
  208. font-size: 14px;
  209. color: var(--color-666);
  210. font-weight: 600;
  211. }
  212. .business-value {
  213. width: 228px;
  214. color: #000;
  215. font-weight: 500;
  216. }
  217. .business-source {
  218. font-size: 14px;
  219. color: var(--color-666);
  220. }
  221. .desc {
  222. width: 180px;
  223. color: var(--color-666);
  224. font-weight: 500;
  225. font-size: 12px;
  226. }
  227. .position-name {
  228. width: 180px;
  229. font-size: 14px;
  230. font-weight: 600;
  231. }
  232. </style>