Commit 4b73c763 authored by Steven杜宇's avatar Steven杜宇

// 家庭

parent f6f84b2f
......@@ -38,19 +38,73 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
return tableView
}()
lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
let cancelBtn = UIButton()
cancelBtn.backgroundColor = UIColor.init(hex: 0xF8F9FB)
cancelBtn.setTitle("取消", for: .normal)
cancelBtn.setTitleColor(.init(hex: 0x222222), for: .normal)
cancelBtn.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
cancelBtn.addTarget(self, action: #selector(didCancelBtnClicked), for: .touchUpInside)
cancelBtn.layer.cornerRadius = kCornerRadius3
view.addSubview(cancelBtn)
let confirmBtn = UIButton()
confirmBtn.backgroundColor = .brandMainColor
confirmBtn.setTitle("确认", for: .normal)
confirmBtn.setTitleColor(.white, for: .normal)
confirmBtn.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
confirmBtn.addTarget(self, action: #selector(didConfirmBtnClicked), for: .touchUpInside)
confirmBtn.layer.cornerRadius = kCornerRadius3
view.addSubview(confirmBtn)
cancelBtn.snp.makeConstraints { make in
make.top.equalTo(10)
make.left.equalTo(16)
make.height.equalTo(44)
make.width.equalTo(86)
}
confirmBtn.snp.makeConstraints { make in
make.top.equalTo(10)
make.right.equalTo(-16)
make.height.equalTo(44)
make.left.equalTo(cancelBtn.snp.right).offset(10)
}
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navTitle = "家庭信息确认"
self.view.backgroundColor = .white
self.view.addSubview(self.tableView)
self.view.addSubview(self.bottomView)
self.tableView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar+16)
make.bottom.equalTo(self.bottomView.snp.top)
}
self.bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(98)
}
self.getData()
}
@objc func didCancelBtnClicked() {
}
@objc func didConfirmBtnClicked() {
}
func getData() {
items.removeAll()
......@@ -66,7 +120,7 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
action: .edit,
isMust: true,
title: "主申请人姓名",
detail: "张全蛋",
detail: "张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋",
previousTitle: "原主申人姓名",
previousDetail: "张晓丹",
isEditMode: isEditMode,
......
......@@ -44,6 +44,10 @@ class YHFamilyInfoItem {
var isEditMode: Bool = false
var isShowPreviousInfo: Bool = false
required init() {
}
init(id: YHFamilyInfoType, action: YHFamilyInfoActionType, isMust: Bool, title: String, detail: String, previousTitle: String, previousDetail: String, isEditMode: Bool, isShowPreviousInfo: Bool) {
self.id = id
self.action = action
......
......@@ -11,7 +11,9 @@ import AttributedString
class YHInfoItemView: UIView {
var rightBtnWidth = 28.0
var item: YHFamilyInfoItem = YHFamilyInfoItem()
let rightBtnWidth = 22.0
lazy var lineView: UIView = {
let view = UIView()
......@@ -34,9 +36,18 @@ class YHInfoItemView: UIView {
return label
}()
lazy var textField: UITextField = {
let tf = UITextField()
tf.font = UIFont.PFSC_M(ofSize: 14)
tf.textColor = UIColor.mainTextColor
tf.isHidden = true
return tf
}()
lazy var rightBtn: UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "family_info_del"), for: .normal)
btn.addTarget(self, action: #selector(didActionButtonClicked), for: .touchUpInside)
return btn
}()
......@@ -78,6 +89,7 @@ class YHInfoItemView: UIView {
self.addSubview(lineView)
self.addSubview(titleLabel)
self.addSubview(detailLabel)
self.addSubview(textField)
self.addSubview(rightBtn)
self.addSubview(previousContentView)
previousContentView.addSubview(previousTitleLabel)
......@@ -101,9 +113,16 @@ class YHInfoItemView: UIView {
make.right.equalTo(-18.0-rightBtnWidth-18.0)
}
textField.snp.makeConstraints { make in
make.top.equalTo(0)
make.left.equalTo(detailLabel)
make.right.equalTo(-18.0-rightBtnWidth-18.0)
make.height.equalTo(52)
}
rightBtn.snp.makeConstraints { make in
make.top.equalTo(16)
make.width.height.equalTo(22)
make.width.height.equalTo(rightBtnWidth)
make.right.equalTo(0)
}
......@@ -127,8 +146,17 @@ class YHInfoItemView: UIView {
}
}
func updateItem(_ item: YHFamilyInfoItem) {
@objc func didActionButtonClicked() {
let isTextEdit = item.isEditMode && item.action == .edit
if isTextEdit {
textField.becomeFirstResponder()
textField.text = ""
}
}
func updateItem(_ item: YHFamilyInfoItem) {
self.item = item
// 标题
var title: ASAttributedString = .init("\(item.title)", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
// 是否必填
......@@ -138,7 +166,13 @@ class YHInfoItemView: UIView {
}
titleLabel.attributed.text = title
let isTextEdit = item.isEditMode && item.action == .edit
detailLabel.text = item.detail
detailLabel.isHidden = isTextEdit
textField.isHidden = !isTextEdit
textField.text = item.detail
rightBtn.isHidden = !item.isEditMode
if item.action == .edit {
rightBtn.setImage(UIImage(named: "family_info_del"), for: .normal)
......@@ -149,9 +183,15 @@ class YHInfoItemView: UIView {
previousDetailLabel.text = item.previousDetail
previousContentView.isHidden = !item.isShowPreviousInfo
detailLabel.snp.updateConstraints { make in
detailLabel.snp.remakeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(titleLabel.snp.right)
make.right.equalTo(item.isEditMode ? -18.0-rightBtnWidth-18.0 : 0)
if isTextEdit {
make.height.equalTo(20)
}
}
previousContentView.snp.remakeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalTo(item.isShowPreviousInfo ? -16 : 0)
......
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