fix: 优化旅拍相册入口与二维码提示布局

This commit is contained in:
2026-07-23 15:40:51 +08:00
parent 787a166263
commit 7ccbc5568d
2 changed files with 41 additions and 5 deletions

View File

@ -20,7 +20,9 @@ final class TravelAlbumCodeDialogViewController: UIViewController {
private let albumNameLabel = UILabel()
private let qrImageView = UIImageView()
private let loadingIndicator = UIActivityIndicatorView(style: .medium)
private let hintLabel = UILabel()
private let hintLabel = TravelAlbumCodeHintLabel(
contentInsets: UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)
)
private let downloadButton = UIButton(type: .system)
init(state: TravelAlbumEntryViewModel.AlbumCodeState) {
@ -117,8 +119,8 @@ final class TravelAlbumCodeDialogViewController: UIViewController {
hintLabel.snp.makeConstraints { make in
make.top.equalTo(qrImageView.snp.bottom).offset(18)
make.centerX.equalToSuperview()
make.height.equalTo(34)
make.leading.greaterThanOrEqualToSuperview().offset(20)
make.trailing.lessThanOrEqualToSuperview().offset(-20)
}
downloadButton.snp.makeConstraints { make in
make.top.equalTo(hintLabel.snp.bottom).offset(20)
@ -160,3 +162,30 @@ final class TravelAlbumCodeDialogViewController: UIViewController {
onDownload?()
}
}
/// Android
private final class TravelAlbumCodeHintLabel: UILabel {
private let contentInsets: UIEdgeInsets
init(contentInsets: UIEdgeInsets) {
self.contentInsets = contentInsets
super.init(frame: .zero)
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func drawText(in rect: CGRect) {
super.drawText(in: rect.inset(by: contentInsets))
}
override var intrinsicContentSize: CGSize {
let size = super.intrinsicContentSize
return CGSize(
width: size.width + contentInsets.left + contentInsets.right,
height: size.height + contentInsets.top + contentInsets.bottom
)
}
}

View File

@ -184,7 +184,8 @@ extension TravelAlbumEntryViewController: UITableViewDelegate {
///
private final class TravelAlbumHeroCard: UIControl {
private let gradientLayer = CAGradientLayer()
private let plusView = UIImageView(image: UIImage(systemName: "plus"))
private let plusView = UIView()
private let plusImageView = UIImageView(image: UIImage(systemName: "plus"))
private let titleLabel = UILabel()
private let subtitleLabel = UILabel()
private let arrowLabel = UILabel()
@ -202,10 +203,11 @@ private final class TravelAlbumHeroCard: UIControl {
gradientLayer.endPoint = CGPoint(x: 1, y: 0.5)
layer.insertSublayer(gradientLayer, at: 0)
plusView.tintColor = AppColor.primary
plusView.contentMode = .scaleAspectFit
plusView.backgroundColor = .white
plusView.layer.cornerRadius = 17
plusView.clipsToBounds = true
plusImageView.tintColor = AppColor.primary
plusImageView.contentMode = .scaleAspectFit
titleLabel.text = "新建相册任务"
titleLabel.font = .systemFont(ofSize: 19, weight: .medium)
@ -218,6 +220,7 @@ private final class TravelAlbumHeroCard: UIControl {
arrowLabel.font = .systemFont(ofSize: 36, weight: .light)
addSubview(plusView)
plusView.addSubview(plusImageView)
addSubview(titleLabel)
addSubview(subtitleLabel)
addSubview(arrowLabel)
@ -226,6 +229,10 @@ private final class TravelAlbumHeroCard: UIControl {
make.centerY.equalToSuperview()
make.size.equalTo(34)
}
plusImageView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.size.equalTo(26)
}
titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(30)
make.leading.equalTo(plusView.snp.trailing).offset(16)