Commit Graph

17 Commits

Author SHA1 Message Date
lzh
680c965a27 新增: 多项目切换 + 业务平台 SSO 单点跳转
核心功能:
1. 多项目切换:header 新增 ProjectDropdown,切项目时自动刷新权限菜单
2. 业务平台 SSO:header 新增「业务平台」按钮,OAuth2 授权码流程无感跳转
3. SSO 回调:/sso-callback 页面接收业务平台跳回的 code,换 IoT token 登录

共享包改动:
- packages/stores:access store 新增 projectId 字段并加入持久化
- packages/effects/layouts:新增 ProjectDropdown 共享组件

apps/web-antd 改动:
- api/request.ts:
  · project-id 请求头仅在非 null 时设置(避免 axios 把 null 序列化为字符串 "null")
  · X-Client-Id 改读 VITE_APP_CLIENT_ID,允许多个壳应用各自声明
- api/core/sso.ts:ssoCallback 参数走 body,避免 code 出现在浏览器历史/nginx 日志
- api/system/project:新增项目 simple-list API
- constants/sso.ts:集中 IOT_CLIENT_ID/BIZ_CLIENT_ID 等常量;
  generateOauthState 用 crypto.randomUUID 生成 state,替代不安全的 Math.random
- store/auth.ts:抽 completeLogin 公共收尾逻辑,新增 ssoLogin 复用
- views/_core/authentication/sso-callback.vue:SSO 回调页;
  dev 模式保留时延日志,失败时通过 query 透给登录页
- router/routes/core.ts:/sso-callback 路由 + beforeEnter 守卫
  (缺 code 直接拦回登录页,避免死循环)
- layouts/basic.vue:
  · 以 ProjectDropdown 替换 TenantDropdown(列表拉取失败兜底隐藏)
  · 切项目时调用 fetchUserInfo,避免菜单/权限陈旧
  · 新增「业务平台」跳转按钮;state 写 sessionStorage,
    生产缺 VITE_BIZ_BASE_URL 时显式报错而非静默回 localhost
  · setInterval 在 onUnmounted 中清理

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 11:40:03 +08:00
YunaiV
9f8e7533fb fix:租户切换首次无法加载的问题 2025-05-06 22:22:32 +08:00
xingyu4j
bd02645e26 perf: 优化 租户切换 2025-05-06 15:44:31 +08:00
xingyu4j
64ee81c327 feat: 增加切换租户功能 2025-05-06 14:11:46 +08:00
xingyu4j
50d028f6b8 Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev 2025-04-28 10:06:29 +08:00
Netfan
aa27a2f7a1 feat: encrypt the privacy data when it is persisted (#6056)
* 对私密数据持久化时执行加密
* 将锁屏密码合并到accessStore中进行加密
2025-04-27 20:59:10 +08:00
YunaiV
c0a92a5694 refactor:基于 lint 处理排版(框架层面) 2025-04-22 22:17:41 +08:00
YunaiV
c2358e2132 feat: request && login && router【e6939e22】(login.vue 和 request.ts 增加租户的选择) 2025-03-20 23:12:55 +08:00
YunaiV
3c3886e345 feat: request && login && router【e6939e22】(不包括 login.vue 和 request.ts) 2025-03-20 12:34:02 +08:00
Vben
081d2aed23 perf: format code with better style (#5283) 2025-01-01 11:39:49 +08:00
Netfan
0f756503ff feat: add demo for modify menu badge data 2024-12-16 12:45:07 +08:00
Vben
29f572abd3 chore: chore(deps): bump pinia-plugin-persistedstate from 3.2.3 to 4.0.1 (#4392) 2024-09-13 22:08:55 +08:00
Vben
2288827265 fix: fixed the failure to refresh the page when login failed (#4204) 2024-08-20 22:33:25 +08:00
vben
89dcf522f5 refactor: Separate store 2024-07-30 21:10:28 +08:00
vince
14538f7ed5 refactor(project): re-adjust the overall folder 2024-07-23 00:03:59 +08:00
vben
fed47f5e05 refactor: refacotr preference 2024-06-01 23:15:29 +08:00
vben
399334ac57 chore: init project 2024-05-19 21:20:42 +08:00