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">
  15. <view class="bold" 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.contact?.avatar || 'https://minio.citupro.com/dev/menduner/7.png'"></image>
  49. </view>
  50. <view >
  51. <view class="contact-name">{{ info.contact?.name }}</view>
  52. <view class="contact-info">{{ 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. <view @click="handleClickShare" class="bottom-content-tool">
  87. <uni-icons type="redo-filled" size="24" color="#00897B"/>
  88. <span style="color:#00897B;font-weight:bold;">分享</span>
  89. </view>
  90. <button class="btnStyle bgButtons" @tap="handleSend">立即沟通</button>
  91. <button v-if="delivery" :disabled="true" class="buttons btnStyle disable">我已投递</button>
  92. <button v-else class="buttons btnStyle" @click="handleDelivery">我要投递</button>
  93. </view>
  94. </view>
  95. <uni-popup
  96. ref="poster"
  97. type="center"
  98. class="f-straight"
  99. style="position: relative;"
  100. >
  101. <canvas
  102. :style="{
  103. width:`${appInfo.windowWidth}px;`,
  104. height:`${appInfo.windowHeight}px;margin-left:-9999px; margin-top:-99.5vh;`
  105. }" canvas-id="firstCanvas" id="firstCanvas"></canvas>
  106. <image
  107. :style="{ width:`${appInfo.windowWidth}px;`, height:`${appInfo.windowHeight*.9}px;`}"
  108. :src="imgSrc"
  109. mode="aspectFit"
  110. />
  111. <!-- <uni-icons v-if="!!imgSrc" type="clear" size="35" color="#FFF" style="position: absolute;top: 10px;right: 28px;" @click="posterClose"></uni-icons> -->
  112. </uni-popup>
  113. <!-- 选择简历 -->
  114. <uni-popup ref="popup" background-color="#fff" :mask-click="false" >
  115. <view class="dialogBox" style="width: 86vw;">
  116. <view class="dialog-title">
  117. <view class="title">选择简历</view>
  118. <uni-icons type="close" color="grey" size="26" @click="popupClose" />
  119. </view>
  120. <view style="height: 1px; margin: 0 20rpx; background-color: #dedede;"></view>
  121. <scroll-view class="dialog-content" scroll-y="true" style="max-height: 50vh; width: auto;">
  122. <uni-card
  123. v-for="(item, index) in resumeList"
  124. :key="index"
  125. shadow="0px 0px 3px 1px rgba(0,0,0,0.1)"
  126. :is-shadow="true"
  127. :border='false'
  128. background-color="red"
  129. :class="{'selected': selectIndex === index}"
  130. @click="selectIndex = index"
  131. >
  132. <view class="d-flex align-center">
  133. <view style="flex: 1;">
  134. <view style="font-weight: bold;">
  135. <uni-icons v-if="selectIndex === index" color="green" type="checkmarkempty" size="18"></uni-icons>
  136. {{ item.title }}
  137. </view>
  138. <view>上传时间:{{ timesTampChange(item.createTime, 'Y-M-D') }}</view>
  139. </view>
  140. <view class="ss-m-l-30" style="width: 60rpx;">
  141. <uni-icons @click="preview(item.url)" type="eye" size="24"></uni-icons>
  142. </view>
  143. </view>
  144. </uni-card>
  145. <view class="selectOnline" @click="handleUpload">选取微信聊天文件</view>
  146. </scroll-view>
  147. <view class="dialog-bottom" @click="deliverySubmit()">确认投递</view>
  148. </view>
  149. </uni-popup>
  150. <!-- 上传简历 -->
  151. <uni-popup ref="uploadPopup" type="dialog">
  152. <uni-popup-dialog
  153. type="warn"
  154. cancelText="取消"
  155. confirmText="确定"
  156. title="系统提示"
  157. content="您还未上传过简历,是否选取微信聊天文件投递?"
  158. @confirm="handleUpload"
  159. @close="uploadPopup.close()"
  160. ></uni-popup-dialog>
  161. </uni-popup>
  162. <!-- 职位分享 -->
  163. <uni-popup ref="sharePopup" type="share">
  164. <uni-popup-share title="分享到">
  165. <view class="share-pop">
  166. <button class="f-straight" open-type="share">
  167. <view class="share-round share-round-1" >
  168. <uni-icons
  169. type="weixin"
  170. color="#FFF"
  171. size="30"
  172. />
  173. </view>
  174. <view style="font-size:12px;">微信</view>
  175. </button>
  176. <!-- <button class="f-straight" @click="createPoster">
  177. <view class="share-round share-round-2" >
  178. <uni-icons
  179. type="download-filled"
  180. color="#FFF"
  181. size="30"
  182. />
  183. </view>
  184. <view style="font-size:12px;">生成海报</view>
  185. </button> -->
  186. </view>
  187. </uni-popup-share>
  188. </uni-popup>
  189. </layout-page>
  190. </template>
  191. <script setup>
  192. import { commissionCalculation } from '@/utils/position'
  193. import { timesTampChange } from '@/utils/date'
  194. import { preview } from '@/utils/preview'
  195. import { uploadFile } from '@/api/file'
  196. import layoutPage from '@/layout'
  197. import { ref } from 'vue';
  198. import {
  199. jobCvRelSend,
  200. getPositionDetails,
  201. jobCvRelCheckSend,
  202. getPersonJobUnfavorite, // 取消收藏
  203. getPersonJobFavorite, // 收藏
  204. getJobFavoriteCheck,
  205. jobCvRelHireSend,
  206. getShareDetail
  207. } from '@/api/position'
  208. import { getPersonResumeCv, saveResume } from '@/api/user'
  209. import { dealDictObjData } from '@/utils/position'
  210. import { getAccessToken } from '@/utils/request'
  211. import { onLoad, onShareAppMessage, onShow } from '@dcloudio/uni-app'
  212. import { prologue, defaultText } from '@/hooks/useIM'
  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. let jobId = ''
  224. let obj = {}
  225. onLoad(async (options) => {
  226. console.log(options, 'options')
  227. // 网站二维码分享
  228. if (options.scene) {
  229. const scene = decodeURIComponent(options.scene)
  230. const str = scene.split('=')
  231. const res = await getShareDetail({ id: str[1] })
  232. obj = res.data
  233. }
  234. // 是否众聘
  235. isEmployment.value = options?.sharedById || obj?.sharedById
  236. jobId = options?.id || options?.jobId || obj?.jobId || ''
  237. if (jobId) {
  238. loading.value = true
  239. loadingText.value = '加载中 . . . '
  240. deliveryCheck()
  241. getCollectionStatus()
  242. getPositionDetail()
  243. } else {
  244. loadingText.value = '加载失败 . . . '
  245. }
  246. })
  247. onShow(() => {
  248. if (!jobId) {
  249. return
  250. }
  251. deliveryCheck()
  252. })
  253. //在点击open-type="share"按钮后会触发以下函数,可以在函数中写需要的逻辑,当然函数的返回值必须是一个对象,用于设置分享卡片的展示形式
  254. //发送给微信好友
  255. onShareAppMessage((res) => {
  256. let path = `/pagesB/positionDetail/index?jobId=${info.value.id}`
  257. if (info.value.hire) {
  258. path += `&sharedById=${info.value.userId}`
  259. }
  260. return {
  261. title: '我发现了一个好职位,快来看看吧', //分享的名称
  262. path
  263. }
  264. })
  265. // 富文本内容处理,去除多余的换行空格等
  266. const cleanedHtml = (text) => {
  267. let cleaned = text.replace(/\n/g, '</br>')
  268. cleaned = cleaned.replace(/\s+/g, ' ').trim()
  269. cleaned = cleaned.replace(/(^|\s+)<\/p>(\s*<p>|$)/g, '</p><p>').trim()
  270. cleaned = cleaned.replace(/<p>\s*(<br>)\s*<\/p>/g, '')
  271. cleaned = cleaned.replace(/<p>\s*(<\/br>)\s*<\/p>/g, '')
  272. return cleaned
  273. }
  274. // 企业详情
  275. const handleToEnterprise = () => {
  276. uni.navigateTo({
  277. url: `/pagesB/companyDetail/index?id=${info.value.enterprise?.id}`
  278. })
  279. }
  280. async function getPositionDetail () {
  281. try {
  282. loading.value = true
  283. const { data } = await getPositionDetails({ id: jobId })
  284. info.value = data
  285. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value }
  286. loading.value = false
  287. } finally {
  288. }
  289. }
  290. // 效验是否有投递过简历
  291. const delivery = ref(false) // 是否已投递简历
  292. async function deliveryCheck () {
  293. try {
  294. if (!getAccessToken()) return delivery.value = false
  295. const { data } = await jobCvRelCheckSend({ jobId })
  296. delivery.value = Boolean(data)
  297. } finally {
  298. }
  299. }
  300. import { showAuthModal } from '@/hooks/useModal'
  301. const popup = ref()
  302. const uploadPopup = ref()
  303. const resumeList = ref([])
  304. const selectIndex = ref(null)
  305. const handleDelivery = async () => {
  306. // 未登录
  307. if (!getAccessToken()) {
  308. uni.showToast({
  309. title:'请先登录',
  310. icon: 'none'
  311. })
  312. showAuthModal()
  313. return
  314. }
  315. // 已投递
  316. if (delivery.value) {
  317. uni.showToast({ title: '您已投递过该职位!', icon: 'none', duration: 2000, })
  318. return
  319. }
  320. const { data } = await getPersonResumeCv()
  321. resumeList.value = data
  322. // 未上传简历
  323. if (!resumeList.value?.length) {
  324. return uploadPopup.value.open()
  325. }
  326. popup.value.open()
  327. }
  328. const deliverySubmit = async (uploadFile) => {
  329. const resume = uploadFile ? uploadFile : resumeList.value[selectIndex.value]
  330. if (!resume) {
  331. selectIndex.value = null
  332. uni.showToast({ title: '请选择简历', icon: 'none', duration: 2000, })
  333. return
  334. }
  335. if (isEmployment.value) {
  336. await jobCvRelHireSend({
  337. jobId,
  338. url: resume.url,
  339. recommendUserId: isEmployment.value
  340. })
  341. } else {
  342. await jobCvRelSend({
  343. jobId,
  344. title: resume.title,
  345. url: resume.url,
  346. type: info.value.hire ? 1 : 0
  347. })
  348. }
  349. uni.showToast({ title: '投递成功', icon: 'none', duration: 2000, })
  350. deliveryCheck()
  351. popup.value.close()
  352. }
  353. const popupClose = () => {
  354. selectIndex.value = null
  355. popup.value.close()
  356. }
  357. // 发起聊天
  358. async function handleSend () {
  359. if (!getAccessToken()) {
  360. showAuthModal()
  361. return
  362. }
  363. const userId = info.value.contact.userId
  364. const enterpriseId = info.value.contact.enterpriseId
  365. const textObj = {
  366. text: defaultText,
  367. positionInfo: positionInfo.value,
  368. }
  369. // console.log('textObj', textObj)
  370. const channel = await prologue({userId, enterpriseId, text: JSON.stringify(textObj)})
  371. console.log('channel', channel)
  372. // 跳转
  373. const query = {
  374. id: userId,
  375. isEmployment: isEmployment.value ? isEmployment.value : '-1',
  376. name: info.value?.contact?.name,
  377. postName: info.value?.contact?.postNameCn,
  378. enterpriseName: info.value?.enterprise?.anotherName,
  379. enterpriseId: info.value?.enterpriseId,
  380. channelId: channel.channel_id,
  381. avatar: info.value?.contact?.avatar,
  382. sex: info.value?.contact?.sex,
  383. }
  384. console.log('query', query)
  385. const queryStr = Object.keys(query).reduce((r, v) => {
  386. return r += `${v}=${encodeURIComponent(query[v])}&`
  387. }, '?')
  388. uni.navigateTo({
  389. url: `/pagesA/chart/index${queryStr.slice(0, -1)}`
  390. })
  391. }
  392. // 效验求职者是否有收藏该职位
  393. const isCollection = ref(false)
  394. const getCollectionStatus = async () => {
  395. if (!getAccessToken()) return isCollection.value = false
  396. const { data } = await getJobFavoriteCheck({ jobId })
  397. isCollection.value = Boolean(data)
  398. }
  399. // 操作 收藏&取消收藏职位
  400. const handleCollection = async () => {
  401. const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
  402. await api(isCollection.value ? jobId : { jobId })
  403. await getCollectionStatus()
  404. }
  405. // 选取微信聊天文件
  406. // 上传附件
  407. const handleUpload = () => {
  408. wx.chooseMessageFile({
  409. count: 1,
  410. type: 'file',
  411. success (res) {
  412. const title = res.tempFiles[0].name
  413. const path = res.tempFiles[0].path
  414. //效验是否为支持的文件格式
  415. if(/\.(pdf|docx|doc)$/.test(title)){
  416. uploadFile(path).then(async (res) => {
  417. if (!res.data) {
  418. uni.showToast({
  419. title: '上传失败',
  420. icon: 'none'
  421. })
  422. return
  423. }
  424. await saveResume({ title, url: res.data })
  425. uni.showToast({
  426. title: '上传成功',
  427. icon: 'success'
  428. })
  429. deliverySubmit({ title, url: res.data })
  430. })
  431. }else{
  432. uni.showToast({
  433. icon: 'none',
  434. title: '请上传pdf、word类型的文件',
  435. duration: 2000
  436. })
  437. return
  438. }
  439. }
  440. })
  441. }
  442. // 分享
  443. const handleClickShare = () => {
  444. if (!getAccessToken()) {
  445. uni.showToast({
  446. title:'请先登录',
  447. icon: 'none'
  448. })
  449. showAuthModal()
  450. return
  451. }
  452. sharePopup.value.open()
  453. }
  454. // 获取设备信息
  455. function getSystemInfo(){
  456. return new Promise((resolve, reject) =>{
  457. uni.getSystemInfo({
  458. success: (result) => {
  459. console.log(result)
  460. resolve(result)
  461. },
  462. fail: (err) => {
  463. console.log(err)
  464. }
  465. })
  466. })
  467. }
  468. function roundedRect(ctx, x, y, width, height, radius, color) {
  469. ctx.beginPath();
  470. ctx.moveTo(x, y + radius);
  471. ctx.lineTo(x, y + height - radius);
  472. ctx.quadraticCurveTo(x, y + height, x + radius, y + height);
  473. ctx.lineTo(x + width - radius, y + height);
  474. ctx.quadraticCurveTo(x + width, y + height, x + width, y + height - radius);
  475. ctx.lineTo(x + width, y + radius);
  476. ctx.quadraticCurveTo(x + width, y, x + width - radius, y);
  477. ctx.lineTo(x + radius, y);
  478. ctx.quadraticCurveTo(x, y, x, y + radius);
  479. // ctx.fillStyle = "#f5f5f5";
  480. ctx.fillStyle = color;
  481. ctx.fill()
  482. ctx.strokeStyle = color
  483. ctx.stroke();
  484. }
  485. //微信获取图片信息
  486. function getImageTempRatio (url){
  487. return new Promise((resolve, reject)=>{
  488. wx.getImageInfo({
  489. src:url,
  490. success:(res) =>{
  491. resolve(res)
  492. }
  493. })
  494. })
  495. }
  496. /**
  497. *
  498. * @param text 文本
  499. * @param x 起始位置x
  500. * @param y 起始位置y
  501. * @param maxWidth 最大宽度
  502. * @param lineHeight 行高
  503. * @param ctx 画布上下文
  504. * @param type 类型 cut 截断+省略号 wrap 自动换行
  505. */
  506. function wrapText(text, x, y, maxWidth, lineHeight, ctx, type = 'cut') {
  507. const words = text.split(' '); // 按空格分割成单词
  508. let line = ''
  509. words.forEach((word) => {
  510. const testLine = line + word + ' '; // 测试当前行加上新单词
  511. const metrics = ctx.measureText(testLine); // 测量文本宽度
  512. // 检查是否超过最大宽度
  513. if (metrics.width > maxWidth && line) {
  514. if (type === 'wrap') {
  515. ctx.fillText(line, x, y); // 在当前 y 位置绘制当前行
  516. line = word + ' '; // 重置行并开始新的一行
  517. y += lineHeight; // 更新 y 位置
  518. }
  519. if (type === 'cut') {
  520. line = line.slice(0, -word.length - 2) + '...'; // 截断当前行并添加省略号
  521. }
  522. } else {
  523. line = testLine; // 如果没有超出宽度,更新当前行
  524. }
  525. })
  526. // 绘制剩余的文本
  527. ctx.fillText(line, x, y)
  528. }
  529. // 生成海报
  530. async function createPoster () {
  531. const top = 50
  532. const left = 30
  533. console.log(info.value)
  534. sharePopup.value.close()
  535. const res = await getSystemInfo()
  536. const { windowWidth, windowHeight } = res
  537. appInfo.value = {
  538. windowWidth, windowHeight
  539. }
  540. var context = uni.createCanvasContext('firstCanvas')
  541. //底色
  542. context.setFillStyle('#03877a')
  543. context.fillRect(0,0, windowWidth, windowHeight)
  544. // 职位信息
  545. // 名称
  546. context.setFillStyle('#FFF')
  547. context.font = 'normal bold 26px Microsoft YaHei'
  548. context.fillText(info.value.name, left, top)
  549. // 薪酬
  550. context.fillStyle = 'yellow';
  551. context.font = 'normal 22px Microsoft YaHei'
  552. const payText = `${info.value.payFrom}-${info.value.payTo} / ${positionInfo.value.payName}`
  553. const payWidth = context.measureText(payText).width;
  554. const rightX = windowWidth - payWidth - left;
  555. context.fillText(payText, rightX, top);
  556. // 地区|年限|学历
  557. const areaText = `${positionInfo.value?.areaName} | ${positionInfo.value?.eduName} | ${positionInfo.value?.expName}`
  558. context.setFillStyle('#FFF')
  559. context.font = 'normal 14px Microsoft YaHei'
  560. const subTitleH = top + 20
  561. context.fillText(areaText, left, subTitleH)
  562. // 企业信息卡片
  563. roundedRect(context, left, subTitleH + 20 , windowWidth - 2 * left , 50, 10, 'rgba(255, 255, 255, 0.45)')
  564. // 企业信息
  565. // const headerMsg = await getImageTempRatio(info.value.contact.avatar)
  566. // context.drawImage(
  567. // headerMsg.path,
  568. // left + 5,
  569. // subTitleH + 25,
  570. // 40,
  571. // 40
  572. // )
  573. // 企业信息
  574. context.setFillStyle('#FFF')
  575. context.font = 'normal 16px Microsoft YaHei'
  576. const emTextH = subTitleH + 50
  577. context.fillText(info.value.enterprise.anotherName, left + 20, emTextH)
  578. // 企业地点
  579. const _areaText = `${info.value.areaName}`
  580. const areaTextW = context.measureText(_areaText).width;
  581. const _rightX = windowWidth - areaTextW - left - 20;
  582. context.fillText(_areaText, _rightX, emTextH);
  583. // 福利
  584. // context.setFillStyle('#FFF')
  585. context.font = 'normal 14px Microsoft YaHei'
  586. const welfareH = emTextH + 40
  587. const welfareText = info.value.tagList && info.value.tagList.join(' ') || ''
  588. wrapText(welfareText, left, welfareH, windowWidth - 2 * left, 20, context)
  589. // 卡片
  590. const cardTop = welfareH + 20 // 卡片顶部距离
  591. const cardH = windowHeight - cardTop - 100 // 卡片高度
  592. roundedRect(context, 10, cardTop , windowWidth - 20 , cardH, 10,'#fff')
  593. // 岗位
  594. // context.setFillStyle('#000000')
  595. // context.setFontSize(20)
  596. // context.font = 'normal bold 20px Microsoft YaHei'
  597. // context.fillText('111',windowWidth/10, windowHeight * 0.2)
  598. // 地区频率时长薪资
  599. // context.setFillStyle('#6c6e7b')
  600. // context.setFontSize(15)
  601. // context.font = 'normal 15px Microsoft YaHei'
  602. // context.fillText(' | ',windowWidth/10, windowHeight * 0.2 + 30)
  603. // context.setFontSize(18)
  604. // context.font = 'normal 18px Microsoft YaHei'
  605. // context.setFillStyle('#f67272')
  606. // context.fillText('120/天', windowWidth/10, windowHeight * 0.2 + 60)
  607. // 小程序码/ 二维码
  608. // context.drawImage(
  609. // // image.path,
  610. // windowWidth *0.5 - windowWidth/8,
  611. // windowHeight * 0.60,
  612. // windowWidth/4,
  613. // windowWidth/4
  614. // )
  615. context.setFontSize(16)
  616. context.fillText('长按二维码查看岗位', windowWidth/3.2, windowHeight * 0.65 + windowWidth/4)
  617. context.draw(false, () =>{
  618. uni.showLoading({
  619. title: '加载中……',
  620. icon: 'none',
  621. })
  622. setTimeout(() => {
  623. wx.canvasToTempFilePath({
  624. canvasId: 'firstCanvas',
  625. x:0,
  626. y:0,
  627. success:(res)=>{
  628. console.log('成功', res)
  629. imgSrc.value = res.tempFilePath
  630. },
  631. fail:(err)=>{
  632. console.log('canvasToTemp-fail', err)
  633. },
  634. complete:()=>{
  635. uni.hideLoading();
  636. }
  637. })
  638. }, 3000)
  639. // canvas生成图片
  640. poster.value.open()
  641. })
  642. }
  643. </script>
  644. <style scoped lang="scss">
  645. @import '../../static/style/position/index.scss';
  646. .bottom-content {
  647. display: flex;
  648. justify-content: space-evenly;
  649. align-items: center;
  650. width: 100%;
  651. margin: 20rpx 0;
  652. .btnStyle {
  653. flex: 1;
  654. margin-right: 20rpx;
  655. }
  656. .bgButtons {
  657. border: 2rpx solid #00897b;
  658. color: #00897b;
  659. background: #FFF;
  660. border-radius: 50rpx;
  661. }
  662. &-tool {
  663. width: 160rpx;
  664. display: flex;
  665. justify-content: center;
  666. flex-direction: column;
  667. align-items: center;
  668. }
  669. }
  670. .share-pop {
  671. width: 100%;
  672. // height:300rpx;
  673. display: flex;
  674. justify-content: center;
  675. .f-straight {
  676. margin: 40rpx;
  677. background: unset;
  678. &::after{
  679. border:none !important;
  680. }
  681. }
  682. .share-round {
  683. border-radius:50%;
  684. height:100rpx;
  685. width:100rpx;
  686. display: flex;
  687. align-items: center;
  688. justify-content: center;
  689. }
  690. .share-round-1 {
  691. background-color:#22a039;
  692. }
  693. .share-round-2 {
  694. background-color:#3693cd;
  695. }
  696. }
  697. .preview {
  698. position: fixed;
  699. z-index: 9;
  700. height: 100vh;
  701. width: 100vw;
  702. left: 0;
  703. top: 0;
  704. .image {
  705. position: absolute;
  706. width: 80%;
  707. left: 10%;
  708. top: 100rpx;
  709. }
  710. }
  711. </style>