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

// 家庭成员

parent 5fac66f3
...@@ -290,9 +290,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -290,9 +290,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
if isEditEnd { if isEditEnd {
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} }
return cell return cell
...@@ -330,9 +328,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -330,9 +328,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
let selectItem = answers[index] let selectItem = answers[index]
self.child?.setBirthOverSeas(selectItem.title == "国外".local) self.child?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} else if detailItem.type == .isHaveHkIdentityCard || detailItem.type == .isNowInHK || detailItem.type == .isPreviousMarriageChild { // 是否办理过香港身份证 是否在岗 是否前次婚姻子女 } else if detailItem.type == .isHaveHkIdentityCard || detailItem.type == .isNowInHK || detailItem.type == .isPreviousMarriageChild { // 是否办理过香港身份证 是否在岗 是否前次婚姻子女
var select = false var select = false
...@@ -356,9 +352,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -356,9 +352,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
self.child?.setPreviousMarriageChild(option) self.child?.setPreviousMarriageChild(option)
} }
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} }
return cell return cell
...@@ -367,6 +361,12 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -367,6 +361,12 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
return createDefaultCell(indexPath) return createDefaultCell(indexPath)
} }
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section >= items.count { return } if indexPath.section >= items.count { return }
...@@ -438,9 +438,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -438,9 +438,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
self.child?.childInHk.info = date self.child?.childInHk.info = date
} }
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} else if detailItem.type == .birthCity { // 出生城市 } else if detailItem.type == .birthCity { // 出生城市
...@@ -459,9 +457,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -459,9 +457,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
print("\(string1)\n\(string2)\n\(string3)\n\(string4)") print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.birthPlace.area = [string2, string3, string4] self.child?.birthPlace.area = [string2, string3, string4]
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
self.present(vc, animated: true) self.present(vc, animated: true)
...@@ -473,9 +469,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -473,9 +469,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
self.child?.hkIdentity = selectType.title self.child?.hkIdentity = selectType.title
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} else if detailItem.type == .occupation { // 职业 } else if detailItem.type == .occupation { // 职业
let occupation = self.child?.occupation ?? "" let occupation = self.child?.occupation ?? ""
...@@ -484,9 +478,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -484,9 +478,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
self.child?.occupation = selectType.title self.child?.occupation = selectType.title
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} else if detailItem.type == .gender { // 性别 } else if detailItem.type == .gender { // 性别
...@@ -499,9 +491,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -499,9 +491,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
let selectMale = (selectType.index == YHFormPickerViewSubType.gender(.male).index) let selectMale = (selectType.index == YHFormPickerViewSubType.gender(.male).index)
self.child?.setMale(selectMale) self.child?.setMale(selectMale)
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} else if detailItem.type == .marriageState { // 婚姻 } else if detailItem.type == .marriageState { // 婚姻
let marriage = self.child?.married let marriage = self.child?.married
...@@ -510,13 +500,13 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -510,13 +500,13 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
self.child?.married = selectType.title self.child?.married = selectType.title
self.loadBasicInfo() self.loadBasicInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} }
} }
} }
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) { func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理 // 复用时需清理
......
...@@ -84,7 +84,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -84,7 +84,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.saveBlock = { bottomView.saveBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
self.saveInfo() self.saveInfo(isShowToast: true)
} }
stepView.snp.makeConstraints { make in stepView.snp.makeConstraints { make in
...@@ -194,22 +194,39 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -194,22 +194,39 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
} }
extension YHChildInfoContainerVC { extension YHChildInfoContainerVC {
func saveInfo() {
// isSubmit:是否为提交 false为保存 true为提交
func saveInfo(isSubmit:Bool, callBack:((Bool, String?)->Void)?) {
guard let child = child else { return } guard let child = child else { return }
guard let info = child.toDictionary() else { return } guard let info = child.toDictionary() else { return }
let dict:[String: Any] = ["orderId":child.orderId, let dict:[String: Any] = ["order_id":child.orderId,
"relation":child.relationType.rawValue, "relation":child.relation,
"step":child.step, "step":child.step,
"next":false, "next":isSubmit,
"info":info] "info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { [weak self] success, error in self.familyRequest.addOrSaveFamilyMember(params:dict) {
[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if success { if let callBack = callBack {
callBack(success, error?.errorMsg)
} }
} }
} }
func saveInfo(isShowToast:Bool) {
saveInfo(isSubmit: false) {
[weak self] success, msg in
guard let self = self else { return }
if !isShowToast { return }
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
}
func saveInfoSilent() {
saveInfo(isShowToast: false)
}
} }
...@@ -242,8 +242,8 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -242,8 +242,8 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .isAccompanyToHK { // 是否随行 if detailItem.type == .isAccompanyToHK { // 是否随行
self.child?.setFollow(option) self.child?.setFollow(option)
if let delegate = self.delegate { if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.updateStepView)) {
delegate.updateStepView?() delegate.updateStepView()
} }
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证 } else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
...@@ -263,9 +263,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -263,9 +263,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.child?.setOwnCustody(option) self.child?.setOwnCustody(option)
} }
self.loadChildInfo() self.loadChildInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
return cell return cell
...@@ -292,9 +290,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -292,9 +290,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if isEditEnd { if isEditEnd {
self.loadChildInfo() self.loadChildInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} }
return cell return cell
...@@ -463,6 +459,12 @@ extension YHChildPrimaryInfoVC { ...@@ -463,6 +459,12 @@ extension YHChildPrimaryInfoVC {
func nextStep()->Bool { func nextStep()->Bool {
return true return true
} }
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
} }
......
...@@ -401,9 +401,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -401,9 +401,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
return return
} }
} }
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} }
return cell return cell
...@@ -668,4 +666,10 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -668,4 +666,10 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.layer.mask = nil cell.layer.mask = nil
} }
} }
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
} }
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
import UIKit import UIKit
@objc protocol YHSpouseInfoVCProtocol { @objc protocol YHSpouseInfoVCProtocol:NSObjectProtocol {
@objc optional func updateStepView() @objc func updateStepView()
@objc optional func saveInfo() // 静默保存数据(不显示toast)
@objc func saveInfoSilent()
} }
@objc protocol YHFamilyMemberProtol { @objc protocol YHFamilyMemberProtol {
...@@ -109,7 +110,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -109,7 +110,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.saveBlock = { bottomView.saveBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
self.saveInfo() saveInfo(isShowToast: true)
} }
stepView.snp.makeConstraints { make in stepView.snp.makeConstraints { make in
...@@ -177,6 +178,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -177,6 +178,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
extension YHSpouseInfoContainerVC { extension YHSpouseInfoContainerVC {
// isSubmit:是否为提交 false为保存 true为提交
func saveInfo(isSubmit:Bool, callBack:((Bool, String?)->Void)?) { func saveInfo(isSubmit:Bool, callBack:((Bool, String?)->Void)?) {
guard let spouse = spouse else { return } guard let spouse = spouse else { return }
...@@ -188,7 +190,8 @@ extension YHSpouseInfoContainerVC { ...@@ -188,7 +190,8 @@ extension YHSpouseInfoContainerVC {
"next":isSubmit, "next":isSubmit,
"info":info] "info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { [weak self] success, error in self.familyRequest.addOrSaveFamilyMember(params:dict) {
[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if let callBack = callBack { if let callBack = callBack {
callBack(success, error?.errorMsg) callBack(success, error?.errorMsg)
...@@ -196,8 +199,18 @@ extension YHSpouseInfoContainerVC { ...@@ -196,8 +199,18 @@ extension YHSpouseInfoContainerVC {
} }
} }
func saveInfo() { func saveInfo(isShowToast:Bool) {
saveInfo(isSubmit: false, callBack:nil) saveInfo(isSubmit: false) {
[weak self] success, msg in
guard let self = self else { return }
if !isShowToast { return }
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
}
func saveInfoSilent() {
saveInfo(isShowToast: false)
} }
......
...@@ -197,8 +197,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -197,8 +197,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.spouse?.setFollow(option) self.spouse?.setFollow(option)
self.loadSponseInfo() self.loadSponseInfo()
if let delegate = self.delegate { if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.updateStepView)) {
delegate.updateStepView?() delegate.updateStepView()
} }
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证 } else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
...@@ -218,6 +218,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -218,6 +218,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.spouse?.setOverSearsOver1Year(option) self.spouse?.setOverSearsOver1Year(option)
self.loadSponseInfo() self.loadSponseInfo()
} }
save()
} }
return cell return cell
...@@ -249,9 +250,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -249,9 +250,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.spouse?.address.details = text ?? "" self.spouse?.address.details = text ?? ""
if isEditEnd { if isEditEnd {
self.loadSponseInfo() self.loadSponseInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} }
return cell return cell
...@@ -276,28 +275,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -276,28 +275,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
return UITableView.automaticDimension return UITableView.automaticDimension
// if item is YHFormDetailItem {
// let detailItem = item as! YHFormDetailItem
// if detailItem.type == .isLiveTother ||
// detailItem.type == .isAccompanyToHK ||
// detailItem.type == .isHandleHKPassPort ||
// detailItem.type == .isLiveOverSeasMore1Year
// {
// return UITableView.automaticDimension
// }
// }
// return 52.0
} }
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
...@@ -340,6 +318,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -340,6 +318,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} }
self.loadSponseInfo() self.loadSponseInfo()
save()
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
...@@ -352,6 +331,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -352,6 +331,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
print("\(string1)\n\(string2)\n\(string3)\n\(string4)") print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.spouse?.address.area = [string2, string3, string4] self.spouse?.address.area = [string2, string3, string4]
self.loadSponseInfo() self.loadSponseInfo()
save()
} }
self.present(vc, animated: true) self.present(vc, animated: true)
...@@ -411,5 +391,12 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -411,5 +391,12 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} }
return true return true
} }
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
} }
...@@ -367,8 +367,8 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour ...@@ -367,8 +367,8 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
} }
func save() { func save() {
if let delegate = delegate { if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfo?() delegate.saveInfoSilent()
} }
} }
......
...@@ -45,7 +45,8 @@ class YHFamilyRequestViewModel { ...@@ -45,7 +45,8 @@ class YHFamilyRequestViewModel {
YHHUD.show(.progress(message: "数据加载中...")) YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
// let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
......
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