index.vue 22 KB

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