引入统一设计令牌并迁移首页、订单和数据 UI

This commit is contained in:
2026-07-06 17:58:18 +08:00
parent 71ab38af8d
commit 28dc004110
31 changed files with 737 additions and 213 deletions

View File

@ -30,10 +30,10 @@ final class HomeViewController: BaseViewController {
}
override func setupUI() {
view.backgroundColor = UIColor(hex: 0xF5F5F5)
view.backgroundColor = AppColor.pageBackground
contentStack.axis = .vertical
contentStack.spacing = 12
contentStack.spacing = AppSpacing.sm
scrollView.showsVerticalScrollIndicator = false
view.addSubview(scenicHeaderView)
@ -51,15 +51,15 @@ final class HomeViewController: BaseViewController {
scenicHeaderView.snp.makeConstraints { make in
make.top.equalTo(view.safeAreaLayoutGuide)
make.leading.trailing.equalToSuperview()
make.height.equalTo(52)
make.height.equalTo(AppSpacing.homeHeaderHeight)
}
scrollView.snp.makeConstraints { make in
make.top.equalTo(scenicHeaderView.snp.bottom)
make.leading.trailing.bottom.equalToSuperview()
}
contentStack.snp.makeConstraints { make in
make.edges.equalToSuperview().inset(16)
make.width.equalTo(scrollView.snp.width).offset(-32)
make.edges.equalToSuperview().inset(AppSpacing.screenHorizontalInset)
make.width.equalTo(scrollView.snp.width).offset(-AppSpacing.screenHorizontalInset * 2)
}
}

View File

@ -47,8 +47,8 @@ final class HomeCommonAppsGridView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
titleLabel.text = "常用应用"
titleLabel.font = .systemFont(ofSize: 16, weight: .bold)
titleLabel.textColor = AppColor.text333
titleLabel.font = .app(.title)
titleLabel.textColor = AppColor.textPrimary
collectionView.backgroundColor = .clear
collectionView.delegate = self
@ -61,7 +61,7 @@ final class HomeCommonAppsGridView: UIView {
make.top.leading.trailing.equalToSuperview()
}
collectionView.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.top.equalTo(titleLabel.snp.bottom).offset(AppSpacing.sm)
make.leading.trailing.bottom.equalToSuperview()
make.height.equalTo(88)
}
@ -101,8 +101,8 @@ final class HomeMenuCell: UICollectionViewCell {
iconView.tintColor = AppColor.primary
iconView.contentMode = .scaleAspectFit
titleLabel.font = .systemFont(ofSize: 12)
titleLabel.textColor = AppColor.text333
titleLabel.font = .app(.caption)
titleLabel.textColor = AppColor.textPrimary
titleLabel.textAlignment = .center
titleLabel.numberOfLines = 2
@ -110,13 +110,13 @@ final class HomeMenuCell: UICollectionViewCell {
contentView.addSubview(titleLabel)
iconView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(8)
make.top.equalToSuperview().offset(AppSpacing.xs)
make.centerX.equalToSuperview()
make.width.height.equalTo(28)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(iconView.snp.bottom).offset(8)
make.leading.trailing.equalToSuperview().inset(4)
make.top.equalTo(iconView.snp.bottom).offset(AppSpacing.xs)
make.leading.trailing.equalToSuperview().inset(AppSpacing.xxs)
}
}

View File

@ -17,23 +17,23 @@ final class HomeLocationReportCardView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
layer.cornerRadius = 10
backgroundColor = AppColor.cardBackground
layer.cornerRadius = AppRadius.md
titleLabel.text = "位置上报"
titleLabel.font = .systemFont(ofSize: 16, weight: .semibold)
titleLabel.textColor = AppColor.text333
titleLabel.font = .app(.title)
titleLabel.textColor = AppColor.textPrimary
addressLabel.font = .systemFont(ofSize: 13)
addressLabel.textColor = AppColor.text666
addressLabel.font = .app(.body)
addressLabel.textColor = AppColor.textSecondary
addressLabel.numberOfLines = 2
reportButton.setTitle("立即上报", for: .normal)
reportButton.setTitleColor(.white, for: .normal)
reportButton.backgroundColor = AppColor.primary
reportButton.layer.cornerRadius = 6
reportButton.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium)
reportButton.contentEdgeInsets = UIEdgeInsets(top: 8, left: 14, bottom: 8, right: 14)
reportButton.layer.cornerRadius = AppRadius.sm
reportButton.titleLabel?.font = .app(.bodyMedium)
reportButton.contentEdgeInsets = UIEdgeInsets(top: AppSpacing.xs, left: 14, bottom: AppSpacing.xs, right: 14)
reportButton.addTarget(self, action: #selector(reportTapped), for: .touchUpInside)
addSubview(titleLabel)
@ -41,16 +41,16 @@ final class HomeLocationReportCardView: UIView {
addSubview(reportButton)
titleLabel.snp.makeConstraints { make in
make.top.leading.equalToSuperview().offset(15)
make.top.leading.equalToSuperview().offset(AppSpacing.screenHorizontalInset)
}
addressLabel.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(8)
make.leading.equalToSuperview().offset(15)
make.bottom.equalToSuperview().offset(-15)
make.trailing.lessThanOrEqualTo(reportButton.snp.leading).offset(-12)
make.top.equalTo(titleLabel.snp.bottom).offset(AppSpacing.xs)
make.leading.equalToSuperview().offset(AppSpacing.screenHorizontalInset)
make.bottom.equalToSuperview().offset(-AppSpacing.screenHorizontalInset)
make.trailing.lessThanOrEqualTo(reportButton.snp.leading).offset(-AppSpacing.sm)
}
reportButton.snp.makeConstraints { make in
make.trailing.equalToSuperview().offset(-15)
make.trailing.equalToSuperview().offset(-AppSpacing.screenHorizontalInset)
make.centerY.equalToSuperview()
}
}

View File

@ -19,7 +19,7 @@ final class HomeQuickActionsView: UIView {
super.init(frame: frame)
stackView.axis = .horizontal
stackView.distribution = .fillEqually
stackView.spacing = 12
stackView.spacing = AppSpacing.sm
addSubview(stackView)
stackView.snp.makeConstraints { make in
make.edges.equalToSuperview()
@ -45,8 +45,8 @@ final class HomeQuickActionsView: UIView {
private func makeActionButton(title: String, icon: String, action: Selector) -> UIView {
let container = UIView()
container.backgroundColor = .white
container.layer.cornerRadius = 10
container.backgroundColor = AppColor.cardBackground
container.layer.cornerRadius = AppRadius.md
let button = UIButton(type: .system)
button.addTarget(self, action: action, for: .touchUpInside)
@ -61,8 +61,8 @@ final class HomeQuickActionsView: UIView {
let label = UILabel()
label.text = title
label.font = .systemFont(ofSize: 13, weight: .medium)
label.textColor = AppColor.text333
label.font = .app(.bodyMedium)
label.textColor = AppColor.textPrimary
label.textAlignment = .center
let column = UIStackView(arrangedSubviews: [imageView, label])

View File

@ -16,22 +16,22 @@ final class HomeScenicHeaderView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
titleLabel.font = .systemFont(ofSize: 16, weight: .medium)
titleLabel.textColor = AppColor.text333
arrowView.tintColor = AppColor.text666
backgroundColor = AppColor.cardBackground
titleLabel.font = .app(.subtitle)
titleLabel.textColor = AppColor.textPrimary
arrowView.tintColor = AppColor.textSecondary
arrowView.contentMode = .scaleAspectFit
addSubview(titleLabel)
addSubview(arrowView)
titleLabel.snp.makeConstraints { make in
make.leading.equalToSuperview().offset(16)
make.leading.equalToSuperview().offset(AppSpacing.screenHorizontalInset)
make.centerY.equalToSuperview()
make.trailing.lessThanOrEqualTo(arrowView.snp.leading).offset(-8)
make.trailing.lessThanOrEqualTo(arrowView.snp.leading).offset(-AppSpacing.xs)
}
arrowView.snp.makeConstraints { make in
make.trailing.equalToSuperview().offset(-16)
make.trailing.equalToSuperview().offset(-AppSpacing.screenHorizontalInset)
make.centerY.equalToSuperview()
make.width.height.equalTo(16)
}

View File

@ -15,17 +15,17 @@ final class HomeStoreCardView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
layer.cornerRadius = 10
backgroundColor = AppColor.cardBackground
layer.cornerRadius = AppRadius.md
nameLabel.font = .systemFont(ofSize: 16, weight: .semibold)
nameLabel.textColor = AppColor.text333
nameLabel.font = .app(.title)
nameLabel.textColor = AppColor.textPrimary
addressLabel.font = .systemFont(ofSize: 13)
addressLabel.textColor = AppColor.text666
addressLabel.font = .app(.body)
addressLabel.textColor = AppColor.textSecondary
addressLabel.numberOfLines = 2
statusLabel.font = .systemFont(ofSize: 12, weight: .medium)
statusLabel.font = .app(.captionMedium)
statusLabel.textColor = AppColor.primary
addSubview(nameLabel)
@ -33,17 +33,17 @@ final class HomeStoreCardView: UIView {
addSubview(statusLabel)
nameLabel.snp.makeConstraints { make in
make.top.leading.equalToSuperview().offset(15)
make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-8)
make.top.leading.equalToSuperview().offset(AppSpacing.screenHorizontalInset)
make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-AppSpacing.xs)
}
statusLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(15)
make.trailing.equalToSuperview().offset(-15)
make.top.equalToSuperview().offset(AppSpacing.screenHorizontalInset)
make.trailing.equalToSuperview().offset(-AppSpacing.screenHorizontalInset)
}
addressLabel.snp.makeConstraints { make in
make.top.equalTo(nameLabel.snp.bottom).offset(8)
make.leading.trailing.equalToSuperview().inset(15)
make.bottom.equalToSuperview().offset(-15)
make.top.equalTo(nameLabel.snp.bottom).offset(AppSpacing.xs)
make.leading.trailing.equalToSuperview().inset(AppSpacing.screenHorizontalInset)
make.bottom.equalToSuperview().offset(-AppSpacing.screenHorizontalInset)
}
}

View File

@ -18,18 +18,18 @@ final class HomeWorkStatusCardView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
layer.cornerRadius = 10
backgroundColor = AppColor.cardBackground
layer.cornerRadius = AppRadius.md
onlineButton.titleLabel?.font = .systemFont(ofSize: 12, weight: .medium)
onlineButton.layer.cornerRadius = 4
onlineButton.titleLabel?.font = .app(.captionMedium)
onlineButton.layer.cornerRadius = AppRadius.xs
onlineButton.contentEdgeInsets = UIEdgeInsets(top: 6, left: 12, bottom: 6, right: 12)
onlineButton.addTarget(self, action: #selector(onlineTapped), for: .touchUpInside)
countdownLabel.font = .systemFont(ofSize: 16, weight: .medium)
countdownLabel.font = .app(.subtitle)
countdownLabel.textColor = AppColor.primary
reminderButton.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium)
reminderButton.titleLabel?.font = .app(.subtitle)
reminderButton.setTitleColor(AppColor.primary, for: .normal)
reminderButton.addTarget(self, action: #selector(reminderTapped), for: .touchUpInside)
@ -38,18 +38,18 @@ final class HomeWorkStatusCardView: UIView {
addSubview(reminderButton)
onlineButton.snp.makeConstraints { make in
make.leading.equalToSuperview().offset(15)
make.leading.equalToSuperview().offset(AppSpacing.screenHorizontalInset)
make.centerY.equalToSuperview()
}
countdownLabel.snp.makeConstraints { make in
make.center.equalToSuperview()
}
reminderButton.snp.makeConstraints { make in
make.trailing.equalToSuperview().offset(-15)
make.trailing.equalToSuperview().offset(-AppSpacing.screenHorizontalInset)
make.centerY.equalToSuperview()
}
snp.makeConstraints { make in
make.height.equalTo(52)
make.height.equalTo(AppSpacing.formRowHeight)
}
}
@ -61,11 +61,11 @@ final class HomeWorkStatusCardView: UIView {
func apply(isOnline: Bool, countdownText: String, reminderMinutes: Int) {
onlineButton.setTitle(isOnline ? "在线" : "离线", for: .normal)
if isOnline {
onlineButton.backgroundColor = UIColor(hex: 0x22C55E)
onlineButton.setTitleColor(UIColor(hex: 0xF0FDF4), for: .normal)
onlineButton.backgroundColor = AppColor.online
onlineButton.setTitleColor(AppColor.successBackground, for: .normal)
} else {
onlineButton.backgroundColor = UIColor(hex: 0xF4F4F4)
onlineButton.setTitleColor(UIColor(hex: 0x7B8EAA), for: .normal)
onlineButton.backgroundColor = AppColor.inputBackground
onlineButton.setTitleColor(AppColor.textTabInactive, for: .normal)
}
countdownLabel.text = countdownText
let reminderTitle = reminderMinutes == 0 ? "不提醒" : "提前\(reminderMinutes)分钟"