diff --git a/src/utils/permissionManager.js b/src/utils/permissionManager.js index ca2ff61..ab48353 100644 --- a/src/utils/permissionManager.js +++ b/src/utils/permissionManager.js @@ -67,7 +67,8 @@ export const ROLE_PERMISSIONS = { PAGES.PERSONAL_SALARY, // 个人薪资查看 PAGES.HOST_SETTING, // 主播设置 '/information-details', - '/search-payee' + '/search-payee', + '/apply' ], // Guest (访客/申请者) diff --git a/src/utils/usePageInitialization.js b/src/utils/usePageInitialization.js index f905300..a27c0ce 100644 --- a/src/utils/usePageInitialization.js +++ b/src/utils/usePageInitialization.js @@ -265,13 +265,32 @@ export function usePageInitialization(options = {}) { } } catch (error) { console.error('获取团队信息失败:', error) - if (error.message && error.message.includes('401')) { - await router.push({ - path: '/not_app', - query: { message: error.message } - }) - return + + // 检查错误状态码 + const errorMessage = error.message || '' + const errorStatus = error.response?.status || error.status + + console.log('Error details:', { errorMessage, errorStatus, error }) + + // HTTP 406错误通常表示NOT_TEAM_MEMBER,应该跳转到apply + if (errorStatus === 406 || errorMessage.includes('406')) { + console.log('跳转到 apply 页面') + await router.replace('/apply') + return null } + + // HTTP 401错误表示未授权,应该跳转到not_app + if (errorStatus === 401 || errorMessage.includes('401')) { + console.log('跳转到 not_app 页面') + await router.replace({ + path: '/not_app', + query: { message: errorMessage } + }) + return null + } + + // 其他错误,记录但不跳转 + console.warn('未处理的错误:', error) } return null } diff --git a/src/views/ApplyView.vue b/src/views/ApplyView.vue index 21779fa..1020ab7 100644 --- a/src/views/ApplyView.vue +++ b/src/views/ApplyView.vue @@ -1,6 +1,6 @@