Jelajahi Sumber

生成分享海报

lifanagju_citu 2 bulan lalu
induk
melakukan
748531421b

+ 1 - 1
pages.json

@@ -322,7 +322,7 @@
 				{
 					"path": "jobFair/jobFairEntShare",
 					"style": {
-						"navigationBarTitleText": "分享招聘会参与的企业"
+						"navigationBarTitleText": "分享招聘会企业"
 					}
 				},
 				{

+ 4 - 16
pagesB/jobFair/enterprisesClassification.vue

@@ -56,7 +56,8 @@
         </view>
       </view>
     </scroll-view>
-    <view class="shareButtonBox" @tap="handleShare">
+    <!-- 招聘会分享按钮 -->
+    <view v-if="showShareBtn" class="shareButtonBox" @tap="handleShare">
       <uni-icons type="redo-filled" size="20" color="#fff" />
     </view>
   </view>
@@ -78,10 +79,9 @@ const query = reactive({
   jobFairId: undefined,
 })
 
-const entName = ref('')
+const showShareBtn = ref(false)
 
 onLoad(async (options) => {
-  entName.value = options.entName
   if (options?.jobFairId) {
     query.jobFairId = options.jobFairId
     getJobFairDetail()
@@ -112,6 +112,7 @@ const getJobFairDetail = async () => {
   if (data?.backgroundColour) {
     backgroundColor.value = data.backgroundColour || '#fff'
   }
+  showShareBtn.value = Boolean(data?.shareImg)
 }
 getJobFairDetail()
 
@@ -266,17 +267,4 @@ const handleShare = () => {
     }
   }
 }
-
-.titleBox {
-  text-align: center;
-  padding: 0 20rpx 15px;
-  .title {
-    font-size: 20px;
-    font-weight: 600;
-    margin-bottom: 12px;
-  }
-  .entName {
-    color: #fff;
-  }
-}
 </style>

+ 15 - 30
pagesB/jobFair/jobFairEntShare.vue

@@ -13,10 +13,8 @@
 import { ref, computed } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 import { getJobAdvertisedShareQrcode } from '@/api/user'
-import { getJobFair } from '@/api/jobFair'
-// import { getEnterpriseDetails } from '@/api/user'
-// import { getEnterpriseDetails } from '@/api/user'
-  // const positionList = listData.value.length ? JSON.stringify(listData.value.slice(0, 2)) : "0"
+import { getJobFairEntJobPage, getJobFair } from '@/api/jobFair'
+import { formatName } from '@/utils/getText'
 
 const shareUrl = ref('')
 const windowWidth = ref(0)
@@ -30,21 +28,22 @@ onLoad(async (options) => {
   enterpriseId = options.enterpriseId
   await getJobFairDetail()
   await getEntPositionList()
-  // await getJobFairEntDetail()
   const windowInfo = wx.getWindowInfo()
   windowWidth.value = windowInfo.windowWidth
   console.log(windowWidth.value, '当前机型屏幕宽')
+  if (shareImg) createPoster() // 生成海报
 })
 
 const getJobFairDetail = async () => {
   if (!jobFairId) return
   const { data } = await getJobFair(jobFairId)
   shareImg = data?.contentImg || ''
-  if (shareImg) createPoster()
 }
 
+let positionNameList = []
+let entLogoUrl = ''
 const getEntPositionList = async () => {
-  if (!jobFairId || enterpriseId) {
+  if (!jobFairId || !enterpriseId) {
     uni.showToast({ title: '获取企业岗位失败,请重试!', icon: 'none', duration: 2000 })
     return
   }
@@ -55,26 +54,13 @@ const getEntPositionList = async () => {
       jobFairId,
       enterpriseId,
     }
-    // tab对应的职位类型id列表
-    const idList = tabIndex.value !== -1 ? tabList.value[tabIndex.value]?.value : []
-    idList?.length && idList.forEach((value, index) => { params[`positionId[${index}]`] = value })
-    //
     const res = await getJobFairEntJobPage(params)
-    const list = res?.data?.list || []
-    // list.forEach(e => {
-    //   e.job = dealDictObjData({}, e)
-    //   e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
-    // })
-    // listData.value = listData.value.concat(list)
-    // showShareBtn.value = true
-    // if (listData.value?.length === +res?.data?.total) {
-    //   more.value = 'noMore'
-    //   return
-    // }
-  } catch (error) {
-    query.pageNo--
-    more.value = 'more'
-  }
+    const list = res?.data?.list?.length ? res.data.list : []
+    positionNameList = list.map(e => { return formatName(e?.name) })
+    entLogoUrl = list[0]?.enterprise?.logoUrl || ''
+    entName = list[0]?.enterprise?.anotherName || ''
+    debugger
+  } catch (error) {}
 }
 
 const imgStyle = computed(() => {
@@ -131,11 +117,10 @@ const getToLocal = (base64data) => {
 // 生成分享二维码
 const qrCode = ref()
 const handleShareCode = async () => {
+  const result = await saveShareQuery({ jobFairId, enterpriseId, entName })
 	const query = {
-		scene: `jobFairId=${jobFairId}&enterpriseId=${enterpriseId}&entName=${entName}`,
-		scene: 'jobFairId=' + jobFairId + '&enterpriseId=' + enterpriseId,
-		path: 'pages/login/index',
-    // path: 'pagesB/jobFair/positionClassification',
+		scene: 'id=' + result.data,
+    path: 'pagesB/jobFair/positionClassification',
 		width: 200,
 		autoColor: false,
 		checkPath: true,

+ 3 - 1
pagesB/jobFair/jobFairShare.vue

@@ -18,6 +18,7 @@ import { getJobFair, saveShareQuery } from '@/api/jobFair'
 const shareUrl = ref('')
 const windowWidth = ref(0)
 let jobFairId = '' // 分享会ID
+let isEnt = false // 招聘会类型
 let shareImg = '' // 分享背景图片-底图
 // let shareImg = 'https://menduner.citupro.com:3443/dev/4dd7dd3c9ef350d62fcbc814b88c1ac1916f484a3ee8d8531ae7a2698a289670.jpg' // 分享背景图片-底图
 
@@ -33,6 +34,7 @@ const getJobFairDetail = async () => {
   if (!jobFairId) return
   const { data } = await getJobFair(jobFairId)
   shareImg = data?.shareImg || ''
+  isEnt = Number(data?.category)
   if (shareImg) createPoster()
 }
 
@@ -93,7 +95,7 @@ const handleShareCode = async () => {
   const result = await saveShareQuery({ jobFairId })
 	const query = {
 		scene: 'id=' + result.data,
-    path: 'pagesB/jobFair/positionClassification',
+    path: `pagesB/jobFair/${isEnt ? 'enterprisesClassification' : 'positionClassification'}`,
 		width: 200,
 		autoColor: false,
 		checkPath: true,

+ 14 - 7
pagesB/jobFair/positionClassification.vue

@@ -5,10 +5,10 @@
     <scroll-view class="scrollBox" :scroll-y="true" :scroll-top="scrollTop" @scrolltolower="loadingMore" @scroll="onScroll" style="position:relative;">
       <view>
         <!-- 轮播图 -->
-        <SwiperAd v-if="swiperAdList.length" :list="swiperAdList" margin="0" borderRadius="0" @click="handleToDetails"></SwiperAd>
+        <SwiperAd v-if="swiperAdList.length && !query.enterpriseId" :list="swiperAdList" margin="0" borderRadius="0" @click="handleToDetails"></SwiperAd>
         <view class="stick" :style="`background-color: ${backgroundColor}`">
           <!-- tab页签 -->
-          <scroll-view v-if="tabList?.length" scroll-x="true" class="scroll-container">
+          <scroll-view v-if="tabList?.length && !query.enterpriseId" scroll-x="true" class="scroll-container">
             <view
               class="scroll-item"
               :style="`margin-left: ${index ? '24px' : ''};`"
@@ -23,7 +23,7 @@
             </view>
           </scroll-view>
           <!-- entName 企业》企业内职位列表 -->
-          <view v-if="entName" class="enterpriseName" :style="`color: ${entNameColor}`">{{ entName }}</view>
+          <view v-if="entName && query.enterpriseId" class="enterpriseName" :style="`color: ${entNameColor}`">{{ entName }}</view>
         </view>
         <view v-if="listData?.length" class="listDataBox">
           <PositionList
@@ -40,7 +40,8 @@
         </view>
       </view>
     </scroll-view>
-    <view class="shareButtonBox" @tap="handleShare">
+    <!-- 招聘会分享按钮 -->
+    <view v-if="showShareBtn" class="shareButtonBox" @tap="handleShare">
       <uni-icons type="redo-filled" size="20" color="#fff" />
     </view>
   </view>
@@ -64,17 +65,15 @@ const query = reactive({
 })
 
 const entName = ref('')
+const showShareBtn = ref(false)
 
-let obj = {}
 onLoad(async (options) => {
-  console.log('options:', options)
   // 网站二维码分享
 	if (options.scene) {
     const scene = decodeURIComponent(options.scene)
     const key = scene.split('=')[1]
     if (!key) return
     const res = await getShareQueryById({key})
-    console.log('res:', res)
     options.jobFairId = res?.data?.jobFairId
     options.enterpriseId = res?.data?.enterpriseId
     options.backgroundColor = res?.data?.backgroundColor
@@ -85,6 +84,7 @@ onLoad(async (options) => {
     if (options.enterpriseId) {
       query.enterpriseId = options.enterpriseId
       entName.value = options.entName
+      getEntShareImg()
       getEntPositionList()
     } else {
       getJobFairDetail()
@@ -120,6 +120,13 @@ const getJobFairDetail = async () => {
   if (data?.backgroundColour) {
     backgroundColor.value = data.backgroundColour || '#fff'
   }
+  showShareBtn.value = Boolean(data?.shareImg)
+}
+
+const getEntShareImg = async () => {
+  if (!query.jobFairId) return
+  const { data } = await getJobFair(query.jobFairId)
+  showShareBtn.value = Boolean(data?.contentImg)
 }
 
 // 切换类型