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

// 家庭

parent 3b051ab7
......@@ -19,6 +19,7 @@ enum YHFamilyMemberRelationType: Int {
class YHFamilyInfoUpdateViewController: YHBaseViewController {
var relation:YHFamilyMemberRelationType = .mainApplicant
var isInfoEditing: Bool = false
var items: [[YHFamilyInfoItem]] = []
......@@ -52,8 +53,10 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
func getData() {
var isEditMode = false
var isShowPreviousInfo = false
items.removeAll()
let isEditMode = self.isInfoEditing
let isShowPreviousInfo = false
// arr1 信息核实
var arr1 = [YHFamilyInfoItem]()
......@@ -200,8 +203,8 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
detail: "港澳通行证",
previousTitle: "原申报旅行证件",
previousDetail: "港澳通行证",
isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo)
isEditMode: false,
isShowPreviousInfo: false)
arr2.append(travelCerInfo)
let cerIdInfo = YHFamilyInfoItem(id: .travelCertificateId,
......@@ -211,8 +214,8 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
detail: "2351235234523542",
previousTitle: "原证件号",
previousDetail: "2351235234523542",
isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo)
isEditMode: false,
isShowPreviousInfo: false)
arr2.append(cerIdInfo)
......@@ -231,16 +234,27 @@ extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewData
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHIFamilyInfoListCell.cellReuseIdentifier, for: indexPath) as! YHIFamilyInfoListCell
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.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 {
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)))
cell.titleLabel.attributed.text = title + subtitle
cell.modifyBtn.isHidden = true
}
if 0 <= indexPath.row && indexPath.row < items.count {
......
......@@ -61,6 +61,14 @@ class YHIFamilyInfoListCell: UITableViewCell {
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 = {
let view = UIView()
view.backgroundColor = .white
......@@ -77,8 +85,9 @@ class YHIFamilyInfoListCell: UITableViewCell {
lazy var modifyBtn: UIButton = {
let btn = UIButton()
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.titleLabel?.textColor = .brandMainColor
btn.setTitleColor(.brandMainColor, for: .normal)
btn.setTitle("修改", for: .normal)
btn.addTarget(self, action: #selector(didModifyBtnClicked), for: .touchUpInside)
return btn
}()
......@@ -96,6 +105,10 @@ class YHIFamilyInfoListCell: UITableViewCell {
setupUI()
}
@objc func didModifyBtnClicked() {
editBlock?(!self.isEditState)
}
func setupUI() {
self.selectionStyle = .none
......
......@@ -140,13 +140,17 @@ class YHInfoItemView: UIView {
titleLabel.attributed.text = title
detailLabel.text = item.detail
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
previousDetailLabel.text = item.previousDetail
previousContentView.isHidden = !item.isShowPreviousInfo
detailLabel.snp.updateConstraints { make in
make.right.equalTo(item.isEditMode ? -18.0-rightBtnWidth-18.0 : 0)
}
previousContentView.snp.remakeConstraints { make in
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