添加景区入驻申请流程并对齐 Android
This commit is contained in:
@ -88,4 +88,22 @@ final class HomeAPI {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// 拉取景区申请待审核列表。
|
||||
func scenicApplicationPending() async throws -> ScenicApplicationPendingsResponse {
|
||||
try await client.send(
|
||||
APIRequest(method: .get, path: "/api/yf-handset-app/photog/scenic-apply/all")
|
||||
)
|
||||
}
|
||||
|
||||
/// 提交景区申请。
|
||||
func submitScenicApplication(_ request: ScenicApplicationSubmitRequest) async throws {
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(
|
||||
method: .post,
|
||||
path: "/api/yf-handset-app/photog/scenic-apply/submit",
|
||||
body: request
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,9 +163,23 @@ final class PermissionApplyViewModel {
|
||||
.flatMap(\.scenic)
|
||||
}
|
||||
|
||||
func clearRoleSelection() {
|
||||
selectedRoleId = nil
|
||||
selectedRoleName = ""
|
||||
selectedScenicIds = []
|
||||
selectedScenicNames = []
|
||||
availableScenics = []
|
||||
availableRoles = availableRoles.map { role in
|
||||
var copy = role
|
||||
copy.isSelected = false
|
||||
return copy
|
||||
}
|
||||
notifyStateChange()
|
||||
}
|
||||
|
||||
func submit(api: HomeAPI) async {
|
||||
guard let roleId = selectedRoleId else {
|
||||
onShowMessage?("请先选择角色")
|
||||
onShowMessage?("请选择角色")
|
||||
return
|
||||
}
|
||||
let newScenicIds = selectedScenicIds.filter { id in
|
||||
|
||||
@ -17,6 +17,7 @@ final class ScenicSelectionViewModel {
|
||||
private(set) var spots: [ScenicSpotDisplayItem] = []
|
||||
private(set) var searchQuery = ""
|
||||
private(set) var currentLocationText = "最近的景区"
|
||||
private(set) var isLocating = false
|
||||
private(set) var isLoading = false
|
||||
|
||||
var onStateChange: (() -> Void)?
|
||||
@ -53,7 +54,7 @@ final class ScenicSelectionViewModel {
|
||||
}
|
||||
|
||||
func startLocation() async {
|
||||
isLoading = true
|
||||
isLocating = true
|
||||
notifyStateChange()
|
||||
do {
|
||||
let snapshot = try await locationProvider.requestSnapshot()
|
||||
@ -67,7 +68,7 @@ final class ScenicSelectionViewModel {
|
||||
} catch {
|
||||
onShowMessage?("定位失败: \(error.localizedDescription)")
|
||||
}
|
||||
isLoading = false
|
||||
isLocating = false
|
||||
notifyStateChange()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user