index.vue 9.5 KB

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