对齐 Android 无权限强制弹窗、角色下拉与申请页交互,补充 UIButton configuration 适配,并增强景区排队 TTS 与相关单元测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
126 lines
3.5 KiB
Swift
126 lines
3.5 KiB
Swift
//
|
|
// PermissionApplyModels.swift
|
|
// suixinkan
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// 首页进入权限申请流程时的目标页面。
|
|
enum PermissionApplyDestination: Equatable {
|
|
case apply
|
|
case status(applyCode: String)
|
|
}
|
|
|
|
/// 权限申请页待确认删除的对象。
|
|
enum PermissionDeletionTarget: Equatable {
|
|
case role(name: String)
|
|
case scenic(id: Int, name: String)
|
|
|
|
/// Android 删除弹窗标题。
|
|
var dialogTitle: String {
|
|
switch self {
|
|
case .role: "是否删除该角色"
|
|
case .scenic: "是否删除该景区"
|
|
}
|
|
}
|
|
|
|
/// Android 删除弹窗正文。
|
|
var dialogMessage: String {
|
|
switch self {
|
|
case .role(let name): "您确定要删除\(name)角色吗?"
|
|
case .scenic(_, let name): "您确定要删除\(name)吗?"
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 待审核的角色权限申请响应。
|
|
struct RoleApplyPendingResponse: Decodable, Equatable {
|
|
let code: String
|
|
let roleId: Int
|
|
let roleName: String
|
|
let scenicList: [RoleApplyScenicItem]
|
|
let status: Int
|
|
let statusLabel: String
|
|
let createdAt: String
|
|
let auditNote: String
|
|
let auditedAt: String?
|
|
let auditedBy: String?
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case code
|
|
case roleId = "role_id"
|
|
case roleName = "role_name"
|
|
case scenicList = "scenic_list"
|
|
case status
|
|
case statusLabel = "status_label"
|
|
case createdAt = "created_at"
|
|
case auditNote = "audit_note"
|
|
case auditedAt = "audited_at"
|
|
case auditedBy = "audited_by"
|
|
}
|
|
|
|
init(from decoder: Decoder) throws {
|
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
code = try container.decodeIfPresent(String.self, forKey: .code) ?? ""
|
|
roleId = try container.decodeIfPresent(Int.self, forKey: .roleId) ?? 0
|
|
roleName = try container.decodeIfPresent(String.self, forKey: .roleName) ?? ""
|
|
scenicList = try container.decodeIfPresent([RoleApplyScenicItem].self, forKey: .scenicList) ?? []
|
|
status = try container.decodeIfPresent(Int.self, forKey: .status) ?? 0
|
|
statusLabel = try container.decodeIfPresent(String.self, forKey: .statusLabel) ?? ""
|
|
createdAt = try container.decodeIfPresent(String.self, forKey: .createdAt) ?? ""
|
|
auditNote = try container.decodeIfPresent(String.self, forKey: .auditNote) ?? ""
|
|
auditedAt = try container.decodeIfPresent(String.self, forKey: .auditedAt)
|
|
auditedBy = try container.decodeIfPresent(String.self, forKey: .auditedBy)
|
|
}
|
|
}
|
|
|
|
/// 权限申请中的景区摘要。
|
|
struct RoleApplyScenicItem: Decodable, Equatable {
|
|
let id: Int
|
|
let name: String
|
|
}
|
|
|
|
/// 全部可申请景区响应。
|
|
struct ScenicListAllResponse: Decodable, Equatable {
|
|
let total: Int
|
|
let list: [ScenicListItem]
|
|
|
|
init(total: Int = 0, list: [ScenicListItem] = []) {
|
|
self.total = total
|
|
self.list = list
|
|
}
|
|
}
|
|
|
|
/// 可申请景区条目。
|
|
struct ScenicListItem: Decodable, Equatable {
|
|
let id: Int
|
|
let name: String
|
|
}
|
|
|
|
/// 权限申请提交参数。
|
|
struct RoleApplySubmitRequest: Encodable {
|
|
let scenicId: [Int]
|
|
let roleId: Int
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case scenicId = "scenic_id"
|
|
case roleId = "role_id"
|
|
}
|
|
}
|
|
|
|
/// 权限申请角色选项。
|
|
struct RoleOption: Equatable, Hashable {
|
|
let id: Int
|
|
let name: String
|
|
let description: String
|
|
var isSelected: Bool
|
|
}
|
|
|
|
/// 权限申请景区选项。
|
|
struct ScenicOption: Equatable, Hashable {
|
|
let id: Int
|
|
let name: String
|
|
var isSelected: Bool
|
|
var isDisabled: Bool
|
|
}
|