Browse Source

职位详情:网页二维码分享参数获取接口更换

Xiao_123 3 days ago
parent
commit
b1d25d4b77

+ 7 - 0
pagesB/jobFair/enterprisesClassification.vue

@@ -102,6 +102,13 @@ onLoad(async (options) => {
     const key = scene.split('=')[1]
     if (!key) return
     const res = await getShareQueryById({key})
+    if (!res || !res?.data) {
+      uni.showToast({ title: '服务器错误,请联系管理员', icon: 'none', duration: 2000 })
+      setTimeout(() => {
+        uni.reLaunch({ url: '/pages/index/position' })
+      }, 2000)
+      return
+    }
     options.jobFairId = res?.data?.jobFairId
   }
   if (options?.jobFairId) {

+ 7 - 0
pagesB/jobFair/positionClassification.vue

@@ -120,6 +120,13 @@ onLoad(async (options) => {
     if (!key) return
     const res = await getShareQueryById({key})
     console.log(res, 'result')
+    if (!res || !res?.data) {
+      uni.showToast({ title: '服务器错误,请联系管理员', icon: 'none', duration: 2000 })
+      setTimeout(() => {
+        uni.reLaunch({ url: '/pages/index/position' })
+      }, 2000)
+      return
+    }
     options.jobFairId = res?.data?.jobFairId
     options.enterpriseId = res?.data?.enterpriseId
     options.backgroundColor = res?.data?.backgroundColor

+ 12 - 4
pagesB/positionDetail/index.vue

@@ -266,7 +266,7 @@ import { prologue, defaultText } from '@/hooks/useIM'
 import { userStore } from '@/store/user'
 import { formatName } from '@/utils/getText'
 import studentDeliveryForm from '@/components/studentDeliveryForm'
-// import { getShareQueryById } from '@/api/jobFair.js'
+import { getShareQueryById } from '@/api/jobFair.js'
 
 const navbarHeight = ref(0)
 
@@ -320,9 +320,17 @@ onLoad(async (options) => {
   // 网站二维码分享
   if (options.scene) {
     const scene = decodeURIComponent(options.scene)
-    const str = scene.split('=')
-    const res = await getShareDetail({ id: str[1] })
-    obj = res.data
+    const key = scene.split('=')[1]
+    const res = await getShareQueryById({ key })
+    // 获取不到参数则跳转首页
+    if (!res || !res?.data) {
+      uni.showToast({ title: '服务器错误,请联系管理员', icon: 'none', duration: 2000 })
+      setTimeout(() => {
+        uni.reLaunch({ url: '/pages/index/position' })
+      }, 2000)
+      return
+    }
+    obj = res.data || {}
   }
 
   // 是否众聘