Blame view

泰额版/Food Labeling Management App UniApp/src/utils/appAdminRole.ts 600 Bytes
540ac0e3   杨鑫   前端修改bug
1
2
3
4
5
6
7
8
9
10
11
12
13
  import type { UsAppMyProfileOutputDto } from '../services/usAppAuth'
  
  /** 与后端 ReportsRoleHelper.IsAdminRole 对齐(App 管理员级联选店) */
  export function isAppAdminUser(profile: UsAppMyProfileOutputDto | null | undefined): boolean {
    if (!profile) return false
    const code = (profile.primaryRoleCode ?? '').trim().toLowerCase()
    if (code === 'admin') return true
    const display = (profile.roleDisplay ?? '').trim().toLowerCase()
    if (!display) return false
    if (display.includes('administrator')) return true
    if (display.includes('super admin')) return true
    return false
  }