1
0

feat(web): 统一页面显示和权限

This commit is contained in:
2024-11-26 10:40:58 +08:00
parent 246e27677e
commit e76236be62
6 changed files with 43 additions and 7 deletions

View File

@@ -187,3 +187,19 @@ export function apiGet(url) {
export function apiPost(url) {
return api('post', url)
}
export function roleCheck(roles) {
return `\${ARRAYINCLUDES(['${roles.join("','")}'], role)}`
}
export const role = {
administrator: 'ADMINISTRATOR',
checker: 'CHECKER',
provider: 'PROVIDER',
customer: 'CUSTOMER',
}
export const administratorOnly = roleCheck([role.administrator])
export const checkerOnly = roleCheck([role.administrator, role.checker])
export const userOnly = roleCheck([role.administrator, role.provider, role.customer])