修复ui问题

This commit is contained in:
qaq
2025-08-20 15:34:05 +08:00
parent c43e0fecdc
commit 8dc171fe4b
20 changed files with 13515 additions and 273861 deletions
+4 -2
View File
@@ -1,4 +1,5 @@
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { Button } from "@heroui/button";
import { Card, CardBody, CardHeader } from "@heroui/card";
import { Input } from "@heroui/input";
@@ -121,6 +122,7 @@ const getInitialConfigs = (): Record<string, string> => {
};
export default function ConfigPage() {
const navigate = useNavigate();
const initialConfigs = getInitialConfigs();
const [configs, setConfigs] = useState<Record<string, string>>(initialConfigs);
const [loading, setLoading] = useState(Object.keys(initialConfigs).length === 0); // 如果有缓存数据,不显示loading
@@ -132,10 +134,10 @@ export default function ConfigPage() {
useEffect(() => {
if (!isAdmin()) {
toast.error('权限不足,只有管理员可以访问此页面');
window.location.href = '/dashboard';
navigate('/dashboard', { replace: true });
return;
}
}, []);
}, [navigate]);
// 加载配置数据(优先从缓存)
const loadConfigs = async (currentConfigs?: Record<string, string>) => {
+1 -1
View File
@@ -95,7 +95,7 @@ export default function ProfilePage() {
// 退出登录
const handleLogout = () => {
safeLogout();
window.location.href = '/';
navigate('/', { replace: true });
};
// 密码表单验证
+1 -1
View File
@@ -119,7 +119,7 @@ export const SettingsPage = () => {
loadPanelAddresses();
}
} catch (error) {
toast.error('添加失败');
toast.error('添加失败' + error);
}
};