index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. <template>
  2. <layout-page>
  3. <scroll-view class="scrollBox" style="position:relative;">
  4. <view class="box">
  5. <view v-if="loading" class="vertical80-center">{{ loadingText }}</view>
  6. <view v-else>
  7. <!-- 职位名称 + 薪资 -->
  8. <view class="d-flex justify-space-between">
  9. <h2 class="JobName ellipsis">
  10. {{ info.name }}
  11. </h2>
  12. <span class="salary w-600">{{ info.payFrom }}-{{ info.payTo }}/{{ positionInfo.payName }}</span>
  13. </view>
  14. <!-- 职位地区 收藏职位 -->
  15. <view class="d-flex justify-space-between mt-5">
  16. <view class="bold" style="font-size: 14px;">
  17. <span>
  18. <span>{{positionInfo?.areaName }}</span>
  19. <span class="viewider-mx">|</span>
  20. <span>{{positionInfo?.eduName }}</span>
  21. <span class="viewider-mx">|</span>
  22. <span>{{positionInfo?.expName }}</span>
  23. </span>
  24. </view>
  25. <!-- 收藏职位 -->
  26. <view @click="handleCollection">
  27. <uni-icons
  28. :type="isCollection ? 'heart-filled' : 'heart'"
  29. color="#fc6d5e"
  30. class="mr"
  31. size="25"
  32. ></uni-icons>
  33. </view>
  34. </view>
  35. <!-- 标签 -->
  36. <view class="tagList mt">
  37. <view class="tag" v-for="(tag,i) in info?.tagList || []" :key="'tagList' + i">
  38. {{ tag }}
  39. </view>
  40. </view>
  41. <!-- 赏金 -->
  42. <view v-if="info.hire" class="topLine mt-5" style="display: flex; align-items: center;">
  43. <view class="iconfont icon-a-1_zhaopin" style="color: #e03506; font-size: 30px;"></view>
  44. <view class="hirePrice">{{ `赏金:${commissionCalculation(info.hirePrice, 1)}元` }}</view>
  45. </view>
  46. <!-- 岗位职责 -->
  47. <view class="topLine fs14 mt-5">
  48. <view class="fs15 w-600 my5">岗位职责</view>
  49. <view v-if="!info.content">暂无</view>
  50. <rich-text v-else class="htmlCss" :nodes="info.content"></rich-text>
  51. </view>
  52. <!-- 岗位要求 -->
  53. <view class="topLine mt-5">
  54. <view class="fs15 w-600 my5">岗位要求</view>
  55. <view v-if="!info.requirement">暂无</view>
  56. <rich-text v-else class="htmlCss" :nodes="info.requirement"></rich-text>
  57. </view>
  58. <!-- 企业信息 -->
  59. <view class="topLine mt-5 d-flex">
  60. <view class="avatarBox">
  61. <image class="avatar" :src="info.contact?.avatar || 'https://minio.citupro.com/dev/menduner/7.png'"></image>
  62. </view>
  63. <view >
  64. <view class="contact-name">{{ info.contact?.name }}</view>
  65. <view class="contact-info">{{ info.enterprise?.name }} · {{ info.contact?.postNameCn }}</view>
  66. </view>
  67. </view>
  68. <!-- 工作地址 -->
  69. <view class="topLine mt-5">
  70. <view class="fs15 w-600 my5">工作地址</view>
  71. <view class="my10">
  72. <uni-icons
  73. type="map-pin-ellipse"
  74. color="#00897B"
  75. class="mr"
  76. size="25"
  77. ></uni-icons>
  78. <span style="color: var(--color-666);font-size: 15px;line-height: 26px;">{{ info.address }}</span>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </scroll-view>
  84. <!-- 分享 投递 -->
  85. <view class="bottom-sticky" v-if="!loading && jobId">
  86. <view style="display: flex;justify-content: space-evenly;align-items: center;width: 100%;margin: 20rpx 0;">
  87. <view @click="handleClickShare" style="display: flex;justify-content: center;flex-direction: column;align-items: center;">
  88. <uni-icons type="redo-filled" size="24" color="#00897B"/>
  89. <span style="color:#00897B;font-weight:bold;">分享</span>
  90. </view>
  91. <button v-if="delivery" :disabled="true" class="buttons disable">我已投递</button>
  92. <button v-else class="buttons" @click="handleDelivery">我要投递</button>
  93. </view>
  94. </view>
  95. <!-- 选择简历 -->
  96. <uni-popup ref="popup" background-color="#fff" :mask-click="false" >
  97. <view class="dialogBox" style="width: 86vw;">
  98. <view class="dialog-title">
  99. <view class="title">选择简历</view>
  100. <uni-icons type="close" color="grey" size="26" @click="popupClose" />
  101. </view>
  102. <view style="height: 1px; margin: 0 20rpx; background-color: #dedede;"></view>
  103. <scroll-view class="dialog-content" scroll-y="true" style="max-height: 50vh; width: auto;">
  104. <uni-card
  105. v-for="(item, index) in resumeList"
  106. :key="index"
  107. shadow="0px 0px 3px 1px rgba(0,0,0,0.1)"
  108. :is-shadow="true"
  109. :border='false'
  110. background-color="red"
  111. :class="{'selected': selectIndex === index}"
  112. @click="selectIndex = index"
  113. >
  114. <view class="d-flex align-center">
  115. <view style="flex: 1;">
  116. <view style="font-weight: bold;">
  117. <uni-icons v-if="selectIndex === index" color="green" type="checkmarkempty" size="18"></uni-icons>
  118. {{ item.title }}
  119. </view>
  120. <view>上传时间:{{ timesTampChange(item.createTime, 'Y-M-D') }}</view>
  121. </view>
  122. <view class="ss-m-l-30" style="width: 60rpx;">
  123. <uni-icons @click="preview(item.url)" type="eye" size="24"></uni-icons>
  124. </view>
  125. </view>
  126. </uni-card>
  127. <view class="selectOnline" @click="handleUpload">选取微信聊天文件</view>
  128. </scroll-view>
  129. <view class="dialog-bottom" @click="deliverySubmit()">确认投递</view>
  130. </view>
  131. </uni-popup>
  132. <!-- 上传简历 -->
  133. <uni-popup ref="uploadPopup" type="dialog">
  134. <uni-popup-dialog
  135. type="warn"
  136. cancelText="取消"
  137. confirmText="确定"
  138. title="系统提示"
  139. content="您还未上传过简历,是否选取微信聊天文件投递?"
  140. @confirm="handleUpload"
  141. @close="uploadPopup.close()"
  142. ></uni-popup-dialog>
  143. </uni-popup>
  144. </layout-page>
  145. </template>
  146. <script setup>
  147. import { commissionCalculation } from '@/utils/position'
  148. import { timesTampChange } from '@/utils/date'
  149. import { preview } from '@/utils/preview'
  150. import { uploadFileTest } from '@/api/file'
  151. import layoutPage from '@/layout'
  152. import { ref } from 'vue';
  153. import {
  154. jobCvRelSend,
  155. getPositionDetails,
  156. jobCvRelCheckSend,
  157. getPersonJobUnfavorite, // 取消收藏
  158. getPersonJobFavorite, // 收藏
  159. getJobFavoriteCheck
  160. } from '@/api/position'
  161. import { getPersonResumeCv, saveResume } from '@/api/user'
  162. import { dealDictObjData } from '@/utils/position'
  163. import { getAccessToken } from '@/utils/request'
  164. import { onLoad } from '@dcloudio/uni-app';
  165. const loading = ref(false)
  166. const loadingText = ref('加载中 . . . ')
  167. // 职位详情
  168. const info = ref({})
  169. const positionInfo = ref({})
  170. const getPositionDetail = async () => {
  171. try {
  172. loading.value = true
  173. const { data } = await getPositionDetails({ id: jobId })
  174. info.value = data
  175. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value }
  176. loading.value = false
  177. console.log('positionInfo', positionInfo.value)
  178. } finally {
  179. }
  180. }
  181. let jobId = ''
  182. onLoad((options) => {
  183. jobId = options?.id || ''
  184. if (jobId) {
  185. loading.value = true
  186. loadingText.value = '加载中 . . . '
  187. deliveryCheck()
  188. getCollectionStatus()
  189. getPositionDetail()
  190. } else {
  191. loadingText.value = '加载失败 . . . '
  192. }
  193. })
  194. // 效验是否有投递过简历
  195. const delivery = ref(false) // 是否已投递简历
  196. const deliveryCheck = async () => {
  197. try {
  198. if (!getAccessToken()) return delivery.value = false
  199. const { data } = await jobCvRelCheckSend({ jobId })
  200. delivery.value = Boolean(data)
  201. } finally {
  202. }
  203. }
  204. import { showAuthModal } from '@/hooks/useModal'
  205. const popup = ref()
  206. const uploadPopup = ref()
  207. const resumeList = ref([])
  208. const selectIndex = ref(null)
  209. const handleDelivery = async () => {
  210. // 未登录
  211. if (!getAccessToken()) {
  212. uni.showToast({
  213. title:'请先登录',
  214. icon: 'none'
  215. })
  216. showAuthModal()
  217. return
  218. }
  219. // 已投递
  220. if (delivery.value) {
  221. uni.showToast({ title: '您已投递过该职位!', icon: 'none', duration: 2000, })
  222. return
  223. }
  224. const { data } = await getPersonResumeCv()
  225. resumeList.value = data
  226. // 未上传简历
  227. if (!resumeList.value?.length) return uploadPopup.value.open()
  228. popup.value.open()
  229. }
  230. const deliverySubmit = async (uploadFile) => {
  231. const resume = uploadFile ? uploadFile : resumeList.value[selectIndex.value]
  232. if (!resume) {
  233. selectIndex.value = null
  234. uni.showToast({ title: '请选择简历', icon: 'none', duration: 2000, })
  235. return
  236. }
  237. await jobCvRelSend({ jobId, title: resume.title, url: resume.url, type: info.value.hire ? 1 : 0 })
  238. uni.showToast({ title: '投递成功', icon: 'none', duration: 2000, })
  239. deliveryCheck()
  240. popup.value.close()
  241. }
  242. const popupClose = () => {
  243. selectIndex.value = null
  244. popup.value.close()
  245. }
  246. // 效验求职者是否有收藏该职位
  247. const isCollection = ref(false)
  248. const getCollectionStatus = async () => {
  249. if (!getAccessToken()) return isCollection.value = false
  250. const { data } = await getJobFavoriteCheck({ jobId })
  251. isCollection.value = Boolean(data)
  252. }
  253. // 操作 收藏&取消收藏职位
  254. const handleCollection = async () => {
  255. const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
  256. await api(isCollection.value ? jobId : { jobId })
  257. await getCollectionStatus()
  258. }
  259. // 选取微信聊天文件
  260. // 上传附件
  261. const handleUpload = () => {
  262. wx.chooseMessageFile({
  263. count: 1,
  264. type: 'file',
  265. success (res) {
  266. const title = res.tempFiles[0].name
  267. const path = res.tempFiles[0].path
  268. //效验是否为支持的文件格式
  269. if(/\.(pdf|docx|doc)$/.test(title)){
  270. uploadFileTest(path).then(async (res) => {
  271. if (!res.data) {
  272. uni.showToast({
  273. title: '上传失败',
  274. icon: 'none'
  275. })
  276. return
  277. }
  278. await saveResume({ title, url: res.data })
  279. uni.showToast({
  280. title: '上传成功',
  281. icon: 'success'
  282. })
  283. deliverySubmit({ title, url: res.data })
  284. })
  285. }else{
  286. uni.showToast({
  287. icon: 'none',
  288. title: '请上传pdf、word类型的文件',
  289. duration: 2000
  290. })
  291. return
  292. }
  293. }
  294. })
  295. }
  296. // 分享
  297. const handleClickShare = () => {
  298. uni.showToast({ title: '正在努力建设中 . . .', icon: 'none', duration: 2000, })
  299. }
  300. </script>
  301. <style scoped lang="scss">
  302. .mb5 { margin-bottom: 5px; }
  303. .my5 { margin: 5px 0; }
  304. .my10 { margin: 10px 0; }
  305. .mt10 { margin-top: 10px; }
  306. .fs14 { font-size: 14px; }
  307. .fs15 { font-size: 15px; }
  308. .box {
  309. padding: 10px 30rpx 100px;
  310. }
  311. .JobName {
  312. color: #37576c;
  313. font-size: 24px;
  314. margin-right: 30px;
  315. margin-top: 1px;
  316. vertical-align: middle;
  317. flex: 1;
  318. }
  319. .tagList {
  320. width: 100%;
  321. display: flex;
  322. flex-wrap: wrap;
  323. .tagListItem {
  324. margin: 10rpx 10rpx 10rpx 0;
  325. }
  326. }
  327. .topLine {
  328. border-top: 1px solid #EDEDED;
  329. // border-bottom: 1px solid #EDEDED;
  330. padding-top: 10px;
  331. }
  332. .tag {
  333. padding: 5px 10px;
  334. background-color: #e2f0ef;
  335. color: #00897B;
  336. border-radius: 5px;
  337. font-size: 14px;
  338. margin-right: 8px;
  339. margin-top: 4px;
  340. }
  341. .hirePrice {
  342. padding: 5px 10px;
  343. background-color: #fc6d5e63;
  344. color: #ff250e;
  345. border-radius: 5px;
  346. font-size: 14px;
  347. margin-left: 8px;
  348. margin-top: 4px;
  349. }
  350. .htmlCss {
  351. white-space: pre-wrap;
  352. word-break: break-all;
  353. line-height: 28px;
  354. color: var(--color-333);
  355. font-size: 15px;
  356. text-align: justify;
  357. letter-spacing: 0;
  358. }
  359. //底部按钮公用定位
  360. .bottom-sticky{
  361. display: flex;
  362. width:100vw;
  363. position: fixed;
  364. bottom:0;
  365. left: 0;
  366. background-image:linear-gradient(rgba(255,255,255,1),white);
  367. }
  368. .buttons{
  369. width: 60vw;
  370. height: 44px;
  371. border-radius: 25px;
  372. margin: 0;
  373. color: #fff !important;
  374. background-color: #00897b !important;
  375. }
  376. .disable { background-color: #00897bbe !important; color: #ffffffec !important;}
  377. .noMore{
  378. margin: 20px 0;
  379. }
  380. .date-time{
  381. color:#d9d0d2;
  382. float: right;
  383. }
  384. .viewided-line {
  385. width: 100%;
  386. height: 1px;
  387. background-color: #f0f2f7;
  388. margin: 20px 0;
  389. }
  390. .avatarBox{
  391. max-width: 40px;
  392. max-height: 40px;
  393. margin: 0 10px;
  394. }
  395. .avatar{
  396. width: 40px;
  397. height: 40px;
  398. }
  399. .sub-li-bottom {
  400. display: flex;
  401. justify-content:space-between;
  402. align-items: center;
  403. background: linear-gradient(90deg, #f5fcfc 0, #fcfbfa 100%);
  404. font-size: 13px;
  405. padding: 5px 30rpx;
  406. }
  407. .salary {
  408. color: #fe574a;
  409. line-height: 41px;
  410. font-weight: 600;
  411. height: auto;
  412. display: inline-block;
  413. vertical-align: sub;
  414. }
  415. .list-shape {
  416. padding: 10px 30rpx 10px;
  417. margin-top: 10px;
  418. background-color: #fff;
  419. .titleBox {
  420. display: flex;
  421. align-items: center;
  422. justify-content: space-between;
  423. }
  424. }
  425. .viewider-mx{
  426. margin: 0 10rpx;
  427. }
  428. .viewider {
  429. color:#e4d4d2;
  430. }
  431. //公司名称
  432. .cer-end{
  433. position: absolute;
  434. top: 85%;
  435. right: 16%;
  436. }
  437. .cer-text{
  438. text-decoration: underline;
  439. margin: 0 5rpx;
  440. }
  441. //一行展示不全...
  442. .dis{
  443. display: flex;
  444. align-items: center;
  445. }
  446. .showPopup-more{
  447. width: 26vw;
  448. white-space: nowrap;
  449. overflow: hidden;
  450. text-overflow: ellipsis;
  451. }
  452. /* 列表触底暂无更多 */
  453. .noMore{ text-align:center; color:grey; }
  454. .mt { margin-top: 10rpx; }
  455. .mb { margin-bottom: 10rpx; }
  456. .ml { margin-left: 20rpx; }
  457. .mr { margin-right: 20rpx; }
  458. .mr-10{ margin-right: 10rpx; }
  459. .my-5{ margin: 5px 0; }
  460. // 选择简历
  461. .dialogBox {
  462. .dialog-title {
  463. display: flex;
  464. justify-content: space-between;
  465. align-items: center;
  466. color:#767a82;
  467. padding: 20rpx;
  468. .title {
  469. font-weight: bold;
  470. margin-left: 10rpx;
  471. }
  472. }
  473. .dialog-content{
  474. padding: 20rpx;
  475. padding-bottom: 50rpx;
  476. .selected {
  477. background-color: #00897b !important;
  478. }
  479. }
  480. .selectOnline {
  481. font-size: 14px;
  482. color: #00897b;
  483. text-align: center;
  484. margin-top: 10rpx;
  485. }
  486. .dialog-bottom{
  487. width: 100%;
  488. height: 44px;
  489. line-height: 44px;
  490. text-align: center;
  491. color: #fff !important;
  492. background-color: #00897b !important;
  493. }
  494. }
  495. </style>