index.vue 24 KB

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