index.vue 24 KB

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