This commit is contained in:
2026-08-13 11:54:26 +08:00
parent b4b629a497
commit 33a5cc4f94
4 changed files with 16 additions and 6 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -27,7 +27,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<title>民众智创</title>
<script type="module" crossorigin src="/assets/index-BfoYu7mK.js"></script>
<script type="module" crossorigin src="/assets/index-8FIfOCqA.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DSYnuUvx.css">
</head>
<body>
@@ -515,12 +515,11 @@ const AppLayout: React.FC = () => {
const [isMobile, setIsMobile] = useState(false);
const [operationManualUrl, setOperationManualUrl] = useState('');
// 监听"被踢出"事件 — 单设备登录互斥,显示顶部消息并跳转登录
// 监听"被踢出"事件 — 单设备登录互斥,跳转登录页并带上标识
useEffect(() => {
const handleKickedOut = () => {
message.warning('您的账号已在其他设备登录,请重新登录');
localStorage.removeItem('token');
navigate('/login');
navigate('/login?kicked_out=1');
};
window.addEventListener('kicked-out', handleKickedOut);
return () => window.removeEventListener('kicked-out', handleKickedOut);
+11
View File
@@ -74,6 +74,17 @@ const LoginPage: React.FC = () => {
}
}, [tabParam]);
// 单设备登录互斥 — 被踢出后显示提示
useEffect(() => {
if (searchParams.get('kicked_out') === '1') {
message.warning('您的账号已在其他设备登录,请重新登录');
// 清除参数,避免刷新重复提示
const url = new URL(window.location.href);
url.searchParams.delete('kicked_out');
window.history.replaceState({}, '', url.toString());
}
}, [searchParams]);
const goToRedirect = () => {
if (redirect) {
try {