index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  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. <view class="mt-5" style="display: flex; align-items: center;">
  8. <!-- 赏金 -->
  9. <view v-if="info.hire && info.hirePrice" class="hirePrice ss-m-r-10 d-flex align-center">
  10. <view class="iconfont icon-a-1_zhaopin ss-m-r-10" style="color: #e03506; font-size: 20px;"></view>
  11. <view>{{ `赏金:${commissionCalculation(info.hirePrice / 100, 1)}元` }}</view>
  12. </view>
  13. <image v-if="isJobFair" src="/static/svg/jobFair.svg" class="ss-m-r-10" style="width: 22px; height: 22px;"></image>
  14. <!-- 职位名称 -->
  15. <h2 class="JobName" style="flex: 1;">{{ formatName(info.name) }}</h2>
  16. </view>
  17. <!-- 职位地区 -->
  18. <view class="d-flex justify-space-between mt-5 align-center">
  19. <view style="font-size: 14px; flex: 1; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; margin-right: 30px;">
  20. <span>
  21. <span>{{positionInfo?.area?.str ?? '全国' }}</span>
  22. <span class="viewider-mx" v-if="positionInfo?.eduName">|</span>
  23. <span>{{positionInfo?.eduName }}</span>
  24. <span class="viewider-mx" v-if="positionInfo?.expName">|</span>
  25. <span>{{positionInfo?.expName }}</span>
  26. </span>
  27. </view>
  28. </view>
  29. <view class="d-flex justify-space-between mt-5 align-center">
  30. <!-- 收藏职位 -->
  31. <view @click="handleCollection" style="width: 36px;">
  32. <uni-icons
  33. :type="isCollection ? 'heart-filled' : 'heart'"
  34. color="#fc6d5e"
  35. class="mr"
  36. size="25"
  37. ></uni-icons>
  38. </view>
  39. <!-- 薪资 -->
  40. <view>
  41. <span v-if="!info.payFrom && !info.payTo" class="salary w-600">面议</span>
  42. <span v-else class="salary w-600">{{ info.payFrom }}-{{ info.payTo }}/{{ positionInfo.payName }}</span>
  43. </view>
  44. </view>
  45. <view class="font-size-13 color-999 ss-m-t-10" style="text-align: end;">更新时间:{{ timesTampChange(info.updateTime, 'Y-M-D h:m') }}</view>
  46. <!-- 标签 -->
  47. <view class="tagList mt">
  48. <view class="tag" v-for="(tag,i) in info?.tagList || []" :key="'tagList' + i">
  49. {{ tag }}
  50. </view>
  51. </view>
  52. <!-- 企业信息 -->
  53. <view class="topLine mt-5 d-flex" @click="jumpToEnterpriseDetail(info.enterprise.id)">
  54. <view class="avatarBox">
  55. <image style="width: 40px; height: 40px;" :src="info.enterprise?.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
  56. </view>
  57. <view >
  58. <view class="contact-name">{{ info.contact?.name }}</view>
  59. <view class="contact-info">{{ formatName(info.enterprise?.anotherName || info.enterprise?.name) }} {{ info.contact?.postNameCn ? '· ' + info.contact?.postNameCn : '' }}</view>
  60. </view>
  61. </view>
  62. <!-- 岗位职责 -->
  63. <view class="topLine fs14 mt-5">
  64. <view class="fs15 w-600 my5">岗位职责</view>
  65. <view v-if="!info.content"></view>
  66. <rich-text v-else class="htmlCss" :nodes="cleanedHtml(info.content)"></rich-text>
  67. </view>
  68. <!-- 岗位要求 -->
  69. <view class="topLine mt-5">
  70. <view class="fs15 w-600 my5">岗位要求</view>
  71. <view v-if="!info.requirement"></view>
  72. <rich-text v-else class="htmlCss" :nodes="cleanedHtml(info.requirement)"></rich-text>
  73. </view>
  74. <!-- 工作地址 -->
  75. <view class="topLine mt-5">
  76. <view class="fs15 w-600 my5">工作地址</view>
  77. <view class="my10">
  78. <uni-icons
  79. type="map-pin-ellipse"
  80. color="#00897B"
  81. class="mr"
  82. size="25"
  83. ></uni-icons>
  84. <span style="color: var(--color-666);font-size: 15px;line-height: 26px;">{{ info.address || '' }}</span>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </scroll-view>
  90. <!-- 分享 投递 -->
  91. <view class="bottom-sticky" v-if="!loading && jobId && info.status === '0'">
  92. <view class="bottom-content">
  93. <!-- 已登录可以分享 -->
  94. <button v-if="beenLogin" class="bottom-content-tool shareButtonCss" open-type="share">
  95. <uni-icons type="redo-filled" size="24" color="#00897B" style="line-height: 24px;"/>
  96. <span style="color:#00897B;font-weight:bold;line-height: 22px;">分享</span>
  97. </button>
  98. <!-- 未登录点击分享拉起登录 -->
  99. <view v-else @click="handleClickShare" class="bottom-content-tool">
  100. <uni-icons type="redo-filled" size="24" color="#00897B"/>
  101. <span style="color:#00897B;font-weight:bold;">分享</span>
  102. </view>
  103. <button class="btnStyle bgButtons" type="primary" plain="true" @tap="handleSend">立即沟通</button>
  104. <button v-if="delivery" :disabled="true" class="buttons btnStyle disable">我已投递</button>
  105. <button v-else class="buttons btnStyle" type="primary" @click="handleDelivery">我要投递</button>
  106. </view>
  107. </view>
  108. <uni-popup
  109. ref="poster"
  110. type="center"
  111. class="f-straight"
  112. style="position: relative;"
  113. >
  114. <canvas
  115. :style="{
  116. width:`${appInfo.windowWidth}px;`,
  117. height:`${appInfo.windowHeight}px;margin-left:-9999px; margin-top:-99.5vh;`
  118. }" canvas-id="firstCanvas" id="firstCanvas"></canvas>
  119. <image
  120. :style="{ width:`${appInfo.windowWidth}px;`, height:`${appInfo.windowHeight*.9}px;`}"
  121. :src="imgSrc"
  122. mode="aspectFit"
  123. />
  124. <!-- <uni-icons v-if="!!imgSrc" type="clear" size="35" color="#FFF" style="position: absolute;top: 10px;right: 28px;" @click="posterClose"></uni-icons> -->
  125. </uni-popup>
  126. <!-- 选择简历 -->
  127. <uni-popup ref="popup" background-color="#fff" :mask-click="false" >
  128. <view class="dialogBox" style="width: 86vw;">
  129. <view class="dialog-title">
  130. <view class="title">选择简历</view>
  131. <uni-icons type="close" color="grey" size="26" @click="popupClose" />
  132. </view>
  133. <view style="height: 1px; margin: 0 20rpx; background-color: #dedede;"></view>
  134. <scroll-view class="dialog-content" scroll-y="true" style="max-height: 50vh; width: auto;">
  135. <uni-card
  136. v-for="(item, index) in resumeList"
  137. :key="index"
  138. shadow="0px 0px 3px 1px rgba(0,0,0,0.1)"
  139. :is-shadow="true"
  140. :border='false'
  141. background-color="red"
  142. :class="{'selected': selectIndex === index}"
  143. @click="selectIndex = index"
  144. >
  145. <view class="d-flex align-center">
  146. <view style="flex: 1;">
  147. <view style="font-weight: bold;">
  148. <uni-icons v-if="selectIndex === index" color="green" type="checkmarkempty" size="18"></uni-icons>
  149. {{ item.title }}
  150. </view>
  151. <view>上传时间:{{ timesTampChange(item.createTime, 'Y-M-D') }}</view>
  152. </view>
  153. <view class="ss-m-l-30" style="width: 60rpx;">
  154. <uni-icons @click="preview(item.url)" type="eye" size="24"></uni-icons>
  155. </view>
  156. </view>
  157. </uni-card>
  158. <view class="selectOnline" @click="handleUpload">选取微信聊天文件</view>
  159. </scroll-view>
  160. <view class="dialog-bottom" @click="deliverySubmit()">确认投递</view>
  161. </view>
  162. </uni-popup>
  163. <!-- 上传简历 -->
  164. <uni-popup ref="uploadPopup" type="dialog">
  165. <uni-popup-dialog
  166. type="warn"
  167. cancelText="取消"
  168. confirmText="确定"
  169. title="系统提示"
  170. content="您还未上传过简历,是否选取微信聊天文件投递?"
  171. @confirm="handleUpload"
  172. @close="uploadPopup.close()"
  173. ></uni-popup-dialog>
  174. </uni-popup>
  175. <!-- 职位分享 -->
  176. <uni-popup ref="sharePopup" type="share">
  177. <uni-popup-share title="分享到">
  178. <view class="share-pop">
  179. <button class="f-straight" open-type="share">
  180. <view class="share-round share-round-1" >
  181. <uni-icons type="weixin" color="#FFF" size="30" />
  182. </view>
  183. <view style="font-size:12px;">微信</view>
  184. </button>
  185. </view>
  186. </uni-popup-share>
  187. </uni-popup>
  188. <!-- 当前是赏金职位时,询问是否登录,不登录则没有赏金 -->
  189. <uni-popup ref="loginPopup" type="dialog">
  190. <uni-popup-dialog
  191. type="warn"
  192. cancelText="取消"
  193. confirmText="登录"
  194. title="系统提示"
  195. content="当前为赏金职位,不登录进行分享将无法获得赏金,是否登录?"
  196. @confirm="handleLoginConfirm"
  197. @close="handleLoginClose" />
  198. </uni-popup>
  199. <view class="hideCanvasView">
  200. <canvas class="shareCanvas" canvas-id="shareCanvas" style="width: 452px; height: 362px;"></canvas>
  201. </view>
  202. </layout-page>
  203. </template>
  204. <script setup>
  205. import { commissionCalculation, jumpToEnterpriseDetail } from '@/utils/position'
  206. import { timesTampChange } from '@/utils/date'
  207. import { preview } from '@/utils/preview'
  208. import { uploadFile } from '@/api/file'
  209. import layoutPage from '@/layout'
  210. import { ref, watch } from 'vue';
  211. import {
  212. jobCvRelSend,
  213. getPositionDetails,
  214. jobCvRelCheckSend,
  215. jobFairCvRelCheckSend,
  216. getPersonJobUnfavorite, // 取消收藏
  217. getPersonJobFavorite, // 收藏
  218. getJobFavoriteCheck,
  219. jobCvRelHireSend,
  220. getShareDetail
  221. } from '@/api/position'
  222. import { getPersonResumeCv, saveResume } from '@/api/user'
  223. import { dealDictObjData } from '@/utils/position'
  224. import { getAccessToken, showNecessaryInfoPopup } from '@/utils/request'
  225. import { onLoad, onShareAppMessage } from '@dcloudio/uni-app'
  226. import { prologue, defaultText } from '@/hooks/useIM'
  227. import { userStore } from '@/store/user'
  228. import { getSubscribeTemplateList } from '@/api/common'
  229. import { formatName } from '@/utils/getText'
  230. const useUserStore = userStore()
  231. const sharePopup = ref()
  232. const loading = ref(false)
  233. const loadingText = ref('加载中 . . . ')
  234. // 职位详情
  235. const info = ref({})
  236. const positionInfo = ref({})
  237. const isEmployment = ref(null)
  238. const imgSrc = ref('')
  239. const appInfo = ref({})
  240. const poster = ref()
  241. const beenLogin = ref(false)
  242. const areaName = ref('')
  243. const canvasToTempFilePath = ref('')
  244. // 监听登录状态
  245. watch(() => useUserStore.refreshToken, (newVal) => {
  246. beenLogin.value = Boolean(newVal)
  247. }, { immediate: true }, { deep: true })
  248. let jobId = ''
  249. let jobFairId = ''
  250. const isJobFair = ref(false) // 是否是通过招聘会进入的岗位
  251. let obj = {}
  252. onLoad(async (options) => {
  253. console.log(options, 'options')
  254. areaName.value = options?.area || ''
  255. // 网站二维码分享
  256. if (options.scene) {
  257. const scene = decodeURIComponent(options.scene)
  258. const str = scene.split('=')
  259. const res = await getShareDetail({ id: str[1] })
  260. obj = res.data
  261. }
  262. // 是否众聘
  263. isEmployment.value = options?.sharedById || obj?.sharedById
  264. jobId = options?.id || options?.jobId || obj?.jobId || ''
  265. jobFairId = options?.jobFairId !== 'undefined' && options.jobFairId !== 'null' && options.jobFairId || obj?.jobFairId || ''
  266. // console.log(`${jobFairId?'是':'不是'}招聘会职位`, ',jobFairId:', jobFairId)
  267. isJobFair.value = Boolean(jobFairId)
  268. deliveryCheck()
  269. if (jobId) {
  270. loading.value = true
  271. loadingText.value = '加载中 . . . '
  272. getCollectionStatus()
  273. getPositionDetail()
  274. } else {
  275. loadingText.value = '加载失败 . . . '
  276. }
  277. })
  278. // onShow(() => {
  279. // if (!jobId) {
  280. // return
  281. // }
  282. // })
  283. const getImageTempRatio = (url) => {
  284. return new Promise((req, rej)=>{
  285. wx.getImageInfo({
  286. src:url,
  287. success:(res) =>{
  288. req(res)
  289. }
  290. })
  291. })
  292. }
  293. /**
  294. ctx: 画布的上下文环境
  295. fontSize: 文字大小
  296. text: 绘制文本
  297. maxWidth: 一行文字最大宽度
  298. x:文本在x轴显示的位置
  299. y:文本在y轴显示的位置
  300. maxLine:最多绘制的行数
  301. **/
  302. //处理文字多出省略号显示
  303. const enterpriseNameLines = ref(0)
  304. const dealWords = (ctx, fontSize, text, maxWidth, x, y, maxLine, isEnterpriseName) => {
  305. ctx.setFontSize(fontSize);//设置字体大小
  306. var allRow = Math.ceil(ctx.measureText(text).width / maxWidth);//实际总共能分多少行
  307. enterpriseNameLines.value = allRow
  308. var count = allRow >= maxLine ? maxLine : allRow;//实际能分多少行与设置的最大显示行数比,谁小就用谁做循环次数
  309. var endPos = 0;//当前字符串的截断点
  310. for (var j = 0; j < count; j++) {
  311. var nowStr = text.slice(endPos);//当前剩余的字符串
  312. var rowWid = 0;//每一行当前宽度
  313. if (ctx.measureText(nowStr).width > maxWidth) {//如果当前的字符串宽度大于最大宽度,然后开始截取
  314. for (var m = 0; m < nowStr.length; m++) {
  315. rowWid += ctx.measureText(nowStr[m]).width;//当前字符串总宽度
  316. if (rowWid > maxWidth) {
  317. if (j === maxLine - 1) { //如果是最后一行
  318. ctx.fillText(nowStr.slice(0, m - 1) + '...', x, y + (j + 1) * 30); //(j+1)*18这是每一行的高度
  319. } else {
  320. ctx.fillText(nowStr.slice(0, m), x, y + (j + 1) * 30);
  321. }
  322. endPos += m;//下次截断点
  323. break;
  324. }
  325. }
  326. } else {
  327. //如果当前的字符串宽度小于最大宽度就直接输出
  328. ctx.fillText(nowStr.slice(0), x, (isEnterpriseName ? y + 2 : y) + (j + 1) * 30);
  329. }
  330. }
  331. }
  332. // 职位分享图片绘制
  333. const createPoster = async () => {
  334. var context = uni.createCanvasContext('shareCanvas')
  335. //清空画布
  336. context.clearRect(0, 0, 452, 362);
  337. //背景图片
  338. context.drawImage('../../static/img/share-cover-border.jpg', 0, 0, 452, 362);
  339. // 岗位名称
  340. context.setFillStyle('#333333')
  341. dealWords(context, 25, formatName(positionInfo.value?.name), 350, 40, 30, 2)
  342. // 工作地区、工作经验、学历要求
  343. context.setFillStyle('#6c6e7b')
  344. const area = areaName.value + ' | '
  345. const combinationText = area + (positionInfo.value.expName || '') + (positionInfo.value.eduName ? ' | ' + positionInfo.value.eduName : '')
  346. dealWords(context, 20, combinationText, 350, 40, 100, 1) // 上下文、字号、文本、最大宽度、x、y、行数
  347. // 薪资
  348. context.setFontSize(22)
  349. context.setFillStyle('#f67272')
  350. const { payFrom, payTo, payName } = positionInfo.value
  351. const salary = payFrom && payTo ? payFrom + '-' + payTo + (payName ? '元/'+ payName : '') : '面议'
  352. context.fillText(salary, 40, 170)
  353. // 间隔线
  354. context.setLineDash([2, 4], 1)
  355. context.beginPath()
  356. context.moveTo(40, 195)
  357. context.lineTo(412, 195)
  358. context.setStrokeStyle('#00897B')
  359. context.stroke()
  360. // 企业头像
  361. const { logoUrl, anotherName, industryName, scaleName, name } = positionInfo.value.enterprise
  362. const {path : headImg} = await getImageTempRatio(logoUrl ? logoUrl : 'https://minio.citupro.com/dev/menduner/company-avatar.png')
  363. context.drawImage(headImg, 40, 220, 90, 90)
  364. // 企业名称
  365. context.setFillStyle('#000000')
  366. dealWords(context, 25, formatName(anotherName || name), 250, 150, 210, 2, true)
  367. // 企业行业类型、规模
  368. context.setFontSize(20)
  369. let industry = industryName && industryName.length > 6 ? `${industryName.slice(0, 7)}...` : industryName
  370. context.setFillStyle('#6c6e7b')
  371. context.fillText(`${industry || ''}${scaleName ? ' | ' + scaleName : ''}`, 150, enterpriseNameLines.value === 1 ? 280 : 310)
  372. context.draw(false, () =>{
  373. wx.canvasToTempFilePath({
  374. canvasId: 'shareCanvas',
  375. success:(res)=>{
  376. canvasToTempFilePath.value = res.tempFilePath
  377. console.log('canvas-success', canvasToTempFilePath.value)
  378. },
  379. fail:(err)=>{
  380. console.log('canvasToTemp-fail', err)
  381. }
  382. })
  383. })
  384. }
  385. //在点击open-type="share"按钮后会触发以下函数,可以在函数中写需要的逻辑,当然函数的返回值必须是一个对象,用于设置分享卡片的展示形式
  386. //发送给微信好友
  387. onShareAppMessage((res) => {
  388. let path = `/pagesB/positionDetail/index?jobId=${info.value.id}`
  389. if (info.value.hire) {
  390. path += `&sharedById=${useUserStore.accountInfo.userId}`
  391. }
  392. if (jobFairId) {
  393. path += `&jobFairId=${jobFairId}`
  394. }
  395. if(!canvasToTempFilePath.value){
  396. setTimeout(() => {},1000)
  397. }
  398. return {
  399. title: '我发现了一个好职位,快来看看吧',
  400. path,
  401. imageUrl: canvasToTempFilePath.value
  402. }
  403. })
  404. // 富文本内容处理,去除多余的换行空格等
  405. const cleanedHtml = (text) => {
  406. const cleaned = text.replace(/\n/g, '<br>')
  407. .replace(/\s+/g, ' ')
  408. .replace(/(^|\s+)<\/p>(\s*<p>|$)/g, '</p><p>')
  409. .replace(/<p>\s*(<br>)\s*<\/p>/g, '')
  410. .replace(/<pre([^>]*)>/g, '<div$1>')
  411. .replace(/<\/pre>/g, '</div>')
  412. .replace(/<p>\s*(<\/br>)\s*<\/p>/g, '').trim()
  413. return cleaned
  414. }
  415. // 职位详情
  416. async function getPositionDetail () {
  417. try {
  418. loading.value = true
  419. const { data } = await getPositionDetails({ id: jobId })
  420. info.value = data
  421. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value, enterprise: dealDictObjData({}, data.enterprise) }
  422. loading.value = false
  423. areaName.value = positionInfo.value.area?.str ?? '全国'
  424. // 生成分享图片
  425. createPoster()
  426. } finally {
  427. }
  428. }
  429. // 效验是否有投递过简历
  430. const delivery = ref(false) // 是否已投递简历
  431. async function deliveryCheck () {
  432. try {
  433. if (!getAccessToken() || !jobId) return delivery.value = false
  434. const params = { jobId, ...(jobFairId && { jobFairId }) }
  435. const api = params.jobFairId ? jobFairCvRelCheckSend : jobCvRelCheckSend
  436. const { data } = await api(params)
  437. delivery.value = Boolean(data)
  438. } finally {
  439. }
  440. }
  441. import { showAuthModal } from '@/hooks/useModal'
  442. const popup = ref()
  443. const uploadPopup = ref()
  444. const resumeList = ref([])
  445. const selectIndex = ref(null)
  446. const handleOpen = async () => {
  447. // 未上传简历
  448. if (!resumeList.value?.length) {
  449. return uploadPopup.value.open()
  450. }
  451. popup.value.open()
  452. }
  453. const handleDelivery = async () => {
  454. // 未登录
  455. if (!getAccessToken()) {
  456. uni.showToast({
  457. title:'请先登录',
  458. icon: 'none'
  459. })
  460. showAuthModal()
  461. return
  462. }
  463. if (showNecessaryInfoPopup()) {
  464. uni.showToast({
  465. title: '请先完善基本信息',
  466. icon: 'none'
  467. })
  468. showAuthModal('necessaryInfo')
  469. return
  470. }
  471. // 已投递
  472. if (delivery.value) {
  473. uni.showToast({ title: '您已投递过该职位!', icon: 'none', duration: 2000, })
  474. return
  475. }
  476. // 获取附件简历
  477. const { data } = await getPersonResumeCv()
  478. resumeList.value = data
  479. // 消息订阅
  480. const { data: templateList } = await getSubscribeTemplateList()
  481. const tmplIds = templateList.map(e => e.id)
  482. console.log(tmplIds, '消息订阅模版ID')
  483. uni.requestSubscribeMessage({
  484. tmplIds,
  485. success:(res)=>{
  486. console.log(res, 'uni.requestSubscribeMessage-res')
  487. if (res[tmplIds[0]] === 'accept' || res[tmplIds[1]] === 'accept') {
  488. console.log('订阅成功', res)
  489. handleOpen()
  490. }
  491. },
  492. fail:(err)=>{
  493. console.log('订阅失败', err)
  494. handleOpen()
  495. }
  496. })
  497. }
  498. const deliverySubmit = async (uploadFile) => {
  499. const resume = uploadFile ? uploadFile : resumeList.value[selectIndex.value]
  500. if (!resume) {
  501. selectIndex.value = null
  502. uni.showToast({ title: '请选择简历', icon: 'none', duration: 2000, })
  503. return
  504. }
  505. const params = {
  506. jobId,
  507. url: resume.url,
  508. ...(jobFairId && { jobFairId })
  509. }
  510. if (isEmployment.value) {
  511. params.recommendUserId = isEmployment.value
  512. await jobCvRelHireSend(params)
  513. } else {
  514. params.type = info.value.hire ? 1 : 0
  515. params.title = resume.title
  516. await jobCvRelSend(params)
  517. }
  518. uni.showToast({ title: '投递成功', icon: 'none', duration: 2000, })
  519. deliveryCheck()
  520. popup.value.close()
  521. }
  522. const popupClose = () => {
  523. selectIndex.value = null
  524. popup.value.close()
  525. }
  526. // 发起聊天
  527. async function handleSend () {
  528. if (!getAccessToken()) {
  529. showAuthModal()
  530. return
  531. }
  532. if (showNecessaryInfoPopup()) {
  533. uni.showToast({
  534. title: '请先完善基本信息',
  535. icon: 'none'
  536. })
  537. showAuthModal('necessaryInfo')
  538. return
  539. }
  540. const userId = info.value.contact.userId
  541. const enterpriseId = info.value.contact.enterpriseId
  542. const textObj = {
  543. text: defaultText,
  544. positionInfo: positionInfo.value,
  545. }
  546. const channel = await prologue({userId, enterpriseId, text: JSON.stringify(textObj)})
  547. // 跳转
  548. const query = {
  549. id: userId,
  550. isEmployment: isEmployment.value ? isEmployment.value : '-1',
  551. name: info.value?.contact?.name,
  552. postName: info.value?.contact?.postNameCn,
  553. enterpriseName: info.value?.enterprise?.anotherName,
  554. enterpriseId: info.value?.enterpriseId,
  555. channelID: channel.channelID,
  556. channelType: channel.channelType,
  557. avatar: info.value?.contact?.avatar,
  558. sex: info.value?.contact?.sex,
  559. // ...(jobFairId && { jobFairId }),
  560. }
  561. const queryStr = Object.keys(query).reduce((r, v) => {
  562. return r += `${v}=${encodeURIComponent(query[v])}&`
  563. }, '?')
  564. uni.navigateTo({
  565. url: `/pagesA/chart/index${queryStr.slice(0, -1)}`
  566. })
  567. }
  568. // 效验求职者是否有收藏该职位
  569. const isCollection = ref(false)
  570. const getCollectionStatus = async () => {
  571. if (!getAccessToken()) return isCollection.value = false
  572. const { data } = await getJobFavoriteCheck({ jobId })
  573. isCollection.value = Boolean(data)
  574. }
  575. // 操作 收藏&取消收藏职位
  576. const handleCollection = async () => {
  577. const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
  578. await api(isCollection.value ? jobId : { jobId })
  579. await getCollectionStatus()
  580. }
  581. // 选取微信聊天文件
  582. // 上传附件
  583. const handleUpload = () => {
  584. wx.chooseMessageFile({
  585. count: 1,
  586. type: 'file',
  587. success (res) {
  588. // 限制文件上传大小
  589. const size = res.tempFiles[0].size
  590. if (size / (1024*1024) > 20) {
  591. uni.showToast({ icon: 'none', title: '文件大小不能超过20M' })
  592. return
  593. }
  594. const title = res.tempFiles[0].name
  595. const path = res.tempFiles[0].path
  596. //效验是否为支持的文件格式
  597. if(/\.(pdf|docx|doc)$/.test(title)){
  598. uploadFile(path, 'attachment').then(async (res) => {
  599. if (!res.data) {
  600. uni.showToast({
  601. title: '上传失败',
  602. icon: 'none'
  603. })
  604. return
  605. }
  606. await saveResume({ title, url: res.data })
  607. uni.showToast({
  608. title: '上传成功',
  609. icon: 'success'
  610. })
  611. deliverySubmit({ title, url: res.data })
  612. })
  613. }else{
  614. uni.showToast({
  615. icon: 'none',
  616. title: '请上传pdf、doc、docx类型的文件',
  617. duration: 2000
  618. })
  619. return
  620. }
  621. }
  622. })
  623. }
  624. // 分享
  625. const loginPopup = ref()
  626. const handleClickShare = () => {
  627. // 如果当前职位是赏金职位且没有登录的状态,则弹窗询问是否需要登录;普通职位登录与不登录都可直接分享
  628. if (!getAccessToken() && info.value.hire) return loginPopup.value.open()
  629. sharePopup.value.open()
  630. }
  631. // 取消则直接弹窗分享
  632. const handleLoginClose = () => {
  633. sharePopup.value.open()
  634. }
  635. // 确认则弹窗登录
  636. const handleLoginConfirm = () => {
  637. showAuthModal()
  638. }
  639. </script>
  640. <style scoped lang="scss">
  641. @import '../../static/style/position/index.scss';
  642. .hideCanvasView{
  643. position: relative;
  644. }
  645. .shareCanvas {
  646. position: fixed;
  647. top: -99999upx;
  648. left: -99999upx;
  649. z-index: -99999;
  650. }
  651. .bottom-content {
  652. display: flex;
  653. justify-content: space-evenly;
  654. align-items: center;
  655. width: 100%;
  656. margin: 20rpx 0;
  657. .btnStyle {
  658. flex: 1;
  659. margin-right: 20rpx;
  660. }
  661. .bgButtons {
  662. border: 2rpx solid #00897b;
  663. color: #00897b;
  664. // background: #FFF;
  665. border-radius: 50rpx;
  666. }
  667. .shareButtonCss {
  668. font-size: 16px;
  669. background: unset;
  670. &::after{
  671. border:none !important;
  672. }
  673. }
  674. &-tool {
  675. width: 160rpx;
  676. display: flex;
  677. justify-content: center;
  678. flex-direction: column;
  679. align-items: center;
  680. }
  681. }
  682. .share-pop {
  683. width: 100%;
  684. // height:300rpx;
  685. display: flex;
  686. justify-content: center;
  687. .f-straight {
  688. margin: 40rpx;
  689. background: unset;
  690. &::after{
  691. border:none !important;
  692. }
  693. }
  694. .share-round {
  695. border-radius:50%;
  696. height:100rpx;
  697. width:100rpx;
  698. display: flex;
  699. align-items: center;
  700. justify-content: center;
  701. }
  702. .share-round-1 {
  703. background-color:#22a039;
  704. }
  705. .share-round-2 {
  706. background-color:#3693cd;
  707. }
  708. }
  709. .preview {
  710. position: fixed;
  711. z-index: 9;
  712. height: 100vh;
  713. width: 100vw;
  714. left: 0;
  715. top: 0;
  716. .image {
  717. position: absolute;
  718. width: 80%;
  719. left: 10%;
  720. top: 100rpx;
  721. }
  722. }
  723. </style>