抽离登陆模块

This commit is contained in:
2025-05-20 16:46:03 +08:00
commit 9e6649afa0
33 changed files with 3893 additions and 0 deletions

2
src/modules/basename.ts Normal file
View File

@@ -0,0 +1,2 @@
// @ts-ignore
export const basename = DEV_SERVER ? '/' : BASE_NAME;

View File

@@ -0,0 +1,11 @@
.beian2 {
position: fixed;
z-index: 99;
}
@media (max-width: 640px) {
.beiann2 {
position: static !important; /* 或者 relative根据需求修改 */
}
}

View File

@@ -0,0 +1,15 @@
import clsx from 'clsx';
import './beian.css';
type Props = {
className?: string;
text?: string;
};
export const Beian = (props: Props) => {
return (
<div className={clsx('beian text-sm w-full flex justify-center text-[#e69c36]', props.className)}>
<a href='//beian.miit.gov.cn' target='_blank'>
{props.text}
</a>
</div>
);
};

3
src/modules/message.ts Normal file
View File

@@ -0,0 +1,3 @@
import { message } from '@kevisual/system-ui/dist/message';
export { message };

25
src/modules/query.ts Normal file
View File

@@ -0,0 +1,25 @@
import { QueryClient } from '@kevisual/query';
import { QueryLoginBrowser } from '@kevisual/query-login';
export const query = new QueryClient();
export const queryLogin = new QueryLoginBrowser({
query: query as any,
});
query.after(async (res, ctx) => {
if (res.code === 401) {
if (query.stop) {
return {
code: 500,
success: false,
message: '登录已过期.',
};
}
query.stop = true;
const result = await queryLogin.afterCheck401ToRefreshToken(res, ctx);
query.stop = false;
return result;
}
return res;
});