// // ProfileStatusBadgeView.swift // suixinkan // import SnapKit import UIKit /// 个人信息页状态标签,用于账号状态、审核状态等展示。 final class ProfileStatusBadgeView: UIView { enum Style { case accountActive case scenic case auditPending case auditApproved case auditRejected case bankPending case bankApproved case bankRejected } private let label = UILabel() override init(frame: CGRect) { super.init(frame: frame) label.font = .systemFont(ofSize: 12, weight: .medium) label.textAlignment = .center addSubview(label) label.snp.makeConstraints { make in make.edges.equalToSuperview().inset(UIEdgeInsets(top: 3, left: 8, bottom: 3, right: 8)) } layer.cornerRadius = 4 clipsToBounds = true } @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func apply(style: Style, text: String) { label.text = text switch style { case .accountActive: label.textColor = UIColor(hex: 0x22C55E) backgroundColor = UIColor(hex: 0xF0FDF4) case .scenic: label.textColor = AppColor.primary backgroundColor = UIColor(hex: 0xEFF6FF) case .auditPending, .bankPending: label.textColor = UIColor(hex: 0xFF7B00) backgroundColor = UIColor(hex: 0xFFF0E2) case .auditApproved, .bankApproved: label.textColor = AppColor.primary backgroundColor = UIColor(hex: 0xEFF6FF) case .auditRejected, .bankRejected: label.textColor = UIColor(hex: 0xEF4444) backgroundColor = UIColor(hex: 0xFFE7E7) } } }