details.vue 13 KB

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