details.vue 14 KB

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