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

// 家庭

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