feat(drone-dock): 接入游客确认交付并对齐网页样式

This commit is contained in:
2026-10-30 16:19:40 +08:00
parent f99a175f99
commit fad2ed8a50
23 changed files with 2437 additions and 89 deletions
@@ -1,34 +1,6 @@
import SnapKit
import UIKit
/// 缩略图上的选择圆圈,显式绘制白色勾选以免透出背景图片。
@MainActor
enum DroneMaterialSelectionIcon {
/// 使用固定配色绘制选择状态,避免按钮重新应用系统 tint。
static func image(selected: Bool, tint: UIColor, opacity: CGFloat = 1) -> UIImage {
UIGraphicsImageRenderer(size: CGSize(width: 24, height: 24)).image { context in
context.cgContext.setAlpha(opacity)
let circle = UIBezierPath(ovalIn: CGRect(x: 1, y: 1, width: 22, height: 22))
tint.set()
if selected {
circle.fill()
UIColor.white.setStroke()
let check = UIBezierPath()
check.move(to: CGPoint(x: 6.5, y: 12))
check.addLine(to: CGPoint(x: 10.5, y: 16))
check.addLine(to: CGPoint(x: 17.5, y: 7.5))
check.lineWidth = 2.2
check.lineCapStyle = .round
check.lineJoinStyle = .round
check.stroke()
} else {
circle.lineWidth = 1.6
circle.stroke()
}
}.withRenderingMode(.alwaysOriginal)
}
}
/// 素材库的订单摘要,保留拍摄履约与素材处理相互独立的表达。
@MainActor
final class DroneMaterialOrderCell: UICollectionViewCell {
@@ -178,11 +150,11 @@ final class DroneMaterialSelectionCell: UICollectionViewCell {
countLabel.text = "\(recordCount)次拍摄 · 最新在前"
var config = UIButton.Configuration.plain()
config.title = "全选可下载"
config.image = UIImage(systemName: allSelected ? "checkmark.circle.fill" : "circle")
config.imagePadding = 6
config.contentInsets = .zero
config.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(pointSize: 15)
let foreground = enabled ? DroneDockStyle.primary : UIColor(hex: 0xC2C9D4)
let foreground = enabled ? MaterialSelectionIcon.primary : UIColor(hex: 0xC2C9D4)
config.image = MaterialSelectionIcon.orderImage(selected: allSelected, size: 19,
tint: foreground, includesBackground: false)
config.baseForegroundColor = foreground
config.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in
var attributes = incoming
@@ -190,7 +162,6 @@ final class DroneMaterialSelectionCell: UICollectionViewCell {
attributes.foregroundColor = foreground
return attributes
}
config.imageColorTransformer = UIConfigurationColorTransformer { _ in foreground }
selectAllButton.configuration = config
selectAllButton.isEnabled = enabled
selectAllButton.accessibilityLabel = "全选可下载"
@@ -296,6 +267,8 @@ final class DroneMaterialCell: UICollectionViewCell {
videoBadge.textAlignment = .center
videoBadge.text = "视频"
selectionButton.imageView?.contentMode = .scaleAspectFit
selectionButton.contentHorizontalAlignment = .right
selectionButton.contentVerticalAlignment = .top
selectionButton.addTarget(self, action: #selector(selectionTapped), for: .touchUpInside)
previewButton.addTarget(self, action: #selector(previewTapped), for: .touchUpInside)
retryUploadButton.setTitle("重试上传", for: .normal)
@@ -325,7 +298,7 @@ final class DroneMaterialCell: UICollectionViewCell {
make.height.equalTo(18)
}
selectionButton.snp.makeConstraints { make in
make.top.trailing.equalTo(thumbnail)
make.top.trailing.equalTo(thumbnail).inset(6)
make.size.equalTo(44)
}
nameRow.snp.makeConstraints { make in
@@ -363,13 +336,11 @@ final class DroneMaterialCell: UICollectionViewCell {
selectionButton.accessibilityIdentifier = "drone.materials.select.\(material.id)"
selectionButton.accessibilityLabel = completed ? "\(material.title),演示完成,未写入相册" : "选择\(material.title)"
selectionButton.accessibilityTraits = selected || completed ? [.button, .selected] : .button
let tint = completed ? DroneDockStyle.success : selected ? DroneDockStyle.primary : UIColor.white
selectionButton.setImage(DroneMaterialSelectionIcon.image(selected: selected || completed, tint: tint), for: .normal)
selectionButton.setImage(DroneMaterialSelectionIcon.image(selected: selected || completed, tint: tint, opacity: 0.6), for: .disabled)
selectionButton.imageView?.layer.shadowColor = UIColor.black.cgColor
selectionButton.imageView?.layer.shadowOpacity = 0.22
selectionButton.imageView?.layer.shadowRadius = 2
selectionButton.imageView?.layer.shadowOffset = .zero
let tint = completed ? DroneDockStyle.success : MaterialSelectionIcon.primary
selectionButton.setImage(MaterialSelectionIcon.orderImage(selected: selected || completed, size: 22,
tint: tint, includesBackground: true), for: .normal)
selectionButton.setImage(MaterialSelectionIcon.orderImage(selected: selected || completed, size: 22,
tint: tint, includesBackground: true, opacity: 0.6), for: .disabled)
}
@objc private func previewTapped() { onPreviewTap?() }