index.vue 23 KB

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