diff --git a/config/routes.ts b/config/routes.ts index 41bd63e..0b014e3 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -12,13 +12,18 @@ */ export default [ { + // 原来是 redirect: '/account/center',改为默认渲染第三方过渡页 path: '/', - redirect: '/account/center', + component: './ThirdPartyRedirect', + // 不使用全局 layout,避免 layout 中的鉴权/重定向影响该过渡页 + layout: false, }, { - path: '*', + // 原来是 redirect: '/account/center',改为默认渲染第三方过渡页 + path: '/login-tow', + component: './ThirdPartyRedirect', + // 单独允许直接访问第三方过渡页 layout: false, - component: './404', }, { path: '/user', @@ -162,6 +167,17 @@ export default [ }, ], }, + { + name: 'company', + path: '/company', + routes: [ + { + name: '企业资质审核详情', + path: '/company/qualification-review/detail/:id', + component: './Company/QualificationReview/detail', + }, + ], + }, { name: 'jobfair', path: '/jobfair', @@ -183,5 +199,9 @@ export default [ }, ], }, - + { + path: '*', + layout: false, + component: './404', + }, ]; diff --git a/shihezi.zip b/shihezi.zip index c9da4de..544a60b 100644 Binary files a/shihezi.zip and b/shihezi.zip differ diff --git a/src/access.ts b/src/access.ts index e1f2065..f98d2b6 100644 --- a/src/access.ts +++ b/src/access.ts @@ -21,6 +21,7 @@ export function setSessionToken( access_token: string | undefined, refresh_token: string | undefined, expireTime: number, + lcToken: string | undefined, ): void{ if (access_token) { localStorage.setItem('access_token', access_token); @@ -32,6 +33,11 @@ export function setSessionToken( } else { localStorage.removeItem('refresh_token'); } + if (lcToken) { + localStorage.setItem('lcToken', lcToken); + } else { + localStorage.removeItem('lcToken'); + } localStorage.setItem('expireTime', `${expireTime}`); } diff --git a/src/app.tsx b/src/app.tsx index 5416802..abf78af 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -6,6 +6,10 @@ import { history } from '@umijs/max'; import defaultSettings from '../config/defaultSettings'; import { errorConfig } from './requestErrorConfig'; import { clearSessionToken, getAccessToken, getRefreshToken, getTokenExpireTime } from './access'; +import { + exchangeThirdPartyCredential, + isThirdPartyTransitionPage, +} from './utils/thirdPartyLogin'; import { getRemoteMenu, getRoutersInfo, @@ -69,7 +73,17 @@ export async function getInitialState(): Promise<{ }; // 如果不是登录页面,执行 const { location } = history; - if (location.pathname !== PageEnum.LOGIN) { + // 排除登录页面、过渡页面和求职者页面(考虑基础路径 /shihezi/) + const isTransitionPage = location.pathname === '/' || + location.pathname === '/login-tow' || + location.pathname === '/shihezi/' || + location.pathname === '/shihezi/login-tow'; + + // 排除求职者相关页面 + const isJobPortalPage = location.pathname.startsWith('/job-portal') || + location.pathname.startsWith('/shihezi/job-portal'); + + if (location.pathname !== PageEnum.LOGIN && !isTransitionPage && !isJobPortalPage) { const currentUser = await fetchUserInfo(); return { fetchUserInfo, @@ -91,9 +105,9 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) = avatarProps: { src: initialState?.currentUser?.avatar, title: , - render: (_, avatarChildren) => { - return {avatarChildren}; - }, + render: (_, avatarChildren) => { + return {avatarChildren}; + }, }, waterMarkProps: { // content: initialState?.currentUser?.nickName, @@ -115,8 +129,17 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) = footerRender: () =>