1
This commit is contained in:
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<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" />
|
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
|
||||||
<title>民众智创</title>
|
<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">
|
<link rel="stylesheet" crossorigin href="/assets/index-DSYnuUvx.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -515,12 +515,11 @@ const AppLayout: React.FC = () => {
|
|||||||
const [isMobile, setIsMobile] = useState(false);
|
const [isMobile, setIsMobile] = useState(false);
|
||||||
const [operationManualUrl, setOperationManualUrl] = useState('');
|
const [operationManualUrl, setOperationManualUrl] = useState('');
|
||||||
|
|
||||||
// 监听"被踢出"事件 — 单设备登录互斥,显示顶部消息并跳转登录
|
// 监听"被踢出"事件 — 单设备登录互斥,跳转登录页并带上标识
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKickedOut = () => {
|
const handleKickedOut = () => {
|
||||||
message.warning('您的账号已在其他设备登录,请重新登录');
|
|
||||||
localStorage.removeItem('token');
|
localStorage.removeItem('token');
|
||||||
navigate('/login');
|
navigate('/login?kicked_out=1');
|
||||||
};
|
};
|
||||||
window.addEventListener('kicked-out', handleKickedOut);
|
window.addEventListener('kicked-out', handleKickedOut);
|
||||||
return () => window.removeEventListener('kicked-out', handleKickedOut);
|
return () => window.removeEventListener('kicked-out', handleKickedOut);
|
||||||
|
|||||||
@@ -74,6 +74,17 @@ const LoginPage: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}, [tabParam]);
|
}, [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 = () => {
|
const goToRedirect = () => {
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user