index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. <!-- 职位分享 -->
  145. <uni-popup ref="sharePopup" type="share">
  146. <uni-popup-share title="分享到" @select="handleSelect"></uni-popup-share>
  147. </uni-popup>
  148. </layout-page>
  149. </template>
  150. <script setup>
  151. import { commissionCalculation } from '@/utils/position'
  152. import { timesTampChange } from '@/utils/date'
  153. import { preview } from '@/utils/preview'
  154. import { uploadFile } from '@/api/file'
  155. import layoutPage from '@/layout'
  156. import { ref } from 'vue';
  157. import {
  158. jobCvRelSend,
  159. getPositionDetails,
  160. jobCvRelCheckSend,
  161. getPersonJobUnfavorite, // 取消收藏
  162. getPersonJobFavorite, // 收藏
  163. getJobFavoriteCheck
  164. } from '@/api/position'
  165. import { getPersonResumeCv, saveResume } from '@/api/user'
  166. import { dealDictObjData } from '@/utils/position'
  167. import { getAccessToken } from '@/utils/request'
  168. import { onLoad } from '@dcloudio/uni-app';
  169. const sharePopup = ref()
  170. const loading = ref(false)
  171. const loadingText = ref('加载中 . . . ')
  172. // 职位详情
  173. const info = ref({})
  174. const positionInfo = ref({})
  175. const getPositionDetail = async () => {
  176. try {
  177. loading.value = true
  178. const { data } = await getPositionDetails({ id: jobId })
  179. info.value = data
  180. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value }
  181. loading.value = false
  182. console.log('positionInfo', positionInfo.value)
  183. } finally {
  184. }
  185. }
  186. let jobId = ''
  187. onLoad((options) => {
  188. jobId = options?.id || ''
  189. if (jobId) {
  190. loading.value = true
  191. loadingText.value = '加载中 . . . '
  192. deliveryCheck()
  193. getCollectionStatus()
  194. getPositionDetail()
  195. } else {
  196. loadingText.value = '加载失败 . . . '
  197. }
  198. })
  199. // 效验是否有投递过简历
  200. const delivery = ref(false) // 是否已投递简历
  201. const deliveryCheck = async () => {
  202. try {
  203. if (!getAccessToken()) return delivery.value = false
  204. const { data } = await jobCvRelCheckSend({ jobId })
  205. delivery.value = Boolean(data)
  206. } finally {
  207. }
  208. }
  209. import { showAuthModal } from '@/hooks/useModal'
  210. const popup = ref()
  211. const uploadPopup = ref()
  212. const resumeList = ref([])
  213. const selectIndex = ref(null)
  214. const handleDelivery = async () => {
  215. // 未登录
  216. if (!getAccessToken()) {
  217. uni.showToast({
  218. title:'请先登录',
  219. icon: 'none'
  220. })
  221. showAuthModal()
  222. return
  223. }
  224. // 已投递
  225. if (delivery.value) {
  226. uni.showToast({ title: '您已投递过该职位!', icon: 'none', duration: 2000, })
  227. return
  228. }
  229. const { data } = await getPersonResumeCv()
  230. resumeList.value = data
  231. // 未上传简历
  232. if (!resumeList.value?.length) return uploadPopup.value.open()
  233. popup.value.open()
  234. }
  235. const deliverySubmit = async (uploadFile) => {
  236. const resume = uploadFile ? uploadFile : resumeList.value[selectIndex.value]
  237. if (!resume) {
  238. selectIndex.value = null
  239. uni.showToast({ title: '请选择简历', icon: 'none', duration: 2000, })
  240. return
  241. }
  242. await jobCvRelSend({ jobId, title: resume.title, url: resume.url, type: info.value.hire ? 1 : 0 })
  243. uni.showToast({ title: '投递成功', icon: 'none', duration: 2000, })
  244. deliveryCheck()
  245. popup.value.close()
  246. }
  247. const popupClose = () => {
  248. selectIndex.value = null
  249. popup.value.close()
  250. }
  251. // 效验求职者是否有收藏该职位
  252. const isCollection = ref(false)
  253. const getCollectionStatus = async () => {
  254. if (!getAccessToken()) return isCollection.value = false
  255. const { data } = await getJobFavoriteCheck({ jobId })
  256. isCollection.value = Boolean(data)
  257. }
  258. // 操作 收藏&取消收藏职位
  259. const handleCollection = async () => {
  260. const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
  261. await api(isCollection.value ? jobId : { jobId })
  262. await getCollectionStatus()
  263. }
  264. // 选取微信聊天文件
  265. // 上传附件
  266. const handleUpload = () => {
  267. wx.chooseMessageFile({
  268. count: 1,
  269. type: 'file',
  270. success (res) {
  271. const title = res.tempFiles[0].name
  272. const path = res.tempFiles[0].path
  273. //效验是否为支持的文件格式
  274. if(/\.(pdf|docx|doc)$/.test(title)){
  275. uploadFile(path).then(async (res) => {
  276. if (!res.data) {
  277. uni.showToast({
  278. title: '上传失败',
  279. icon: 'none'
  280. })
  281. return
  282. }
  283. await saveResume({ title, url: res.data })
  284. uni.showToast({
  285. title: '上传成功',
  286. icon: 'success'
  287. })
  288. deliverySubmit({ title, url: res.data })
  289. })
  290. }else{
  291. uni.showToast({
  292. icon: 'none',
  293. title: '请上传pdf、word类型的文件',
  294. duration: 2000
  295. })
  296. return
  297. }
  298. }
  299. })
  300. }
  301. // 分享
  302. const handleClickShare = () => {
  303. sharePopup.value.open()
  304. }
  305. const handleSelect = (e) => {
  306. console.log(e, 'share')
  307. uni.showToast({ title: '正在努力建设中 . . .', icon: 'none', duration: 2000, })
  308. }
  309. </script>
  310. <style scoped lang="scss">
  311. @import '../../static/style/position/index.scss';
  312. </style>