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

// 家庭

parent 3b051ab7
...@@ -19,6 +19,7 @@ enum YHFamilyMemberRelationType: Int { ...@@ -19,6 +19,7 @@ enum YHFamilyMemberRelationType: Int {
class YHFamilyInfoUpdateViewController: YHBaseViewController { class YHFamilyInfoUpdateViewController: YHBaseViewController {
var relation:YHFamilyMemberRelationType = .mainApplicant var relation:YHFamilyMemberRelationType = .mainApplicant
var isInfoEditing: Bool = false
var items: [[YHFamilyInfoItem]] = [] var items: [[YHFamilyInfoItem]] = []
...@@ -52,8 +53,10 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -52,8 +53,10 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
func getData() { func getData() {
var isEditMode = false items.removeAll()
var isShowPreviousInfo = false
let isEditMode = self.isInfoEditing
let isShowPreviousInfo = false
// arr1 信息核实 // arr1 信息核实
var arr1 = [YHFamilyInfoItem]() var arr1 = [YHFamilyInfoItem]()
...@@ -200,8 +203,8 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -200,8 +203,8 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
detail: "港澳通行证", detail: "港澳通行证",
previousTitle: "原申报旅行证件", previousTitle: "原申报旅行证件",
previousDetail: "港澳通行证", previousDetail: "港澳通行证",
isEditMode: isEditMode, isEditMode: false,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: false)
arr2.append(travelCerInfo) arr2.append(travelCerInfo)
let cerIdInfo = YHFamilyInfoItem(id: .travelCertificateId, let cerIdInfo = YHFamilyInfoItem(id: .travelCertificateId,
...@@ -211,8 +214,8 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -211,8 +214,8 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
detail: "2351235234523542", detail: "2351235234523542",
previousTitle: "原证件号", previousTitle: "原证件号",
previousDetail: "2351235234523542", previousDetail: "2351235234523542",
isEditMode: isEditMode, isEditMode: false,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: false)
arr2.append(cerIdInfo) arr2.append(cerIdInfo)
...@@ -231,16 +234,27 @@ extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewData ...@@ -231,16 +234,27 @@ extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewData
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHIFamilyInfoListCell.cellReuseIdentifier, for: indexPath) as! YHIFamilyInfoListCell let cell = tableView.dequeueReusableCell(withIdentifier: YHIFamilyInfoListCell.cellReuseIdentifier, for: indexPath) as! YHIFamilyInfoListCell
if indexPath.row == 0 { if indexPath.row == 0 {
// 标题 // 标题
var title: ASAttributedString = .init("信息核实", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor)) let title: ASAttributedString = .init("信息核实", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
cell.titleLabel.attributed.text = title cell.titleLabel.attributed.text = title
cell.modifyBtn.isHidden = false
cell.isEditState = self.isInfoEditing
cell.editBlock = {
[weak self] isEdit in
guard let self = self else { return }
self.isInfoEditing = isEdit
self.getData()
}
} else { } else {
let title: ASAttributedString = .init("递交证件信息", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor)) let title: ASAttributedString = .init("递交证件信息", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
let subtitle: ASAttributedString = .init("(如需更换,请联系您的生活管家)", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor(alpha: 0.5))) let subtitle: ASAttributedString = .init("(如需更换,请联系您的生活管家)", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
cell.titleLabel.attributed.text = title + subtitle cell.titleLabel.attributed.text = title + subtitle
cell.modifyBtn.isHidden = true
} }
if 0 <= indexPath.row && indexPath.row < items.count { if 0 <= indexPath.row && indexPath.row < items.count {
......
...@@ -61,6 +61,14 @@ class YHIFamilyInfoListCell: UITableViewCell { ...@@ -61,6 +61,14 @@ class YHIFamilyInfoListCell: UITableViewCell {
static let cellReuseIdentifier = "YHIFamilyInfoListCell" static let cellReuseIdentifier = "YHIFamilyInfoListCell"
var isEditState: Bool = false {
didSet {
let text = self.isEditState ? "完成" : "修改"
self.modifyBtn.setTitle(text, for: .normal)
}
}
var editBlock:((Bool)->())?
lazy var whiteView: UIView = { lazy var whiteView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .white view.backgroundColor = .white
...@@ -77,8 +85,9 @@ class YHIFamilyInfoListCell: UITableViewCell { ...@@ -77,8 +85,9 @@ class YHIFamilyInfoListCell: UITableViewCell {
lazy var modifyBtn: UIButton = { lazy var modifyBtn: UIButton = {
let btn = UIButton() let btn = UIButton()
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14) btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.titleLabel?.textColor = .brandMainColor btn.setTitleColor(.brandMainColor, for: .normal)
btn.setTitle("修改", for: .normal) btn.setTitle("修改", for: .normal)
btn.addTarget(self, action: #selector(didModifyBtnClicked), for: .touchUpInside)
return btn return btn
}() }()
...@@ -96,6 +105,10 @@ class YHIFamilyInfoListCell: UITableViewCell { ...@@ -96,6 +105,10 @@ class YHIFamilyInfoListCell: UITableViewCell {
setupUI() setupUI()
} }
@objc func didModifyBtnClicked() {
editBlock?(!self.isEditState)
}
func setupUI() { func setupUI() {
self.selectionStyle = .none self.selectionStyle = .none
......
...@@ -140,13 +140,17 @@ class YHInfoItemView: UIView { ...@@ -140,13 +140,17 @@ class YHInfoItemView: UIView {
titleLabel.attributed.text = title titleLabel.attributed.text = title
detailLabel.text = item.detail detailLabel.text = item.detail
rightBtn.isHidden = !item.isEditMode rightBtn.isHidden = !item.isEditMode
if item.action == .edit {
rightBtn.setImage(UIImage(named: "family_info_del"), for: .normal)
} else if item.action == .select {
rightBtn.setImage(UIImage(named: "family_info_arrow"), for: .normal)
}
previousTitleLabel.text = item.previousTitle previousTitleLabel.text = item.previousTitle
previousDetailLabel.text = item.previousDetail previousDetailLabel.text = item.previousDetail
previousContentView.isHidden = !item.isShowPreviousInfo previousContentView.isHidden = !item.isShowPreviousInfo
detailLabel.snp.updateConstraints { make in detailLabel.snp.updateConstraints { make in
make.right.equalTo(item.isEditMode ? -18.0-rightBtnWidth-18.0 : 0) make.right.equalTo(item.isEditMode ? -18.0-rightBtnWidth-18.0 : 0)
} }
previousContentView.snp.remakeConstraints { make in previousContentView.snp.remakeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
......
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