Commit afe744f0 authored by Steven杜宇's avatar Steven杜宇

// 色值统一

parent 1afd2a53
......@@ -159,7 +159,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.titleLabel.text = item.getTitle()
cell.title = item.getTitle()
return cell
}
......
......@@ -168,9 +168,9 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
let titleItem = arr[0] as! YHFormTitleItem
if detailItem.type == .chinaIdentityCardNumber {
cell.titleLabel.text = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码")
cell.title = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码")
} else {
cell.titleLabel.text = detailItem.getTitle()
cell.title = detailItem.getTitle()
}
return cell
}
......@@ -190,7 +190,7 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.titleLabel.text = detailItem.getTitle()
cell.title = detailItem.getTitle()
return cell
}
......
......@@ -177,7 +177,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.titleLabel.text = item.getTitle()
cell.title = item.getTitle()
return cell
}
......
......@@ -179,7 +179,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.titleLabel.text = item.getTitle()
cell.title = item.getTitle()
return cell
}
......
......@@ -183,7 +183,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.titleLabel.text = item.getTitle()
cell.title = item.getTitle()
return cell
}
......
......@@ -33,7 +33,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHFormItemDoubleChoiceCell.self, forCellReuseIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier)
tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier)
tableView.register(YHFormItemEnterDetailCell.self, forCellReuseIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier)
tableView.register(YHFormItemSelectSheetCell.self, forCellReuseIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier)
tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier)
tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier)
return tableView
......@@ -66,6 +66,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
let title1 = YHFormTitleItem(type: .nationality)
let item10 = YHFormDetailItem(type: .nationOrArea)
item10.value = spouse.nationality
item10.placeHolder = "请选择".local
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
......@@ -79,6 +80,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
if !spouse.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea)
item21.value = spouse.address?.country
item21.placeHolder = "请选择".local
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
......@@ -93,6 +95,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
if let area = address.area {
item22.value = area.joined(separator: "/")
}
item22.placeHolder = "请选择城市".local
arr2.append(item22)
}
......@@ -221,11 +224,11 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .nationOrArea || detailItem.type == .liveCity {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detailLabel.text = detailItem.value
cell.detailLabel.textAlignment = .left
cell.placeHolder = detailItem.placeHolder
cell.detail = detailItem.value
return cell
}
......@@ -233,8 +236,8 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.textField.text = detailItem.value
cell.textField.placeholder = detailItem.placeHolder
cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder
cell.textChange = {
[weak self] text in
guard let self = self else { return }
......
......@@ -12,7 +12,7 @@ class YHFormItemAddCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemAddCell"
let btnTitleColor = UIColor(hexString:"#4388FF")
let btnTitleColor:UIColor = .brandMainColor
let btnHeight = 44.0
let cornerRadius = 4.0
......@@ -27,8 +27,8 @@ class YHFormItemAddCell: UITableViewCell {
lazy var addBtn: UIButton = {
let btn = UIButton()
btn.setTitle("新增信息".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(btnTitleColor, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(btnTitleColor, for: .normal)
btn.iconInLeft(spacing: 6)
btn.setImage(UIImage(named: "form_add_info"), for: .normal)
......
......@@ -24,13 +24,13 @@ class YHFormChoiceItem {
class YHFormItemDoubleChoiceCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemDoubleChoiceCell"
let btnWidth = 70.0
let btnHeight = 32.0
let btnTitleSelectColor = UIColor(hex: 0x4487F9)
let btnTitleDefaultColor = UIColor(hex:0x222222)
let btnBgDefaultColor = UIColor(hex:0xF8F9FB)
let btnBgSelectColor = UIColor(hex:0x4487F9, alpha: 0.08)
let answerBaseTag = 9527
private let btnWidth = 70.0
private let btnHeight = 32.0
private let btnTitleSelectColor = UIColor.brandMainColor
private let btnTitleDefaultColor = UIColor.mainTextColor
private let btnBgDefaultColor = UIColor.contentBkgColor
private let btnBgSelectColor = UIColor.brandMainColor.withAlphaComponent(0.08)
private let answerBaseTag = 9527
var answerBlock:(([YHFormChoiceItem], Int)->Void)?
......@@ -41,7 +41,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
let str = "*"+question
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222)
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
......@@ -74,23 +74,23 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
}
// 更新答案按钮选中状态
func updateAnswerButton(_ btn:UIButton, _ isSelect:Bool) {
private func updateAnswerButton(_ btn:UIButton, _ isSelect:Bool) {
btn.layer.borderColor = (isSelect ? btnTitleSelectColor : .clear).cgColor
btn.setTitleColor((isSelect ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal)
btn.backgroundColor = (isSelect ? btnBgSelectColor : btnBgDefaultColor)
}
lazy var titleLabel: UILabel = {
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textColor = .mainTextColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.systemFont(ofSize: 14)
label.font = UIFont.PFSC_R(ofSize: 14)
label.lineBreakMode = .byCharWrapping
return label
}()
lazy var answer1Btn: UIButton = {
private lazy var answer1Btn: UIButton = {
let btn = UIButton()
btn.setTitle("", for: .normal)
......@@ -106,7 +106,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
return btn
}()
lazy var answer2Btn: UIButton = {
private lazy var answer2Btn: UIButton = {
let btn = UIButton()
btn.setTitle("", for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
......
......@@ -12,6 +12,8 @@ class YHFormItemEnterDetailCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemEnterDetailCell"
private let titleFont: UIFont = UIFont.PFSC_M(ofSize: 14)
private let titleColor:UIColor = .mainTextColor
// 是否必填 如必填title会展示红色*
var isMust = false
var deleteBlock:(()->Void)?
......@@ -29,8 +31,8 @@ class YHFormItemEnterDetailCell: UITableViewCell {
if let title = title {
let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222)
.font: titleFont,
.foregroundColor:titleColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
......@@ -42,13 +44,13 @@ class YHFormItemEnterDetailCell: UITableViewCell {
}
}
lazy var titleLabel: UILabel = {
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.text = "XXXXXXX"
label.textColor = UIColor(hexString:"#333333")
label.textColor = titleColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14)
label.font = titleFont
return label
}()
......@@ -62,17 +64,17 @@ class YHFormItemEnterDetailCell: UITableViewCell {
return label
}()
lazy var arrowImgView: UIImageView = {
private lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView
}()
lazy var deleteButton: UIButton = {
private lazy var deleteButton: UIButton = {
let btn = UIButton()
btn.setTitle("删除".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(UIColor(hex: 0xF81D22), for: .normal)
btn.setTitleColor(.failColor, for: .normal)
btn.addTarget(self, action: #selector(didClickDeleteBtn(btn:)), for: .touchUpInside)
btn.isHidden = true
return btn
......
......@@ -19,11 +19,11 @@ class YHFormItemInputTextCell: UITableViewCell {
var title:String? {
didSet {
if let title = title {
if let title = title, !title.isEmpty {
let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222)
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
......@@ -31,26 +31,44 @@ class YHFormItemInputTextCell: UITableViewCell {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
}
}
}
var placeHolder:String? {
didSet {
if let placeHolder = placeHolder {
textField.attributedPlaceholder = NSAttributedString(string: placeHolder, attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
} else {
textField.attributedPlaceholder = nil
}
}
}
var text:String? {
didSet {
textField.text = text
}
}
lazy var titleLabel: UILabel = {
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textColor = .mainTextColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14)
return label
}()
lazy var textField:UITextField = {
private lazy var textField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.placeholder = "请如实填写"
textField.font = UIFont.PFSC_R(ofSize: 14)
textField.tintColor = UIColor(hex: 0xC0C0C0)
textField.textColor = UIColor(hex: 0x222222)
textField.font = UIFont.PFSC_M(ofSize: 14)
textField.tintColor = UIColor.mainTextColor
textField.textColor = UIColor.mainTextColor
textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
return textField
}()
......
......@@ -12,17 +12,21 @@ import UIKit
class YHFormItemSelectSheetCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemSelectSheetCell"
private let titleColor = UIColor.mainTextColor
private let detailColor = UIColor.mainTextColor
private let placeHolderColor = UIColor.placeHolderColor
// 是否必填 如必填title会展示红色*
var isMust = false
var placeHolder:String?
var title:String? {
didSet {
if let title = title {
if let title = title, !title.isEmpty {
let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222)
.foregroundColor:titleColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
......@@ -30,34 +34,31 @@ class YHFormItemSelectSheetCell: UITableViewCell {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
}
}
}
var tips:String? {
didSet {
tipsLabel.text = tips
}
}
var detail:String? {
didSet {
detailLabel.text = detail
if let detail = detail, !detail.isEmpty {
tipsLabel.isHidden = true
detailLabel.isHidden = false
detailLabel.text = detail
detailLabel.textColor = detailColor
} else {
tipsLabel.isHidden = false
detailLabel.isHidden = true
detailLabel.text = placeHolder
detailLabel.textColor = placeHolderColor
}
}
}
lazy var titleLabel: UILabel = {
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textColor = titleColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14)
......@@ -66,24 +67,13 @@ class YHFormItemSelectSheetCell: UITableViewCell {
private lazy var detailLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString: "#222222")
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize: 14)
label.isHidden = true
return label
}()
private lazy var tipsLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString: "#C0C0C0")
label.text = "请选择".local
label.textColor = detailColor
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize: 14)
label.isHidden = false
label.font = UIFont.PFSC_M(ofSize: 14)
return label
}()
lazy var arrowImgView: UIImageView = {
private lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView
}()
......@@ -102,7 +92,6 @@ class YHFormItemSelectSheetCell: UITableViewCell {
self.selectionStyle = .none
contentView.addSubview(titleLabel)
contentView.addSubview(detailLabel)
contentView.addSubview(tipsLabel)
contentView.addSubview(arrowImgView)
titleLabel.snp.makeConstraints { make in
......@@ -117,9 +106,6 @@ class YHFormItemSelectSheetCell: UITableViewCell {
make.centerY.equalToSuperview()
}
tipsLabel.snp.makeConstraints { make in
make.edges.equalTo(detailLabel)
}
arrowImgView.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(20, 20))
make.right.equalToSuperview().offset(-16)
......
......@@ -19,10 +19,10 @@ class YHFormItemTitleCell: UITableViewCell {
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textColor = .mainTextColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 16)
label.font = UIFont.PFSC_M(ofSize: 17)
return label
}()
......@@ -31,7 +31,7 @@ class YHFormItemTitleCell: UITableViewCell {
label.textColor = .labelTextColor2
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14)
label.font = UIFont.PFSC_R(ofSize: 12)
return label
}()
......@@ -40,7 +40,7 @@ class YHFormItemTitleCell: UITableViewCell {
let btn = UIButton()
btn.setTitle("取消操作".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(UIColor(hex: 0x4487F9), for: .normal)
btn.setTitleColor(.brandMainColor, for: .normal)
btn.tag = cancelTag
btn.addTarget(self, action: #selector(didClickOperatorBtn(btn:)), for: .touchUpInside)
btn.isHidden = true
......@@ -58,7 +58,7 @@ class YHFormItemTitleCell: UITableViewCell {
lazy var bottomLineView:UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xF0F0F0)
view.backgroundColor = .separatorColor
return view
}()
......
......@@ -58,9 +58,12 @@ extension UIColor {
//内容背景色
static let contentBkgColor : UIColor = UIColor(hexString: "#F8F9FB")!
//占位符颜色
static let placeHolderColor: UIColor = UIColor(hexString: "#C0C0C0")!
// 分割线颜色
static let separatorColor: UIColor = UIColor(hexString: "#F0F0F0")!
public convenience init(r : CGFloat, g : CGFloat, b : CGFloat,alpha:CGFloat = 1.0) {
self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: alpha)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment