抽离登陆模块
This commit is contained in:
2
src/modules/basename.ts
Normal file
2
src/modules/basename.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
// @ts-ignore
|
||||
export const basename = DEV_SERVER ? '/' : BASE_NAME;
|
||||
11
src/modules/beian/beian.css
Normal file
11
src/modules/beian/beian.css
Normal file
@@ -0,0 +1,11 @@
|
||||
.beian2 {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.beiann2 {
|
||||
position: static !important; /* 或者 relative,根据需求修改 */
|
||||
}
|
||||
}
|
||||
|
||||
15
src/modules/beian/beian.tsx
Normal file
15
src/modules/beian/beian.tsx
Normal 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
3
src/modules/message.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { message } from '@kevisual/system-ui/dist/message';
|
||||
|
||||
export { message };
|
||||
25
src/modules/query.ts
Normal file
25
src/modules/query.ts
Normal 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;
|
||||
});
|
||||
Reference in New Issue
Block a user