index.vue 22 KB

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