修复订单来源弹窗打开时的图片预览展示

This commit is contained in:
2026-07-07 11:14:57 +08:00
parent 187ba990d4
commit 3c25a0b789
4 changed files with 31 additions and 20 deletions

View File

@ -16,7 +16,6 @@ final class OrderSourceLeadListViewController: BaseViewController, UITableViewDa
private let loadLeads: (OrderSourcePerson) async -> Void
private let onLeadBound: (OrderSourceSelection) -> Void
private let onCallPhone: (String) -> Void
private let onPreviewImages: ([String], Int) -> Void
private let phoneRow = UIStackView()
private let phoneLabel = UILabel()
@ -32,8 +31,7 @@ final class OrderSourceLeadListViewController: BaseViewController, UITableViewDa
referralOrder: BoundReferralOrderEntity?,
loadLeads: @escaping (OrderSourcePerson) async -> Void,
onLeadBound: @escaping (OrderSourceSelection) -> Void,
onCallPhone: @escaping (String) -> Void,
onPreviewImages: @escaping ([String], Int) -> Void
onCallPhone: @escaping (String) -> Void
) {
self.person = person
self.orderNumber = orderNumber
@ -42,7 +40,6 @@ final class OrderSourceLeadListViewController: BaseViewController, UITableViewDa
self.loadLeads = loadLeads
self.onLeadBound = onLeadBound
self.onCallPhone = onCallPhone
self.onPreviewImages = onPreviewImages
super.init(nibName: nil, bundle: nil)
}
@ -178,7 +175,9 @@ final class OrderSourceLeadListViewController: BaseViewController, UITableViewDa
&& currentSelection?.lead.key == lead.key
cell.configure(lead: lead, selected: selected)
cell.onCallPhone = onCallPhone
cell.onImageTap = onPreviewImages
cell.onImageTap = { [weak self] urls, index in
self?.presentImagePreview(imageURLs: urls, startIndex: index)
}
cell.onSelect = { [weak self] in
guard let self else { return }
let selection = OrderSourceSelection(person: self.person, lead: lead)

View File

@ -15,7 +15,6 @@ final class OrderSourcePickerViewController: UIViewController, UITableViewDataSo
private let loadLeads: (OrderSourcePerson) async -> Void
private let onLeadBound: (OrderSourceSelection) -> Void
private let onCallPhone: (String) -> Void
private let onPreviewImages: ([String], Int) -> Void
private let titleLabel = UILabel()
private let subtitleLabel = UILabel()
@ -29,8 +28,7 @@ final class OrderSourcePickerViewController: UIViewController, UITableViewDataSo
referralOrder: BoundReferralOrderEntity?,
loadLeads: @escaping (OrderSourcePerson) async -> Void,
onLeadBound: @escaping (OrderSourceSelection) -> Void,
onCallPhone: @escaping (String) -> Void,
onPreviewImages: @escaping ([String], Int) -> Void
onCallPhone: @escaping (String) -> Void
) {
self.orderNumber = orderNumber
self.viewModel = viewModel
@ -38,7 +36,6 @@ final class OrderSourcePickerViewController: UIViewController, UITableViewDataSo
self.loadLeads = loadLeads
self.onLeadBound = onLeadBound
self.onCallPhone = onCallPhone
self.onPreviewImages = onPreviewImages
super.init(nibName: nil, bundle: nil)
}
@ -157,8 +154,7 @@ final class OrderSourcePickerViewController: UIViewController, UITableViewDataSo
referralOrder: referralOrder,
loadLeads: loadLeads,
onLeadBound: onLeadBound,
onCallPhone: onCallPhone,
onPreviewImages: onPreviewImages
onCallPhone: onCallPhone
)
navigationController?.setNavigationBarHidden(false, animated: true)
navigationController?.pushViewController(leadController, animated: true)

View File

@ -377,7 +377,7 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT
self?.presentOrderSourcePicker(for: order)
}
actions.onOrderSourceImageTap = { [weak self] images, index in
self?.presentImagePreview(images: images, startIndex: index)
self?.presentImagePreview(imageURLs: images, startIndex: index)
}
if let travel = order.photoTravel, travel.canGiftRetouch {
actions.onSendGift = { [weak self] in
@ -492,9 +492,6 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT
},
onCallPhone: { [weak self] phone in
self?.callPhone(phone)
},
onPreviewImages: { [weak self] urls, index in
self?.presentImagePreview(images: urls, startIndex: index)
}
)
self.orderSourcePicker = controller
@ -524,9 +521,4 @@ final class OrdersViewController: BaseViewController, UITableViewDataSource, UIT
guard !trimmed.isEmpty, let url = URL(string: "tel://\(trimmed)") else { return }
UIApplication.shared.open(url)
}
private func presentImagePreview(images: [String], startIndex: Int) {
guard !images.isEmpty else { return }
present(ImagePreviewViewController(imageURLs: images, startIndex: startIndex), animated: true)
}
}