register.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import React from 'react';
  2. import { Row, Col, Card, 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'>
  17. <Col xs={24} sm={24} md={8} lg={8} xl={8} xxl={8} className='flex-1 border border-green-500 h-8'>
  18. <BasicInfoForm style={{ flex: 1 }} />
  19. </Col>
  20. <Col xs={24} sm={24} md={8} lg={8} xl={8} xxl={8}>
  21. <ProtocolList />
  22. </Col>
  23. <Col xs={24} sm={24} md={8} lg={8} xl={8} xxl={8}>
  24. <SelectedProtocolList />
  25. </Col>
  26. </Row>
  27. );
  28. }
  29. if (screens.md || screens.lg) {
  30. // 中屏幕:左右两栏,右侧上下分
  31. return (
  32. <Row gutter={16} style={{ margin: 16 }}>
  33. <Col xs={24} sm={24} md={12} lg={12}>
  34. <BasicInfoForm />
  35. </Col>
  36. <Col xs={24} sm={24} md={12} lg={12}>
  37. <Row gutter={[0, 16]}>
  38. <Col span={24}>
  39. <ProtocolList />
  40. </Col>
  41. <Divider />
  42. <Col span={24}>
  43. <SelectedProtocolList className="" />
  44. </Col>
  45. </Row>
  46. </Col>
  47. </Row>
  48. );
  49. }
  50. if (screens.xs || screens.sm) {
  51. // 小屏幕:手风琴式布局
  52. return (
  53. <Collapse accordion defaultActiveKey={['1']} style={{ margin: 16 }}>
  54. <Panel header="基本信息表单区域" key="1">
  55. <BasicInfoForm />
  56. </Panel>
  57. <Panel header="待选择协议列表区域" key="2">
  58. <ProtocolList />
  59. </Panel>
  60. <Panel header="已选择协议列表区域" key="3">
  61. <SelectedProtocolList />
  62. </Panel>
  63. </Collapse>
  64. );
  65. }
  66. };
  67. export default RegisterPage;