register.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import React from 'react';
  2. import { Row, Col, Collapse, Grid, Divider } from 'antd';
  3. import BasicInfoForm from './components/register.form';
  4. import ProtocolList from './components/register.protocol.list';
  5. import SelectedProtocolList from './components/register.selected.protocol.list';
  6. const { useBreakpoint } = Grid;
  7. const { Panel } = Collapse;
  8. const RegisterPage: React.FC = () => {
  9. const screens = useBreakpoint();
  10. // xs: <480, sm: ≥576, md: ≥768, lg: ≥992, xl: ≥1200, xxl: ≥1600
  11. // 优先级:xs/sm(小屏)→ md/lg(中屏)→ xl/xxl(大屏)
  12. console.log(screens);
  13. if (screens.xl || screens.xxl) {
  14. // 大屏幕:三栏布局
  15. return (
  16. <Row className="flex-1 h-full">
  17. <Col
  18. xs={24}
  19. sm={24}
  20. md={8}
  21. lg={8}
  22. xl={8}
  23. xxl={8}
  24. style={{
  25. border: '4px solid green',
  26. display: 'flex',
  27. flexDirection: 'column',
  28. }}
  29. className='h-full'
  30. >
  31. <BasicInfoForm style={{ overflow: 'auto' }} />
  32. </Col>
  33. <Col xs={24} sm={24} md={8} lg={8} xl={8} xxl={8} className='h-full'>
  34. <ProtocolList />
  35. </Col>
  36. <Col xs={24} sm={24} md={8} lg={8} xl={8} xxl={8}>
  37. <SelectedProtocolList />
  38. </Col>
  39. </Row>
  40. );
  41. }
  42. if (screens.md || screens.lg) {
  43. // 中屏幕:左右两栏,右侧上下分
  44. return (
  45. <Row gutter={16} className='h-full flex-1 '>
  46. <Col xs={24} sm={24} md={12} lg={12} className='h-full flex flex-column border-8 border-red-400' >
  47. <BasicInfoForm style={{ overflow: 'auto' ,width:'100%'}}/>
  48. </Col>
  49. <Col xs={24} sm={24} md={12} lg={12}>
  50. <Row gutter={[0, 16]}>
  51. <Col span={24}>
  52. <ProtocolList />
  53. </Col>
  54. <Divider />
  55. <Col span={24}>
  56. <SelectedProtocolList className="" />
  57. </Col>
  58. </Row>
  59. </Col>
  60. </Row>
  61. );
  62. }
  63. if (screens.xs || screens.sm) {
  64. // 小屏幕:手风琴式布局
  65. return (
  66. <Collapse accordion defaultActiveKey={['1']} style={{ margin: 16 ,overflow:'auto', height:'100%'}}>
  67. <Panel header="基本信息表单区域" key="1">
  68. <BasicInfoForm />
  69. </Panel>
  70. <Panel header="待选择协议列表区域" key="2">
  71. <ProtocolList />
  72. </Panel>
  73. <Panel header="已选择协议列表区域" key="3">
  74. <SelectedProtocolList />
  75. </Panel>
  76. </Collapse>
  77. );
  78. }
  79. };
  80. export default RegisterPage;