This commit is contained in:
2026-08-13 11:50:50 +08:00
parent 2aa737edaa
commit b4b629a497
3 changed files with 122 additions and 137 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-DujE7ipQ.js"></script>
<script type="module" crossorigin src="/assets/index-BfoYu7mK.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DSYnuUvx.css">
</head>
<body>
@@ -1,5 +1,5 @@
import React, { useEffect, useState, useCallback, useRef } from 'react';
import { Layout, Avatar, Dropdown, Space, Modal, Form, Input, message, notification, Tag, Button, Typography, Radio, Drawer, Tabs, Progress, Collapse, ConfigProvider } from 'antd';
import { Layout, Avatar, Dropdown, Space, Modal, Form, Input, message, Tag, Button, Typography, Radio, Drawer, Tabs, Progress, Collapse, ConfigProvider } from 'antd';
import { QRCodeSVG } from 'qrcode.react';
import {
PlayCircleOutlined,
@@ -515,27 +515,12 @@ const AppLayout: React.FC = () => {
const [isMobile, setIsMobile] = useState(false);
const [operationManualUrl, setOperationManualUrl] = useState('');
// 监听"被踢出"事件 — 单设备登录互斥,显示顶部通知
// 监听"被踢出"事件 — 单设备登录互斥,显示顶部消息并跳转登录
useEffect(() => {
const handleKickedOut = () => {
notification.warning({
message: '登录提示',
description: '您的账号已在其他设备登录,请重新登录',
placement: 'top',
duration: 0, // 不自动关闭
btn: (
<Button
type="primary"
size="small"
onClick={() => {
message.warning('您的账号已在其他设备登录,请重新登录');
localStorage.removeItem('token');
navigate('/login');
}}
>
</Button>
),
});
};
window.addEventListener('kicked-out', handleKickedOut);
return () => window.removeEventListener('kicked-out', handleKickedOut);