Kaynağa Gözat

Merge branch 'master' of https://git.citupro.com/zhengnaiwen_citu/menduner-uniapp

lifanagju_citu 6 ay önce
ebeveyn
işleme
03f5c4c209

+ 2 - 2
App.vue

@@ -10,14 +10,14 @@
 			// 	return {
 			// 		title: '门墩儿 专注顶尖招聘',
 			// 		path: '/pages/index/position',
-			// 		imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+			// 		imageUrl: '../../static/img/share-poster.jpg'
 			// 	}
 			// })
 			// onShareTimeline(() => {
 			// 	return {
 			// 		title: '门墩儿 专注顶尖招聘',
 			// 		path: '/pages/index/position',
-			// 		imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+			// 		imageUrl: '../../static/img/share-poster.jpg'
 			// 	}
 			// })
 			console.log('App Launch')

+ 1 - 1
components/PositionList/index.vue

@@ -40,7 +40,7 @@
             <uni-tag
               class="ss-m-l-10"
               v-if="item?.job?.hirePrice && item?.job?.hirePrice > 0" 
-              :text="`赏金:${commissionCalculation(item.job.hirePrice, 1)}元`"
+              :text="`赏金:${commissionCalculation(item.job.hirePrice / 100, 1)}元`"
               inverted="false"
               size="default"
               custom-style="background-color: #e2f0ef; color:#00897B; border-color:#e2f0ef;"

+ 6 - 0
pages.json

@@ -252,6 +252,12 @@
 					"style": {
 						"navigationBarTitleText": "精选企业"
 					}
+				},
+				{
+					"path": "sharePoster/index",
+					"style": {
+						"navigationBarTitleText": "我的分享码"
+					}
 				}
 			]
 		}

+ 2 - 2
pages/index/communicate.vue

@@ -92,14 +92,14 @@ onLoad(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-			imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+			imageUrl: '../../static/img/share-poster.jpg'
     }
   })
 	onShareTimeline(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-			imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+			imageUrl: '../../static/img/share-poster.jpg'
     }
   })
 })

+ 2 - 2
pages/index/crowdsourcing.vue

@@ -95,14 +95,14 @@ onLoad(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-			imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+			imageUrl: '../../static/img/share-poster.jpg'
     }
   })
 	onShareTimeline(() => {
 		return {
 			title: '门墩儿 专注顶尖招聘',
 			path: '/pages/index/position',
-			imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+			imageUrl: '../../static/img/share-poster.jpg'
 		}
 	})
 })

+ 6 - 6
pages/index/my.vue

@@ -103,13 +103,13 @@ const itemList = [
 ]
 
 const list = ref([
-	{	title: '我的分享码',	path: 'shareQrCode'	},					
-	{	title: '新用户邀请记录',	path: '/pagesB/inviteRecord/index'	},
-	{	title: '会员套餐', path: '/pagesA/vipPackage/index'	},		
-
 	{	title: '在线简历',	path: '/pagesA/resumeOnline/index'	},					
 	{	title: '附件简历',	path: '/pagesA/resume/index'	},					
 	{ title: '面试管理', path: '/pagesA/interview/index' },
+	{	title: '会员套餐', path: '/pagesA/vipPackage/index'	},		
+	{	title: '我的分享码',	path: 'shareQrCode'	},					
+	// {	title: '我的分享码',	path: '/pagesB/sharePoster/index'	},					
+	{	title: '新用户邀请记录',	path: '/pagesB/inviteRecord/index'	},
 	{ title: '门墩儿商城', appId: 'wx6decdf12f9e7a061' },
 	{ title: '我要招聘', key: 'recruit' },
 	{ title: '协议中心', path: '/pagesB/agreement/index', open: true }
@@ -133,14 +133,14 @@ onLoad(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-			imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+			imageUrl: '../../static/img/share-poster.jpg'
     }
   })
 	onShareTimeline(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-			imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+			imageUrl: '../../static/img/share-poster.jpg'
     }
   })
 })

+ 4 - 4
pages/index/position.vue

@@ -79,14 +79,14 @@ onLoad(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-      imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+      imageUrl: '../../static/img/share-poster.jpg'
     }
   })
   onShareTimeline(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-      imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+      imageUrl: '../../static/img/share-poster.jpg'
     }
   })
   if (!uni.getStorageSync('token')) getRewardEventList()
@@ -164,7 +164,8 @@ const handleGrid = async (e) => {
 const positionListData = ref([])
 const query = reactive({ 
   pageSize: 20, 
-  pageNo: 1, 
+  pageNo: 1,
+  hire: false,
   content: '',
   areaIds: [],
   industryIds: [],
@@ -172,7 +173,6 @@ const query = reactive({
   payScope: [],
   expType: []
 })
-//
 const getData = async () => {
   try {
     const res = await getJobAdvertisedSearch(query)

+ 2 - 2
pages/index/welfare.vue

@@ -142,14 +142,14 @@ onLoad(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-      imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+      imageUrl: '../../static/img/share-poster.jpg'
     }
   })
   onShareTimeline(() => {
     return {
       title: '门墩儿 专注顶尖招聘',
       path: '/pages/index/position',
-      imageUrl: 'https://minio.menduner.com/dev/menduner/miniProgram/share-poster.jpg'
+      imageUrl: '../../static/img/share-poster.jpg'
     }
   })
 })

+ 6 - 6
pagesA/recommendation/list.vue

@@ -1,7 +1,7 @@
 <template>
 	<view>
 		<view
-			class="list"
+			class="list ss-m-x-15"
 			v-for="item in items"
 			:key="item.id"
 		>
@@ -11,11 +11,10 @@
 			</view>
 			<view class="list-remuneration">
 				薪酬:
-				{{ item.job?.payFrom }}
-				{{ item.job?.payFrom && item.job?.payTo ? ' - ' : '' }}
-				{{ item.job?.payTo }}
+				<span v-if="item.job?.payFrom && item.job?.payTo">{{ item.job?.payFrom + '-' + item.job?.payTo }}</span>
+				<span v-else>面议</span>
 			</view>
-			<view class="list-company">
+			<view class="list-company" style="border-radius: 0 0 12px 12px;">
 				<text>{{ item.enterprise?.anotherName }}</text>
 				<text>{{ item.enterprise?.anotherName && item.job?.name ? ' · ' : '' }}</text>
 				<text>{{ item.job?.name }}</text>
@@ -36,8 +35,9 @@ const props = defineProps({
 
 <style lang="scss" scoped>
 .list {
-	background: #FFF;
+	background: #fff;
 	margin-top: 20rpx;
+	border-radius: 12px;
 	&-top {
 		padding: 20rpx;
 		display: flex;

+ 7 - 6
pagesB/positionDetail/index.vue

@@ -40,7 +40,7 @@
           <!-- 赏金 -->
           <view v-if="info.hire" class="topLine mt-5" style="display: flex; align-items: center;">
             <view class="iconfont icon-a-1_zhaopin" style="color: #e03506; font-size: 30px;"></view>
-            <view class="hirePrice">{{ `赏金:${commissionCalculation(info.hirePrice, 1)}元` }}</view>
+            <view class="hirePrice">{{ `赏金:${commissionCalculation(info.hirePrice / 100, 1)}元` }}</view>
           </view>
           <!-- 企业信息 -->
           <view class="topLine mt-5 d-flex" @click="handleToEnterprise">
@@ -289,7 +289,7 @@ const getImageTempRatio = (url) => {
   maxLine:最多绘制的行数
 **/
 //处理文字多出省略号显示
-const dealWords = (ctx, fontSize, text, maxWidth, x, y, maxLine) => {
+const dealWords = (ctx, fontSize, text, maxWidth, x, y, maxLine, isEnterpriseName) => {
   ctx.setFontSize(fontSize);//设置字体大小
   var allRow = Math.ceil(ctx.measureText(text).width / maxWidth);//实际总共能分多少行
   var count = allRow >= maxLine ? maxLine : allRow;//实际能分多少行与设置的最大显示行数比,谁小就用谁做循环次数
@@ -310,8 +310,9 @@ const dealWords = (ctx, fontSize, text, maxWidth, x, y, maxLine) => {
           break;
         }
       }
-    } else {//如果当前的字符串宽度小于最大宽度就直接输出
-      ctx.fillText(nowStr.slice(0), x, y + (j + 1) * 30);
+    } else {
+      //如果当前的字符串宽度小于最大宽度就直接输出
+      ctx.fillText(nowStr.slice(0), x, (isEnterpriseName ? y + 20 : y) + (j + 1) * 30);
     }
   }
 }
@@ -359,7 +360,7 @@ const createPoster = async () => {
 
   // 企业名称
   context.setFillStyle('#000000')
-  dealWords(context, 25, anotherName, 250, 150, 210, 2)
+  dealWords(context, 25, anotherName, 250, 150, 210, 2, true)
 
   // 企业行业类型、规模
   context.setFontSize(20)
@@ -386,7 +387,7 @@ onShareAppMessage((res) => {
   console.log(1, 'onShareAppMessage', res)
   let path = `/pagesB/positionDetail/index?jobId=${info.value.id}`
   if (info.value.hire) {
-    path += `&sharedById=${info.value.userId}`
+    path += `&sharedById=${useUserStore.accountInfo.userId}`
   }
   if(!canvasToTempFilePath.value){
 		setTimeout(() => {},1000)

+ 101 - 0
pagesB/sharePoster/index.vue

@@ -0,0 +1,101 @@
+<template>
+  <view style="position: relative;">
+    <view v-if="shareUrl" class="d-flex align-center flex-column">
+      <image v-if="!!shareUrl" class="imgBox" @click="handlePreviewSharePoster" :src="shareUrl" :show-menu-by-longpress="true"></image>
+      <view class="color-999 ss-m-t-20 font-size-14">点击图片预览,长按图片保存</view>
+    </view>
+		<canvas canvas-id="posterCanvas" class="shareCanvas" style="width: 330px; height: 600px;"></canvas>
+  </view>
+</template>
+
+<script setup>
+import { ref, computed } from 'vue'
+import { userStore } from '@/store/user'
+
+const useUserStore = userStore()
+const baseInfo = computed(() => useUserStore?.baseInfo)
+const shareUrl = ref('')
+
+// 图片预览
+const handlePreviewSharePoster = () => {
+	uni.previewImage({
+		current: 0,
+		longPressActions: {
+			itemList: ['发送给朋友', '保存图片', '收藏']
+		},
+		urls: [shareUrl.value]
+	})
+}
+
+const getImageTempRatio = (url) => {
+  return new Promise((req, rej)=>{
+    wx.getImageInfo({
+      src:url,
+      success:(res) =>{
+        req(res)
+      }
+    })
+  })
+}
+
+// 个人头像
+const drawAvatar = (ctx, imagePath, x, y, radius) => {
+  ctx.save() // 保存当前绘图上下文
+  // 绘制圆形裁剪路径
+  ctx.beginPath();
+  ctx.arc(x + radius, y + radius, radius, 0, 2 * Math.PI)
+  ctx.clip();
+  // 绘制图片
+  ctx.drawImage(imagePath, x, y, 2 * radius, 2 * radius) // 注意这里的宽高是直径的2倍
+  ctx.restore() // 恢复之前保存的绘图上下文
+}
+
+const createPoster = async () => {
+  uni.showLoading({ title: '生成中...', mask: true })
+  var context = uni.createCanvasContext('posterCanvas')
+
+  //清空画布
+  context.clearRect(0, 0, 330, 600)
+
+  //背景图片
+  const { path: bgUrl } = await getImageTempRatio('https://minio.menduner.com/dev/a3cfa7975c5905441175abaa738cfca0bd794dbb6249318328c8cfff69ca91fe.jpg')
+  context.drawImage(bgUrl, 0, 0, 330, 600) // 路径、x、y、宽、高
+  
+  // 头像
+  const { path } = await getImageTempRatio(baseInfo.value.avatar)
+  drawAvatar(context, path, 121.5, 74, 43.5) // canvas、图片路径、x、y、半径
+
+  //分享二维码
+  const { path: qrCode } = await getImageTempRatio('https://minio.citupro.com/dev/menduner/miniProgram.jpg')
+  context.drawImage(qrCode, 108, 310, 110, 110)
+
+  context.draw(false, () =>{
+    wx.canvasToTempFilePath({ 
+      canvasId: 'posterCanvas',
+      success:(res)=>{
+        shareUrl.value = res.tempFilePath
+        console.log('canvas-success', shareUrl.value)
+		    uni.hideLoading({})
+      },
+      fail:(err)=>{
+        uni.hideLoading({})
+        console.log('canvas-fail', err)
+      }
+    })
+  })
+}
+createPoster()
+</script>
+
+<style scoped lang="scss">
+.shareCanvas {
+	position: fixed;
+	top: -99999upx;
+	left: -99999upx;
+	z-index: -99999;
+}
+.imgBox {
+  width: 330px;
+  height: 600px;
+}
+</style>

BIN
static/img/share-poster.jpg


+ 1 - 1
utils/position.js

@@ -96,7 +96,7 @@ export const rechargeRatio = () => { return 10 }
 export const commissionCalculation = (count, type) => {
   if (!data || !Object.keys(data).length) return
   // 所占的百分比
-  const ratio = parseFloat(data[list[type]]) / 100 // 所占的百分比-> 50%变为0.5 (不能改)
+  const ratio = parseFloat(data[list[type]]) / 10 // 所占的百分比-> 50%变为0.5 (不能改)
   // 积分变成金额
   const value = count * ratio / rechargeRatio()
   return value % 1 === 0 ? Math.floor(value) : value.toFixed(2)