统一甲屿云命名体系
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Purpose: AdminCachedUserInfo supports admin-helpers.ts by holding or executing the admin cached user info page or API role.
|
||||
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
import { loadCachedAdminUserInfo, isBootstrapAdminUser, type AdminCachedUserInfo } from '@/utils/admin-session'
|
||||
|
||||
export { loadCachedAdminUserInfo, isBootstrapAdminUser }
|
||||
export type { AdminCachedUserInfo }
|
||||
|
||||
/**
|
||||
* Purpose: getAdminRoleLabel supports admin-helpers.ts by holding or executing the get admin role label page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export const getAdminRoleLabel = (type?: number) => {
|
||||
switch (type) {
|
||||
case 4:
|
||||
return '平台管理员'
|
||||
case 2:
|
||||
return '店长'
|
||||
case 3:
|
||||
return '美甲师'
|
||||
default:
|
||||
return '后台账号'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: getAdminShopOptions supports admin-helpers.ts by holding or executing the get admin shop options page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export const getAdminShopOptions = (userInfo?: AdminCachedUserInfo | null) => {
|
||||
const ids = userInfo?.shopIds || []
|
||||
const names = userInfo?.shopNames || []
|
||||
return ids.map((id, index) => ({
|
||||
id: String(id),
|
||||
name: names[index] || `门店 ${id}`
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: getAdminCurrentShopName supports admin-helpers.ts by holding or executing the get admin current shop name page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export const getAdminCurrentShopName = (userInfo?: AdminCachedUserInfo | null) =>
|
||||
userInfo?.shopName || (isBootstrapAdminUser(userInfo) ? '平台总览模式' : '游客模式')
|
||||
Reference in New Issue
Block a user