SystemZone.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import React, { forwardRef } from 'react';
  2. import { Space, Row } from 'antd';
  3. import MeButton from '../pages/security/components/MeButton';
  4. import { useSelector } from 'react-redux';
  5. import { RootState } from '@/states/store';
  6. import { isLoggedIn } from '../states/user_info';
  7. import Icon from '@/components/Icon';
  8. import { IconButton } from '@/components/IconButton';
  9. interface SystemZoneProps {
  10. onMenuClick?: (key: string) => void;
  11. }
  12. const SystemZone = forwardRef<HTMLDivElement, SystemZoneProps>(
  13. ({ onMenuClick }, ref) => {
  14. const login = useSelector((state: RootState) => isLoggedIn(state.userInfo));
  15. const username = useSelector((state: RootState) => state.userInfo.name);
  16. const avatarUrl = useSelector((state: RootState) => state.userInfo.avatar);
  17. return (
  18. <Row
  19. ref={ref}
  20. style={{
  21. position: 'sticky',
  22. flex: '0 0 auto',
  23. bottom: 0,
  24. left: 0,
  25. width: '100%',
  26. justifyContent: 'center',
  27. padding: '16px 0',
  28. boxShadow: '0 -2px 5px rgba(0,0,0,0.1)',
  29. }}
  30. >
  31. <Space
  32. direction="vertical"
  33. align="start"
  34. style={{ width: '100%', paddingLeft: 20 }}
  35. >
  36. <IconButton
  37. icon={
  38. <Icon
  39. module="module-common"
  40. name="btn_3DCam_AIView"
  41. userId="user-A" // 会优先查 custom/user-A/... 再回退到 base
  42. theme="default"
  43. size="2x"
  44. state="normal"
  45. //widthPx={32}// 和size 2x 保持一致
  46. />
  47. }
  48. iconPlace="left"
  49. iconSize={32} // 和size 2x 保持一致
  50. type="primary"
  51. style={{ padding: '4px 16px' }}
  52. disabled
  53. >
  54. 配置
  55. </IconButton>
  56. <MeButton
  57. size="large"
  58. isLogin={login}
  59. avatarUrl={avatarUrl || undefined}
  60. username={login ? username : '未登录'}
  61. onClick={() => onMenuClick?.('me')}
  62. />
  63. </Space>
  64. </Row>
  65. );
  66. }
  67. );
  68. export default SystemZone;