index.vue 23 KB

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