生产管理系统 404页面兜底
This commit is contained in:
@@ -30,7 +30,7 @@ import { useAuth } from '@/components/auth/AuthContext';
|
|||||||
import { authReducer, initialAuthState, AuthState, AuthAction } from './authReducer';
|
import { authReducer, initialAuthState, AuthState, AuthAction } from './authReducer';
|
||||||
import { getCaptchaApiV1AuthCaptchaGet, loginApiV1AuthLoginPost } from '@/lib/api/sdk.gen';
|
import { getCaptchaApiV1AuthCaptchaGet, loginApiV1AuthLoginPost } from '@/lib/api/sdk.gen';
|
||||||
import type { CaptchaResponse } from '@/lib/api/types.gen';
|
import type { CaptchaResponse } from '@/lib/api/types.gen';
|
||||||
|
import {PERSONAL_CELTRAL_PAGE} from "@/config/constants"
|
||||||
interface LoginFormProps {
|
interface LoginFormProps {
|
||||||
onRegisterClick: () => void;
|
onRegisterClick: () => void;
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ export function LoginForm({ onRegisterClick }: LoginFormProps) {
|
|||||||
login(userData);
|
login(userData);
|
||||||
toast.success('登录成功!正在跳转...');
|
toast.success('登录成功!正在跳转...');
|
||||||
// 跳转到个人中心页面
|
// 跳转到个人中心页面
|
||||||
window.location.href = '/central-config/personal-center/personal-info';
|
window.location.href = PERSONAL_CELTRAL_PAGE;
|
||||||
} else {
|
} else {
|
||||||
dispatch({ type: 'SET_ERROR', payload: '登录失败,请检查用户名和密码' });
|
dispatch({ type: 'SET_ERROR', payload: '登录失败,请检查用户名和密码' });
|
||||||
toast.error('登录失败,请检查用户名和密码');
|
toast.error('登录失败,请检查用户名和密码');
|
||||||
@@ -279,6 +279,7 @@ export function LoginForm({ onRegisterClick }: LoginFormProps) {
|
|||||||
value={state.passwordForm.captcha}
|
value={state.passwordForm.captcha}
|
||||||
onChange={(value) => dispatch({ type: 'UPDATE_PASSWORD_FORM', payload: { captcha: value } })}
|
onChange={(value) => dispatch({ type: 'UPDATE_PASSWORD_FORM', payload: { captcha: value } })}
|
||||||
onCaptchaChange={(captchaData) => setPasswordCaptchaData(captchaData)}
|
onCaptchaChange={(captchaData) => setPasswordCaptchaData(captchaData)}
|
||||||
|
instanceId="password-login"
|
||||||
className="mt-2"
|
className="mt-2"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -357,6 +358,7 @@ export function LoginForm({ onRegisterClick }: LoginFormProps) {
|
|||||||
<CaptchaInput
|
<CaptchaInput
|
||||||
value={state.phoneForm.captcha}
|
value={state.phoneForm.captcha}
|
||||||
onChange={(value) => dispatch({ type: 'UPDATE_PHONE_FORM', payload: { captcha: value } })}
|
onChange={(value) => dispatch({ type: 'UPDATE_PHONE_FORM', payload: { captcha: value } })}
|
||||||
|
instanceId="phone-login"
|
||||||
className="mt-2"
|
className="mt-2"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,13 +17,9 @@ export default function NotFound() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen relative flex items-center justify-center">
|
<Card className="backdrop-blur-md absolute inset-x-6 top-6 bottom-6
|
||||||
|
flex-1 min-h-0">
|
||||||
{/* 主要内容 */}
|
<CardHeader className="text-center p-0">
|
||||||
<div className="relative z-10 w-full max-w-2xl mx-auto p-6">
|
|
||||||
{/* 404 状态卡片 */}
|
|
||||||
<Card className="backdrop-blur-md bg-background/80 border-border/50 shadow-2xl">
|
|
||||||
<CardHeader className="text-center pb-2">
|
|
||||||
<div className="flex justify-center mb-4">
|
<div className="flex justify-center mb-4">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div className="text-8xl font-bold text-destructive animate-pulse">404</div>
|
<div className="text-8xl font-bold text-destructive animate-pulse">404</div>
|
||||||
@@ -43,7 +39,7 @@ export default function NotFound() {
|
|||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
|
|
||||||
<CardContent className="space-y-6">
|
<CardContent className="space-y-6 p-0">
|
||||||
{/* 错误信息提示 */}
|
{/* 错误信息提示 */}
|
||||||
<Alert>
|
<Alert>
|
||||||
<Search className="h-4 w-4" />
|
<Search className="h-4 w-4" />
|
||||||
@@ -100,7 +96,7 @@ export default function NotFound() {
|
|||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
||||||
<CardFooter className="flex flex-col space-y-4 pt-6 border-t">
|
<CardFooter className="flex flex-col space-y-4 pt-6 border-t p-0">
|
||||||
{/* 帮助信息 */}
|
{/* 帮助信息 */}
|
||||||
<div className="text-center text-sm text-muted-foreground">
|
<div className="text-center text-sm text-muted-foreground">
|
||||||
<p>需要帮助?请联系系统管理员</p>
|
<p>需要帮助?请联系系统管理员</p>
|
||||||
@@ -113,7 +109,5 @@ export default function NotFound() {
|
|||||||
</div>
|
</div>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -52,11 +52,6 @@ export function ClientAuthInterceptor({ children }: ClientAuthInterceptorProps)
|
|||||||
return <>{children}</>;
|
return <>{children}</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果未认证且不在认证页面,显示跳转状态
|
|
||||||
if (!isAuthenticated) {
|
|
||||||
return <LoadingScreen variant="redirect" />;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 认证通过,渲染子组件
|
// 认证通过,渲染子组件
|
||||||
return <>{children}</>;
|
return <>{children}</>;
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ export function MainContent({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex-1 flex flex-col bg-background h-full">
|
<div className="flex-1 flex flex-col bg-background h-full">
|
||||||
<div className="flex-1 p-6 min-h-0 content-container">
|
<div className="flex-1 p-6 min-h-0 content-container relative">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -55,3 +55,6 @@ export const THEME = {
|
|||||||
error: '#ef4444'
|
error: '#ef4444'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 默认有权限的首页 个人中心
|
||||||
|
export const PERSONAL_CELTRAL_PAGE = "central-config/personal-center/personal-info"
|
||||||
Reference in New Issue
Block a user