index.vue 25 KB

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