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 }) {