实现权限驱动的首页 Tab 并对齐 Android
This commit is contained in:
@ -45,6 +45,20 @@ enum AppRoleCode: String, CaseIterable, Equatable {
|
||||
self == .photographer
|
||||
}
|
||||
|
||||
/// 首页隐藏顶部在线/位置/快捷操作的角色。
|
||||
static let homeMinimalTopRoles: Set<AppRoleCode> = [
|
||||
.storeAdmin,
|
||||
.editor,
|
||||
.scenicCS,
|
||||
.scenicAdmin,
|
||||
.scenicOperation,
|
||||
]
|
||||
|
||||
/// 当前角色是否使用首页精简顶部布局。
|
||||
var usesHomeMinimalTopLayout: Bool {
|
||||
AppRoleCode.homeMinimalTopRoles.contains(self)
|
||||
}
|
||||
|
||||
/// 从后端 role_code 解析角色。
|
||||
static func fromCode(_ code: String?) -> AppRoleCode? {
|
||||
let normalized = code?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
|
||||
Reference in New Issue
Block a user