update user detail

This commit is contained in:
Timi
2026-08-07 16:02:29 +08:00
parent 1b1121f052
commit 28b789eb86
13 changed files with 421 additions and 147 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* 构建用户备用头像。
*
* @param name 头像中显示的用户名
* @param backgroundColor 头像背景色
*/
export function buildFallbackAvatar(name: string, backgroundColor = "#2563eb"): string {
const text = encodeURIComponent((name.trim() || "用户").slice(0, 2));
const fill = encodeURIComponent(backgroundColor);
return [
"data:image/svg+xml;charset=UTF-8,",
"%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E",
`%3Crect width='120' height='120' rx='24' fill='${fill}'/%3E`,
"%3Ctext x='50%25' y='54%25' fill='white' font-size='36' font-family='Arial,sans-serif' text-anchor='middle' dominant-baseline='middle'%3E",
text,
"%3C/text%3E%3C/svg%3E"
].join("");
}
+6
View File
@@ -75,6 +75,12 @@ export const coreRoleCodes = {
userRoleAdmin: "CORE:USER_ROLE_ADMIN"
} as const;
export const gaoRoleCodes = {
globalManager: "GAO:GLOBAL_MANAGER",
storeManager: "GAO:STORE_MANAGER",
employee: "GAO:EMPLOYEE"
} as const;
export const permissionManagementRoleAccess = {
value: [
coreRoleCodes.admin,
+2 -3
View File
@@ -2,7 +2,6 @@ import type { StoreBusinessDayOpenStatus, StoreStatus } from "@/types/Store";
import { permissionCodes } from "@/utils/permission";
import { type Page, useUserStore } from "timi-web";
export const defaultStoreId = "00000000-0000-0000-0000-000000000001";
export const currentStoreIdStorageKey = "gao-customer-h5:current-store-id";
type LoginUserWithStore = {
@@ -21,9 +20,9 @@ type LoginUserWithStore = {
export function getCurrentStoreId(): string {
const userStore = useUserStore();
if (userStore.hasPermissions(permissionCodes.store.read)) {
return readStoredCurrentStoreId() || getLoginUserStoreId() || defaultStoreId;
return readStoredCurrentStoreId() || getLoginUserStoreId();
}
return getLoginUserStoreId() || defaultStoreId;
return getLoginUserStoreId();
}
export function setCurrentStoreId(storeId: string): void {