|
|
@@ -1,8 +1,8 @@
|
|
|
import React, { useState } from 'react';
|
|
|
-import { Row, Col } from 'antd';
|
|
|
-import { useSelector } from 'react-redux';
|
|
|
+import { Row, Col, message } from 'antd';
|
|
|
+import { useDispatch, useSelector } from 'react-redux';
|
|
|
import { RootState } from '@/states/store';
|
|
|
-import { isLoggedIn } from '../states/user_info';
|
|
|
+import { clearUserInfo, isLoggedIn } from '../states/user_info';
|
|
|
import Icon from '@/components/Icon';
|
|
|
import { IconButton } from '@/components/IconButton';
|
|
|
import ExitModal from '@/components/ExitModal';
|
|
|
@@ -11,6 +11,11 @@ import { FormattedMessage } from 'react-intl';
|
|
|
import logo from '@/assets/imgs/bzylogo.png';
|
|
|
import logo_human from '@/assets/imgs/human-logo.png';
|
|
|
import { useAppSelector } from '@/states/store';
|
|
|
+import { getPlatformInfo } from '@/utils/platform';
|
|
|
+import { setSystemMode, SystemMode } from '@/states/systemModeSlice';
|
|
|
+import { setBusinessFlow } from '@/states/BusinessFlowSlice';
|
|
|
+import { clearWorks } from '@/states/exam/examWorksCacheSlice';
|
|
|
+import { setBodyPositions, setSelectedBodyPosition } from '@/states/exam/bodyPositionListSlice';
|
|
|
|
|
|
const BottomBar: React.FC = () => {
|
|
|
const { themeType, currentTheme } = useAppSelector((state) => state.theme);
|
|
|
@@ -18,11 +23,29 @@ const BottomBar: React.FC = () => {
|
|
|
const username = useSelector((state: RootState) => state.userInfo.name);
|
|
|
const avatarUrl = useSelector((state: RootState) => state.userInfo.avatar);
|
|
|
const productName = useAppSelector((state) => state.product.productName);
|
|
|
-
|
|
|
+ const dispatch = useDispatch();
|
|
|
// 退出弹框状态管理
|
|
|
const [exitModalVisible, setExitModalVisible] = useState(false);
|
|
|
|
|
|
const handleExitClick = (): void => {
|
|
|
+ const platformInfo = getPlatformInfo();
|
|
|
+ if (platformInfo.isBrowser) {
|
|
|
+ // 浏览器环境下,直接退出登录
|
|
|
+ // 应用级注销:清除所有用户相关状态
|
|
|
+ // 1. 清除用户信息
|
|
|
+ dispatch(clearUserInfo());
|
|
|
+ // 2. 重置系统模式,避免急诊模式注销后黑屏
|
|
|
+ dispatch(setSystemMode(SystemMode.Normal));
|
|
|
+ // 3. 重置业务流程到注册页面,避免直接进入检查页面
|
|
|
+ dispatch(setBusinessFlow('register'));
|
|
|
+ // 4. 清理工单缓存,避免患者数据泄露
|
|
|
+ dispatch(clearWorks());
|
|
|
+ // 5. 清理体位列表,避免患者数据泄露
|
|
|
+ dispatch(setBodyPositions([]));
|
|
|
+ dispatch(setSelectedBodyPosition(null));
|
|
|
+ message.success('已退出登录');
|
|
|
+ return;
|
|
|
+ }
|
|
|
setExitModalVisible(true);
|
|
|
};
|
|
|
|
|
|
@@ -137,3 +160,7 @@ const BottomBar: React.FC = () => {
|
|
|
};
|
|
|
|
|
|
export default BottomBar;
|
|
|
+function dispatch(arg0: any) {
|
|
|
+ throw new Error('Function not implemented.');
|
|
|
+}
|
|
|
+
|