作为 人才小程序开发者, 我想要 调整个人信息页面的布局和样式以符合原型设计, 以便 用户获得与原型一致的视觉体验和交互体验。
现有实现状态:
原型设计参考:
docs/小程序原型/rencai.html 提供了个人信息页面的完整原型设计发现的主要差异:
技术依赖:
技术栈:
bg-gradient-to-b from-blue-500 to-blue-700)bg-blue-50)bg-blue-100 蓝色文字 text-blue-800)text-lg font-bold)grid grid-cols-2 gap-3)border border-gray-200 rounded-lg)@d8d/rencai-personal-info-ui中创建UserInfoHeader.tsx组件bg-gradient-to-b from-blue-500 to-blue-700)w-16 h-16 rounded-full)border-2 border-white)text-xl font-bold)bg-white/20)rounded-full p-2)i-heroicons-camera-20-solid)BankCardInfo.tsx组件卡片容器样式:
bg-blue-50)BankCardItem.tsx组件布局样式:
font-medium text-gray-800)text-lg font-bold text-gray-800)text-sm text-gray-600)text-sm text-gray-600 mt-2)bg-blue-100)text-blue-800)text-xs px-2 py-1 rounded-full)BankCardInfo.tsx中添加"添加"按钮:
text-blue-500)i-heroicons-plus-20-solid)text-sm)DocumentPhotos.tsx组件容器布局:
grid grid-cols-2 gap-3)DocumentPhotoItem.tsx组件样式:
border border-gray-200 rounded-lg)p-3)text-center)aspect-square)rounded-lg)bg-gray-100)mx-auto mb-2)i-heroicons-document-20-solid)text-gray-400)text-2xl)text-center)text-xs)text-gray-600)line-clamp-1)PersonalInfoPage.tsx中Navbar的title属性tests/pages/PersonalInfoPage/PersonalInfoPage.test.tsx:
tests/unit/components/PersonalBasicInfo.test.tsx(如果需要)tests/unit/components/BankCardItem.test.tsx:
tests/unit/components/DocumentPhotoItem.test.tsx:
pnpm typecheck确保类型检查通过来源: docs/小程序原型/rencai.html (行483-628)
顶部用户信息区域 (行498-513):
<div class="gradient-bg text-white p-5">
<div class="flex justify-between items-start">
<div class="flex items-center">
<div class="w-16 h-16 rounded-full border-2 border-white mr-4 bg-blue-500 flex items-center justify-center text-white text-xl font-bold">
张
</div>
<div>
<h2 class="text-xl font-bold">张明</h2>
<p class="text-sm opacity-80">肢体残疾 · 三级 · 在职</p>
</div>
</div>
<button class="bg-white/20 rounded-full p-2">
<i class="fas fa-camera text-white"></i>
</button>
</div>
</div>
银行卡信息卡片 (行556-573):
<div class="card bg-white p-4 mb-4">
<div class="flex justify-between items-center mb-3">
<h3 class="font-semibold text-gray-700">银行卡信息</h3>
<button class="text-blue-500 text-sm">
<i class="fas fa-plus mr-1"></i>添加
</button>
</div>
<div class="bg-blue-50 rounded-lg p-4">
<div class="flex justify-between items-center mb-2">
<p class="font-medium text-gray-800">中国工商银行</p>
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full">默认</span>
</div>
<p class="text-sm text-gray-600 mb-1">储蓄卡</p>
<p class="text-lg font-bold text-gray-800">**** **** **** 5678</p>
<p class="text-sm text-gray-600 mt-2">持卡人:张明</p>
</div>
</div>
证件照片 (行575-604):
<div class="card bg-white p-4">
<h3 class="font-semibold text-gray-700 mb-3">证件照片</h3>
<div class="grid grid-cols-2 gap-3">
<div class="border border-gray-200 rounded-lg p-3 text-center">
<div class="w-12 h-12 rounded-lg bg-gray-100 flex items-center justify-center mx-auto mb-2">
<i class="fas fa-id-card text-gray-400"></i>
</div>
<p class="text-xs text-gray-600">身份证</p>
</div>
<!-- 其他证件类型... -->
</div>
</div>
故事017.003完成状态:
故事017.012完成状态:
leftIcon="" leftText="")故事017.013完成状态:
来源: architecture/tech-stack.md
运行时和框架:
测试框架:
来源: architecture/mini-ui-package-standards.md
关键规范要求:
重要: 在Taro小程序中,<View> 组件内的子元素默认是横向布局(flex-row),需要显式添加 flex flex-col 类才能实现垂直布局。
正确示例:
// ✅ 正确: 使用 flex flex-col 实现垂直布局
<View className="flex flex-col">
<Text>姓名: 张三</Text>
<Text>性别: 男</Text>
</View>
// ❌ 错误: 缺少 flex flex-col,子元素会横向排列
<View>
<Text>姓名: 张三</Text>
<Text>性别: 男</Text>
</View>
必须使用Heroicons图标类:不要使用emoji或文本符号。
图标类命名格式:i-heroicons-{icon-name}-{size}-{style}
正确示例:
// ✅ 正确: 使用Heroicons图标类
<View className="i-heroicons-camera-20-solid w-5 h-5 text-white" />
<View className="i-heroicons-plus-20-solid text-blue-500" />
<View className="i-heroicons-document-20-solid text-gray-400" />
// ❌ 错误: 使用emoji或FontAwesome
<Text>📷</Text>
<i class="fas fa-camera"></i>
本故事需要的图标:
camera-20-solid - 相机图标(右上角头像编辑按钮)plus-20-solid - 加号图标(银行卡添加按钮)document-20-solid - 文档图标(证件照片占位)Tailwind CSS渐变类:
// 蓝色渐变(从上到下)
<View className="bg-gradient-to-b from-blue-500 to-blue-700">
{/* 内容 */}
</View>
// 其他常用渐变方向:
// bg-gradient-to-r (从左到右)
// bg-gradient-to-l (从右到左)
// bg-gradient-to-t (从下到上)
Tailwind CSS网格类:
// 2x2网格布局
<View className="grid grid-cols-2 gap-3">
<View>项目1</View>
<View>项目2</View>
<View>项目3</View>
<View>项目4</View>
</View>
// 其他网格配置:
// grid-cols-1 (单列)
// grid-cols-3 (三列)
// gap-4 (更大间距)
Tailwind CSS边框类:
// 完整边框
<View className="border border-gray-200 rounded-lg p-3">
{/* 内容 */}
</View>
// 其他边框样式:
// border-0 (无边框)
// border-2 (加粗边框)
// rounded (圆角)
// rounded-full (完全圆角)
来源: architecture/source-tree.md
rencai-personal-info-ui包结构:
mini-ui-packages/rencai-personal-info-ui/
├── src/
│ ├── api/
│ │ ├── talentPersonalInfoClient.ts
│ │ └── index.ts
│ ├── components/
│ │ ├── PersonalBasicInfo.tsx
│ │ ├── BankCardInfo.tsx
│ │ ├── BankCardItem.tsx
│ │ ├── DocumentPhotos.tsx
│ │ ├── DocumentPhotoItem.tsx
│ │ └── UserInfoHeader.tsx (本故事新增)
│ ├── pages/
│ │ └── PersonalInfoPage/
│ │ └── PersonalInfoPage.tsx (本故事修改)
│ ├── utils/
│ │ └── maskUtils.ts
│ └── index.ts
├── tests/
│ ├── unit/
│ │ └── components/
│ │ ├── PersonalBasicInfo.test.tsx
│ │ ├── BankCardItem.test.tsx (本故事修改)
│ │ └── DocumentPhotoItem.test.tsx (本故事修改)
│ └── pages/
│ └── PersonalInfoPage/
│ └── PersonalInfoPage.test.tsx (本故事修改)
├── package.json
├── jest.config.cjs
└── tsconfig.json
重要: UI包内部导入必须使用相对路径,不要使用别名。
正确示例:
// ✅ 正确: 使用相对路径导入同一包内的模块
import { talentPersonalInfoClient } from '../../api'
import { BankCardItem } from '../components/BankCardItem'
import UserInfoHeader from '../components/UserInfoHeader'
错误示例:
// ❌ 错误: 不要使用别名导入UI包内部的模块
import { talentPersonalInfoClient } from '@/api'
import { BankCardItem } from '@/components/BankCardItem'
import UserInfoHeader from '@/components/UserInfoHeader'
个人信息数据结构 (从故事017.003):
export interface PersonalInfoResponse {
name: string // 姓名
gender: string // 性别
idCard: string // 身份证号
disabilityId: string // 残疾证号
disabilityType: string // 残疾类型
disabilityLevel: string // 残疾等级
phone: string // 联系电话
province: string // 省份
city: string // 城市
district: string | null // 区县
detailedAddress: string | null // 详细地址
birthDate: string | null // 出生日期
jobStatus: number // 就业状态 (0-待业, 1-在职)
// ... 其他字段
}
就业状态映射:
const jobStatusMap: Record<number, string> = {
0: '待业',
1: '在职'
}
银行卡数据结构 (从故事017.003):
export interface BankCardInfo {
id: number
subBankName: string // 支行名称
bankName: string | null // 银行名称
cardNumber: string // 卡号
cardholderName: string // 持卡人姓名
cardType: string | null // 卡类型
isDefault: number // 是否默认 (0-否, 1-是)
fileUrl: string | null // 证件照片URL
}
来源: architecture/mini-ui-testing-standards.md
测试框架: Jest (mini项目使用Jest,不是Vitest!)
测试要求:
pnpm typecheck确保类型检查通过测试执行:
# 运行所有测试
cd mini-ui-packages/rencai-personal-info-ui && pnpm test
# 运行特定测试
pnpm test --testNamePattern="UserInfoHeader"
pnpm test --testNamePattern="PersonalInfoPage"
# 生成覆盖率报告
pnpm test:coverage
主要风险:
缓解措施:
来源: architecture/testing-strategy.md
测试框架:
组件测试:
布局测试:
集成测试:
回归测试:
pnpm typecheck确保类型检查通过# 运行所有测试
cd mini-ui-packages/rencai-personal-info-ui && pnpm test
# 运行特定测试
pnpm test --testNamePattern="UserInfoHeader"
pnpm test --testNamePattern="BankCardItem"
pnpm test --testNamePattern="DocumentPhotoItem"
pnpm test --testNamePattern="PersonalInfoPage"
# 生成覆盖率报告
pnpm test:coverage
| 日期 | 版本 | 描述 | 作者 |
|---|---|---|---|
| 2025-12-26 | 1.0 | 创建故事文档 | James (Dev Agent) |
此部分由开发代理在实施过程中填写
Claude Sonnet (claude-sonnet-4-20250514)
无重大调试问题。实施过程顺利。
flex flex-col 以确保正确的垂直布局(Taro 小程序规范)新增文件:
mini-ui-packages/rencai-personal-info-ui/src/components/UserInfoHeader.tsx - 顶部用户信息区域组件mini-ui-packages/rencai-personal-info-ui/tests/unit/components/UserInfoHeader.test.tsx - UserInfoHeader 组件测试修改文件:
mini-ui-packages/rencai-personal-info-ui/src/pages/PersonalInfoPage/PersonalInfoPage.tsx - 集成 UserInfoHeader,更新 Navbar 标题mini-ui-packages/rencai-personal-info-ui/src/components/BankCardInfo.tsx - 添加"添加"按钮,添加 flex flex-colmini-ui-packages/rencai-personal-info-ui/src/components/BankCardItem.tsx - 蓝色背景样式,显示持卡人姓名mini-ui-packages/rencai-personal-info-ui/src/components/DocumentPhotos.tsx - 添加 flex flex-colmini-ui-packages/rencai-personal-info-ui/src/components/DocumentPhotoItem.tsx - 添加边框样式,更新占位图标mini-ui-packages/rencai-personal-info-ui/src/components/PersonalBasicInfo.tsx - 添加 flex flex-colmini-ui-packages/rencai-personal-info-ui/tests/pages/PersonalInfoPage/PersonalInfoPage.test.tsx - 更新测试用例mini-ui-packages/rencai-personal-info-ui/tests/unit/components/BankCardItem.test.tsx - 更新测试用例mini-ui-packages/rencai-personal-info-ui/tests/unit/components/DocumentPhotoItem.test.tsx - 更新测试用例mini-ui-packages/rencai-personal-info-ui/tests/unit/components/UserInfoHeader.test.tsx - 更新测试用例以匹配新行为此部分由QA代理在审查完成后填写