refactor: 前端登录/权限/界面状态迁移至 zustand

This commit is contained in:
2026-08-04 14:41:27 +08:00
parent ce1dcc07ea
commit f07ffdc64c
39 changed files with 970 additions and 211 deletions
@@ -28,9 +28,16 @@ export const buildTeacherCandidateLabel = (user: TeacherCandidateUser) => {
displayName && displayName !== user.username
? `${displayName}${user.username}`
: user.username;
const roleNames = [...new Set((user.roles || []).map((role) => role.name).filter(Boolean))];
const roleNames = [
...new Set((user.roles || []).flatMap((role) => (role.name ? [role.name] : []))),
];
const subjects = [
...new Set((user.profile?.subjects || []).map((subject) => subject.trim()).filter(Boolean)),
...new Set(
(user.profile?.subjects || []).flatMap((subject) => {
const trimmed = subject.trim();
return trimmed ? [trimmed] : [];
}),
),
];
return [identity, roleNames.join('/'), subjects.join('/')].filter(Boolean).join(' · ');