Advance UIKit rewrite with AMap integration and core UI modules.

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>
This commit is contained in:
2026-06-26 15:16:12 +08:00
parent 9edf993432
commit d99a5b1bf8
124 changed files with 5195 additions and 1536 deletions

View File

@ -39,6 +39,7 @@ struct LocationReportSubmitResponse: Decodable, Equatable {
let expired: Int
let status: Int
///
enum CodingKeys: String, CodingKey {
case staffId = "staff_id"
case expired
@ -73,6 +74,7 @@ struct LocationReportHistoryItem: Decodable, Equatable, Identifiable {
let remark: String
let createdAt: String
///
enum CodingKeys: String, CodingKey {
case id
case staffId = "staff_id"

View File

@ -11,6 +11,7 @@ import UIKit
final class LocationReportViewController: ModuleTableViewController {
private let viewModel = LocationReportViewModel()
/// UI
override func viewDidLoad() {
title = "位置上报"
navigationItem.rightBarButtonItem = UIBarButtonItem(
@ -23,17 +24,21 @@ final class LocationReportViewController: ModuleTableViewController {
wireViewModel(viewModel) { }
}
override func numberOfSections(in tableView: UITableView) -> Int { 2 }
/// section
override func numberOfTableSections() -> Int { 2 }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
/// section
override func tableRowCount(in section: Int) -> Int {
section == 0 ? 3 : 1
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
/// section
override func tableSectionTitle(for section: Int) -> String? {
section == 0 ? "状态" : "操作"
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
/// Cell
override func tableCell(for indexPath: IndexPath, row: ModuleTableRow, in tableView: UITableView) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(
withIdentifier: TitleSubtitleTableViewCell.reuseIdentifier,
for: indexPath
@ -55,8 +60,8 @@ final class LocationReportViewController: ModuleTableViewController {
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
///
override func didSelectTableRow(at indexPath: IndexPath) {
if indexPath.section == 1 {
Task {
_ = await viewModel.setOnline(
@ -69,10 +74,12 @@ final class LocationReportViewController: ModuleTableViewController {
}
}
/// Content
override func reloadContent() async {
viewModel.applyCurrentLocation(latitude: 39.9, longitude: 116.4, address: "定位待接入")
}
/// Report
@objc private func submitReport() {
Task {
_ = await viewModel.submit(
@ -91,25 +98,30 @@ extension LocationReportViewModel: ViewModelBindable {}
final class LocationReportHistoryViewController: ModuleTableViewController {
private let viewModel = LocationReportHistoryViewModel()
/// UI
override func viewDidLoad() {
title = "上报历史"
super.viewDidLoad()
wireViewModel(viewModel) { }
}
/// tableCount
override func tableRowCount() -> Int {
viewModel.items.count
}
/// Cell
override func configureCell(_ cell: TitleSubtitleTableViewCell, at indexPath: IndexPath) {
let record = viewModel.items[indexPath.row]
cell.configure(title: record.typeTitle, subtitle: record.address, detail: record.createdAt)
}
/// Content
override func reloadContent() async {
await viewModel.reload(staffId: services.staffId, api: services.locationReportAPI)
}
/// table
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
guard indexPath.row >= viewModel.items.count - 2 else { return }
Task { await viewModel.loadMore(staffId: services.staffId, api: services.locationReportAPI) }