feat: 更新素材管理和举报风险地图
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
//
|
||||
|
||||
import PhotosUI
|
||||
import QuickLook
|
||||
import SnapKit
|
||||
import UIKit
|
||||
|
||||
@ -20,7 +19,6 @@ final class WildPhotographerReportSubmitViewController: BaseViewController {
|
||||
private let contactField = UITextField()
|
||||
private let submitButton = UIButton(type: .system)
|
||||
private var pickerTarget: WildReportPickerTarget = .image
|
||||
private var previewURL: URL?
|
||||
private weak var activeInputView: UIView?
|
||||
|
||||
init(
|
||||
@ -213,7 +211,12 @@ final class WildPhotographerReportSubmitViewController: BaseViewController {
|
||||
grid.axis = .vertical
|
||||
grid.spacing = 8
|
||||
|
||||
let types = viewModel.reportTypes.isEmpty ? WildReportType.fallbackOptions : viewModel.reportTypes
|
||||
let types = viewModel.reportTypes
|
||||
if types.isEmpty, !viewModel.isLoadingReportTypes {
|
||||
let empty = WildReportUI.label("暂无可选举报类型,请稍后重试", font: .systemFont(ofSize: 13), color: AppColor.textSecondary)
|
||||
card.stack.addArrangedSubview(empty)
|
||||
return card
|
||||
}
|
||||
stride(from: 0, to: types.count, by: 3).forEach { startIndex in
|
||||
let rowTypes = Array(types[startIndex ..< min(startIndex + 3, types.count)])
|
||||
let row = UIStackView()
|
||||
@ -223,7 +226,7 @@ final class WildPhotographerReportSubmitViewController: BaseViewController {
|
||||
|
||||
rowTypes.forEach { type in
|
||||
let button = WildReportTypeOptionButton()
|
||||
button.apply(type: type, isSelected: type == viewModel.selectedReportType)
|
||||
button.apply(type: type, isSelected: viewModel.selectedReportType == type)
|
||||
button.addAction(UIAction { [weak self] _ in self?.viewModel.selectReportType(type) }, for: .touchUpInside)
|
||||
button.snp.makeConstraints { make in make.height.equalTo(72) }
|
||||
row.addArrangedSubview(button)
|
||||
@ -537,14 +540,11 @@ final class WildPhotographerReportSubmitViewController: BaseViewController {
|
||||
}
|
||||
|
||||
private func previewAttachment(_ attachment: WildReportAttachment) {
|
||||
guard let url = attachment.localFileURL else {
|
||||
guard let item = MediaPreviewItem(wildReportAttachment: attachment) else {
|
||||
showToast("当前附件暂无本地预览")
|
||||
return
|
||||
}
|
||||
previewURL = url
|
||||
let preview = QLPreviewController()
|
||||
preview.dataSource = self
|
||||
present(preview, animated: true)
|
||||
presentMediaPreview(items: [item], startIndex: 0)
|
||||
}
|
||||
|
||||
@objc private func refreshLocationTapped() { viewModel.refreshCurrentLocation() }
|
||||
@ -631,16 +631,6 @@ extension WildPhotographerReportSubmitViewController: PHPickerViewControllerDele
|
||||
}
|
||||
}
|
||||
|
||||
extension WildPhotographerReportSubmitViewController: QLPreviewControllerDataSource {
|
||||
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
|
||||
previewURL == nil ? 0 : 1
|
||||
}
|
||||
|
||||
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
|
||||
previewURL! as NSURL
|
||||
}
|
||||
}
|
||||
|
||||
extension WildPhotographerReportSubmitViewController: UITextViewDelegate {
|
||||
func textViewDidBeginEditing(_ textView: UITextView) {
|
||||
activeInputView = textView
|
||||
|
||||
Reference in New Issue
Block a user