From caeaadfed06b1be77b0b7bd04d7c236d9895468e Mon Sep 17 00:00:00 2001 From: Pine Date: Mon, 24 Aug 2026 18:29:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=B9=B3=E5=8F=B0=E7=AB=AF):=20=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E7=AB=AF=E5=8F=AA=E4=BF=9D=E7=95=99=E8=BF=90=E8=90=A5?= =?UTF-8?q?(operator)=E5=8D=95=E4=B8=80=E8=A7=92=E8=89=B2=20=E2=80=94=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=85=B6=E5=AE=83=E7=AB=AF=E5=8F=A3/?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rbac NAV「总览」由 8 端口开放改为仅 operator(平台端单一角色);其它端口(政务/企业/服务商/投资人/OPC/载体/开发者)不再作为平台端角色入口。 - 平台登录:多身份时仅展示 operator 身份(过滤其它端口),其余端口走各自端(园区账密等)入口。 - npm run build 通过。 --- src/lib/rbac.tsx | 3 ++- src/pages/login/index.tsx | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/rbac.tsx b/src/lib/rbac.tsx index 93e91ca..c05d93a 100644 --- a/src/lib/rbac.tsx +++ b/src/lib/rbac.tsx @@ -29,7 +29,8 @@ export interface NavGroup { export const NAV: NavGroup[] = [ { items: [ - { to: "/", label: "总览", icon: LayoutDashboard, roles: ["operator", "government", "enterprise", "carrier", "provider", "investor", "opc", "developer"] }, + // 平台端只保留运营(operator)单一角色;其它端口(政务/企业/服务商/投资/OPC/载体等)不作为平台端角色入口 + { to: "/", label: "总览", icon: LayoutDashboard, roles: ["operator"] }, ], }, { diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index afd43a5..f7107ea 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -43,8 +43,9 @@ export default function LoginPage() { setLoading(true); try { const res = await login(username, password); - // 多身份:进入身份选择 - if (res && res.identities.length > 1) setPendingIds(res.identities); + // 平台端只保留运营(operator)单一角色:过滤其它端口身份(政务/企业/载体/服务商等) + const operatorIds = (res?.identities ?? []).filter((i) => i.role === "operator"); + if (operatorIds.length > 1) setPendingIds(operatorIds); else navigate("/", { replace: true }); } catch (err) { setError(err instanceof Error ? err.message : "登录失败");