index.vue 24 KB

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