index.tsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { PageContainer, ProCard } from '@ant-design/pro-components';
  2. import { useEmotionCss } from '@ant-design/use-emotion-css';
  3. import { useModel } from '@umijs/max';
  4. import { Avatar, Divider, Space } from 'antd';
  5. import React from 'react';
  6. const Workbench: React.FC = () => {
  7. const { initialState } = useModel('@@initialState');
  8. const { currentUser } = initialState ?? {};
  9. // const { token } = theme.useToken();
  10. const headerClassName = useEmotionCss(({ token }) => {
  11. return {
  12. display: 'flex',
  13. flexDirection: 'row',
  14. alignItems: 'center',
  15. '.avatar': {
  16. width: 64,
  17. height: 64,
  18. },
  19. '.text-panel': {
  20. display: 'flex',
  21. flexDirection: 'column',
  22. justifyContent: 'space-between',
  23. padding: `${token.paddingXS}px ${token.paddingMD}px`,
  24. '.text': {
  25. color: token.colorTextHeading,
  26. fontSize: 20,
  27. marginBottom: token.paddingXS,
  28. },
  29. '.tags': {
  30. fontSize: 14,
  31. color: token.colorTextLabel,
  32. '.iconfont': {
  33. marginRight: 4,
  34. },
  35. },
  36. },
  37. };
  38. });
  39. return (
  40. <PageContainer>
  41. <ProCard>
  42. <div className={headerClassName}>
  43. <Avatar
  44. className="avatar"
  45. src={currentUser?.avatar || '/images/avatar-default.svg'}
  46. alt="头像"
  47. />
  48. <div className="text-panel">
  49. <span className="text">
  50. 欢迎您{currentUser?.name},祝你开心每一天!
  51. </span>
  52. <Space className="tags" split={<Divider type="vertical" />}>
  53. {currentUser?.sysOrg && <span>{currentUser?.sysOrg.name}</span>}
  54. {currentUser?.sysRoles && currentUser?.sysRoles.length > 0 && <span>{currentUser?.sysRoles?.map(t => t.name)?.join('、')}</span>}
  55. </Space>
  56. </div>
  57. </div>
  58. </ProCard>
  59. {/* <ProList
  60. headerTitle="2023至2024学年上学期(2023秋)小学教育质量问卷监测"
  61. style={{ marginTop: token.margin }}
  62. size="small"
  63. toolBarRender={() => [<Button key="detail" type="link" size="small">详情</Button>]}
  64. /> */}
  65. </PageContainer>
  66. );
  67. };
  68. export default Workbench;