|
@@ -1,16 +1,9 @@
|
|
|
import React, { forwardRef, useState } from 'react';
|
|
import React, { forwardRef, useState } from 'react';
|
|
|
import { Space, Row } from 'antd';
|
|
import { Space, Row } from 'antd';
|
|
|
-import MeButton from '../pages/security/components/MeButton';
|
|
|
|
|
-import { useSelector } from 'react-redux';
|
|
|
|
|
-import { RootState } from '@/states/store';
|
|
|
|
|
-import { isLoggedIn } from '../states/user_info';
|
|
|
|
|
-import Icon from '@/components/Icon';
|
|
|
|
|
import { IconButton } from '@/components/IconButton';
|
|
import { IconButton } from '@/components/IconButton';
|
|
|
-import ExitModal from '@/components/ExitModal';
|
|
|
|
|
|
|
+import Icon from '@/components/Icon';
|
|
|
import SettingsModal from '@/pages/system/SettingsModal/SettingsModal';
|
|
import SettingsModal from '@/pages/system/SettingsModal/SettingsModal';
|
|
|
-import { showNotImplemented } from '@/utils/notificationHelper';
|
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
-import { UserOutlined } from '@ant-design/icons';
|
|
|
|
|
|
|
|
|
|
interface SystemZoneProps {
|
|
interface SystemZoneProps {
|
|
|
onMenuClick?: (key: string) => void;
|
|
onMenuClick?: (key: string) => void;
|
|
@@ -19,23 +12,9 @@ interface SystemZoneProps {
|
|
|
const SystemZone = forwardRef<HTMLDivElement, SystemZoneProps>(
|
|
const SystemZone = forwardRef<HTMLDivElement, SystemZoneProps>(
|
|
|
// eslint-disable-next-line
|
|
// eslint-disable-next-line
|
|
|
({ onMenuClick }, ref) => {
|
|
({ onMenuClick }, ref) => {
|
|
|
- const login = useSelector((state: RootState) => isLoggedIn(state.userInfo));
|
|
|
|
|
- const username = useSelector((state: RootState) => state.userInfo.name);
|
|
|
|
|
- const avatarUrl = useSelector((state: RootState) => state.userInfo.avatar);
|
|
|
|
|
-
|
|
|
|
|
- // 退出弹框状态管理
|
|
|
|
|
- const [exitModalVisible, setExitModalVisible] = useState(false);
|
|
|
|
|
// 系统设置弹框状态管理
|
|
// 系统设置弹框状态管理
|
|
|
const [settingsModalVisible, setSettingsModalVisible] = useState(false);
|
|
const [settingsModalVisible, setSettingsModalVisible] = useState(false);
|
|
|
|
|
|
|
|
- const handleExitClick = (): void => {
|
|
|
|
|
- setExitModalVisible(true);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const handleExitModalClose = (): void => {
|
|
|
|
|
- setExitModalVisible(false);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
const handleSettingsClick = (): void => {
|
|
const handleSettingsClick = (): void => {
|
|
|
setSettingsModalVisible(true);
|
|
setSettingsModalVisible(true);
|
|
|
};
|
|
};
|
|
@@ -48,14 +27,10 @@ const SystemZone = forwardRef<HTMLDivElement, SystemZoneProps>(
|
|
|
<Row
|
|
<Row
|
|
|
ref={ref}
|
|
ref={ref}
|
|
|
style={{
|
|
style={{
|
|
|
- position: 'sticky',
|
|
|
|
|
flex: '0 0 auto',
|
|
flex: '0 0 auto',
|
|
|
- bottom: 0,
|
|
|
|
|
- left: 0,
|
|
|
|
|
width: '100%',
|
|
width: '100%',
|
|
|
justifyContent: 'center',
|
|
justifyContent: 'center',
|
|
|
padding: '16px 0',
|
|
padding: '16px 0',
|
|
|
- boxShadow: '0 -2px 5px rgba(0,0,0,0.1)',
|
|
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
<style>{`
|
|
<style>{`
|
|
@@ -93,80 +68,8 @@ const SystemZone = forwardRef<HTMLDivElement, SystemZoneProps>(
|
|
|
defaultMessage={'nav.config'}
|
|
defaultMessage={'nav.config'}
|
|
|
/>
|
|
/>
|
|
|
</IconButton>
|
|
</IconButton>
|
|
|
-
|
|
|
|
|
- <IconButton
|
|
|
|
|
- icon={
|
|
|
|
|
- login ? (
|
|
|
|
|
- avatarUrl ? (
|
|
|
|
|
- <Icon
|
|
|
|
|
- module="module-common"
|
|
|
|
|
- name="btn_3DCam_AIView"
|
|
|
|
|
- userId="user-A"
|
|
|
|
|
- theme="default"
|
|
|
|
|
- size="2x"
|
|
|
|
|
- state="normal"
|
|
|
|
|
- url={avatarUrl}
|
|
|
|
|
- />
|
|
|
|
|
- ) : (
|
|
|
|
|
- <Icon
|
|
|
|
|
- module="module-security"
|
|
|
|
|
- name="user-not-login"
|
|
|
|
|
- userId="user-A"
|
|
|
|
|
- theme="default"
|
|
|
|
|
- size="2x"
|
|
|
|
|
- state="normal"
|
|
|
|
|
- />
|
|
|
|
|
- )
|
|
|
|
|
- ) : (
|
|
|
|
|
- <Icon
|
|
|
|
|
- module="module-common"
|
|
|
|
|
- name="user-not-login"
|
|
|
|
|
- userId="user-A"
|
|
|
|
|
- theme="default"
|
|
|
|
|
- size="2x"
|
|
|
|
|
- state="normal"
|
|
|
|
|
- />
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- iconPlace="left"
|
|
|
|
|
- iconSize={32}
|
|
|
|
|
- type="default"
|
|
|
|
|
- block
|
|
|
|
|
- style={{ padding: '4px 16px' }}
|
|
|
|
|
- onClick={() => showNotImplemented('我的')}
|
|
|
|
|
- >
|
|
|
|
|
- {login ? username : '未登录'}
|
|
|
|
|
- </IconButton>
|
|
|
|
|
-
|
|
|
|
|
- <IconButton
|
|
|
|
|
- data-testid="exit-button"
|
|
|
|
|
- icon={
|
|
|
|
|
- <Icon
|
|
|
|
|
- module="module-common"
|
|
|
|
|
- name="btn_3DCam_AIView"
|
|
|
|
|
- userId="user-A"
|
|
|
|
|
- theme="default"
|
|
|
|
|
- size="2x"
|
|
|
|
|
- state="normal"
|
|
|
|
|
- />
|
|
|
|
|
- }
|
|
|
|
|
- iconPlace="left"
|
|
|
|
|
- iconSize={32}
|
|
|
|
|
- type="default"
|
|
|
|
|
- block
|
|
|
|
|
- style={{ padding: '4px 16px' }}
|
|
|
|
|
- onClick={handleExitClick}
|
|
|
|
|
- >
|
|
|
|
|
- <FormattedMessage
|
|
|
|
|
- id="nav.logout"
|
|
|
|
|
- defaultMessage={'nav.logout'}
|
|
|
|
|
- />
|
|
|
|
|
- </IconButton>
|
|
|
|
|
</Space>
|
|
</Space>
|
|
|
|
|
|
|
|
- {/* 退出选择弹框 */}
|
|
|
|
|
- <ExitModal visible={exitModalVisible} onClose={handleExitModalClose} />
|
|
|
|
|
-
|
|
|
|
|
{/* 系统设置弹框 */}
|
|
{/* 系统设置弹框 */}
|
|
|
<SettingsModal
|
|
<SettingsModal
|
|
|
visible={settingsModalVisible}
|
|
visible={settingsModalVisible}
|
|
@@ -178,3 +81,4 @@ const SystemZone = forwardRef<HTMLDivElement, SystemZoneProps>(
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
export default SystemZone;
|
|
export default SystemZone;
|
|
|
|
|
+
|