Commit 12599bd3 authored by pete谢兆麟's avatar pete谢兆麟

新增受养人 首页逻辑修改

parent c87f617b
...@@ -100,6 +100,24 @@ class YHAddAdoptersViewController: YHBaseViewController { ...@@ -100,6 +100,24 @@ class YHAddAdoptersViewController: YHBaseViewController {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
func showDeleteAlert(_ model: YHAdopterDependentModel) {
var spouse = "子女"
if model.is_spouse == 1 {
spouse = "配偶"
}
var value = ""
if model.dep_name.count != 0 {
value = spouse + "(\(model.dep_name))"
} else {
value = spouse
}
YHCommonAlertView.show("", "您确定要删除\(value)吗?", "取消", "确认") {
self.viewModel.postDependentsDel(id: model.id) { [weak self] success, error in
guard let self = self else { return }
self.getData()
}
}
}
} }
extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSource { extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSource {
...@@ -174,10 +192,7 @@ extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSourc ...@@ -174,10 +192,7 @@ extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSourc
} }
cell.deleteBlock = { [weak self] model in cell.deleteBlock = { [weak self] model in
guard let self = self else { return } guard let self = self else { return }
self.viewModel.postDependentsDel(id: model.id) { [weak self] success, error in self.showDeleteAlert(model)
guard let self = self else { return }
self.getData()
}
} }
cell.clickBlock = { [weak self] model in cell.clickBlock = { [weak self] model in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -72,10 +72,6 @@ class YHAdopterNewPeopleViewController: YHBaseViewController { ...@@ -72,10 +72,6 @@ class YHAdopterNewPeopleViewController: YHBaseViewController {
stepView = { stepView = {
let step = YHStepView() let step = YHStepView()
step.dataSource = ["完善配偶信息", "上传配偶资料"] step.dataSource = ["完善配偶信息", "上传配偶资料"]
step.block = { [weak self] (index) in
guard let self = self else { return }
self.updateDataSource()
}
return step return step
}() }()
view.addSubview(stepView) view.addSubview(stepView)
......
...@@ -37,7 +37,7 @@ class YHAdopterDependentModel: SmartCodable { ...@@ -37,7 +37,7 @@ class YHAdopterDependentModel: SmartCodable {
var created_at : String = "" var created_at : String = ""
var updated_at : String = "" var updated_at : String = ""
var deleted_at : String = "" var deleted_at : String = ""
var has_spouse : Bool = false //是否有配偶 var is_spouse : Int = 0 //是否有配偶
var sync_subset_id : Int = 0 var sync_subset_id : Int = 0
required init() { required init() {
......
...@@ -162,6 +162,13 @@ class YHAdopterAddNewTableViewCell: UITableViewCell { ...@@ -162,6 +162,13 @@ class YHAdopterAddNewTableViewCell: UITableViewCell {
guard let dataSource = dataSource else { guard let dataSource = dataSource else {
return return
} }
if dataSource.count == 0 {
moreButton.isHidden = true
cannalButton.isHidden = true
} else {
moreButton.isHidden = false
cannalButton.isHidden = true
}
var total = 0 var total = 0
for i in 0 ..< dataSource.count { for i in 0 ..< dataSource.count {
let line = UIView() let line = UIView()
......
...@@ -111,10 +111,14 @@ class YHAdopterItemView: UIView { ...@@ -111,10 +111,14 @@ class YHAdopterItemView: UIView {
func updateAllViews() { func updateAllViews() {
guard let dataSource = dataSource else { return } guard let dataSource = dataSource else { return }
var spouse = "子女" var spouse = "子女"
if dataSource.has_spouse { if dataSource.is_spouse == 1 {
spouse = "配偶" spouse = "配偶"
} }
if dataSource.dep_name.count != 0 {
titleLabel.text = spouse + "(\(dataSource.dep_name))" titleLabel.text = spouse + "(\(dataSource.dep_name))"
} else {
titleLabel.text = spouse
}
if dataSource.status == 0 { if dataSource.status == 0 {
explainLabel.text = "待完善" explainLabel.text = "待完善"
explainLabel.textColor = UIColor.brandMainColor explainLabel.textColor = UIColor.brandMainColor
......
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