临时跳过所有板块的企业微信授权限制,方便本地开发和调试。
所有板块和模块的路由守卫都已临时注释:
/customer-service/*)/designer/*)/team-leader/*)/finance/*)/hr/*)/admin/*)/wxwork/:cid/*)yss-project/src/app/app.routes.ts{
path: 'customer-service',
loadComponent: () => import('./pages/customer-service/customer-service-layout/customer-service-layout').then(m => m.CustomerServiceLayout),
// canActivate: [WxworkAuthGuard], // 临时注释,方便本地开发
children: [...]
}
{
path: 'designer',
// canActivate: [WxworkAuthGuard], // 临时注释,方便本地开发
children: [...]
}
{
path: 'team-leader',
// canActivate: [WxworkAuthGuard], // 临时注释,方便本地开发
children: [...]
}
{
path: 'finance',
// canActivate: [WxworkAuthGuard], // 临时注释,方便本地开发
children: [...]
}
{
path: 'hr',
loadComponent: () => import('./pages/hr/hr-layout/hr-layout').then(m => m.HrLayout),
// canActivate: [WxworkAuthGuard], // 临时注释,方便本地开发
children: [...]
}
{
path: 'admin',
loadComponent: () => import('./pages/admin/admin-layout/admin-layout').then(m => m.AdminLayout),
// canActivate: [WxworkAuthGuard], // 临时注释,方便本地开发
children: [...]
}
{
path: 'wxwork/:cid',
// canActivate: [WxworkAuthGuard], // 临时注释,方便本地开发
children: [
// 项目详情、客户画像、项目问卷等
]
}
示例(假设公司ID为cDL6R1hgSi):
cd yss-project
npm run start
或
cd yss-project
ng serve --port 4200
无需企业微信授权,直接在浏览器中访问任意页面URL。
如果页面需要加载数据,确保设置了公司ID:
// 在浏览器控制台运行
localStorage.setItem('company', 'your-company-id-here');
然后刷新页面。
在部署到生产环境之前,必须取消所有路由守卫的注释,恢复企业微信授权验证:
// yss-project/src/app/app.routes.ts
// 客服路由
{
path: 'customer-service',
loadComponent: () => import('./pages/customer-service/customer-service-layout/customer-service-layout').then(m => m.CustomerServiceLayout),
canActivate: [WxworkAuthGuard], // 取消注释
children: [...]
}
// 设计师路由
{
path: 'designer',
canActivate: [WxworkAuthGuard], // 取消注释
children: [...]
}
// 组长路由
{
path: 'team-leader',
canActivate: [WxworkAuthGuard], // 取消注释
children: [...]
}
// 财务路由
{
path: 'finance',
canActivate: [WxworkAuthGuard], // 取消注释
children: [...]
}
// 人事路由
{
path: 'hr',
loadComponent: () => import('./pages/hr/hr-layout/hr-layout').then(m => m.HrLayout),
canActivate: [WxworkAuthGuard], // 取消注释
children: [...]
}
// 管理员路由
{
path: 'admin',
loadComponent: () => import('./pages/admin/admin-layout/admin-layout').then(m => m.AdminLayout),
canActivate: [WxworkAuthGuard], // 取消注释
children: [...]
}
查看 yss-project/src/app/app.routes.ts,确认所有 canActivate: [WxworkAuthGuard] 都已注释。
逐个访问各板块的页面,确认可以正常打开:
# 客服
http://localhost:4200/customer-service/dashboard
# 设计师
http://localhost:4200/designer/dashboard
# 组长
http://localhost:4200/team-leader/dashboard
# 财务
http://localhost:4200/finance/dashboard
# 人事
http://localhost:4200/hr/dashboard
# 管理员
http://localhost:4200/admin/dashboard
打开浏览器开发者工具(F12),查看控制台:
/)原因:可能有子路由单独配置了守卫
解决方法:
canActivate原因:API请求可能需要授权token
解决方法:
原因:缺少公司ID或用户信息
解决方法:
// 在浏览器控制台设置
localStorage.setItem('company', 'your-company-id');
localStorage.setItem('Parse/ProfileId', 'your-profile-id');
| 日期 | 修改内容 | 修改人 |
|---|---|---|
| 2024-10-25 | 跳过客服板块授权 | AI Assistant |
| 2024-10-25 | 跳过所有板块授权 | AI Assistant |
完成时间: 2024-10-25
开发者: AI Assistant
状态: ✅ 已完成
环境: 本地开发专用
安全级别: ⚠️ 仅用于开发,生产环境必须恢复