feat(drone-dock): 新增拍摄准备与当前任务页面
This commit is contained in:
@@ -209,7 +209,7 @@ final class DroneDockWorkbenchViewController: BaseViewController {
|
||||
navigationController?.pushViewController(controller, animated: true)
|
||||
}
|
||||
|
||||
/// 当前任务、素材和交付将在后续页面实现;本轮点击只展示对应订单入口。
|
||||
/// 拍摄进入本地准备/原任务,其他下级业务暂保留入口提示。
|
||||
private enum OrderEntry { case shooting, materials, delivery }
|
||||
|
||||
private func showOrderEntry(id: String, action: OrderEntry) {
|
||||
@@ -222,8 +222,8 @@ final class DroneDockWorkbenchViewController: BaseViewController {
|
||||
let detail: String
|
||||
switch action {
|
||||
case .shooting:
|
||||
title = order.primaryAction.title
|
||||
detail = order.activeTask.map { "当前任务:\($0.phase.title)" } ?? "剩余 \(order.remainingShootingCount) 次拍摄"
|
||||
openShootingOrder(id: order.id, from: presenter ?? self)
|
||||
return
|
||||
case .materials:
|
||||
title = "查看素材"
|
||||
detail = order.materialState.title
|
||||
@@ -236,6 +236,28 @@ final class DroneDockWorkbenchViewController: BaseViewController {
|
||||
(presenter ?? self).present(alert, animated: true)
|
||||
}
|
||||
|
||||
/// 始终读取当前范围快照,恢复原任务而不因重新进入重复召唤。
|
||||
private func openShootingOrder(id: String, from presenter: UIViewController) {
|
||||
guard let order = viewModel.store.shootingOrder(id: id) else { return }
|
||||
if order.activeTask != nil {
|
||||
openTask(orderID: id, from: presenter)
|
||||
} else if order.remainingShootingCount > 0 {
|
||||
let controller = DroneShootingPreparationViewController(
|
||||
viewModel: DroneShootingPreparationViewModel(store: viewModel.store, orderID: id)
|
||||
)
|
||||
controller.delegate = self
|
||||
presenter.navigationController?.pushViewController(controller, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
private func openTask(orderID: String, from presenter: UIViewController) {
|
||||
let controller = DroneShootingTaskViewController(
|
||||
viewModel: DroneShootingTaskViewModel(store: viewModel.store, orderID: orderID)
|
||||
)
|
||||
controller.delegate = self
|
||||
presenter.navigationController?.pushViewController(controller, animated: true)
|
||||
}
|
||||
|
||||
@objc private func receiptTapped() {
|
||||
showAlert(title: "收款码", message: "套餐收款页面将在后续搭建,当前不会创建订单或发起收款。")
|
||||
}
|
||||
@@ -268,6 +290,32 @@ extension DroneDockWorkbenchViewController: DroneShootingOrdersViewControllerDel
|
||||
}
|
||||
}
|
||||
|
||||
extension DroneDockWorkbenchViewController: DroneShootingPreparationViewControllerDelegate {
|
||||
func shootingPreparationViewController(_ controller: DroneShootingPreparationViewController, didRequestTaskFor orderID: String) {
|
||||
openTask(orderID: orderID, from: controller)
|
||||
}
|
||||
}
|
||||
|
||||
extension DroneDockWorkbenchViewController: DroneShootingTaskViewControllerDelegate {
|
||||
func shootingTaskViewControllerDidRequestWorkbench(_ controller: DroneShootingTaskViewController) {
|
||||
navigationController?.popToViewController(self, animated: true)
|
||||
}
|
||||
|
||||
func shootingTaskViewController(_ controller: DroneShootingTaskViewController, didRequestPreparationFor order: DroneShootingOrder) {
|
||||
guard let navigationController, let index = navigationController.viewControllers.firstIndex(where: { $0 === self }) else { return }
|
||||
let preparation = DroneShootingPreparationViewController(
|
||||
viewModel: DroneShootingPreparationViewModel(store: viewModel.store, orderID: order.id)
|
||||
)
|
||||
preparation.delegate = self
|
||||
navigationController.setViewControllers(Array(navigationController.viewControllers.prefix(through: index)) + [preparation], animated: true)
|
||||
}
|
||||
|
||||
func shootingTaskViewController(_ controller: DroneShootingTaskViewController, didRequestMaterialsFor order: DroneShootingOrder) {
|
||||
guard let order = viewModel.store.shootingOrder(id: order.id) else { return }
|
||||
showPreviewEntry(order: order, action: .materials, presenter: controller)
|
||||
}
|
||||
}
|
||||
|
||||
/// 工作台标题及查看全部入口。
|
||||
private final class DroneDockSectionHeader: UICollectionReusableView {
|
||||
var onViewAll: (() -> Void)?
|
||||
|
||||
Reference in New Issue
Block a user