index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <!-- 分享职位 -->
  2. <template>
  3. <div style="background-color: #f0f0f0;" :style="{'padding': isMobile ? '0' : '10px'}">
  4. <v-card
  5. class="py-3 px-5"
  6. style="min-height: calc(100vh - 20px); box-sizing: border-box; margin: 0 auto;"
  7. :style="{'width': isMobile ? '100%' : '750px'}"
  8. >
  9. <div v-if="!Object.keys(info).length">加载失败</div>
  10. <div v-else>
  11. <div class="d-flex justify-space-between">
  12. <h2 class="JobName ellipsis">{{ info.name }}</h2>
  13. <span class="salary">{{ info.payFrom }}-{{ info.payTo }}/{{ positionInfo.payName }}</span>
  14. </div>
  15. <div class="d-flex justify-space-between mt-4">
  16. <div class="banner-tags">
  17. <div v-for="k in desc" :key="k.mdi" class="mr-3">
  18. <v-icon color="var(--color-666)" size="20">{{ k.mdi }}</v-icon>
  19. <span class="f-w-600 ml-1">{{ positionInfo[k.value] }}</span>
  20. </div>
  21. </div>
  22. <div class="mt-4" v-if="info?.tagList">
  23. <v-chip size="small" class="mr-1 mb-1" color="primary" label v-for="(k, i) in info.tagList" :key="i">{{ k }}</v-chip>
  24. </div>
  25. </div>
  26. <div class="text-end d-flex align-center justify-space-between mt-3">
  27. <v-btn
  28. class="button-item radius"
  29. color="warning"
  30. variant="outlined"
  31. :prepend-icon="isCollection ? 'mdi-heart' : 'mdi-heart-outline'"
  32. @click="handleCollection"
  33. >{{ isCollection ? $t('position.cancelFavorite') : $t('position.collection') }}</v-btn>
  34. <publicRecruitment v-if="info.hire" width="50" height="60"></publicRecruitment>
  35. </div>
  36. <div v-if="info.hire" class="mt-3">
  37. <v-chip v-if="info.hirePrice" label color="primary">赏金:{{ info.hirePrice }}元</v-chip>
  38. <v-chip v-if="info.hirePoint" label color="primary">积分:{{ info.hirePoint }}点</v-chip>
  39. </div>
  40. <v-divider class="mt-3"></v-divider>
  41. <div class="mt-3 mb-1 f-w-600">{{ $t('position.jobResponsibilities') }}</div>
  42. <div class="requirement" v-html="info.content?.replace(/\n/g, '</br>')"></div>
  43. <div class="mt-3 mb-1 f-w-600">{{ $t('position.jobRequirements') }}</div>
  44. <div class="requirement" v-html="info.requirement?.replace(/\n/g, '</br>')"></div>
  45. <v-divider class="my-3"></v-divider>
  46. <div class="contact">
  47. <div class="float-left d-flex align-center">
  48. <v-img :src="info.contact?.avatar || 'https://minio.citupro.com/dev/menduner/7.png'" :width="45" style="height: 45px;"></v-img>
  49. <div class="ml-2">
  50. <div class="contact-name">{{ info.contact?.name }}</div>
  51. <div class="contact-info">{{ info.enterprise?.name }} · {{ info.contact?.postNameCn }}</div>
  52. </div>
  53. </div>
  54. </div>
  55. <v-divider class="my-3"></v-divider>
  56. <div>
  57. <h4>{{ $t('position.address') }}</h4>
  58. <div class="mt-1">
  59. <v-icon size="25" color="primary">mdi-map-marker</v-icon>
  60. <span style="color: var(--color-666);font-size: 15px;">{{ info.address }}</span>
  61. </div>
  62. </div>
  63. <div class="text-center my-10">
  64. <v-btn v-if="!isMobile" class="mr-2 radius button-item" color="success" variant="outlined" target="_blank" to="/recruit/personal/position">{{ $t('position.moreBtn') }}</v-btn>
  65. <v-btn class="radius button-item" color="primary" :disabled="delivery" @click="sendResumeProcessVerify">{{ delivery ? $t('position.delivered') : $t('position.submitResume') }}</v-btn>
  66. </div>
  67. </div>
  68. </v-card>
  69. <!-- 快速登录/注册 -->
  70. <login-page
  71. v-if="sendResume.showLogin"
  72. :jobId="jobId"
  73. @loginSuccess="loginSuccess"
  74. @close="handleClose('showLogin')"
  75. ></login-page>
  76. <!-- 快速填写简易人才信息 -->
  77. <simple-page
  78. v-if="sendResume.showSimpleInfo"
  79. @simpleInfoReady="simpleInfoReadyFun"
  80. @close="handleClose('showSimpleInfo')"
  81. ></simple-page>
  82. <!-- 选择简历 -->
  83. <select-page
  84. v-if="sendResume.showSelect"
  85. :hire="info?.hire"
  86. :jobId="jobId"
  87. :userId="sharedById"
  88. @refresh="handleCheckJobDelivery"
  89. @close="handleClose('showSelect')"
  90. ref="selectRef"
  91. ></select-page>
  92. </div>
  93. </template>
  94. <script setup>
  95. defineOptions({name: 'recruit-personal-shareJob-index'})
  96. import loginPage from './components/login.vue'
  97. import simplePage from './sendResume/simple.vue'
  98. import selectPage from './sendResume/select.vue'
  99. import { onMounted, reactive, ref } from 'vue';
  100. import { getPositionDetails, jobCvRelCheckSend, getPersonJobUnfavorite, getPersonJobFavorite, getJobFavoriteCheck } from '@/api/position'
  101. import { dealDictObjData } from '@/utils/position'
  102. import { getPersonalToken } from '@/utils/auth'
  103. import Snackbar from '@/plugins/snackbar'
  104. import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
  105. // 组件挂载后添加事件监听器
  106. const isMobile = ref(false)
  107. onMounted(() => {
  108. const userAgent = navigator.userAgent
  109. isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
  110. })
  111. // 获取路由参数
  112. const queryParams = new URLSearchParams(window.location.search)
  113. const jobId = queryParams.get('jobId') || ''
  114. const sharedById = queryParams.get('sharedById') || ''
  115. // 职位详情
  116. const info = ref({})
  117. const positionInfo = ref({})
  118. const getPositionDetail = async () => {
  119. const data = await getPositionDetails({ id: jobId })
  120. info.value = data
  121. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value }
  122. }
  123. // 效验是否已投递
  124. const delivery = ref(false)
  125. const handleCheckJobDelivery = async () => {
  126. delivery.value = await jobCvRelCheckSend({ jobId })
  127. return delivery.value
  128. }
  129. // 效验求职者是否有收藏该职位
  130. const actions = ref(false)
  131. const isCollection = ref(false)
  132. const getCollectionStatus = async () => {
  133. if (!jobId) return
  134. const data = await getJobFavoriteCheck({ jobId })
  135. isCollection.value = data
  136. }
  137. // 收藏&取消收藏职位
  138. const handleCollection = async () => {
  139. // 效验登录状态
  140. if (!getPersonalToken()) {
  141. actions.value = true
  142. // handleLogin()
  143. sendResume.showLogin = true
  144. return
  145. }
  146. if (!jobId) return
  147. const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
  148. await api(isCollection.value ? jobId : { jobId })
  149. await getCollectionStatus()
  150. }
  151. // 判断有没有jobId跟sharedById,没有的话关闭当前窗口
  152. if (!jobId) { // !sharedById
  153. Snackbar.warning('当前打开的链接无效')
  154. setTimeout(() => {
  155. window.close()
  156. }, 2000)
  157. } else {
  158. getPositionDetail()
  159. if (getPersonalToken()) {
  160. handleCheckJobDelivery()
  161. getCollectionStatus()
  162. }
  163. }
  164. const desc = [
  165. { mdi: 'mdi-map-marker-outline', value: 'areaName' },
  166. { mdi: 'mdi-school-outline', value: 'eduName' },
  167. { mdi: 'mdi-clock-time-ten-outline', value: 'expName' }
  168. ]
  169. // 快速登录成功
  170. const loginSuccess = async () => {
  171. sendResume.showLogin = false // 关闭快速登录弹窗
  172. // actions为true则是收藏时的登录,不需要弹窗选择简历
  173. if (actions.value) {
  174. actions.value = false
  175. Snackbar.success('登录成功')
  176. await handleCollection()
  177. return
  178. }
  179. const bool = await handleCheckJobDelivery()
  180. if (bool) return Snackbar.warning(t('resume.alreadyResume'))
  181. sendResumeProcessVerify()
  182. }
  183. // 简易人才信息
  184. const simpleInfoReady = ref(false)
  185. const simpleInfoReadyFun = () => {
  186. sendResume.showSimpleInfo = false
  187. simpleInfoReady.value = true
  188. sendResumeProcessVerify()
  189. }
  190. const sendResume = reactive({
  191. showLogin: false,
  192. showSimpleInfo: false,
  193. showSelect: false,
  194. })
  195. // 流程校准
  196. const sendResumeProcessVerify = async () => {
  197. try { // 1.登录 2.具备人才信息 3.有无附件简历,无则上传
  198. // 未登录
  199. if (!getPersonalToken()) {
  200. sendResume.showLogin = true
  201. return
  202. }
  203. // 已登录
  204. // * 必填人才信息不完全 -> 不符合快速投递,进入完善人才信息流程
  205. if (!simpleInfoReady.value) {
  206. sendResume.showSimpleInfo = true
  207. return
  208. }
  209. // * 简历列表
  210. // if (!) sendResume.showSelect = true
  211. sendResume.showSelect = true
  212. } catch (error) {
  213. console.error('error', error)
  214. }
  215. }
  216. const handleClose = (key) => {
  217. sendResume[key] = false // 弹窗关闭,重置绑定数据
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .f-w-600 { font-weight: 600; }
  222. .radius { border-radius: 8px; }
  223. .salary {
  224. color: var(--v-error-base);
  225. line-height: 41px;
  226. font-weight: 600;
  227. height: auto;
  228. display: inline-block;
  229. vertical-align: sub;
  230. }
  231. .JobName {
  232. color: #37576c;
  233. font-size: 28px;
  234. margin-right: 30px;
  235. margin-top: 1px;
  236. // max-width: 45%;
  237. vertical-align: middle;
  238. flex: 1;
  239. }
  240. .banner-tags { display: flex; flex-wrap: wrap; }
  241. .requirement {
  242. white-space: pre-wrap;
  243. word-break: break-all;
  244. line-height: 28px;
  245. color: var(--color-333);
  246. font-size: 15px;
  247. text-align: justify;
  248. letter-spacing: 0;
  249. }
  250. .contact {
  251. height: 60px;
  252. line-height: 60px;
  253. padding: 0 10px;
  254. }
  255. .contact-name {
  256. font-size: 20px;
  257. font-weight: 500;
  258. color: var(--color-222);
  259. line-height: 28px;
  260. }
  261. .contact-info {
  262. font-size: 15px;
  263. color: var(--color-666);
  264. line-height: 21px;
  265. margin-top: 8px;
  266. }
  267. .button-item {
  268. min-width: 110px;
  269. height: 36px
  270. }
  271. </style>