Merge branch 'role' into dev

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	backend/app/services/shipping_notice/rpa_worker_heartbeat_alert.py
#	backend/app/services/voucher_check/schedule_seed.py
#	docs/features/shipping-notice/technical.md
#	docs/tec.md
#	frontend/src/features/user/views/UserProfilePage.vue
This commit is contained in:
sophie committed 2026-09-22 18:25:45 +08:00
commit bb7e0977b8
94 files changed
+4493 -388

No files matched your search

@@ -2,8 +2,9 @@
/**
* features/user/views/UserProfilePage.vue
* 用途:工作台个人中心,展示与编辑当前用户资料、语言/主题偏好,并提供修改密码入口。
* 依赖:workspace.context(WORKSPACE_KEY)、lucide 图标、vue-i18n。
* 逻辑:路由 /workspace/profile 懒加载本页;资料状态由 useWorkspaceProfile 经工作台注入,避免与工作台分叉。
* 依赖:workspace.context(WORKSPACE_KEY)、lucide 图标、vue-i18n、isPlatformAdminUser。
* 逻辑:路由 /workspace/profile 懒加载本页;资料状态由 useWorkspaceProfile 经工作台注入。
* 角色展示优先用权限组名称;旧会话缺 role_name 时再按 is_platform_admin 回退。
*/
import { computed, inject } from 'vue';
import { useI18n } from 'vue-i18n';
@@ -11,6 +12,7 @@ import {
User, Mail, Building, CreditCard, Globe, Save, Palette,
} from 'lucide-vue-next';
import { WORKSPACE_KEY } from '@/features/workspace/composables/workspace.context';
import { isPlatformAdminUser } from '@/shared/utils/auth';
const { t } = useI18n();
const userProfile = inject(WORKSPACE_KEY)!;
@@ -36,10 +38,13 @@ const displayName = computed(() => {
});
/**
* 角色展示文案。
* 个人中心角色标签。
* 核心逻辑:有权限组名称就展示名称;否则按 is_platform_admin 回退内置文案。
*/
const roleLabel = computed(() => {
return userProfile.profileUser.role === 'admin' ? t('profile.roleAdmin') : t('profile.roleUser');
const profileRoleLabel = computed(() => {
const user = userProfile.profileUser || {};
if (user.role_name) return user.role_name;
return isPlatformAdminUser(user) ? t('profile.roleAdmin') : t('profile.roleUser');
});
/**
@@ -48,7 +53,7 @@ const roleLabel = computed(() => {
const identityMeta = computed(() => {
const username = userProfile.profileUser.username;
const showUsername = Boolean(username && username !== displayName.value);
return [showUsername ? username : '', userProfile.profileUser.department, roleLabel.value]
return [showUsername ? username : '', userProfile.profileUser.department, profileRoleLabel.value]
.filter(Boolean)
.join(' · ');
});