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

// 家庭

parent 4b73c763
...@@ -116,132 +116,141 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -116,132 +116,141 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
var arr1 = [YHFamilyInfoItem]() var arr1 = [YHFamilyInfoItem]()
if self.relation == .mainApplicant { if self.relation == .mainApplicant {
let name = "张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋"
let mainApplicantNameInfo = YHFamilyInfoItem(id: .mainApplicantName, let mainApplicantNameInfo = YHFamilyInfoItem(id: .mainApplicantName,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "主申请人姓名", title: "主申请人姓名",
detail: "张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋张全蛋", detail: name,
previousTitle: "原主申人姓名", previousTitle: "原主申人姓名",
previousDetail: "张晓丹", previousDetail: name,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(mainApplicantNameInfo) arr1.append(mainApplicantNameInfo)
} else if self.relation == .spouse { } else if self.relation == .spouse {
let name = "李斯"
let spouseNameInfo = YHFamilyInfoItem(id: .spouseName, let spouseNameInfo = YHFamilyInfoItem(id: .spouseName,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "配偶姓名", title: "配偶姓名",
detail: "李斯", detail: name,
previousTitle: "原配偶姓名", previousTitle: "原配偶姓名",
previousDetail: "张晓丹", previousDetail: name,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(spouseNameInfo) arr1.append(spouseNameInfo)
} else if self.relation == .child { } else if self.relation == .child {
let name = "张晓蛋"
let childNameInfo = YHFamilyInfoItem(id: .childName, let childNameInfo = YHFamilyInfoItem(id: .childName,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "子女姓名", title: "子女姓名",
detail: "张晓蛋", detail: name,
previousTitle: "原子女姓名", previousTitle: "原子女姓名",
previousDetail: "张晓丹", previousDetail: name,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(childNameInfo) arr1.append(childNameInfo)
} }
let firsName = "ZH"
let firstNameInfo = YHFamilyInfoItem(id: .firstName, let firstNameInfo = YHFamilyInfoItem(id: .firstName,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "姓(拼音)", title: "姓(拼音)",
detail: "ZH", detail: firsName,
previousTitle: "原姓(拼音)", previousTitle: "原姓(拼音)",
previousDetail: "ZHANG", previousDetail: firsName,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(firstNameInfo) arr1.append(firstNameInfo)
let lastName = "ZHANGZ"
let lastNameInfo = YHFamilyInfoItem(id: .lastName, let lastNameInfo = YHFamilyInfoItem(id: .lastName,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "名(拼音)", title: "名(拼音)",
detail: "ZHANGZ", detail: lastName,
previousTitle: "原名(拼音)", previousTitle: "原名(拼音)",
previousDetail: "ZHANG", previousDetail: lastName,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(lastNameInfo) arr1.append(lastNameInfo)
if self.relation != .child { // 子女无婚姻状况一栏 if self.relation != .child { // 子女无婚姻状况一栏
let marriage = "已婚"
let marriageInfo = YHFamilyInfoItem(id: .marriage, let marriageInfo = YHFamilyInfoItem(id: .marriage,
action: .select, action: .select,
isMust: true, isMust: true,
title: "婚姻状况", title: "婚姻状况",
detail: "已婚", detail: marriage,
previousTitle: "原婚姻状况", previousTitle: "原婚姻状况",
previousDetail: "未婚", previousDetail: marriage,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(marriageInfo) arr1.append(marriageInfo)
} }
let birthNation = "国内"
let birthNationInfo = YHFamilyInfoItem(id: .birthNation, let birthNationInfo = YHFamilyInfoItem(id: .birthNation,
action: .choice, action: .choice,
isMust: true, isMust: true,
title: "出生国家/地区", title: "出生国家/地区",
detail: "国内", detail: birthNation,
previousTitle: "原出生国家/地区", previousTitle: "原出生国家/地区",
previousDetail: "国内", previousDetail: birthNation,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(birthNationInfo) arr1.append(birthNationInfo)
let birthPlace = "上海市市辖区"
let birthPlaceInfo = YHFamilyInfoItem(id: .birthPlace, let birthPlaceInfo = YHFamilyInfoItem(id: .birthPlace,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "出生地", title: "出生地",
detail: "上海市市辖区", detail: birthPlace,
previousTitle: "原出生地", previousTitle: "原出生地",
previousDetail: "上海市市辖区", previousDetail: birthPlace,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(birthPlaceInfo) arr1.append(birthPlaceInfo)
let declareNation = "中国-CHINA"
let declareNationInfo = YHFamilyInfoItem(id: .declareNation, let declareNationInfo = YHFamilyInfoItem(id: .declareNation,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "申报国籍", title: "申报国籍",
detail: "中国-CHINA", detail: declareNation,
previousTitle: "原申报国籍", previousTitle: "原申报国籍",
previousDetail: "中国-CHINA", previousDetail: declareNation,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(declareNationInfo) arr1.append(declareNationInfo)
let occupation = "总监"
let occupationInfo = YHFamilyInfoItem(id: .occupation, let occupationInfo = YHFamilyInfoItem(id: .occupation,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "职业", title: "职业",
detail: "总监", detail: occupation,
previousTitle: "原职业", previousTitle: "原职业",
previousDetail: "总监", previousDetail: occupation,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(occupationInfo) arr1.append(occupationInfo)
let hongkongId = "3231235123512"
let hongkongIdInfo = YHFamilyInfoItem(id: .hongKongId, let hongkongIdInfo = YHFamilyInfoItem(id: .hongKongId,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "香港身份证号", title: "香港身份证号",
detail: "3231235123512", detail: hongkongId,
previousTitle: "原香港身份证号", previousTitle: "原香港身份证号",
previousDetail: "1235235346523452", previousDetail: hongkongId,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(hongkongIdInfo) arr1.append(hongkongIdInfo)
...@@ -250,24 +259,26 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -250,24 +259,26 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
// arr2 递交证件信息 // arr2 递交证件信息
var arr2 = [YHFamilyInfoItem]() var arr2 = [YHFamilyInfoItem]()
let travelCerType = "港澳通行证"
let travelCerInfo = YHFamilyInfoItem(id: .travelCertificateType, let travelCerInfo = YHFamilyInfoItem(id: .travelCertificateType,
action: .select, action: .select,
isMust: true, isMust: true,
title: "申报旅行证件", title: "申报旅行证件",
detail: "港澳通行证", detail: travelCerType,
previousTitle: "原申报旅行证件", previousTitle: "原申报旅行证件",
previousDetail: "港澳通行证", previousDetail: travelCerType,
isEditMode: false, isEditMode: false,
isShowPreviousInfo: false) isShowPreviousInfo: false)
arr2.append(travelCerInfo) arr2.append(travelCerInfo)
let cerId = "2351235234523542"
let cerIdInfo = YHFamilyInfoItem(id: .travelCertificateId, let cerIdInfo = YHFamilyInfoItem(id: .travelCertificateId,
action: .edit, action: .edit,
isMust: true, isMust: true,
title: "证件号", title: "证件号",
detail: "2351235234523542", detail: cerId,
previousTitle: "原证件号", previousTitle: "原证件号",
previousDetail: "2351235234523542", previousDetail: cerId,
isEditMode: false, isEditMode: false,
isShowPreviousInfo: false) isShowPreviousInfo: false)
arr2.append(cerIdInfo) arr2.append(cerIdInfo)
...@@ -277,6 +288,23 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -277,6 +288,23 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
self.tableView.reloadData() self.tableView.reloadData()
} }
func updateData() {
let isEditMode = self.isInfoEditing
let isShowPreviousInfo = false
if let arr1 = items.first {
for item in arr1 {
item.isEditMode = isEditMode
if !isEditMode, !item.previousDetail.isEmpty, item.previousDetail != item.detail {
item.isShowPreviousInfo = true
} else {
item.isShowPreviousInfo = false
}
}
}
self.tableView.reloadData()
}
} }
extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewDataSource { extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewDataSource {
...@@ -299,7 +327,7 @@ extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewData ...@@ -299,7 +327,7 @@ extension YHFamilyInfoUpdateViewController: UITableViewDelegate, UITableViewData
[weak self] isEdit in [weak self] isEdit in
guard let self = self else { return } guard let self = self else { return }
self.isInfoEditing = isEdit self.isInfoEditing = isEdit
self.getData() self.updateData()
} }
} else { } else {
......
...@@ -118,7 +118,8 @@ extension YHApproverInfoVerifyCell: UITableViewDelegate, UITableViewDataSource { ...@@ -118,7 +118,8 @@ extension YHApproverInfoVerifyCell: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.row && indexPath.row < items.count { if 0 <= indexPath.row && indexPath.row < items.count {
let vc = YHFamilyInfoUpdateViewController()
UIViewController.current?.navigationController?.pushViewController(vc)
} }
} }
......
...@@ -41,6 +41,7 @@ class YHInfoItemView: UIView { ...@@ -41,6 +41,7 @@ class YHInfoItemView: UIView {
tf.font = UIFont.PFSC_M(ofSize: 14) tf.font = UIFont.PFSC_M(ofSize: 14)
tf.textColor = UIColor.mainTextColor tf.textColor = UIColor.mainTextColor
tf.isHidden = true tf.isHidden = true
tf.delegate = self
return tf return tf
}() }()
...@@ -110,13 +111,13 @@ class YHInfoItemView: UIView { ...@@ -110,13 +111,13 @@ class YHInfoItemView: UIView {
detailLabel.snp.makeConstraints { make in detailLabel.snp.makeConstraints { make in
make.top.equalTo(16) make.top.equalTo(16)
make.left.equalTo(titleLabel.snp.right) make.left.equalTo(titleLabel.snp.right)
make.right.equalTo(-18.0-rightBtnWidth-18.0) make.right.equalTo(-18.0-rightBtnWidth)
} }
textField.snp.makeConstraints { make in textField.snp.makeConstraints { make in
make.top.equalTo(0) make.top.equalTo(0)
make.left.equalTo(detailLabel) make.left.equalTo(detailLabel)
make.right.equalTo(-18.0-rightBtnWidth-18.0) make.right.equalTo(-18.0-rightBtnWidth)
make.height.equalTo(52) make.height.equalTo(52)
} }
...@@ -186,7 +187,7 @@ class YHInfoItemView: UIView { ...@@ -186,7 +187,7 @@ class YHInfoItemView: UIView {
detailLabel.snp.remakeConstraints { make in detailLabel.snp.remakeConstraints { make in
make.top.equalTo(16) make.top.equalTo(16)
make.left.equalTo(titleLabel.snp.right) make.left.equalTo(titleLabel.snp.right)
make.right.equalTo(item.isEditMode ? -18.0-rightBtnWidth-18.0 : 0) make.right.equalTo(item.isEditMode ? -18.0-rightBtnWidth : 0)
if isTextEdit { if isTextEdit {
make.height.equalTo(20) make.height.equalTo(20)
} }
...@@ -202,3 +203,22 @@ class YHInfoItemView: UIView { ...@@ -202,3 +203,22 @@ class YHInfoItemView: UIView {
} }
} }
} }
extension YHInfoItemView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.isEmpty == true { // 点击删除
return true
}
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
// if newText.count > Self.maxWordsCount {
// YHHUD.flash(message: "限制最多\(Self.maxWordsCount)个字符")
// return false
// }
self.item.detail = newText
return true
}
}
...@@ -338,7 +338,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -338,7 +338,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
} }
if true { if true {
let vc = YHFamilyInfoUpdateViewController() let vc = YHFamilyInfoConfirmViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
return return
} }
......
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