Ready for Review
作为企业用户, 我希望通过手机号密码登录小程序并查看企业概览数据, 以便快速了解公司残疾人就业管理情况。
mini/src/pages/login/index.tsx为企业用户登录页)docs/小程序原型/yongren.html 第218-260行enterpriseAuthClient)enterpriseAuthClient 已可用)enterpriseAuthClient.login接口{phone: string, password: string}/^1[3-9]\d{9}$/(已在现有登录页面实现)useEnterpriseAuth钩子管理认证状态/pages/yongren/dashboard/indexEnterpriseAuthProvider和useEnterpriseAuth钩子useEnterpriseAuth().logout()方法YongrenTabBarLayout作为页面布局,首页标签激活状态PageContainer作为内容容器mini/src/pages/yongren/dashboard/index.tsxenterpriseCompanyClient.overview.get()获取企业概览数据enterpriseCompanyClient.allocations.recent.get()获取近期分配人才列表docs/小程序原型/yongren.html 第276-300行docs/小程序原型/yongren.html 第323-376行docs/小程序原型/yongren.htmlmini/tests/yongren-api.test.ts添加登录API测试useEnterpriseAuth钩子的状态管理YongrenTabBarLayout的集成PageContainer的兼容性依赖故事011.001(基础框架搭建):
mini/src/api.ts:
enterpriseAuthClient - 企业用户认证API(路径前缀:/api/v1/yongren/auth)enterpriseCompanyClient - 企业统计API(路径前缀:/api/v1/yongren/company)enterpriseDisabilityClient - 人才扩展API(路径前缀:/api/v1/yongren/disability-person)channelClient, companyClient, disabilityClient, orderClient, platformClient, salaryClient - Allin系统模块pages/login/index(改造为企业用户登录页)YongrenTabBarLayout - 用人方小程序底部导航布局组件(已包含首页、人才、订单、数据、设置5个导航项)UserStatusBar - 用户状态栏组件(显示用户信息和通知)PageContainer - 页面容器组件(统一页面布局和样式)EnterpriseAuthProvider - 企业认证上下文提供者useEnterpriseAuth - 企业认证钩子(提供登录、登出、状态管理功能)企业用户认证API(史诗012提供,已通过故事011.001集成):
enterpriseAuthClient(已在mini/src/api.ts中可用)POST /login - 企业用户手机号密码登录接口{phone: string, password: string}token和userInfo的企业用户认证信息GET /me - 用户信息获取接口POST /logout - 用户登出接口POST /refresh-token - token刷新接口使用示例:
import { enterpriseAuthClient } from '@/api'
// 登录调用
const response = await enterpriseAuthClient.login.post({
json: { phone: '13800138000', password: 'password123' }
})
企业统计API(史诗012提供,已通过故事011.001集成):
enterpriseCompanyClient(已在mini/src/api.ts中可用)GET /overview - 企业概览数据接口(在职人员统计、待分配人才数、本月订单数等)GET /stats/real-time - 实时数据更新接口GET /employees - 在职人员列表GET /allocations/recent - 近期分配人才列表使用示例:
import { enterpriseCompanyClient } from '@/api'
// 获取企业概览数据
const overview = await enterpriseCompanyClient.overview.get()
技术集成:
mini/src/api.ts的RPC客户端模式(Hono RPC客户端)api/v1/yongrenuseEnterpriseAuth钩子管理登录状态、token存储和验证登录页面设计规范:
必须严格对照原型文件 docs/小程序原型/yongren.html 第218-260行的登录页面设计实现:
页面结构:
h-full flex flex-col justify-center p-8Logo区域(第232-235行):
<h1 class="text-2xl font-bold text-gray-800 mb-2">残疾人就业平台</h1><p class="text-gray-600">为人力资源公司提供专业服务</p>text-center mb-10表单区域(第237-246行):
mb-6flex items-center border border-gray-300 rounded-lg px-4 py-3 mb-4<i class="fas fa-phone text-gray-400 mr-3"></i>,输入框 <input type="tel" placeholder="请输入手机号" class="w-full outline-none"><i class="fas fa-lock text-gray-400 mr-3"></i>,输入框 <input type="password" placeholder="请输入密码" class="w-full outline-none">登录按钮(第248行):
<button class="gradient-bg text-white w-full py-3 rounded-lg font-medium mb-4">登录</button>辅助链接(第250-256行):
<a href="#" class="text-sm text-blue-500">忘记密码?</a>,布局 text-center<div class="mt-12 text-center text-gray-500 text-sm"><span class="text-blue-500">《用户协议》</span> 和 <span class="text-blue-500">《隐私政策》</span>首页/看板页面设计规范:
必须严格对照原型文件 docs/小程序原型/yongren.html 第261-418行的首页设计实现:
页面结构:
h-[calc(100%-60px)] overflow-y-auto p-4(仅减去底部导航60px)顶部信息栏(第276-300行):
gradient-bg text-white rounded-2xl p-5 mb-4flex justify-between items-center
<p class="text-sm opacity-80">欢迎回来</p>,企业名称 <h2 class="text-xl font-bold">阿里巴巴集团</h2><div class="w-12 h-12 rounded-full bg-white/20 flex items-center justify-center"><i class="fas fa-building text-white text-xl"></i></div>mt-4 flex justify-between,三个卡片横向排列
text-center,数字 <p class="text-2xl font-bold">24</p>,标签 <p class="text-xs opacity-80">在职人员</p>快速操作网格(第303-320行):
grid grid-cols-4 gap-3 mb-4bg-blue-50 rounded-xl p-3 text-center(四种颜色:blue-50, green-50, purple-50, yellow-50)fas fa-user-friends text-blue-500 text-lg mb-1(对应操作)text-xs text-gray-700人才列表区域(第323-376行):
flex justify-between items-center mb-3,标题 <h3 class="font-semibold text-gray-700">分配人才</h3>,链接 <a href="#" class="text-xs text-blue-500">查看全部</a>space-y-3person-card card bg-white p-4 flex items-center
name-avatar blue(颜色类:blue, green, purple, orange),显示姓氏flex-1flex justify-between items-start
<h4 class="font-semibold text-gray-800">张明</h4><p class="text-xs text-gray-500">肢体残疾 · 三级</p><span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">在职</span>mt-2
flex justify-between text-xs text-gray-500 mb-1,显示入职时间、薪资.progress-bar 和 .progress-fill 样式数据统计卡片(第379-394行):
<h3 class="font-semibold text-gray-700 mb-3">数据统计</h3>grid grid-cols-2 gap-3stat-card(见基础样式规范)
.pulse-dot,标签 <p class="text-sm text-gray-600">在职率</p>,数值 <p class="text-2xl font-bold text-gray-800">92%</p><p class="text-sm text-gray-600 mb-2">平均薪资</p>,数值 <p class="text-2xl font-bold text-gray-800">¥4,650</p>UI组件使用:
@d8d/allin-*系列UI包页面组件位置:
mini/src/pages/login/index.tsx - 登录页面组件(已由故事011.001改造为企业用户登录页)
mini/src/pages/yongren/login/目录已删除,统一使用现有登录页面mini/src/pages/yongren/dashboard/index.tsx - 首页/看板页面组件(需要创建)
YongrenTabBarLayout布局组件,首页标签激活状态mini/src/pages/yongren/dashboard/目录状态管理位置:
mini/src/utils/auth.tsx - 企业认证上下文提供者(EnterpriseAuthProvider)
useEnterpriseAuth钩子,提供登录、登出、状态管理功能mini/src/stores/auth.ts用于普通用户认证,企业用户使用统一的企业认证框架mini/src/hooks/useEnterpriseAuth.ts - 企业认证钩子(如果已抽取为独立hook)测试框架:Jest + Testing Library 已有测试基础(故事011.001已实现):
mini/tests/yongren-api.test.ts - API客户端集成测试mini/tests/yongren-routes.test.ts - 路由配置测试mini/tests/yongren-components.test.tsx - 布局组件测试关键测试场景:
enterpriseAuthClient.login)/^1[3-9]\d{9}$/)enterpriseCompanyClient.overview.get())YongrenTabBarLayout的集成测试useEnterpriseAuth钩子的状态管理)| 日期 | 版本 | 描述 | 作者 |
|---|---|---|---|
| 2025-12-17 | 1.0 | 初始创建(拆分后的认证与首页故事) | Bob(Scrum Master) |
| 2025-12-18 | 1.1 | 根据故事011.001完成情况更新依赖关系、API规范、文件位置和技术细节 | Bob(Scrum Master) |
| 2025-12-18 | 1.2 | 完成故事实施:登录页面UI更新、首页实现、认证状态管理增强、集成测试 | James(开发代理) |
实施代理: James (全栈开发者) 实施日期: 2025-12-18 实施状态: ✅ 完成 Agent Model Used: claude-sonnet
已完成故事011.002的所有任务,实现企业用户登录页面和首页仪表板功能:
docs/小程序原型/yongren.html 第218-260行设计规范mini/src/pages/login/index.tsx,采用原型设计样式,保持现有企业认证逻辑mini/src/utils/auth.tsx存储refresh_token,添加mini/src/utils/rpc-client.ts token自动刷新逻辑mini/src/pages/yongren/dashboard/index.tsx及index.css,集成企业统计APImini/src/hooks/useRequireAuth.ts保护需要认证的页面mini/tests/yongren-api.test.ts添加企业认证API测试修改的文件:
mini/src/pages/login/index.tsx - 登录页面UI更新mini/src/utils/auth.tsx - 认证逻辑增强,支持refresh_token存储mini/src/utils/rpc-client.ts - 添加token自动刷新机制mini/src/pages/yongren/dashboard/index.tsx - 首页组件完整实现mini/src/pages/yongren/dashboard/index.css - 首页样式文件(新建)mini/src/hooks/useRequireAuth.ts - 认证检查中间件hook(新建)mini/tests/yongren-api.test.ts - 扩展API测试验证结果:
来自QA代理对已完成故事实施的QA审查结果