|
|
@@ -312,11 +312,23 @@ export function Home() {
|
|
|
useAccessStore.getState().fetch();
|
|
|
}, []);
|
|
|
|
|
|
+ if (typeof window !== "undefined") {
|
|
|
+ window.addEventListener("pageshow", (event) => {
|
|
|
+ const perfEntries = performance.getEntriesByType("navigation");
|
|
|
+ if (perfEntries.length > 0) {
|
|
|
+ const navEntry = perfEntries[0] as PerformanceNavigationTiming;
|
|
|
+ if (navEntry.type === "back_forward") {
|
|
|
+ window.location.reload();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
const jkLogin = async (data: { code: string, redirectUrl: string }, url: string) => {
|
|
|
try {
|
|
|
const res = await api.post('jk_code_login', data);
|
|
|
localStorage.setItem('userInfo', JSON.stringify(res.data));
|
|
|
- window.open(url, '_self');
|
|
|
+ location.replace(url);
|
|
|
} catch (error: any) {
|
|
|
Modal.error({
|
|
|
title: '登录失败',
|
|
|
@@ -348,7 +360,7 @@ export function Home() {
|
|
|
const loginUrl = 'http://esc.sribs.com.cn:8080/esc-sso/oauth2.0/authorize?client_id=e97f94cf93761f4d69e8&response_type=code';
|
|
|
const externalLoginUrl = loginUrl + `&redirect_uri=${encodeURIComponent(originUrl)}&state=${encodeURIComponent(fullUrl)}`;
|
|
|
if (!userInfo) {
|
|
|
- window.open(externalLoginUrl, '_self');
|
|
|
+ location.replace(externalLoginUrl);
|
|
|
}
|
|
|
}
|
|
|
}, []);
|