修复文件地址

This commit is contained in:
2026-04-23 11:48:30 +08:00
parent 7793b9d4ec
commit adf124ee70
9 changed files with 81 additions and 61 deletions

View File

@@ -6,9 +6,9 @@ import mocks from './mocks';
import { useUser } from '@/store/modules/user';
import { storage } from '@/utils/Storage';
import { useGlobSetting } from '@/hooks/setting';
import { PageEnum } from '@/enums/pageEnum';
import { ResultEnum } from '@/enums/httpEnum';
import { isUrl } from '@/utils';
import { replaceToLogin } from '@/utils/loginRedirect';
const { useMock, apiUrl, urlPrefix, loggerMock } = useGlobSetting();
@@ -34,14 +34,8 @@ const mockAdapter = createAlovaMockAdapter([...mocks], {
});
function redirectToLogin() {
const loginPath = PageEnum.BASE_LOGIN;
const { pathname, search, hash } = window.location;
const currentPath = `${pathname}${search}${hash}`;
const redirectPath =
pathname === loginPath ? loginPath : `${loginPath}?redirect=${encodeURIComponent(currentPath)}`;
storage.clear();
window.location.replace(redirectPath);
replaceToLogin();
}
export const Alova = createAlova({
@@ -122,7 +116,6 @@ export const Alova = createAlova({
// @ts-ignore
const Modal = window.$dialog;
const LoginPath = PageEnum.BASE_LOGIN;
if (ResultEnum.SUCCESS === code) {
return result;
}
@@ -136,7 +129,7 @@ export const Alova = createAlova({
maskClosable: false,
onOk: async () => {
storage.clear();
window.location.href = LoginPath;
replaceToLogin();
},
});
} else {