From 2d6370b796a87581441801b2c6d941c516afba15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E8=BE=89?= <13935151924@163.com> Date: Fri, 24 Oct 2025 16:54:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8D=A1=E7=89=87=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/AppLayout/AppLayout.vue | 3 +- components/CustomTabBar/CustomTabBar.vue | 79 ++++- components/tabbar/midell-box.vue | 8 +- .../addWorkExperience/addWorkExperience.vue | 56 ++-- packageA/pages/jobExpect/jobExpect.vue | 30 +- packageA/pages/myResume/myResume.vue | 9 +- pages.json | 41 ++- pages/careerfair/careerfair.vue | 24 +- pages/chat/chat.vue | 24 +- pages/chat/components/ai-paging.vue | 36 ++- pages/complete-info/company-info.vue | 102 ++++++- pages/index/components/index-one.vue | 278 +++++++++++++++++- pages/job/publishJob.vue | 48 +-- pages/mine/company-info.vue | 107 ++++--- pages/mine/company-mine.vue | 115 ++++++-- pages/mine/mine.vue | 17 +- pages/msglog/msglog.vue | 26 +- pages/msglog/read.vue | 30 ++ pages/msglog/unread.vue | 30 ++ static/imgs/avatar.jpg | Bin 0 -> 48930 bytes stores/useReadMsg.js | 27 +- stores/useUserStore.js | 11 +- 22 files changed, 896 insertions(+), 205 deletions(-) create mode 100644 static/imgs/avatar.jpg diff --git a/components/AppLayout/AppLayout.vue b/components/AppLayout/AppLayout.vue index e9b405f..c439a44 100644 --- a/components/AppLayout/AppLayout.vue +++ b/components/AppLayout/AppLayout.vue @@ -6,6 +6,7 @@ > @@ -49,7 +50,7 @@ const emit = defineEmits(['onScrollBottom']); defineProps({ title: { type: String, - default: '标题', + default: '', }, border: { type: Boolean, diff --git a/components/CustomTabBar/CustomTabBar.vue b/components/CustomTabBar/CustomTabBar.vue index 49ffe5c..72cc36a 100644 --- a/components/CustomTabBar/CustomTabBar.vue +++ b/components/CustomTabBar/CustomTabBar.vue @@ -154,6 +154,79 @@ watch(() => userInfo.value, (newUserInfo, oldUserInfo) => { // 切换tab const switchTab = (item, index) => { + // 检查是否为"发布岗位"页面,需要判断企业信息是否完整 + if (item.path === '/pages/job/publishJob') { + // 检查用户是否已登录 + const token = uni.getStorageSync('token') || ''; + const hasLogin = userStore.hasLogin; + + if (!token || !hasLogin) { + // 未登录,发送事件显示登录弹窗 + uni.$emit('showLoginModal'); + return; // 不进行页面跳转 + } + + // 已登录,检查企业信息是否完整 + const cachedUserInfo = uni.getStorageSync('userInfo') || {}; + const storeUserInfo = userInfo.value || {}; + const currentUserInfo = storeUserInfo.id ? storeUserInfo : cachedUserInfo; + + // 判断企业信息字段company是否为null或undefined + if (!currentUserInfo.company || currentUserInfo.company === null) { + // 企业信息为空,跳转到企业信息补全页面 + uni.navigateTo({ + url: '/pages/complete-info/company-info', + }); + } else { + // 企业信息完整,跳转到发布岗位页面 + uni.navigateTo({ + url: '/pages/job/publishJob', + }); + } + + currentItem.value = item.id; + return; + } + + // 检查是否为"我的"页面,需要登录验证和用户类型判断 + if (item.path === '/pages/mine/mine') { + // 检查用户是否已登录 + const token = uni.getStorageSync('token') || ''; + const hasLogin = userStore.hasLogin; + + if (!token || !hasLogin) { + // 未登录,发送事件显示登录弹窗 + uni.$emit('showLoginModal'); + return; // 不进行页面跳转 + } + + // 已登录,根据用户类型跳转到不同的"我的"页面 + const cachedUserInfo = uni.getStorageSync('userInfo') || {}; + const storeIsCompanyUser = userInfo.value?.isCompanyUser; + const cachedIsCompanyUser = cachedUserInfo.isCompanyUser; + + // 获取用户类型 + const userType = Number(storeIsCompanyUser !== undefined ? storeIsCompanyUser : (cachedIsCompanyUser !== undefined ? cachedIsCompanyUser : 1)); + + let targetPath = '/pages/mine/mine'; // 默认求职者页面 + + if (userType === 0) { + // 企业用户,跳转到企业我的页面 + targetPath = '/pages/mine/company-mine'; + } else { + // 求职者或其他用户类型,跳转到普通我的页面 + targetPath = '/pages/mine/mine'; + } + + // 跳转到对应的页面 + uni.navigateTo({ + url: targetPath, + }); + + currentItem.value = item.id; + return; + } + // 判断是否为 tabBar 页面 const tabBarPages = [ '/pages/index/index', @@ -164,12 +237,12 @@ const switchTab = (item, index) => { ]; if (tabBarPages.includes(item.path)) { - // tabBar 页面使用 switchTab - uni.navigateTo({ + // TabBar 页面使用 redirectTo 避免页面栈溢出 + uni.redirectTo({ url: item.path, }); } else { - // 非 tabBar 页面使用 navigateTo + // 非 TabBar 页面使用 navigateTo uni.navigateTo({ url: item.path, }); diff --git a/components/tabbar/midell-box.vue b/components/tabbar/midell-box.vue index 031ff12..6df2aaa 100644 --- a/components/tabbar/midell-box.vue +++ b/components/tabbar/midell-box.vue @@ -144,7 +144,7 @@ onMounted(() => { }); const changeItem = (item) => { - // 判断是否为 tabBar 页面 + // 判断是否为 TabBar 页面 const tabBarPages = [ '/pages/index/index', '/pages/careerfair/careerfair', @@ -154,12 +154,12 @@ const changeItem = (item) => { ]; if (tabBarPages.includes(item.path)) { - // tabBar 页面使用 switchTab - uni.switchTab({ + // TabBar 页面使用 redirectTo 避免页面栈溢出 + uni.redirectTo({ url: item.path, }); } else { - // 非 tabBar 页面使用 navigateTo + // 非 TabBar 页面使用 navigateTo uni.navigateTo({ url: item.path, }); diff --git a/packageA/pages/addWorkExperience/addWorkExperience.vue b/packageA/pages/addWorkExperience/addWorkExperience.vue index 2129178..a0090af 100644 --- a/packageA/pages/addWorkExperience/addWorkExperience.vue +++ b/packageA/pages/addWorkExperience/addWorkExperience.vue @@ -1,16 +1,5 @@