From 72c2e286674123204605d1ecfd437528e27f6a3d Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Feb 2026 15:55:30 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E5=8F=98=E9=87=8F=E4=BF=AE=E5=A4=8DTypeScrip?= =?UTF-8?q?t=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite-frontend/src/pages/user.tsx | 66 -------------------------------- 1 file changed, 66 deletions(-) diff --git a/vite-frontend/src/pages/user.tsx b/vite-frontend/src/pages/user.tsx index d5ce2e8..2763cbb 100644 --- a/vite-frontend/src/pages/user.tsx +++ b/vite-frontend/src/pages/user.tsx @@ -30,7 +30,6 @@ import { User, UserForm, UserTunnel, - UserTunnelForm, TunnelAssignItem, Tunnel, SpeedLimit, @@ -42,7 +41,6 @@ import { updateUser, deleteUser, getTunnelList, - assignUserTunnel, batchAssignUserTunnel, getUserTunnelList, removeUserTunnel, @@ -136,14 +134,6 @@ export default function UserPage() { const [tunnelListLoading, setTunnelListLoading] = useState(false); // 分配新隧道权限相关状态 - const [tunnelForm, setTunnelForm] = useState({ - tunnelId: null, - flow: 100, - num: 10, - expTime: null, - flowResetTime: 0, - speedId: null - }); const [assignLoading, setAssignLoading] = useState(false); const [batchTunnelSelections, setBatchTunnelSelections] = useState>(new Map()); @@ -337,58 +327,11 @@ export default function UserPage() { // 隧道权限管理操作 const handleManageTunnels = (user: User) => { setCurrentUser(user); - setTunnelForm({ - tunnelId: null, - flow: 100, - num: 10, - expTime: null, - flowResetTime: 0, - speedId: null - }); setBatchTunnelSelections(new Map()); onTunnelModalOpen(); loadUserTunnels(user.id); }; - const handleAssignTunnel = async () => { - if (!tunnelForm.tunnelId || !tunnelForm.expTime || !currentUser) { - toast.error('请填写完整信息'); - return; - } - - setAssignLoading(true); - try { - const response = await assignUserTunnel({ - userId: currentUser.id, - tunnelId: tunnelForm.tunnelId, - flow: tunnelForm.flow, - num: tunnelForm.num, - expTime: tunnelForm.expTime.getTime(), - flowResetTime: tunnelForm.flowResetTime, - speedId: tunnelForm.speedId - }); - - if (response.code === 0) { - toast.success('分配成功'); - setTunnelForm({ - tunnelId: null, - flow: 100, - num: 10, - expTime: null, - flowResetTime: 0, - speedId: null - }); - loadUserTunnels(currentUser.id); - } else { - toast.error(response.msg || '分配失败'); - } - } catch (error) { - toast.error('分配失败'); - } finally { - setAssignLoading(false); - } - }; - const handleBatchAssignTunnel = async () => { if (batchTunnelSelections.size === 0 || !currentUser) { toast.error('请选择至少一个隧道'); @@ -548,15 +491,6 @@ export default function UserPage() { } }; - // 过滤数据 - const availableTunnels = tunnels.filter( - tunnel => !userTunnels.some(ut => ut.tunnelId === tunnel.id) - ); - - const availableSpeedLimits = speedLimits.filter( - speedLimit => speedLimit.tunnelId === tunnelForm.tunnelId - ); - const editAvailableSpeedLimits = speedLimits.filter( speedLimit => speedLimit.tunnelId === editTunnelForm?.tunnelId );