index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  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 fs14 mt-5">
  49. <view class="fs15 w-600 my5">岗位职责</view>
  50. <view v-if="!info.content">暂无</view>
  51. <rich-text v-else class="htmlCss" :nodes="info.content"></rich-text>
  52. </view>
  53. <!-- 岗位要求 -->
  54. <view class="topLine mt-5">
  55. <view class="fs15 w-600 my5">岗位要求</view>
  56. <view v-if="!info.requirement">暂无</view>
  57. <rich-text v-else class="htmlCss" :nodes="info.requirement"></rich-text>
  58. </view>
  59. <!-- 企业信息 -->
  60. <view class="topLine mt-5 d-flex">
  61. <view class="avatarBox">
  62. <image class="avatar" :src="info.contact?.avatar || 'https://minio.citupro.com/dev/menduner/7.png'"></image>
  63. </view>
  64. <view >
  65. <view class="contact-name">{{ info.contact?.name }}</view>
  66. <view class="contact-info">{{ info.enterprise?.name }} {{ info.contact?.postNameCn ? '· ' + info.contact?.postNameCn : '' }}</view>
  67. </view>
  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. } from '@/api/position'
  209. import { getPersonResumeCv, saveResume } from '@/api/user'
  210. import { dealDictObjData } from '@/utils/position'
  211. import { getAccessToken } from '@/utils/request'
  212. import { onLoad,onShareAppMessage,onShareTimeline, onShow } from '@dcloudio/uni-app'
  213. import { prologue, defaultText } from '@/hooks/useIM'
  214. const sharePopup = ref()
  215. const loading = ref(false)
  216. const loadingText = ref('加载中 . . . ')
  217. // 职位详情
  218. const info = ref({})
  219. const positionInfo = ref({})
  220. const isEmployment = ref(null)
  221. const imgSrc = ref('')
  222. const appInfo = ref({})
  223. const poster = ref()
  224. let jobId = ''
  225. onLoad((options) => {
  226. // console.log(options)
  227. // 是否是众聘
  228. if (options.sharedById) {
  229. isEmployment.value = options.sharedById
  230. }
  231. jobId = options?.id || options?.jobId || ''
  232. if (jobId) {
  233. loading.value = true
  234. loadingText.value = '加载中 . . . '
  235. deliveryCheck()
  236. getCollectionStatus()
  237. getPositionDetail()
  238. } else {
  239. loadingText.value = '加载失败 . . . '
  240. }
  241. })
  242. onShow(() => {
  243. if (!jobId) {
  244. return
  245. }
  246. deliveryCheck()
  247. })
  248. //在点击open-type="share"按钮后会触发以下函数,可以在函数中写需要的逻辑,当然函数的返回值必须是一个对象,用于设置分享卡片的展示形式
  249. //发送给微信好友
  250. onShareAppMessage((res) => {
  251. let path = `/pagesB/positionDetail/index?jobId=${info.value.id}`
  252. if (info.value.hire) {
  253. path += `&sharedById=${info.value.userId}`
  254. }
  255. return {
  256. title: '我发现了一个好职位,快来看看吧', //分享的名称
  257. path
  258. }
  259. })
  260. async function getPositionDetail () {
  261. try {
  262. loading.value = true
  263. const { data } = await getPositionDetails({ id: jobId })
  264. info.value = data
  265. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value }
  266. loading.value = false
  267. } finally {
  268. }
  269. }
  270. // 效验是否有投递过简历
  271. const delivery = ref(false) // 是否已投递简历
  272. async function deliveryCheck () {
  273. try {
  274. if (!getAccessToken()) return delivery.value = false
  275. const { data } = await jobCvRelCheckSend({ jobId })
  276. delivery.value = Boolean(data)
  277. } finally {
  278. }
  279. }
  280. import { showAuthModal } from '@/hooks/useModal'
  281. const popup = ref()
  282. const uploadPopup = ref()
  283. const resumeList = ref([])
  284. const selectIndex = ref(null)
  285. const handleDelivery = async () => {
  286. // 未登录
  287. if (!getAccessToken()) {
  288. uni.showToast({
  289. title:'请先登录',
  290. icon: 'none'
  291. })
  292. showAuthModal()
  293. return
  294. }
  295. // 已投递
  296. if (delivery.value) {
  297. uni.showToast({ title: '您已投递过该职位!', icon: 'none', duration: 2000, })
  298. return
  299. }
  300. const { data } = await getPersonResumeCv()
  301. resumeList.value = data
  302. // 未上传简历
  303. if (!resumeList.value?.length) {
  304. return uploadPopup.value.open()
  305. }
  306. popup.value.open()
  307. }
  308. const deliverySubmit = async (uploadFile) => {
  309. const resume = uploadFile ? uploadFile : resumeList.value[selectIndex.value]
  310. if (!resume) {
  311. selectIndex.value = null
  312. uni.showToast({ title: '请选择简历', icon: 'none', duration: 2000, })
  313. return
  314. }
  315. if (isEmployment.value) {
  316. await jobCvRelHireSend({
  317. jobId,
  318. url: resume.url,
  319. recommendUserId: isEmployment.value
  320. })
  321. } else {
  322. await jobCvRelSend({
  323. jobId,
  324. title: resume.title,
  325. url: resume.url,
  326. type: info.value.hire ? 1 : 0
  327. })
  328. }
  329. uni.showToast({ title: '投递成功', icon: 'none', duration: 2000, })
  330. deliveryCheck()
  331. popup.value.close()
  332. }
  333. const popupClose = () => {
  334. selectIndex.value = null
  335. popup.value.close()
  336. }
  337. // 发起聊天
  338. async function handleSend () {
  339. const userId = info.value.contact.userId
  340. const enterpriseId = info.value.contact.enterpriseId
  341. const textObj = {
  342. text: defaultText,
  343. positionInfo: positionInfo.value,
  344. }
  345. // console.log('textObj', textObj)
  346. const channel = await prologue({userId, enterpriseId, text: JSON.stringify(textObj)})
  347. console.log('channel', channel)
  348. // 跳转
  349. const query = {
  350. id: userId,
  351. isEmployment: isEmployment.value ? isEmployment.value : '-1',
  352. name: info.value?.contact?.name,
  353. postName: info.value?.contact?.postNameCn,
  354. enterpriseName: info.value?.enterprise?.anotherName,
  355. enterpriseId: info.value?.enterpriseId,
  356. channelId: channel.channel_id,
  357. avatar: info.value?.contact?.avatar,
  358. sex: info.value?.contact?.sex,
  359. }
  360. console.log('query', query)
  361. const queryStr = Object.keys(query).reduce((r, v) => {
  362. return r += `${v}=${encodeURIComponent(query[v])}&`
  363. }, '?')
  364. uni.navigateTo({
  365. url: `/pagesA/chart/index${queryStr.slice(0, -1)}`
  366. })
  367. }
  368. // 效验求职者是否有收藏该职位
  369. const isCollection = ref(false)
  370. const getCollectionStatus = async () => {
  371. if (!getAccessToken()) return isCollection.value = false
  372. const { data } = await getJobFavoriteCheck({ jobId })
  373. isCollection.value = Boolean(data)
  374. }
  375. // 操作 收藏&取消收藏职位
  376. const handleCollection = async () => {
  377. const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
  378. await api(isCollection.value ? jobId : { jobId })
  379. await getCollectionStatus()
  380. }
  381. // 选取微信聊天文件
  382. // 上传附件
  383. const handleUpload = () => {
  384. wx.chooseMessageFile({
  385. count: 1,
  386. type: 'file',
  387. success (res) {
  388. const title = res.tempFiles[0].name
  389. const path = res.tempFiles[0].path
  390. //效验是否为支持的文件格式
  391. if(/\.(pdf|docx|doc)$/.test(title)){
  392. uploadFile(path).then(async (res) => {
  393. if (!res.data) {
  394. uni.showToast({
  395. title: '上传失败',
  396. icon: 'none'
  397. })
  398. return
  399. }
  400. await saveResume({ title, url: res.data })
  401. uni.showToast({
  402. title: '上传成功',
  403. icon: 'success'
  404. })
  405. deliverySubmit({ title, url: res.data })
  406. })
  407. }else{
  408. uni.showToast({
  409. icon: 'none',
  410. title: '请上传pdf、word类型的文件',
  411. duration: 2000
  412. })
  413. return
  414. }
  415. }
  416. })
  417. }
  418. // 分享
  419. const handleClickShare = () => {
  420. sharePopup.value.open()
  421. }
  422. // 获取设备信息
  423. function getSystemInfo(){
  424. return new Promise((resolve, reject) =>{
  425. uni.getSystemInfo({
  426. success: (result) => {
  427. console.log(result)
  428. resolve(result)
  429. },
  430. fail: (err) => {
  431. console.log(err)
  432. }
  433. })
  434. })
  435. }
  436. function roundedRect(ctx, x, y, width, height, radius, color) {
  437. ctx.beginPath();
  438. ctx.moveTo(x, y + radius);
  439. ctx.lineTo(x, y + height - radius);
  440. ctx.quadraticCurveTo(x, y + height, x + radius, y + height);
  441. ctx.lineTo(x + width - radius, y + height);
  442. ctx.quadraticCurveTo(x + width, y + height, x + width, y + height - radius);
  443. ctx.lineTo(x + width, y + radius);
  444. ctx.quadraticCurveTo(x + width, y, x + width - radius, y);
  445. ctx.lineTo(x + radius, y);
  446. ctx.quadraticCurveTo(x, y, x, y + radius);
  447. // ctx.fillStyle = "#f5f5f5";
  448. ctx.fillStyle = color;
  449. ctx.fill()
  450. ctx.strokeStyle = color
  451. ctx.stroke();
  452. }
  453. //微信获取图片信息
  454. function getImageTempRatio (url){
  455. return new Promise((resolve, reject)=>{
  456. wx.getImageInfo({
  457. src:url,
  458. success:(res) =>{
  459. resolve(res)
  460. }
  461. })
  462. })
  463. }
  464. /**
  465. *
  466. * @param text 文本
  467. * @param x 起始位置x
  468. * @param y 起始位置y
  469. * @param maxWidth 最大宽度
  470. * @param lineHeight 行高
  471. * @param ctx 画布上下文
  472. * @param type 类型 cut 截断+省略号 wrap 自动换行
  473. */
  474. function wrapText(text, x, y, maxWidth, lineHeight, ctx, type = 'cut') {
  475. const words = text.split(' '); // 按空格分割成单词
  476. let line = ''
  477. words.forEach((word) => {
  478. const testLine = line + word + ' '; // 测试当前行加上新单词
  479. const metrics = ctx.measureText(testLine); // 测量文本宽度
  480. // 检查是否超过最大宽度
  481. if (metrics.width > maxWidth && line) {
  482. if (type === 'wrap') {
  483. ctx.fillText(line, x, y); // 在当前 y 位置绘制当前行
  484. line = word + ' '; // 重置行并开始新的一行
  485. y += lineHeight; // 更新 y 位置
  486. }
  487. if (type === 'cut') {
  488. line = line.slice(0, -word.length - 2) + '...'; // 截断当前行并添加省略号
  489. }
  490. } else {
  491. line = testLine; // 如果没有超出宽度,更新当前行
  492. }
  493. })
  494. // 绘制剩余的文本
  495. ctx.fillText(line, x, y)
  496. }
  497. // 生成海报
  498. async function createPoster () {
  499. const top = 50
  500. const left = 30
  501. console.log(info.value)
  502. sharePopup.value.close()
  503. const res = await getSystemInfo()
  504. const { windowWidth, windowHeight } = res
  505. appInfo.value = {
  506. windowWidth, windowHeight
  507. }
  508. var context = uni.createCanvasContext('firstCanvas')
  509. //底色
  510. context.setFillStyle('#03877a')
  511. context.fillRect(0,0, windowWidth, windowHeight)
  512. // 职位信息
  513. // 名称
  514. context.setFillStyle('#FFF')
  515. context.font = 'normal bold 26px Microsoft YaHei'
  516. context.fillText(info.value.name, left, top)
  517. // 薪酬
  518. context.fillStyle = 'yellow';
  519. context.font = 'normal 22px Microsoft YaHei'
  520. const payText = `${info.value.payFrom}-${info.value.payTo} / ${positionInfo.value.payName}`
  521. const payWidth = context.measureText(payText).width;
  522. const rightX = windowWidth - payWidth - left;
  523. context.fillText(payText, rightX, top);
  524. // 地区|年限|学历
  525. const areaText = `${positionInfo.value?.areaName} | ${positionInfo.value?.eduName} | ${positionInfo.value?.expName}`
  526. context.setFillStyle('#FFF')
  527. context.font = 'normal 14px Microsoft YaHei'
  528. const subTitleH = top + 20
  529. context.fillText(areaText, left, subTitleH)
  530. // 企业信息卡片
  531. roundedRect(context, left, subTitleH + 20 , windowWidth - 2 * left , 50, 10, 'rgba(255, 255, 255, 0.45)')
  532. // 企业信息
  533. // const headerMsg = await getImageTempRatio(info.value.contact.avatar)
  534. // context.drawImage(
  535. // headerMsg.path,
  536. // left + 5,
  537. // subTitleH + 25,
  538. // 40,
  539. // 40
  540. // )
  541. // 企业信息
  542. context.setFillStyle('#FFF')
  543. context.font = 'normal 16px Microsoft YaHei'
  544. const emTextH = subTitleH + 50
  545. context.fillText(info.value.enterprise.anotherName, left + 20, emTextH)
  546. // 企业地点
  547. const _areaText = `${info.value.areaName}`
  548. const areaTextW = context.measureText(_areaText).width;
  549. const _rightX = windowWidth - areaTextW - left - 20;
  550. context.fillText(_areaText, _rightX, emTextH);
  551. // 福利
  552. // context.setFillStyle('#FFF')
  553. context.font = 'normal 14px Microsoft YaHei'
  554. const welfareH = emTextH + 40
  555. const welfareText = info.value.tagList && info.value.tagList.join(' ') || ''
  556. wrapText(welfareText, left, welfareH, windowWidth - 2 * left, 20, context)
  557. // 卡片
  558. const cardTop = welfareH + 20 // 卡片顶部距离
  559. const cardH = windowHeight - cardTop - 100 // 卡片高度
  560. roundedRect(context, 10, cardTop , windowWidth - 20 , cardH, 10,'#fff')
  561. // 岗位
  562. // context.setFillStyle('#000000')
  563. // context.setFontSize(20)
  564. // context.font = 'normal bold 20px Microsoft YaHei'
  565. // context.fillText('111',windowWidth/10, windowHeight * 0.2)
  566. // 地区频率时长薪资
  567. // context.setFillStyle('#6c6e7b')
  568. // context.setFontSize(15)
  569. // context.font = 'normal 15px Microsoft YaHei'
  570. // context.fillText(' | ',windowWidth/10, windowHeight * 0.2 + 30)
  571. // context.setFontSize(18)
  572. // context.font = 'normal 18px Microsoft YaHei'
  573. // context.setFillStyle('#f67272')
  574. // context.fillText('120/天', windowWidth/10, windowHeight * 0.2 + 60)
  575. // 小程序码/ 二维码
  576. // context.drawImage(
  577. // // image.path,
  578. // windowWidth *0.5 - windowWidth/8,
  579. // windowHeight * 0.60,
  580. // windowWidth/4,
  581. // windowWidth/4
  582. // )
  583. context.setFontSize(16)
  584. context.fillText('长按二维码查看岗位', windowWidth/3.2, windowHeight * 0.65 + windowWidth/4)
  585. context.draw(false, () =>{
  586. uni.showLoading({
  587. title: '加载中……',
  588. icon: 'none',
  589. })
  590. setTimeout(() => {
  591. wx.canvasToTempFilePath({
  592. canvasId: 'firstCanvas',
  593. x:0,
  594. y:0,
  595. success:(res)=>{
  596. console.log('成功', res)
  597. imgSrc.value = res.tempFilePath
  598. },
  599. fail:(err)=>{
  600. console.log('canvasToTemp-fail', err)
  601. },
  602. complete:()=>{
  603. uni.hideLoading();
  604. }
  605. })
  606. }, 3000)
  607. // canvas生成图片
  608. poster.value.open()
  609. })
  610. }
  611. </script>
  612. <style scoped lang="scss">
  613. @import '../../static/style/position/index.scss';
  614. .bottom-content {
  615. display: flex;
  616. justify-content: space-evenly;
  617. align-items: center;
  618. width: 100%;
  619. margin: 20rpx 0;
  620. .btnStyle {
  621. flex: 1;
  622. margin-right: 20rpx;
  623. }
  624. .bgButtons {
  625. border: 2rpx solid #00897b;
  626. color: #00897b;
  627. background: #FFF;
  628. border-radius: 50rpx;
  629. }
  630. &-tool {
  631. width: 160rpx;
  632. display: flex;
  633. justify-content: center;
  634. flex-direction: column;
  635. align-items: center;
  636. }
  637. }
  638. .share-pop {
  639. width: 100%;
  640. // height:300rpx;
  641. display: flex;
  642. justify-content: center;
  643. .f-straight {
  644. margin: 40rpx;
  645. background: unset;
  646. &::after{
  647. border:none !important;
  648. }
  649. }
  650. .share-round {
  651. border-radius:50%;
  652. height:100rpx;
  653. width:100rpx;
  654. display: flex;
  655. align-items: center;
  656. justify-content: center;
  657. }
  658. .share-round-1 {
  659. background-color:#22a039;
  660. }
  661. .share-round-2 {
  662. background-color:#3693cd;
  663. }
  664. }
  665. .preview {
  666. position: fixed;
  667. z-index: 9;
  668. height: 100vh;
  669. width: 100vw;
  670. left: 0;
  671. top: 0;
  672. .image {
  673. position: absolute;
  674. width: 80%;
  675. left: 10%;
  676. top: 100rpx;
  677. }
  678. }
  679. </style>