import React, { useState } from 'react'; import { Card, Typography, Button, Space, Tag, Table, List, Avatar, Row, Col, Divider, Tabs, Progress, Badge, Rate, Timeline, Statistic, Switch, Alert, Empty } from 'antd'; import { UserOutlined, StarOutlined, LikeOutlined, MessageOutlined, EyeOutlined, HeartOutlined, ShoppingCartOutlined, CalendarOutlined, ClockCircleOutlined, CheckCircleOutlined } from '@ant-design/icons'; const { Title, Paragraph, Text } = Typography; const { TabPane } = Tabs; /** * 布局样式预览页面 * 展示各种常见UI布局类型及其适用场景 */ const LayoutShowcase: React.FC = () => { const [isMobile, setIsMobile] = useState(window.innerWidth <= 768); // 模拟数据 const listData = [ { id: 1, title: '项目A - 博纳斯线路改造', status: 'active', progress: 75, manager: '张三' }, { id: 2, title: '项目B - 变压器安装工程', status: 'pending', progress: 0, manager: '李四' }, { id: 3, title: '项目C - 电缆敷设施工', status: 'completed', progress: 100, manager: '王五' }, ]; const tableColumns = [ { title: '项目名称', dataIndex: 'title', key: 'title' }, { title: '负责人', dataIndex: 'manager', key: 'manager' }, { title: '进度', dataIndex: 'progress', key: 'progress', render: (v: number) => `${v}%` }, { title: '状态', dataIndex: 'status', key: 'status', render: (v: string) => { const colors: Record = { active: 'processing', pending: 'default', completed: 'success' }; const texts: Record = { active: '进行中', pending: '待开始', completed: '已完成' }; return {texts[v]}; } }, ]; // ============ 布局类型1: 卡片列表 ============ const CardListDemo = () => (
{listData.map(item => (
{item.title}
负责人: {item.manager}
{item.status === 'active' ? '进行中' : item.status === 'completed' ? '已完成' : '待开始'}
))}
); // ============ 布局类型2: 表格布局 ============ const TableDemo = () => (
); // ============ 布局类型3: 网格卡片 ============ const GridCardDemo = () => (
); // ============ 布局类型4: 时间线布局 ============ const TimelineDemo = () => (
项目启动
2026-03-01 - 确定项目范围和团队 ), }, { color: 'blue', children: ( <> 施工准备
2026-03-05 - 材料采购、人员调配 ), }, { color: 'blue', children: ( <> 施工进行中
2026-03-10 - 开始现场施工 ), }, { color: 'gray', children: ( <> 竣工验收
预计 2026-04-01 ), }, ]} />
); // ============ 布局类型5: 瀑布流/Feed布局 ============ const FeedDemo = () => (
(
{item.avatar}
{item.author} {item.date}
{item.title} {item.description}
评论
)} />
); // ============ 布局类型6: 详情页布局 ============ const DetailDemo = () => (
项目详情 进行中
项目名称
博纳斯线路改造工程客户
博纳斯稀土开采公司项目经理
罗仕林合同金额
¥1,250,000开工日期
2026-03-01预计完工
2026-05-30 项目描述 本项目包括7公里22kV高压线路改造,以及1250kVA变压器安装工程。 施工地点位于老挝博纳斯矿区,需考虑当地气候条件。
施工进度
); // ============ 布局对比总结 ============ const ComparisonTable = () => (
); return (
布局样式预览 此页面展示各种常见UI布局类型,帮助开发者选择合适的布局方式
); }; export default LayoutShowcase;