From ad21933303444585fe211bf4ab3023f10e678c70 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 Apr 2026 10:34:18 +0800 Subject: [PATCH] docs: add enhanced homepage implementation plan Add detailed step-by-step implementation plan for enhanced homepage with 6 quick action buttons, responsive grid layout, and 60vh statistics placeholder area. Includes 7 comprehensive tasks with complete code examples. Co-Authored-By: Claude Sonnet 4.6 --- .../plans/2026-04-01-enhanced-homepage.md | 820 ++++++++++++++++++ 1 file changed, 820 insertions(+) create mode 100644 docs/superpowers/plans/2026-04-01-enhanced-homepage.md diff --git a/docs/superpowers/plans/2026-04-01-enhanced-homepage.md b/docs/superpowers/plans/2026-04-01-enhanced-homepage.md new file mode 100644 index 0000000..496b17f --- /dev/null +++ b/docs/superpowers/plans/2026-04-01-enhanced-homepage.md @@ -0,0 +1,820 @@ +# 增强版首页实施计划 + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**目标:** 扩展首页快捷按钮从3个到6个,添加统计数据预留区域,优化响应式布局 + +**架构:** 在现有首页基础上扩展,复用 QuickActionCard 组件,新增 QuickActionsGrid 和 StatisticsPlaceholder 组件,使用 CSS Grid 实现响应式布局 + +**技术栈:** React 18, TypeScript, Ant Design 5.x, UmiJS 4.x, @ant-design/icons + +--- + +## 文件结构 + +``` +src/ +├── pages/ +│ ├── index.tsx [修改] 增强版首页主组件 +│ └── components/ +│ ├── QuickActionCard.tsx [保留] 快捷卡片组件(已存在) +│ ├── QuickActionsGrid.tsx [新建] 6按钮网格布局组件 +│ └── StatisticsPlaceholder.tsx [新建] 统计数据预留区域组件 +└── common/ + └── components/ + └── layout/ + ├── QuickActionIcons.tsx [保留] Header快捷图标(保持不变) + └── CustomHeader.tsx [保留] Header组件(保持不变) +``` + +--- + +## Task 1: 创建 StatisticsPlaceholder 组件 + +**Files:** +- Create: `src/pages/components/StatisticsPlaceholder.tsx` + +**职责:** 统计数据预留区域组件,当前显示空白,为未来扩展预留空间 + +- [ ] **Step 1: 创建组件文件** + +```bash +touch src/pages/components/StatisticsPlaceholder.tsx +``` + +- [ ] **Step 2: 实现组件** + +```tsx +import React from 'react'; + +const StatisticsPlaceholder: React.FC = () => { + return ( +
+ {/* 未来扩展:统计数据卡片、图表、报表等 */} +
+ {/* 当前阶段:完全空白,便于未来扩展 */} +
+
+ ); +}; + +export default StatisticsPlaceholder; +``` + +- [ ] **Step 3: 提交组件** + +```bash +git add src/pages/components/StatisticsPlaceholder.tsx +git commit -m "feat: create StatisticsPlaceholder component + +Add placeholder component for future statistics area with 60vh height." +``` + +--- + +## Task 2: 创建 QuickActionsGrid 组件 + +**Files:** +- Create: `src/pages/components/QuickActionsGrid.tsx` + +**职责:** 6个快捷按钮的网格布局组件,使用 CSS Grid 实现响应式布局 + +- [ ] **Step 1: 创建组件文件** + +```bash +touch src/pages/components/QuickActionsGrid.tsx +``` + +- [ ] **Step 2: 实现组件** + +```tsx +import React from 'react'; +import { + BuildOutlined, + ImportOutlined, + TeamOutlined, + BuildColumnsOutlined, + DollarOutlined, + AuditOutlined, +} from '@ant-design/icons'; +import QuickActionCard from './QuickActionCard'; + +const QuickActionsGrid: React.FC = () => { + const quickActions = [ + { + icon: , + title: '添加机构', + description: '快速创建新的机构', + themeColor: '#1890ff', + path: '/company/list', + }, + { + icon: , + title: '导入项目', + description: '批量导入项目数据', + themeColor: '#52c41a', + path: '/asset/list', + }, + { + icon: , + title: '导入员工', + description: '批量导入员工数据', + themeColor: '#fa8c16', + path: '/company/employees', + }, + { + icon: , + title: '导入楼栋', + description: '批量导入楼栋数据', + themeColor: '#722ed1', + path: '/asset/houses', + }, + { + icon: , + title: '创建收费标准', + description: '创建费用收费标准', + themeColor: '#13c2c2', + path: '/charge/standard', + }, + { + icon: , + title: '登记审核', + description: '审核登记申请', + themeColor: '#f5222d', + path: '/examine/house_registers_audit', + }, + ]; + + return ( +
+ {quickActions.map((action) => ( + + ))} +
+ ); +}; + +export default QuickActionsGrid; +``` + +- [ ] **Step 3: 添加响应式样式** + +在文件末尾添加响应式样式: + +```tsx +export default QuickActionsGrid; + +// 添加响应式样式到全局 CSS 或使用 style 标签 +const style = document.createElement('style'); +style.innerHTML = ` + @media (max-width: 1200px) { + .quick-actions-grid { + grid-template-columns: repeat(3, 1fr) !important; + gap: 20px !important; + } + } + + @media (max-width: 768px) { + .quick-actions-grid { + grid-template-columns: repeat(2, 1fr) !important; + gap: 12px !important; + } + } +`; +document.head.appendChild(style); +``` + +或者更好的方式,使用内联 style 标签在组件中: + +```tsx +return ( + <> +
+ {quickActions.map((action) => ( + + ))} +
+ + +); +``` + +- [ ] **Step 4: 提交组件** + +```bash +git add src/pages/components/QuickActionsGrid.tsx +git commit -m "feat: create QuickActionsGrid component with 6 action buttons + +Add responsive grid layout for 6 quick action buttons with breakpoints for desktop (6), tablet (3x2), and mobile (2x3)." +``` + +--- + +## Task 3: 修改首页主组件 index.tsx + +**Files:** +- Modify: `src/pages/index.tsx` + +**职责:** 重新设计首页结构,使用新组件,添加统计数据预留区域 + +- [ ] **Step 1: 备份当前文件** + +```bash +cp src/pages/index.tsx src/pages/index.tsx.backup +``` + +- [ ] **Step 2: 完全替换首页内容** + +```tsx +import { useMyState } from '@/common'; +import QuickActionsGrid from './components/QuickActionsGrid'; +import StatisticsPlaceholder from './components/StatisticsPlaceholder'; + +export default function Index() { + const { snap } = useMyState(); + const username = snap.session?.user?.username || '用户'; + + return ( +
+ {/* 欢迎语区域 */} +
+

+ 欢迎回来,{username}! +

+

+ 这里是您的快捷工作台,点击下方卡片快速开始常用操作 +

+
+ + {/* 快捷操作区域 */} + + + {/* 统计数据预留区域 */} + +
+ ); +} +``` + +- [ ] **Step 3: 删除旧的响应式样式** + +如果之前的代码中有 `