| @@ -118,7 +118,6 @@ export const layout: RuntimeConfig['layout'] = ({ initialState }) => { | |||||
| }; | }; | ||||
| export const onRouteChange: RuntimeConfig['onRouteChange'] = async (e) => { | export const onRouteChange: RuntimeConfig['onRouteChange'] = async (e) => { | ||||
| debugger; | |||||
| // console.log('onRouteChange'); | // console.log('onRouteChange'); | ||||
| // 路由切换时,尤其是回退时,关闭打开的弹框 | // 路由切换时,尤其是回退时,关闭打开的弹框 | ||||
| @@ -38,8 +38,10 @@ function Authorize() { | |||||
| message.success('登录成功!'); | message.success('登录成功!'); | ||||
| await fetchUserInfo(); | await fetchUserInfo(); | ||||
| const redierctUrl = SessionStorage.getItem(SessionStorage.redirectUrl); | const redierctUrl = SessionStorage.getItem(SessionStorage.redirectUrl); | ||||
| console.log('redirect', redirect); | |||||
| console.log('redierctUrl', redierctUrl); | |||||
| history.replace(redirect || redierctUrl || '/workspace'); | history.replace(redirect || redierctUrl || '/workspace'); | ||||
| SessionStorage.removeItem(SessionStorage.redirectUrl); | |||||
| // SessionStorage.removeItem(SessionStorage.redirectUrl); | |||||
| } | } | ||||
| }, [fetchUserInfo, redirect, code]); | }, [fetchUserInfo, redirect, code]); | ||||
| @@ -15,6 +15,12 @@ const Login = () => { | |||||
| if (res && res.data) { | if (res && res.data) { | ||||
| const clientInfo = res.data; | const clientInfo = res.data; | ||||
| SessionStorage.setItem(SessionStorage.clientInfoKey, clientInfo, true); | SessionStorage.setItem(SessionStorage.clientInfoKey, clientInfo, true); | ||||
| const urlParams = new URL(window.location.href).searchParams; | |||||
| const redirectUrl = urlParams.get('redirect'); | |||||
| console.log('login redirectUrl', redirectUrl); | |||||
| if (redirectUrl) { | |||||
| SessionStorage.setItem(SessionStorage.redirectUrl, redirectUrl); | |||||
| } | |||||
| gotoOAuth2(); | gotoOAuth2(); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -77,9 +77,6 @@ export const gotoLoginPage = (toHome: boolean = true) => { | |||||
| if (pathname !== PageEnum.LOGIN) { | if (pathname !== PageEnum.LOGIN) { | ||||
| closeAllModals(); | closeAllModals(); | ||||
| removeAllPageCacheState(); | removeAllPageCacheState(); | ||||
| if (newSearch) { | |||||
| SessionStorage.setItem(newSearch, SessionStorage.redirectUrl); | |||||
| } | |||||
| history.replace({ | history.replace({ | ||||
| pathname: PageEnum.LOGIN, | pathname: PageEnum.LOGIN, | ||||
| search: newSearch, | search: newSearch, | ||||