1
This commit is contained in:
+116
-116
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-DujE7ipQ.js"></script>
|
<script type="module" crossorigin src="/assets/index-BfoYu7mK.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DSYnuUvx.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DSYnuUvx.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
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 { QRCodeSVG } from 'qrcode.react';
|
||||||
import {
|
import {
|
||||||
PlayCircleOutlined,
|
PlayCircleOutlined,
|
||||||
@@ -515,27 +515,12 @@ 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 = () => {
|
||||||
notification.warning({
|
message.warning('您的账号已在其他设备登录,请重新登录');
|
||||||
message: '登录提示',
|
|
||||||
description: '您的账号已在其他设备登录,请重新登录',
|
|
||||||
placement: 'top',
|
|
||||||
duration: 0, // 不自动关闭
|
|
||||||
btn: (
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
onClick={() => {
|
|
||||||
localStorage.removeItem('token');
|
localStorage.removeItem('token');
|
||||||
navigate('/login');
|
navigate('/login');
|
||||||
}}
|
|
||||||
>
|
|
||||||
重新登录
|
|
||||||
</Button>
|
|
||||||
),
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
window.addEventListener('kicked-out', handleKickedOut);
|
window.addEventListener('kicked-out', handleKickedOut);
|
||||||
return () => window.removeEventListener('kicked-out', handleKickedOut);
|
return () => window.removeEventListener('kicked-out', handleKickedOut);
|
||||||
|
|||||||
Reference in New Issue
Block a user