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

// 家庭

parent a9190c23
...@@ -196,6 +196,8 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -196,6 +196,8 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
} }
let birthNation = "国内" let birthNation = "国内"
let options = [YHFamilyInfoOption(value: "国内", isSelect: true),
YHFamilyInfoOption(value: "国外", isSelect: false)]
let birthNationInfo = YHFamilyInfoItem(id: .birthNation, let birthNationInfo = YHFamilyInfoItem(id: .birthNation,
action: .choice, action: .choice,
isMust: true, isMust: true,
...@@ -203,13 +205,14 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -203,13 +205,14 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
detail: birthNation, detail: birthNation,
previousTitle: "原出生国家/地区", previousTitle: "原出生国家/地区",
previousDetail: birthNation, previousDetail: birthNation,
options: options,
isEditMode: isEditMode, isEditMode: isEditMode,
isShowPreviousInfo: isShowPreviousInfo) isShowPreviousInfo: isShowPreviousInfo)
arr1.append(birthNationInfo) arr1.append(birthNationInfo)
let birthPlace = "上海市市辖区" let birthPlace = "上海市市辖区"
let birthPlaceInfo = YHFamilyInfoItem(id: .birthPlace, let birthPlaceInfo = YHFamilyInfoItem(id: .birthPlace,
action: .edit, action: .select,
isMust: true, isMust: true,
title: "出生地", title: "出生地",
detail: birthPlace, detail: birthPlace,
...@@ -221,7 +224,7 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -221,7 +224,7 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
let declareNation = "中国-CHINA" let declareNation = "中国-CHINA"
let declareNationInfo = YHFamilyInfoItem(id: .declareNation, let declareNationInfo = YHFamilyInfoItem(id: .declareNation,
action: .edit, action: .select,
isMust: true, isMust: true,
title: "申报国籍", title: "申报国籍",
detail: declareNation, detail: declareNation,
...@@ -284,7 +287,10 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController { ...@@ -284,7 +287,10 @@ class YHFamilyInfoUpdateViewController: YHBaseViewController {
arr2.append(cerIdInfo) arr2.append(cerIdInfo)
items.append(contentsOf: [arr1, arr2]) // 信息核实
items.append(arr1)
// 递交证件信息
items.append(arr2)
self.tableView.reloadData() self.tableView.reloadData()
} }
......
...@@ -33,6 +33,16 @@ enum YHFamilyInfoActionType: Int { ...@@ -33,6 +33,16 @@ enum YHFamilyInfoActionType: Int {
case choice = 3 // 按钮多项选择 case choice = 3 // 按钮多项选择
} }
class YHFamilyInfoOption {
var value: String = ""
var isSelect: Bool = false
init(value: String, isSelect: Bool) {
self.value = value
self.isSelect = isSelect
}
}
class YHFamilyInfoItem { class YHFamilyInfoItem {
var id: YHFamilyInfoType = .none var id: YHFamilyInfoType = .none
var action:YHFamilyInfoActionType = .none var action:YHFamilyInfoActionType = .none
...@@ -43,12 +53,13 @@ class YHFamilyInfoItem { ...@@ -43,12 +53,13 @@ class YHFamilyInfoItem {
var previousDetail: String = "" var previousDetail: String = ""
var isEditMode: Bool = false var isEditMode: Bool = false
var isShowPreviousInfo: Bool = false var isShowPreviousInfo: Bool = false
var options:[YHFamilyInfoOption] = []
required init() { required init() {
} }
init(id: YHFamilyInfoType, action: YHFamilyInfoActionType, isMust: Bool, title: String, detail: String, previousTitle: String, previousDetail: String, isEditMode: Bool, isShowPreviousInfo: Bool) { init(id: YHFamilyInfoType, action: YHFamilyInfoActionType, isMust: Bool, title: String, detail: String, previousTitle: String, previousDetail: String, options:[YHFamilyInfoOption] = [], isEditMode: Bool, isShowPreviousInfo: Bool) {
self.id = id self.id = id
self.action = action self.action = action
self.isMust = isMust self.isMust = isMust
...@@ -56,6 +67,7 @@ class YHFamilyInfoItem { ...@@ -56,6 +67,7 @@ class YHFamilyInfoItem {
self.detail = detail self.detail = detail
self.previousTitle = previousTitle self.previousTitle = previousTitle
self.previousDetail = previousDetail self.previousDetail = previousDetail
self.options = options
self.isEditMode = isEditMode self.isEditMode = isEditMode
self.isShowPreviousInfo = isShowPreviousInfo self.isShowPreviousInfo = isShowPreviousInfo
} }
...@@ -154,24 +166,37 @@ class YHIFamilyInfoListCell: UITableViewCell { ...@@ -154,24 +166,37 @@ class YHIFamilyInfoListCell: UITableViewCell {
func updateItems(_ items:[YHFamilyInfoItem]) { func updateItems(_ items:[YHFamilyInfoItem]) {
itemsContentView.removeSubviews() itemsContentView.removeSubviews()
var lastItemView:YHInfoItemView? = nil var lastItemView:UIView? = nil
for (index, item) in items.enumerated() { for (index, item) in items.enumerated() {
let itemView = YHInfoItemView(frame: .zero) var itemView:UIView? = YHInfoItemView(frame: .zero)
itemsContentView.addSubview(itemView) if item.action == .choice {
itemView.updateItem(item) itemView = YHInfoOptionView(frame: .zero)
itemView.snp.makeConstraints { make in }
make.left.right.equalTo(0) if let itemView = itemView as? YHInfoItemView {
if let lastView = lastItemView { itemsContentView.addSubview(itemView)
make.top.equalTo(lastView.snp.bottom) itemView.updateItem(item)
} else {
make.top.equalTo(itemsContentView.snp.top)
}
if index == items.count-1 { } else if let itemView = itemView as? YHInfoOptionView {
make.bottom.equalTo(itemsContentView.snp.bottom) itemsContentView.addSubview(itemView)
itemView.updateItem(item)
}
if let itemView = itemView {
itemView.snp.makeConstraints { make in
make.left.right.equalTo(0)
if let lastView = lastItemView {
make.top.equalTo(lastView.snp.bottom)
} else {
make.top.equalTo(itemsContentView.snp.top)
}
if index == items.count-1 {
make.bottom.equalTo(itemsContentView.snp.bottom)
}
} }
lastItemView = itemView
} }
lastItemView = itemView
} }
self.setNeedsLayout() self.setNeedsLayout()
self.layoutIfNeeded() self.layoutIfNeeded()
......
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