Integrate高德 SDK with simulator-safe build flags, add map views for operating area and punch points, refactor main tabs and key feature screens to UIKit with Diffable lists, and document Swift concurrency defaults in AGENTS.md. Co-authored-by: Cursor <cursoragent@cursor.com>
99 lines
3.1 KiB
Swift
99 lines
3.1 KiB
Swift
//
|
|
// QueueManagementViewControllers.swift
|
|
// suixinkan
|
|
//
|
|
// Created by Codex on 2026/6/26.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
/// 排队管理页。
|
|
final class QueueManagementViewController: ModuleTableViewController {
|
|
private let viewModel = QueueManagementViewModel()
|
|
|
|
/// 视图加载完成后的 UI 初始化与数据绑定。
|
|
override func viewDidLoad() {
|
|
title = "排队管理"
|
|
navigationItem.rightBarButtonItem = UIBarButtonItem(
|
|
title: "设置",
|
|
style: .plain,
|
|
target: self,
|
|
action: #selector(openSettings)
|
|
)
|
|
super.viewDidLoad()
|
|
wireViewModel(viewModel) { [weak self] in self?.updateTitle() }
|
|
}
|
|
|
|
/// table行Count相关逻辑。
|
|
override func tableRowCount() -> Int { viewModel.items.count }
|
|
|
|
/// 配置Cell展示内容。
|
|
override func configureCell(_ cell: TitleSubtitleTableViewCell, at indexPath: IndexPath) {
|
|
let item = viewModel.items[indexPath.row]
|
|
cell.configure(title: item.phoneMasked, subtitle: item.statusText, detail: item.queueCode)
|
|
}
|
|
|
|
/// 刷新Content。
|
|
override func reloadContent() async {
|
|
await viewModel.reload(
|
|
api: services.scenicQueueAPI,
|
|
scenicId: services.currentScenicId,
|
|
userId: services.userId,
|
|
spots: services.scenicSpotContext.spots
|
|
)
|
|
updateTitle()
|
|
}
|
|
|
|
/// 更新Title状态。
|
|
private func updateTitle() {
|
|
title = "排队 \(viewModel.queueCount)"
|
|
}
|
|
|
|
/// open设置相关逻辑。
|
|
@objc private func openSettings() {
|
|
navigationController?.pushViewController(ScenicQueueSettingsViewController(), animated: true)
|
|
}
|
|
}
|
|
|
|
extension QueueManagementViewModel: ViewModelBindable {}
|
|
|
|
/// 排队设置页。
|
|
final class ScenicQueueSettingsViewController: ModuleTableViewController {
|
|
private let viewModel = ScenicQueueSettingsViewModel()
|
|
|
|
/// 视图加载完成后的 UI 初始化与数据绑定。
|
|
override func viewDidLoad() {
|
|
title = "排队设置"
|
|
super.viewDidLoad()
|
|
wireViewModel(viewModel) { }
|
|
}
|
|
|
|
/// table行Count相关逻辑。
|
|
override func tableRowCount() -> Int { viewModel.scenicSpots.count }
|
|
|
|
/// 配置Cell展示内容。
|
|
override func configureCell(_ cell: TitleSubtitleTableViewCell, at indexPath: IndexPath) {
|
|
let spot = viewModel.scenicSpots[indexPath.row]
|
|
let selected = viewModel.selectedSpotId == spot.id
|
|
cell.configure(title: spot.name, subtitle: selected ? "当前打卡点" : nil)
|
|
cell.accessoryType = selected ? .checkmark : .none
|
|
}
|
|
|
|
/// didSelectTableRow 回调处理。
|
|
override func didSelectTableRow(at indexPath: IndexPath) {
|
|
viewModel.selectedSpotId = viewModel.scenicSpots[indexPath.row].id
|
|
}
|
|
|
|
/// 刷新Content。
|
|
override func reloadContent() async {
|
|
await viewModel.load(
|
|
api: services.scenicQueueAPI,
|
|
scenicId: services.currentScenicId,
|
|
userId: services.userId,
|
|
spots: services.scenicSpotContext.spots
|
|
)
|
|
}
|
|
}
|
|
|
|
extension ScenicQueueSettingsViewModel: ViewModelBindable {}
|