Kaynağa Gözat

分享招聘会

lifanagju_citu 2 ay önce
ebeveyn
işleme
af7fabb260

+ 17 - 1
pagesB/jobFair/enterprisesClassification.vue

@@ -76,7 +76,7 @@
 </template>
 
 <script setup>
-import { onLoad } from '@dcloudio/uni-app'
+import { onLoad, onShareAppMessage } from '@dcloudio/uni-app'
 import { ref, reactive, computed } from 'vue'
 import { dealDictArrayData } from '@/utils/position'
 import { getJobFairEnterprisePage, getJobFair } from '@/api/jobFair'
@@ -116,6 +116,7 @@ const tabIndex = ref(-1)
 const tabList = ref([])
 const swiperAdList = ref([])
 const backgroundColor = ref('#fff')
+const jobFairTitle = ref('')
 const textColor = computed(() => {
   return backgroundColor.value === '#fff' ? '#777' : '#fff'
 })
@@ -133,6 +134,9 @@ const getJobFairDetail = async () => {
   if (data?.backgroundColour) {
     backgroundColor.value = data.backgroundColour || '#fff'
   }
+  if (data?.title) {
+    jobFairTitle.value = data.title
+  }
   showShareBtn.value = Boolean(data?.shareImg)
 }
 getJobFairDetail()
@@ -208,6 +212,18 @@ const handleShare = () => {
 	})
 }
 
+// 转发
+onShareAppMessage(async () => {
+  if (!jobFairTitle.value) {
+    jobFairTitle.value = await getJobFairDetail()  // 如果 jobFairTitle.value 为空,尝试异步获取
+  }
+  console.log('jobFairId:', jobFairId)
+  return {
+    title: jobFairTitle.value || '门墩儿-招聘会',
+    path: `/pagesB/jobFair/enterprisesClassification?jobFairId=${query.jobFairId}`
+  }
+})
+
 </script>
 
 <style scoped lang="scss">

+ 9 - 0
pagesB/jobFair/index.vue

@@ -14,6 +14,7 @@
   </view>
 </template>
 <script setup>
+import { onShareAppMessage } from '@dcloudio/uni-app'
 import { ref }  from 'vue'
 import { getJobFairList } from '@/api/jobFair'
 import { timesTampChange } from '@/utils/date'
@@ -36,6 +37,14 @@ const handleToJobFairEnterprises = (val) => {
 	uni.navigateTo({url})
 }
 
+// 转发
+onShareAppMessage(() => {
+  return {
+    title: '门墩儿-招聘会',
+    path: '/pagesB/jobFair/index'
+  }
+})
+
 </script>
 <style lang="scss" scoped>
 .line {

+ 24 - 1
pagesB/jobFair/positionClassification.vue

@@ -85,7 +85,7 @@
 </template>
 
 <script setup>
-import { onLoad } from '@dcloudio/uni-app'
+import { onLoad, onShareAppMessage } from '@dcloudio/uni-app'
 import { ref, reactive, computed } from 'vue'
 import { dealDictObjData } from '@/utils/position'
 import { getJobFairEntJobPage, getJobFair } from '@/api/jobFair'
@@ -139,6 +139,7 @@ const tabIndex = ref(-1)
 const tabList = ref([])
 const swiperAdList = ref([])
 const backgroundColor = ref('#fff')
+const jobFairTitle = ref('')
 const textColor = computed(() => {
   return backgroundColor.value === '#fff' ? '#777' : '#fff'
 })
@@ -160,6 +161,9 @@ const getJobFairDetail = async () => {
   if (data?.backgroundColour) {
     backgroundColor.value = data.backgroundColour || '#fff'
   }
+  if (data?.title) {
+    jobFairTitle.value = data.title
+  }
   showShareBtn.value = Boolean(data?.shareImg)
 }
 
@@ -250,6 +254,25 @@ const handleShare = () => {
 	uni.navigateTo({ url })
 }
 
+// 转发
+onShareAppMessage(async () => {
+  let title = '门墩儿-招聘会'
+  if (query.enterpriseId && entName.value) title = entName.value
+  else title = jobFairTitle.value
+
+  if (!title) {
+    await getJobFairDetail()  // 如果 jobFairTitle.value 为空,尝试异步获取
+    title = jobFairTitle.value
+  }
+  
+  let path = `/pagesB/jobFair/positionClassification?jobFairId=${query.jobFairId}`
+  if (query.enterpriseId) path = path + `&enterpriseId=${query.enterpriseId}`
+  return {
+    title: title || '门墩儿-招聘会',
+    path
+  }
+})
+
 </script>
 
 <style scoped lang="scss">