生产管理系统 loading页面美化

This commit is contained in:
2025-11-03 10:55:32 +08:00
parent fdeb455e47
commit 9791e76d17
4 changed files with 41 additions and 54 deletions

View File

@@ -1,5 +1,5 @@
'use client';
import "@/styles/globals.css"
import { useEffect } from 'react';
import { AuthProvider } from '@/components/auth/AuthContext';
import { ClientAuthInterceptor } from '@/components/auth/ClientAuthInterceptor';

View File

@@ -1,30 +1,10 @@
'use client';
import { useAuth } from '@/components/auth/AuthContext';
import { LoadingScreen } from '@/components/auth/LoadingScreen';
import { redirect } from 'next/navigation';
export default function HomePage() {
const { user, loading, isAuthenticated } = useAuth();
// 如果正在加载,显示加载屏幕
if (loading) {
return <LoadingScreen />;
}
console.log('isAuthenticated:',isAuthenticated)
// 如果未认证,重定向到登录页
if (!isAuthenticated) {
redirect('/login');
}
// 如果已认证,重定向到个人中心
if (isAuthenticated) {
redirect('/central-config/personal-center/personal-info');
}
// 兜底显示(一般不会执行到这里)
return (
<div></div>
<div>
</div>
);
}