details.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <div>
  3. <div class="default-width banner px-6">
  4. <div class="banner-title d-flex justify-space-between">
  5. <div class="d-flex align-center">
  6. <h1 class="ellipsis">{{ info.name }}</h1>
  7. <span class="salary">{{ info.payFrom }}-{{ info.payTo }}/{{ positionInfo.payName }}</span>
  8. <publicRecruitment v-if="info.hire" class="ml-5" width="50" height="50"></publicRecruitment>
  9. </div>
  10. <span class="refresh-time">{{ timesTampChange(info.updateTime) }} {{ $t('common.refresh') }} <v-icon color="warning" size="20">mdi-alert-outline</v-icon></span>
  11. </div>
  12. <div class="banner-tags mt-4">
  13. <span v-for="k in desc" :key="k.mdi" class="mr-10">
  14. <span v-if="positionInfo[k.value]">
  15. <v-icon color="var(--color-666)" size="20">{{ k.mdi }}</v-icon>
  16. <span class="ml-1">{{ positionInfo[k.value] }}</span>
  17. </span>
  18. </span>
  19. </div>
  20. <div class="banner-tools my-4">
  21. <v-chip size="small" label v-for="(k, i) in info.tagList" :key="i" class="mr-1" color="primary">{{ k }}</v-chip>
  22. </div>
  23. <div class="d-flex justify-space-between mb-5">
  24. <div>
  25. <div>
  26. <v-chip v-if="info.hire && info.hirePrice && info.hirePrice > 0" label color="primary">赏金:{{ commissionCalculation(info.hirePrice, 1) }}元</v-chip>
  27. <v-chip v-if="info.hire && info.hirePoint && info.hirePoint > 0" label color="primary" class="ml-1">积分:{{ commissionCalculation(info.hirePoint, 1) }}点</v-chip>
  28. </div>
  29. <div v-if="info?.hire" class="font-size-14 mt-3 color-error">推荐好友入职即可获得赏金</div>
  30. </div>
  31. <div class="banner-tools-btns">
  32. <v-btn
  33. class="radius mr-2 button-item"
  34. variant="outlined"
  35. color="error"
  36. prepend-icon="mdi-share-outline"
  37. style="height: 36px;"
  38. v-if="info?.hire"
  39. @click="handleShare"
  40. >我要赏金</v-btn>
  41. <v-btn
  42. v-else
  43. class="radius mr-2 button-item"
  44. variant="outlined"
  45. color="error"
  46. prepend-icon="mdi-share-outline"
  47. style="height: 36px;"
  48. @click="handleShare"
  49. >{{ $t('position.rewardsShared') }}</v-btn>
  50. <v-btn
  51. class="button-item radius"
  52. color="warning"
  53. variant="outlined"
  54. :prepend-icon="isCollection ? 'mdi-heart' : 'mdi-heart-outline'"
  55. @click="handleCollection"
  56. >{{ isCollection ? $t('position.cancelFavorite') : $t('position.collection') }}</v-btn>
  57. <v-btn class="button-item mx-2 radius" color="success" variant="outlined">{{ $t('position.communicate') }}</v-btn>
  58. <v-btn class="button-item radius" :disabled="delivery" color="primary" variant="outlined" @click="handleDelivery">{{ delivery ? $t('position.delivered') : $t('position.submitResume') }}</v-btn>
  59. </div>
  60. </div>
  61. <v-divider></v-divider>
  62. <div class="d-flex">
  63. <div class="content-left">
  64. <div v-if="Object.keys(info).length">
  65. <div>{{ $t('position.jobResponsibilities') }}:</div>
  66. <div class="requirement" v-html="info.content.replace(/\n/g, '</br>')"></div>
  67. <div class="mt-3">{{ $t('position.jobRequirements') }}:</div>
  68. <div class="requirement" v-html="info.requirement.replace(/\n/g, '</br>')"></div>
  69. </div>
  70. <v-divider class="my-3"></v-divider>
  71. <div class="contact" v-if="Object.keys(info).length">
  72. <div class="float-left d-flex align-center">
  73. <v-img :src="info.contact.avatar || 'https://minio.citupro.com/dev/menduner/7.png'" :width="45" style="height: 45px;"></v-img>
  74. <div class="ml-2">
  75. <div class="contact-name">{{ info.contact.name }}</div>
  76. <div class="contact-info">
  77. {{ info.enterprise.name }}
  78. <span v-if="info?.enterprise?.name && info?.contact?.postNameCn">·</span>
  79. {{ info.contact.postNameCn }}</div>
  80. </div>
  81. </div>
  82. <!-- <div class="float-right">
  83. <v-chip color="primary" label>{{ $t('position.currentOnline') }}</v-chip>
  84. </div> -->
  85. </div>
  86. <v-divider class="my-3"></v-divider>
  87. <div>
  88. <h4>{{ $t('position.address') }}</h4>
  89. <div class="mt-1">
  90. <v-icon size="25" color="primary">mdi-map-marker</v-icon>
  91. <span style="color: var(--color-666);font-size: 15px;">{{ info.address }}</span>
  92. </div>
  93. </div>
  94. <div class="mt-3 text-center">
  95. <v-btn class="mr-2 radius button-item" color="success" variant="outlined">{{ $t('position.communicate') }}</v-btn>
  96. <v-btn class="radius button-item" :disabled="delivery" color="primary" @click="handleDelivery">{{ delivery ? $t('position.delivered') : $t('position.submitResume') }}</v-btn>
  97. </div>
  98. </div>
  99. <div class="content-right" v-if="Object.keys(info).length">
  100. <!-- 公司信息 -->
  101. <EnterpriseInfo :info="{ ...info, position: { ...positionInfo } }"></EnterpriseInfo>
  102. <!-- 相似职位 -->
  103. <similarPositions v-if="similarList.length" class="mt-3" :list="similarList" :info="info"></similarPositions>
  104. </div>
  105. </div>
  106. </div>
  107. <!-- 弹窗提示去上传简历 -->
  108. <promptToUpload v-model="dialog" @handleToUpload="handleToUpload"></promptToUpload>
  109. <!-- 选择简历 -->
  110. <selectResumeDialog v-model="showResume" :list="resumeList" @submit="handleSubmit" @close="handleClose"></selectResumeDialog>
  111. <!-- 复制分享链接 -->
  112. <Dialog
  113. :visible="shareDialog" :widthType="2" :footer="false" titleClass="text-h6"
  114. :title="$t('position.rewardsShared')"
  115. @close="shareDialog = false"
  116. >
  117. <div>
  118. <div class="pa-4" style="background-color: #f0f0f0; border-radius: 8px;">{{ shareUrlTxt }}</div>
  119. <v-btn v-if="!getToken()" class="mt-1" color="warning" variant="text">您还未登录,登录后分享可享受分享有礼活动!</v-btn>
  120. <v-btn class="mt-4 ml-3" color="success" @click="copyText">复制分享链接</v-btn>
  121. <v-btn class="mt-4 ml-3" color="primary" variant="outlined" @click="openShareLink">打开分享链接</v-btn>
  122. </div>
  123. <template #footer>
  124. <v-divider></v-divider>
  125. <div>
  126. <v-btn
  127. class="float-right ma-2"
  128. color="primary"
  129. variant="text"
  130. @click="shareDialog = false"
  131. >{{ $t('common.close') }}</v-btn>
  132. </div>
  133. </template>
  134. </Dialog>
  135. </div>
  136. </template>
  137. <script setup>
  138. import { commissionCalculation } from '@/utils/position'
  139. defineOptions({ name: 'position-details' })
  140. import { computed, ref } from 'vue'
  141. import { useRouter } from 'vue-router'
  142. import { timesTampChange } from '@/utils/date'
  143. import { getPersonResumeCv } from '@/api/recruit/personal/resume'
  144. import { useI18n } from '@/hooks/web/useI18n'
  145. import { getPositionDetails, getSimilarPosition, getJobFavoriteCheck, getPersonJobFavorite, getPersonJobUnfavorite, jobCvRelCheckSend, jobCvRelSend } from '@/api/position'
  146. import { dealDictObjData, dealDictArrayData } from '@/utils/position'
  147. import similarPositions from '@/components/Position/similarPositions.vue'
  148. import EnterpriseInfo from '@/components/Enterprise/info.vue'
  149. import Snackbar from '@/plugins/snackbar'
  150. import Dialog from '@/components/CtDialog'
  151. import promptToUpload from './jobDetails/promptToUpload'
  152. import selectResumeDialog from './jobDetails/selectResumeDialog'
  153. import { getToken } from '@/utils/auth'
  154. const { t } = useI18n()
  155. const router = useRouter()
  156. const { id } = router.currentRoute.value.params
  157. const delivery = ref(false) // 是否已投递简历
  158. // 相似职位
  159. const similarList = ref([])
  160. const getSimilarPositionList = async () => {
  161. if (!Object.keys(positionInfo).length) return
  162. const { list } = await getSimilarPosition({ pageNo: 1, pageSize: 4, positionId: positionInfo.value.positionId, expType: positionInfo.value.expType, eduType: positionInfo.value.eduType })
  163. const items = list.splice(0, 4)
  164. similarList.value = dealDictArrayData([], items)
  165. }
  166. // 职位详情
  167. const info = ref({})
  168. const positionInfo = ref({})
  169. const getPositionDetail = async () => {
  170. const data = await getPositionDetails({ id })
  171. info.value = data
  172. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value }
  173. getSimilarPositionList()
  174. }
  175. getPositionDetail()
  176. // 效验是否有投递过简历
  177. const deliveryCheck = async () => {
  178. const data = await jobCvRelCheckSend({ jobId: id })
  179. if (data) delivery.value = true
  180. }
  181. if (getToken()) deliveryCheck()
  182. const desc = [
  183. { mdi: 'mdi-map-marker-outline', value: 'areaName' },
  184. { mdi: 'mdi-school-outline', value: 'eduName' },
  185. { mdi: 'mdi-clock-time-ten-outline', value: 'expName' }
  186. ]
  187. // 效验求职者是否有收藏该职位
  188. const isCollection = ref(true)
  189. const getCollectionStatus = async () => {
  190. if (!getToken()) return isCollection.value = false
  191. const data = await getJobFavoriteCheck({ jobId: id })
  192. isCollection.value = data
  193. }
  194. getCollectionStatus()
  195. // 分享有礼
  196. const shareDialog = ref(false)
  197. const shareUrl = ref('')
  198. const userInfo = localStorage.getItem('userInfo') ? JSON.parse(localStorage.getItem('userInfo')) : {}
  199. const handleShare = async () => {
  200. // 分享链接携带参数: 用户id、职位id
  201. // if (!id || !userInfo.id) return
  202. shareUrl.value = '/shareJob?' + new URLSearchParams({
  203. jobId: id,
  204. sharedById: userInfo?.id,
  205. }).toString()
  206. shareDialog.value = true
  207. }
  208. const openShareLink = () => { window.open(shareUrl.value) }
  209. // 复制分享链接
  210. const shareUrlTxt = computed(() => {
  211. return 'http://menduner.citupro.com:7878' + shareUrl.value
  212. })
  213. const copyText = async () => {
  214. // try {
  215. // const txt = shareUrlTxt.value
  216. // if (navigator.clipboard && navigator.clipboard.writeText) {
  217. // await navigator.clipboard.writeText(txt)
  218. // Snackbar.success('复制成功')
  219. // } else {
  220. // const textArea = document.createElement("textarea")
  221. // textArea.value = txt
  222. // textArea.style.position = "fixed" // 避免在页面上滚动
  223. // textArea.style.top = 0
  224. // textArea.style.left = 0
  225. // textArea.style.width = "2em"
  226. // textArea.style.height = "2em"
  227. // textArea.style.padding = 0
  228. // textArea.style.border = "none"
  229. // textArea.style.outline = "none"
  230. // textArea.style.boxShadow = "none"
  231. // textArea.style.background = "transparent"
  232. // document.body.appendChild(textArea)
  233. // textArea.focus()
  234. // textArea.select()
  235. // const successful = document.execCommand('copy')
  236. // Snackbar.success(successful ? '复制成功' : '复制失败,请手动复制。')
  237. // }
  238. // } catch (err) {
  239. // Snackbar.error('复制失败,请手动复制。')
  240. // }
  241. try {
  242. await navigator.clipboard.writeText(shareUrlTxt.value)
  243. Snackbar.success('复制成功')
  244. } catch (err) {
  245. Snackbar.error('复制失败,请手动复制。')
  246. }
  247. }
  248. // 收藏&取消收藏职位
  249. const handleCollection = async () => {
  250. const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
  251. await api(isCollection.value ? id : { jobId: id })
  252. await getCollectionStatus()
  253. }
  254. const dialog = ref(false)
  255. const showResume = ref(false)
  256. // 去上传附件
  257. const handleToUpload = () => {
  258. dialog.value = false
  259. window.open('/recruit/personal/personalCenter')
  260. }
  261. // 效验是否有投递简历
  262. const resumeList = ref([])
  263. const selectResume = ref()
  264. const handleDelivery = async () => {
  265. if (delivery.value) return Snackbar.warning(t('resume.alreadyResume'))
  266. const result = await getPersonResumeCv()
  267. resumeList.value = result
  268. // 没有上传过简历的先去上传
  269. if (!result.length) {
  270. dialog.value = true
  271. return
  272. }
  273. showResume.value = true
  274. }
  275. // 简历投递
  276. const handleClose = () => {
  277. showResume.value = false
  278. selectResume.value = null
  279. }
  280. const handleSubmit = async (val) =>{
  281. selectResume.value = val
  282. if (!selectResume.value) return Snackbar.warning(t('resume.selectResumeToSubmit'))
  283. const obj = resumeList.value.find(e => e.id === selectResume.value)
  284. if (!obj) return Snackbar.warning(t('resume.selectedResumeNotExist'))
  285. await jobCvRelSend({ jobId: id, title: obj.title, url: obj.url, type: info.value.hire ? 1 : 0 })
  286. setTimeout(() => {
  287. Snackbar.success(t('resume.deliverySuccess'))
  288. }, 3000)
  289. handleClose()
  290. deliveryCheck()
  291. }
  292. </script>
  293. <style lang="scss" scoped>
  294. .banner {
  295. background-color: #fff;
  296. padding: 18px 0 20px;
  297. }
  298. .banner-title {
  299. line-height: 40px;
  300. font-size: 28px;
  301. font-weight: 600;
  302. }
  303. .banner-title h1 {
  304. display: inline-block;
  305. color: #37576c;
  306. font-size: 28px;
  307. margin-right: 30px;
  308. margin-top: 1px;
  309. max-width: 360px;
  310. vertical-align: middle;
  311. }
  312. .button-item {
  313. min-width: 110px;
  314. height: 36px
  315. }
  316. .salary {
  317. color: var(--v-error-base);
  318. line-height: 41px;
  319. font-weight: 600;
  320. height: auto;
  321. display: inline-block;
  322. vertical-align: sub;
  323. }
  324. .refresh-time {
  325. float: right;
  326. color: var(--color-666);
  327. font-size: 14px;
  328. line-height: 66px;
  329. vertical-align: sub;
  330. }
  331. .banner-tags span {
  332. font-weight: 600;
  333. }
  334. .radius {
  335. border-radius: 8px;
  336. }
  337. .content-left {
  338. width: 810px;
  339. padding: 20px 20px;
  340. }
  341. .content-right {
  342. flex: 1;
  343. padding: 20px 20px 20px 0;
  344. }
  345. .label-text {
  346. color: #7f7a7a;
  347. font-weight: 600;
  348. }
  349. .value-text {
  350. color: #000;
  351. font-weight: 400;
  352. }
  353. .requirement {
  354. white-space: pre-wrap;
  355. word-break: break-all;
  356. line-height: 28px;
  357. color: var(--color-333);
  358. font-size: 15px;
  359. text-align: justify;
  360. letter-spacing: 0;
  361. }
  362. .contact {
  363. height: 60px;
  364. line-height: 60px;
  365. }
  366. .contact-name {
  367. font-size: 20px;
  368. font-weight: 500;
  369. color: var(--color-222);
  370. line-height: 28px;
  371. }
  372. .contact-info {
  373. font-size: 15px;
  374. color: var(--color-666);
  375. line-height: 21px;
  376. margin-top: 8px;
  377. }
  378. </style>