fix(ui): 修复登录与并发请求并统一表格、主题和页面展示
验证:868 项单测、ESLint、Prettier、UI 依赖审计和差异检查通过。
This commit is contained in:
+23
-10
@@ -130,9 +130,11 @@ const ORG_USER_NAV_PATHS = {
|
||||
keyManagement: ['/key-management', '/user-center/key-management'],
|
||||
userCenter: ['/user-center'],
|
||||
};
|
||||
const matchesPathPrefix = (pathname, prefix) =>
|
||||
pathname === prefix || pathname.startsWith(`${prefix}/`);
|
||||
const isOrgAllowedPath = (pathname, extraPrefixes = []) =>
|
||||
[...ORG_ALLOWED_PREFIXES, ...extraPrefixes].some(
|
||||
(p) => pathname === p || pathname.startsWith(p + '/'),
|
||||
[...ORG_ALLOWED_PREFIXES, ...extraPrefixes].some((prefix) =>
|
||||
matchesPathPrefix(pathname, prefix),
|
||||
);
|
||||
|
||||
// 模型超市旧路径 /pricing → /market。用组件而非静态 <Navigate>,
|
||||
@@ -220,27 +222,38 @@ function App() {
|
||||
// /org,从此无任何路径把平台技能加入企业技能库——技能库与分发页永远为空。
|
||||
// 顶栏开关的本意是收敛"员工浏览目录",不应连带阉割企业治理能力,故对
|
||||
// 管理员无条件放行该路由(页面内部仍按 skill_manage 决定是否出现启用按钮)。
|
||||
if (isOrgAdmin && !prefixes.includes('/skill-market')) {
|
||||
if (
|
||||
orgMembershipLoaded &&
|
||||
isOrgAdmin &&
|
||||
!prefixes.includes('/skill-market')
|
||||
) {
|
||||
prefixes.push('/skill-market');
|
||||
}
|
||||
return prefixes;
|
||||
}, [statusState?.status?.HeaderNavModulesOrgUser, isOrgAdmin]);
|
||||
}, [
|
||||
statusState?.status?.HeaderNavModulesOrgUser,
|
||||
orgMembershipLoaded,
|
||||
isOrgAdmin,
|
||||
]);
|
||||
|
||||
// 路由级封锁:org_only 员工访问非企业路由一律回到企业空间。
|
||||
// 仅在企业中心可用时启用,避免企业中心被全局关闭时与其内部回退跳转形成重定向死循环。
|
||||
// 企业列表未到位前不做封锁判定:isOrgAdmin 首帧恒 false,此时若直接重定向,
|
||||
// 硬刷新/收藏夹直达 /skill-market 的 org_only 管理员会在放行判据还没算出来时
|
||||
// 就被弹回 /org,而重定向不可逆——之后 isOrgAdmin 变 true 也回不去。
|
||||
// 只有技能超市的企业管理员特例需要等待企业列表;等待时也不挂载受限页面。
|
||||
const routePath = location.pathname.toLowerCase();
|
||||
const orgConfined =
|
||||
userState?.user?.org_only_mode === true &&
|
||||
orgMembershipLoaded &&
|
||||
isOrgCenterAvailable &&
|
||||
!isOrgAllowedPath(location.pathname, orgUserAllowedPrefixes);
|
||||
!isOrgAllowedPath(routePath, orgUserAllowedPrefixes);
|
||||
|
||||
if (orgConfined) {
|
||||
return (
|
||||
<SetupCheck>
|
||||
<Navigate to='/org' replace />
|
||||
{!orgMembershipLoaded &&
|
||||
matchesPathPrefix(routePath, '/skill-market') ? (
|
||||
<Loading />
|
||||
) : (
|
||||
<Navigate to='/org' replace />
|
||||
)}
|
||||
</SetupCheck>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user