From 595551871d7789ddf913650fe305084de18d6230 Mon Sep 17 00:00:00 2001 From: ZLY Date: Thu, 11 Dec 2025 10:25:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(navbar):=20=E6=B7=BB=E5=8A=A0=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E8=AF=BE=E7=A8=8B=E5=B9=B3=E5=8F=B0=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/NavBar/index.tsx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/NavBar/index.tsx b/src/components/NavBar/index.tsx index 0bcb3ff..d3a6691 100644 --- a/src/components/NavBar/index.tsx +++ b/src/components/NavBar/index.tsx @@ -9,7 +9,8 @@ import { IconSettings, IconPoweroff, IconLoading, - IconUser + IconUser, + IconLink } from '@arco-design/web-react/icon'; import { useSelector, useDispatch } from 'react-redux'; import { GlobalContext } from '@/context'; @@ -63,6 +64,22 @@ function Navbar({ show }: { show: boolean }) { ); } + const toRouter = () => { + const token = localStorage.getItem('token'); + if (window.location.href.includes('localhost')) { + window.open(` http://localhost:9797/pc/login?token=${encodeURIComponent(token)}`); + return; + } + const baseUrl = `${window.location.protocol}//${window.location.hostname}`; + const targetUrl = `${baseUrl}:9800/pc/login`; + if (token) { + window.open(`${targetUrl}?token=${encodeURIComponent(token)}`); + } + else { + window.open(targetUrl); + } + }; + const handleChangeRole = () => { const newRole = role === 'admin' ? 'user' : 'admin'; setRole(newRole); @@ -98,6 +115,10 @@ function Navbar({ show }: { show: boolean }) {