index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <view>
  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. <uni-icons class="icon-a-1_zhaopin" custom-prefix="iconfont" color="#e03506"/>
  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="null" 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. </view>
  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 { ref } from 'vue';
  152. import {
  153. jobCvRelSend,
  154. getPositionDetails,
  155. jobCvRelCheckSend,
  156. getPersonJobUnfavorite, // 取消收藏
  157. getPersonJobFavorite, // 收藏
  158. getJobFavoriteCheck
  159. } from '@/api/position'
  160. import { getPersonResumeCv, saveResume } from '@/api/user'
  161. import { dealDictObjData } from '@/utils/position'
  162. import { getAccessToken } from '@/utils/request'
  163. import { onLoad } from '@dcloudio/uni-app';
  164. const loading = ref(false)
  165. const loadingText = ref('加载中 . . . ')
  166. // 职位详情
  167. const info = ref({})
  168. const positionInfo = ref({})
  169. const getPositionDetail = async () => {
  170. try {
  171. loading.value = true
  172. const { data } = await getPositionDetails({ id: jobId })
  173. info.value = data
  174. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value }
  175. loading.value = false
  176. console.log('positionInfo', positionInfo.value)
  177. } finally {
  178. }
  179. }
  180. let jobId = ''
  181. onLoad((options) => {
  182. jobId = options?.id || ''
  183. if (jobId) {
  184. loading.value = true
  185. loadingText.value = '加载中 . . . '
  186. deliveryCheck()
  187. getCollectionStatus()
  188. getPositionDetail()
  189. } else {
  190. loadingText.value = '加载失败 . . . '
  191. }
  192. })
  193. // 效验是否有投递过简历
  194. const delivery = ref(false) // 是否已投递简历
  195. const deliveryCheck = async () => {
  196. try {
  197. if (!getAccessToken()) return delivery.value = false
  198. const { data } = await jobCvRelCheckSend({ jobId })
  199. delivery.value = Boolean(data)
  200. } finally {
  201. }
  202. }
  203. const popup = ref()
  204. const uploadPopup = ref()
  205. const resumeList = ref([])
  206. const selectIndex = ref(null)
  207. const handleDelivery = async () => {
  208. // 未登录
  209. if (!getAccessToken()) {
  210. uni.showToast({ title: '您还未上传过简历,请先上传简历', icon: 'none', duration: 2000, })
  211. return
  212. }
  213. // 已投递
  214. if (delivery.value) {
  215. uni.showToast({ title: '您已投递过该职位!', icon: 'none', duration: 2000, })
  216. return
  217. }
  218. const { data } = await getPersonResumeCv()
  219. resumeList.value = data
  220. // 未上传简历
  221. if (!resumeList.value?.length) return uploadPopup.value.open()
  222. popup.value.open()
  223. }
  224. const deliverySubmit = async (uploadFile) => {
  225. const resume = uploadFile ? uploadFile : resumeList.value[selectIndex.value]
  226. if (!resume) {
  227. selectIndex.value = null
  228. uni.showToast({ title: '请选择简历', icon: 'none', duration: 2000, })
  229. return
  230. }
  231. await jobCvRelSend({ jobId, title: resume.title, url: resume.url, type: info.value.hire ? 1 : 0 })
  232. uni.showToast({ title: '投递成功', icon: 'none', duration: 2000, })
  233. deliveryCheck()
  234. popup.value.close()
  235. }
  236. const popupClose = () => {
  237. selectIndex.value = null
  238. popup.value.close()
  239. }
  240. // 效验求职者是否有收藏该职位
  241. const isCollection = ref(false)
  242. const getCollectionStatus = async () => {
  243. if (!getAccessToken()) return isCollection.value = false
  244. const { data } = await getJobFavoriteCheck({ jobId })
  245. isCollection.value = Boolean(data)
  246. }
  247. // 操作 收藏&取消收藏职位
  248. const handleCollection = async () => {
  249. const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
  250. await api(isCollection.value ? jobId : { jobId })
  251. await getCollectionStatus()
  252. }
  253. // 选取微信聊天文件
  254. // 上传附件
  255. const handleUpload = () => {
  256. wx.chooseMessageFile({
  257. count: 1,
  258. type: 'file',
  259. success (res) {
  260. const title = res.tempFiles[0].name
  261. const path = res.tempFiles[0].path
  262. //效验是否为支持的文件格式
  263. if(/\.(pdf|docx|doc)$/.test(title)){
  264. uploadFileTest(path).then(async (res) => {
  265. if (!res.data) {
  266. uni.showToast({
  267. title: '上传失败',
  268. icon: 'none'
  269. })
  270. return
  271. }
  272. await saveResume({ title, url: res.data })
  273. uni.showToast({
  274. title: '上传成功',
  275. icon: 'success'
  276. })
  277. deliverySubmit({ title, url: res.data })
  278. })
  279. }else{
  280. uni.showToast({
  281. icon: 'none',
  282. title: '请上传pdf、word类型的文件',
  283. duration: 2000
  284. })
  285. return
  286. }
  287. }
  288. })
  289. }
  290. </script>
  291. <style scoped lang="scss">
  292. .mb5 { margin-bottom: 5px; }
  293. .my5 { margin: 5px 0; }
  294. .my10 { margin: 10px 0; }
  295. .mt10 { margin-top: 10px; }
  296. .fs14 { font-size: 14px; }
  297. .fs15 { font-size: 15px; }
  298. .box {
  299. padding: 10px 30rpx 100px;
  300. }
  301. .JobName {
  302. color: #37576c;
  303. font-size: 24px;
  304. margin-right: 30px;
  305. margin-top: 1px;
  306. vertical-align: middle;
  307. flex: 1;
  308. }
  309. .tagList {
  310. width: 100%;
  311. display: flex;
  312. flex-wrap: wrap;
  313. .tagListItem {
  314. margin: 10rpx 10rpx 10rpx 0;
  315. }
  316. }
  317. .topLine {
  318. border-top: 1px solid #EDEDED;
  319. // border-bottom: 1px solid #EDEDED;
  320. padding-top: 10px;
  321. }
  322. .tag {
  323. padding: 5px 10px;
  324. background-color: #e2f0ef;
  325. color: #00897B;
  326. border-radius: 5px;
  327. font-size: 14px;
  328. margin-right: 8px;
  329. margin-top: 4px;
  330. }
  331. .hirePrice {
  332. padding: 5px 10px;
  333. background-color: #fc6d5e63;
  334. color: #ff250e;
  335. border-radius: 5px;
  336. font-size: 14px;
  337. margin-left: 8px;
  338. margin-top: 4px;
  339. }
  340. .htmlCss {
  341. white-space: pre-wrap;
  342. word-break: break-all;
  343. line-height: 28px;
  344. color: var(--color-333);
  345. font-size: 15px;
  346. text-align: justify;
  347. letter-spacing: 0;
  348. }
  349. //底部按钮公用定位
  350. .bottom-sticky{
  351. display: flex;
  352. width:100vw;
  353. position: fixed;
  354. bottom:0;
  355. left: 0;
  356. background-image:linear-gradient(rgba(255,255,255,1),white);
  357. }
  358. .buttons{
  359. width: 60vw;
  360. height: 44px;
  361. border-radius: 25px;
  362. margin: 0;
  363. color: #fff !important;
  364. background-color: #00897b !important;
  365. }
  366. .disable { background-color: #00897bbe !important; color: #ffffffec !important;}
  367. .noMore{
  368. margin: 20px 0;
  369. }
  370. .date-time{
  371. color:#d9d0d2;
  372. float: right;
  373. }
  374. .viewided-line {
  375. width: 100%;
  376. height: 1px;
  377. background-color: #f0f2f7;
  378. margin: 20px 0;
  379. }
  380. .avatarBox{
  381. max-width: 40px;
  382. max-height: 40px;
  383. margin: 0 10px;
  384. }
  385. .avatar{
  386. width: 40px;
  387. height: 40px;
  388. }
  389. .sub-li-bottom {
  390. display: flex;
  391. justify-content:space-between;
  392. align-items: center;
  393. background: linear-gradient(90deg, #f5fcfc 0, #fcfbfa 100%);
  394. font-size: 13px;
  395. padding: 5px 30rpx;
  396. }
  397. .salary {
  398. color: #fe574a;
  399. line-height: 41px;
  400. font-weight: 600;
  401. height: auto;
  402. display: inline-block;
  403. vertical-align: sub;
  404. }
  405. .list-shape {
  406. padding: 10px 30rpx 10px;
  407. margin-top: 10px;
  408. background-color: #fff;
  409. .titleBox {
  410. display: flex;
  411. align-items: center;
  412. justify-content: space-between;
  413. }
  414. }
  415. .viewider-mx{
  416. margin: 0 10rpx;
  417. }
  418. .viewider {
  419. color:#e4d4d2;
  420. }
  421. //公司名称
  422. .cer-end{
  423. position: absolute;
  424. top: 85%;
  425. right: 16%;
  426. }
  427. .cer-text{
  428. text-decoration: underline;
  429. margin: 0 5rpx;
  430. }
  431. //一行展示不全...
  432. .dis{
  433. display: flex;
  434. align-items: center;
  435. }
  436. .showPopup-more{
  437. width: 26vw;
  438. white-space: nowrap;
  439. overflow: hidden;
  440. text-overflow: ellipsis;
  441. }
  442. /* 列表触底暂无更多 */
  443. .noMore{ text-align:center; color:grey; }
  444. .mt { margin-top: 10rpx; }
  445. .mb { margin-bottom: 10rpx; }
  446. .ml { margin-left: 20rpx; }
  447. .mr { margin-right: 20rpx; }
  448. .mr-10{ margin-right: 10rpx; }
  449. .my-5{ margin: 5px 0; }
  450. // 选择简历
  451. .dialogBox {
  452. .dialog-title {
  453. display: flex;
  454. justify-content: space-between;
  455. align-items: center;
  456. color:#767a82;
  457. padding: 20rpx;
  458. .title {
  459. font-weight: bold;
  460. margin-left: 10rpx;
  461. }
  462. }
  463. .dialog-content{
  464. padding: 20rpx;
  465. padding-bottom: 50rpx;
  466. .selected {
  467. background-color: #00897b !important;
  468. }
  469. }
  470. .selectOnline {
  471. font-size: 14px;
  472. color: #00897b;
  473. text-align: center;
  474. margin-top: 10rpx;
  475. }
  476. .dialog-bottom{
  477. width: 100%;
  478. height: 44px;
  479. line-height: 44px;
  480. text-align: center;
  481. color: #fff !important;
  482. background-color: #00897b !important;
  483. }
  484. }
  485. </style>