Commit 96f0124a authored by David黄金龙's avatar David黄金龙

Merge commit '22be963a' into davidhuang

* commit '22be963a':
  // 家庭信息
  // 身份证上传
  // 家庭成员
parents 980f2189 22be963a
...@@ -81,6 +81,8 @@ ...@@ -81,6 +81,8 @@
04A7BC8F2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */; }; 04A7BC8F2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */; };
04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */; }; 04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */; };
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; }; 04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; };
04B0239C2B91F3EF00B83629 /* YHIdentityCardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B0239B2B91F3EF00B83629 /* YHIdentityCardCell.swift */; };
04B0239E2B92C27C00B83629 /* YHFamilyMemberViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B0239D2B92C27C00B83629 /* YHFamilyMemberViewModel.swift */; };
04C693622B723AB8004C1758 /* YHMySettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693612B723AB8004C1758 /* YHMySettingViewController.swift */; }; 04C693622B723AB8004C1758 /* YHMySettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693612B723AB8004C1758 /* YHMySettingViewController.swift */; };
04C693642B723B56004C1758 /* YHMySettingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693632B723B56004C1758 /* YHMySettingCell.swift */; }; 04C693642B723B56004C1758 /* YHMySettingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693632B723B56004C1758 /* YHMySettingCell.swift */; };
04C693692B73191A004C1758 /* YHEducationInfoListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693682B73191A004C1758 /* YHEducationInfoListVC.swift */; }; 04C693692B73191A004C1758 /* YHEducationInfoListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693682B73191A004C1758 /* YHEducationInfoListVC.swift */; };
...@@ -380,6 +382,8 @@ ...@@ -380,6 +382,8 @@
04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyRequestViewModel.swift; sourceTree = "<group>"; }; 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyRequestViewModel.swift; sourceTree = "<group>"; };
04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTwoOptionAlertView.swift; sourceTree = "<group>"; }; 04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTwoOptionAlertView.swift; sourceTree = "<group>"; };
04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; }; 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; };
04B0239B2B91F3EF00B83629 /* YHIdentityCardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIdentityCardCell.swift; sourceTree = "<group>"; };
04B0239D2B92C27C00B83629 /* YHFamilyMemberViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberViewModel.swift; sourceTree = "<group>"; };
04C693612B723AB8004C1758 /* YHMySettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySettingViewController.swift; sourceTree = "<group>"; }; 04C693612B723AB8004C1758 /* YHMySettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySettingViewController.swift; sourceTree = "<group>"; };
04C693632B723B56004C1758 /* YHMySettingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySettingCell.swift; sourceTree = "<group>"; }; 04C693632B723B56004C1758 /* YHMySettingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySettingCell.swift; sourceTree = "<group>"; };
04C693682B73191A004C1758 /* YHEducationInfoListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEducationInfoListVC.swift; sourceTree = "<group>"; }; 04C693682B73191A004C1758 /* YHEducationInfoListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEducationInfoListVC.swift; sourceTree = "<group>"; };
...@@ -641,6 +645,7 @@ ...@@ -641,6 +645,7 @@
042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */, 042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */,
042FBBC42B64AE3D00F9DE23 /* YHFormItemOnlyDoubleChoiceCell.swift */, 042FBBC42B64AE3D00F9DE23 /* YHFormItemOnlyDoubleChoiceCell.swift */,
042FBBC82B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift */, 042FBBC82B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift */,
04B0239B2B91F3EF00B83629 /* YHIdentityCardCell.swift */,
04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */, 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */,
); );
path = V; path = V;
...@@ -653,6 +658,7 @@ ...@@ -653,6 +658,7 @@
04C8F4802B720DAB00ADF59B /* Spouse(配偶) */, 04C8F4802B720DAB00ADF59B /* Spouse(配偶) */,
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */, 041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */, 042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */, 042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */, 042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */,
); );
...@@ -664,6 +670,7 @@ ...@@ -664,6 +670,7 @@
children = ( children = (
041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */, 041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */,
04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */, 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */,
04B0239D2B92C27C00B83629 /* YHFamilyMemberViewModel.swift */,
041B52DC2B60A889007EBCEB /* YHTest.swift */, 041B52DC2B60A889007EBCEB /* YHTest.swift */,
); );
path = M; path = M;
...@@ -834,7 +841,6 @@ ...@@ -834,7 +841,6 @@
children = ( children = (
04E86E0E2B70DE9400A35F4B /* YHSpouseInfoContainerVC.swift */, 04E86E0E2B70DE9400A35F4B /* YHSpouseInfoContainerVC.swift */,
041B52D52B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift */, 041B52D52B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */, 042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */,
); );
path = "Spouse(配偶)"; path = "Spouse(配偶)";
...@@ -1960,6 +1966,7 @@ ...@@ -1960,6 +1966,7 @@
A5C5B2EA2B4ECA4D00A7C5D1 /* YHDavidModel0.swift in Sources */, A5C5B2EA2B4ECA4D00A7C5D1 /* YHDavidModel0.swift in Sources */,
04E86E512B847D1B00A35F4B /* YHWorkMessageSelectTableViewCell.swift in Sources */, 04E86E512B847D1B00A35F4B /* YHWorkMessageSelectTableViewCell.swift in Sources */,
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */, A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */,
04B0239C2B91F3EF00B83629 /* YHIdentityCardCell.swift in Sources */,
04E86E3E2B834FC100A35F4B /* YHWorkExperienceTextItemView.swift in Sources */, 04E86E3E2B834FC100A35F4B /* YHWorkExperienceTextItemView.swift in Sources */,
042FBBC92B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift in Sources */, 042FBBC92B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift in Sources */,
A5234E2E2B6E43EA00A33433 /* YHBasicInfoFillView.swift in Sources */, A5234E2E2B6E43EA00A33433 /* YHBasicInfoFillView.swift in Sources */,
...@@ -1979,6 +1986,7 @@ ...@@ -1979,6 +1986,7 @@
042FBBCB2B65058000F9DE23 /* YHChildBasicInfoVC.swift in Sources */, 042FBBCB2B65058000F9DE23 /* YHChildBasicInfoVC.swift in Sources */,
04E86E6A2B87352700A35F4B /* YHCompanySelectViewController.swift in Sources */, 04E86E6A2B87352700A35F4B /* YHCompanySelectViewController.swift in Sources */,
A5191F602B89E6FA001069F7 /* YHPreviewInfoQuestionAndAnswerItemView.swift in Sources */, A5191F602B89E6FA001069F7 /* YHPreviewInfoQuestionAndAnswerItemView.swift in Sources */,
04B0239E2B92C27C00B83629 /* YHFamilyMemberViewModel.swift in Sources */,
04E86E452B8357EC00A35F4B /* YHItemModel.swift in Sources */, 04E86E452B8357EC00A35F4B /* YHItemModel.swift in Sources */,
A5ACE9302B4564F7002C94D2 /* Algorithm.swift in Sources */, A5ACE9302B4564F7002C94D2 /* Algorithm.swift in Sources */,
A5C5B32B2B57D17600A7C5D1 /* YHDavidCell5.swift in Sources */, A5C5B32B2B57D17600A7C5D1 /* YHDavidCell5.swift in Sources */,
......
...@@ -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) {
// 复用时需清理 // 复用时需清理
...@@ -538,8 +528,22 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -538,8 +528,22 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHChildBasicInfoVC { extension YHChildBasicInfoVC {
func nextStep()->Bool { func nextStep()->Bool {
// let isChecked = checkIntegrity()
// isNeedShowError = !isChecked
//
// self.tableView .reloadData()
//
// if !isChecked {
// YHHUD.flash(message: "资料还未填完")
// return false
// }
return true return true
} }
func loadInfo() {
self.tableView.reloadData()
}
} }
...@@ -23,6 +23,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -23,6 +23,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
var child:YHFamilyMember? { var child:YHFamilyMember? {
didSet { didSet {
primaryInfoVC.child = child primaryInfoVC.child = child
uploadVC.familyMember = child
certificateVC.familyMember = child certificateVC.familyMember = child
basicInfoVC.child = child basicInfoVC.child = child
} }
...@@ -37,6 +38,12 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -37,6 +38,12 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
} }
for vcItem in stepVCs { for vcItem in stepVCs {
vcItem.vc.view.isHidden = (vcItem.step != currentStep) vcItem.vc.view.isHidden = (vcItem.step != currentStep)
if vcItem.step == currentStep {
// 刷新
if vcItem.vc.responds(to: #selector(YHFamilyMemberProtol.loadInfo)) {
vcItem.vc.loadInfo()
}
}
} }
} }
} }
...@@ -71,7 +78,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -71,7 +78,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
updateStepView() updateStepView()
print("step:\(child.step)") print("step:\(child.step)")
currentStep = child.step currentStep = child.step
view.addSubview(stepView) view.addSubview(stepView)
view.addSubview(bottomView) view.addSubview(bottomView)
...@@ -84,7 +91,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -84,7 +91,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
...@@ -131,7 +138,10 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -131,7 +138,10 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
titles.append(vcItem.title) titles.append(vcItem.title)
} }
stepView.dataSource = titles stepView.dataSource = titles
let step = currentStep
currentStep = step
stepView.maxIndex = child.step
stepView.block = { stepView.block = {
[weak self] index in [weak self] index in
guard let self = self else { return } guard let self = self else { return }
...@@ -194,22 +204,39 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -194,22 +204,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
...@@ -461,8 +457,27 @@ extension YHChildPrimaryInfoVC { ...@@ -461,8 +457,27 @@ extension YHChildPrimaryInfoVC {
} }
func nextStep()->Bool { func nextStep()->Bool {
// let isChecked = checkIntegrity()
// isNeedShowError = !isChecked
//
// self.tableView .reloadData()
//
// if !isChecked {
// YHHUD.flash(message: "资料还未填完")
// return false
// }
return true return true
} }
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
func loadInfo() {
self.tableView.reloadData()
}
} }
......
//
// YHCertificateUploadVC.swift
// galaxy
//
// Created by edy on 2024/2/26.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateUploadVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .systemPink
// Do any additional setup after loading the view.
}
func nextStep()->Bool {
return true
}
}
...@@ -61,7 +61,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol { ...@@ -61,7 +61,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
super.viewDidLoad() super.viewDidLoad()
gk_navTitle = "配偶基本信息填写".local gk_navTitle = "配偶基本信息填写".local
createUI() createUI()
loadBasicInfo() loadInfo()
} }
func createUI() { func createUI() {
...@@ -77,7 +77,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol { ...@@ -77,7 +77,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
} }
} }
func loadBasicInfo() { func loadInfo() {
guard let spouse = spouse else { return } guard let spouse = spouse else { return }
...@@ -349,7 +349,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -349,7 +349,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
let newDegree = YHHasDegreeJson() let newDegree = YHHasDegreeJson()
self.spouse?.hasDegreeJson.append(newDegree) self.spouse?.hasDegreeJson.append(newDegree)
self.loadBasicInfo() self.loadInfo()
} }
return cell return cell
} }
...@@ -394,16 +394,14 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -394,16 +394,14 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} }
if isEditEnd { if isEditEnd {
self.loadBasicInfo() self.loadInfo()
if detailItem.type == .hkIdentityCardNumber { if detailItem.type == .hkIdentityCardNumber {
if let text = text, !text.isHKIdentityCardNumber() { if let text = text, !text.isHKIdentityCardNumber() {
YHHUD.flash(message: "请输入正确的香港身份证号格式") YHHUD.flash(message: "请输入正确的香港身份证号格式")
return return
} }
} }
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} }
return cell return cell
...@@ -441,7 +439,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -441,7 +439,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
let selectItem = answers[index] let selectItem = answers[index]
self.spouse?.setBirthOverSeas(selectItem.title == "国外".local) self.spouse?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo() self.loadInfo()
} }
} else if detailItem.type == .isHaveHkIdentityCard || detailItem.type == .isNowInHK { // 是否办理过香港身份证 是否在岗 } else if detailItem.type == .isHaveHkIdentityCard || detailItem.type == .isNowInHK { // 是否办理过香港身份证 是否在岗
var select = false var select = false
...@@ -460,7 +458,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -460,7 +458,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isHaveHkIdentityCard { } else if detailItem.type == .isHaveHkIdentityCard {
self.spouse?.setHaveHKIdentityCard(selectItem.title == "是".local) self.spouse?.setHaveHKIdentityCard(selectItem.title == "是".local)
} }
self.loadBasicInfo() self.loadInfo()
} }
} }
...@@ -503,21 +501,21 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -503,21 +501,21 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
YHFormPickerView.show(type: .degree) { [weak self] selectType in YHFormPickerView.show(type: .degree) { [weak self] selectType in
guard let self = self else { return } guard let self = self else { return }
degreeInfo.degree = String(selectType.index) degreeInfo.degree = String(selectType.index)
self.loadBasicInfo() self.loadInfo()
} }
} }
cell.areaClickBlock = { cell.areaClickBlock = {
YHFormPickerView.show(type: .degreeLocation) { [weak self] selectType in YHFormPickerView.show(type: .degreeLocation) { [weak self] selectType in
guard let self = self else { return } guard let self = self else { return }
degreeInfo.address = String(selectType.index) degreeInfo.address = String(selectType.index)
self.loadBasicInfo() self.loadInfo()
} }
} }
cell.deleteBlock = { cell.deleteBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
self.spouse?.hasDegreeJson.remove(at: indexPath.row-2) self.spouse?.hasDegreeJson.remove(at: indexPath.row-2)
self.loadBasicInfo() self.loadInfo()
} }
} }
...@@ -543,24 +541,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -543,24 +541,7 @@ extension YHSpouseBasicInfoVC : 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 } return UITableView.automaticDimension
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
}
if item is YHFormAddItem {
return 70.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
} }
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
...@@ -598,7 +579,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -598,7 +579,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .stayHKDate { } else if detailItem.type == .stayHKDate {
self.spouse?.childInHk.info = date self.spouse?.childInHk.info = date
} }
self.loadBasicInfo() self.loadInfo()
} }
} else if detailItem.type == .birthCity { // 出生城市 } else if detailItem.type == .birthCity { // 出生城市
...@@ -616,7 +597,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -616,7 +597,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)") print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.spouse?.birthPlace.area = [string2, string3, string4] self.spouse?.birthPlace.area = [string2, string3, string4]
self.loadBasicInfo() self.loadInfo()
} }
self.present(vc, animated: true) self.present(vc, animated: true)
...@@ -627,7 +608,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -627,7 +608,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] selectType in [weak self] selectType in
guard let self = self else { return } guard let self = self else { return }
self.spouse?.hkIdentity = selectType.title self.spouse?.hkIdentity = selectType.title
self.loadBasicInfo() self.loadInfo()
} }
} else if detailItem.type == .occupation { } else if detailItem.type == .occupation {
let occupation = self.spouse?.occupation ?? "" let occupation = self.spouse?.occupation ?? ""
...@@ -635,7 +616,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -635,7 +616,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] selectType in [weak self] selectType in
guard let self = self else { return } guard let self = self else { return }
self.spouse?.occupation = selectType.title self.spouse?.occupation = selectType.title
self.loadBasicInfo() self.loadInfo()
} }
} else if detailItem.type == .ownDegree { } else if detailItem.type == .ownDegree {
...@@ -645,7 +626,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -645,7 +626,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
let ownDegree = (selectType.index == YHFormPickerViewSubType.ownDegree(.hasDegree).index) let ownDegree = (selectType.index == YHFormPickerViewSubType.ownDegree(.hasDegree).index)
self.spouse?.setHaveDegree(ownDegree) self.spouse?.setHaveDegree(ownDegree)
self.loadBasicInfo() self.loadInfo()
} }
} }
...@@ -668,4 +649,10 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -668,4 +649,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,14 +8,16 @@ ...@@ -8,14 +8,16 @@
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:NSObjectProtocol {
@objc func nextStep()->Bool @objc func nextStep()->Bool
@objc func loadInfo()
} }
class YHFaimilyStepItem { class YHFaimilyStepItem {
...@@ -41,6 +43,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -41,6 +43,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
didSet { didSet {
if let spouse = spouse { if let spouse = spouse {
primaryInfoVC.spouse = spouse primaryInfoVC.spouse = spouse
uploadVC.familyMember = spouse
certificateVC.familyMember = spouse certificateVC.familyMember = spouse
basicInfoVC.spouse = spouse basicInfoVC.spouse = spouse
} }
...@@ -56,6 +59,12 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -56,6 +59,12 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
} }
for vcItem in stepVCs { for vcItem in stepVCs {
vcItem.vc.view.isHidden = (vcItem.step != currentStep) vcItem.vc.view.isHidden = (vcItem.step != currentStep)
if vcItem.step == currentStep {
// 刷新
if vcItem.vc.responds(to: #selector(YHFamilyMemberProtol.loadInfo)) {
vcItem.vc.loadInfo()
}
}
} }
} }
} }
...@@ -96,10 +105,6 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -96,10 +105,6 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
print("step:\(spouse.step)") print("step:\(spouse.step)")
currentStep = spouse.step currentStep = spouse.step
let tap = UITapGestureRecognizer(target: self, action: #selector(tap))
tap.cancelsTouchesInView = false
self.view.addGestureRecognizer(tap)
bottomView.submitBlock = { bottomView.submitBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
...@@ -109,7 +114,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -109,7 +114,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
...@@ -157,6 +162,10 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -157,6 +162,10 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
} }
stepView.dataSource = titles stepView.dataSource = titles
stepView.maxIndex = spouse.step
// 数据源可能会变,所以需要重新设置step
let step = currentStep
currentStep = step
stepView.block = { stepView.block = {
[weak self] index in [weak self] index in
...@@ -167,8 +176,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -167,8 +176,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
} }
print("index:\(index)") print("index:\(index)")
} }
let step = currentStep
currentStep = step
self.view.bringSubviewToFront(stepView) self.view.bringSubviewToFront(stepView)
self.view.bringSubviewToFront(bottomView) self.view.bringSubviewToFront(bottomView)
...@@ -177,6 +185,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -177,6 +185,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 +197,8 @@ extension YHSpouseInfoContainerVC { ...@@ -188,7 +197,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 +206,18 @@ extension YHSpouseInfoContainerVC { ...@@ -196,8 +206,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)
} }
...@@ -253,10 +273,3 @@ extension YHSpouseInfoContainerVC { ...@@ -253,10 +273,3 @@ extension YHSpouseInfoContainerVC {
return nil return nil
} }
} }
extension YHSpouseInfoContainerVC: UIGestureRecognizerDelegate {
@objc func tap() {
print("点击了parentViewController: YHSpouseInfoContainerVC")
}
}
...@@ -44,10 +44,10 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol { ...@@ -44,10 +44,10 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
super.viewDidLoad() super.viewDidLoad()
gk_navTitle = "配偶信息填写".local gk_navTitle = "配偶信息填写".local
createUI() createUI()
loadSponseInfo() loadInfo()
} }
func loadSponseInfo() { func loadInfo() {
guard let spouse = spouse else { return } guard let spouse = spouse else { return }
...@@ -63,25 +63,18 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol { ...@@ -63,25 +63,18 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if spouse.isFollow() { // 随行才加后面的信息 if spouse.isFollow() { // 随行才加后面的信息
// 国籍 // 国籍
let title1 = YHFormTitleItem(type: .nationality) let title1 = YHFormTitleItem(type: .nationality)
let item10 = YHFormDetailItem(type: .nationOrArea) let item10 = YHFormDetailItem(type:.nationOrArea, value:spouse.nationality, placeHolder:"请选择".local, tips:"请选择国籍".local)
item10.value = spouse.nationality
item10.placeHolder = "请选择".local
item10.tips = "请选择国家/地区".local
let arr1:[YHFormItemProtocol] = [title1, item10] let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息 // 居住信息
var arr2 = [YHFormItemProtocol]() var arr2 = [YHFormItemProtocol]()
let title2 = YHFormTitleItem(type: .liveInfo) let title2 = YHFormTitleItem(type: .liveInfo)
let item20 = YHFormDetailItem(type: .isLiveTother) let item20 = YHFormDetailItem(type:.isLiveTother, value:String(spouse.isLiveTother()))
item20.value = String(spouse.isLiveTother())
arr2.append(title2) arr2.append(title2)
arr2.append(item20) arr2.append(item20)
if !spouse.isLiveTother() { // 不同住 才需填写国家/地区 if !spouse.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea) let item21 = YHFormDetailItem(type:.nationOrArea, value:spouse.address.country, placeHolder:"请选择".local, tips:"请选择国家/地区".local)
item21.value = spouse.address.country
item21.placeHolder = "请选择".local
item21.tips = "请选择国家/地区".local
arr2.append(item21) arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行 // 国家/地区已填写 才显示现居住城市和详细地址两行
...@@ -91,19 +84,17 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol { ...@@ -91,19 +84,17 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
// 居住信息中选择中国才会显示现居住城市 // 居住信息中选择中国才会显示现居住城市
let isLiveInChina = spouse.address.country.contains("中国".local) let isLiveInChina = spouse.address.country.contains("中国".local)
if isLiveInChina { if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity) var value:String? = ""
if !spouse.address.area.isEmpty { if !spouse.address.area.isEmpty {
item22.value = spouse.address.area.joined(separator: "/") value = spouse.address.area.joined(separator: "/")
} }
item22.placeHolder = "请选择城市".local let item22 = YHFormDetailItem(type:.liveCity, value:value, placeHolder:"请选择城市".local, tips:"请请选择城市".local)
item22.tips = "请请选择城市".local
arr2.append(item22) arr2.append(item22)
} }
let item23 = YHFormDetailItem(type: .detailAddress) let placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
item23.value = spouse.address.details let tips = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local) let item23 = YHFormDetailItem(type:.detailAddress, value:spouse.address.details, placeHolder:placeHolder, tips:tips)
item23.tips = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
arr2.append(item23) arr2.append(item23)
if !isLiveInChina {// 在国外 if !isLiveInChina {// 在国外
...@@ -196,14 +187,14 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -196,14 +187,14 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .isAccompanyToHK { // 是否随行 if detailItem.type == .isAccompanyToHK { // 是否随行
self.spouse?.setFollow(option) self.spouse?.setFollow(option)
self.loadSponseInfo() self.loadInfo()
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 { // 是否办理港澳通行证
self.spouse?.setNeedHandleHKPassPort(option) self.spouse?.setNeedHandleHKPassPort(option)
self.loadSponseInfo() self.loadInfo()
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住 } else if detailItem.type == .isLiveTother { // 是否与主申请人同住
self.spouse?.setLiveTother(option) self.spouse?.setLiveTother(option)
...@@ -212,12 +203,13 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -212,12 +203,13 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.spouse?.address.details = "" self.spouse?.address.details = ""
self.spouse?.address.area = [] self.spouse?.address.area = []
} }
self.loadSponseInfo() self.loadInfo()
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上 } else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
self.spouse?.setOverSearsOver1Year(option) self.spouse?.setOverSearsOver1Year(option)
self.loadSponseInfo() self.loadInfo()
} }
save()
} }
return cell return cell
...@@ -248,10 +240,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -248,10 +240,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
self.spouse?.address.details = text ?? "" self.spouse?.address.details = text ?? ""
if isEditEnd { if isEditEnd {
self.loadSponseInfo() self.loadInfo()
if let delegate = delegate { save()
delegate.saveInfo?()
}
} }
} }
return cell return cell
...@@ -276,28 +266,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -276,28 +266,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? {
...@@ -339,7 +308,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -339,7 +308,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.spouse?.address.country = country self.spouse?.address.country = country
} }
self.loadSponseInfo() self.loadInfo()
save()
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
...@@ -351,7 +321,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -351,7 +321,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
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.loadInfo()
save()
} }
self.present(vc, animated: true) self.present(vc, animated: true)
...@@ -411,5 +382,12 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -411,5 +382,12 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} }
return true return true
} }
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
} }
//
// YHCertificateUploadVC.swift
// galaxy
//
// Created by edy on 2024/2/26.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateUploadVC: YHBaseViewController, YHFamilyMemberProtol {
var tableView: UITableView!
var familyMember:YHFamilyMember? {
didSet {
if let familyMember = familyMember {
viewModel.mainModel = familyMember
}
}
}
var viewModel: YHFamilyMemberViewModel = YHFamilyMemberViewModel()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
createUI()
}
func loadInfo() {
self.tableView.reloadData()
}
func nextStep()->Bool {
return true
}
func createUI() {
tableView = {
let tableView = UITableView(frame:.zero, style:.plain)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHIdentityCardCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + YHStepView.height)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.bottom.equalTo(view)
}
}
}
extension YHCertificateUploadVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return viewModel.getIDCardDataSource(false).count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHIdentityCardCell.self)
cell.type = YHCardType(rawValue: indexPath.row) ?? .identity
cell.viewModel = viewModel
cell.informationBlock = {[weak self] type, image, isLeft in
guard let self = self else { return }
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 217.0
}
}
...@@ -399,9 +399,12 @@ class YHFormDetailItem : YHFormItemProtocol { ...@@ -399,9 +399,12 @@ class YHFormDetailItem : YHFormItemProtocol {
return true return true
} }
init(type: YHFormDetailItemType, isNeed:Bool = true) { init(type: YHFormDetailItemType, isNeed:Bool = true, value:String? = "", placeHolder:String? = "", tips:String? = "") {
self.type = type self.type = type
self.isNeed = isNeed self.isNeed = isNeed
self.value = value
self.placeHolder = placeHolder
self.tips = tips
} }
...@@ -912,7 +915,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -912,7 +915,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var step: Int = 0 var step: Int = 0
var isHandled: Int = 0 var isHandled: Int = 0
var notFillNumber: Int = -1 var notFillNumber: Int = -1
var certificates: YHCertificates? var certificates: YHCertificates = YHCertificates()
var usedName: String = "" var usedName: String = ""
var hkIdentityOther: String = "" var hkIdentityOther: String = ""
var isHkHandled: Int = 0 var isHkHandled: Int = 0
...@@ -1218,9 +1221,9 @@ class YHSubsetNamePinyin: SmartCodable { ...@@ -1218,9 +1221,9 @@ class YHSubsetNamePinyin: SmartCodable {
// MARK: - YHCertificates // MARK: - YHCertificates
class YHCertificates: SmartCodable { class YHCertificates: SmartCodable {
var cnIdentityCard: YHCNIdentityCard? var cnIdentityCard: YHCNIdentityCard = YHCNIdentityCard()
var passport: YHCNIdentityCard? var passport: YHCNIdentityCard = YHCNIdentityCard()
var hkMacaoPass: YHCNIdentityCard? var hkMacaoPass: YHCNIdentityCard = YHCNIdentityCard()
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case cnIdentityCard = "cnIdentityCard" case cnIdentityCard = "cnIdentityCard"
...@@ -1231,24 +1234,18 @@ class YHCertificates: SmartCodable { ...@@ -1231,24 +1234,18 @@ class YHCertificates: SmartCodable {
required init() { required init() {
} }
init(cnIdentityCard: YHCNIdentityCard?, passport: YHCNIdentityCard?, hkMacaoPass: YHCNIdentityCard?) {
self.cnIdentityCard = cnIdentityCard
self.passport = passport
self.hkMacaoPass = hkMacaoPass
}
} }
// MARK: - YHCNIdentityCard // MARK: - YHCNIdentityCard
class YHCNIdentityCard: SmartCodable { class YHCNIdentityCard: SmartCodable {
var id: Int = 0 var id: Int = 0
var number: String? var number: String = ""
var issueAt: String? var issueAt: String = ""
var issueDateStartAt: String? var issueDateStartAt: String = ""
var issueDateEndAt: String? var issueDateEndAt: String = ""
var imgFront: String? var imgFront: String = ""
var imgBack: String? var imgBack: String = ""
var passportType: Int = 0 var passportType: Int = 0
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
...@@ -1265,16 +1262,6 @@ class YHCNIdentityCard: SmartCodable { ...@@ -1265,16 +1262,6 @@ class YHCNIdentityCard: SmartCodable {
required init() { required init() {
} }
init(id:Int, number: String?, issueAt:String?, issueDateStartAt: String?, imgFront: String?, imgBack: String?, passportType: Int) {
self.id = id
self.number = number
self.issueAt = issueAt
self.issueDateStartAt = issueDateStartAt
self.imgFront = imgFront
self.imgBack = imgBack
self.passportType = passportType
}
} }
// MARK: - YHHasDegreeJson // MARK: - YHHasDegreeJson
......
//
// YHFamilyMemberViewModel.swift
// galaxy
//
// Created by edy on 2024/3/2.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import Alamofire
class YHFamilyMemberViewModel {
var mainModel: YHFamilyMember = YHFamilyMember()
func getIDCardDataSource(_ isShowPrompt: Bool) -> [YHSectionItemModel] {
let item = YHItemModel(id: .id5, isNeed: true, title: "身份证", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt)
let section = YHSectionItemModel(title: "中国身份证(选填)", models: [item])
let item1 = YHItemModel(id: .id6, isNeed: true, title: "港澳通行证(选填)", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt)
let section1 = YHSectionItemModel(title: "中国身份证(选填)", models: [item1])
if mainModel.isNeedHandleHKPassPort() {
return [section, section1]
} else {
return [section]
}
}
func updateModel(_ item: YHItemModel) {
guard let type = item.id else { return }
if item.id == .id8 {
mainModel.certificates.cnIdentityCard.number = item.message ?? ""
} else if item.id == .id9 {
mainModel.certificates.cnIdentityCard.issueAt = item.message ?? ""
} else if item.id == .id10 {
mainModel.certificates.cnIdentityCard.issueDateStartAt = item.message ?? ""
} else if item.id == .id11 {
mainModel.certificates.cnIdentityCard.issueDateEndAt = item.message ?? ""
} else if item.id == .id12 {
mainModel.certificates.hkMacaoPass.number = item.message ?? ""
} else if item.id == .id13 {
mainModel.certificates.hkMacaoPass.issueAt = item.message ?? ""
} else if item.id == .id14 {
mainModel.certificates.hkMacaoPass.issueDateStartAt = item.message ?? ""
} else if item.id == .id15 {
mainModel.certificates.hkMacaoPass.issueDateEndAt = item.message ?? ""
} else if item.id == .id16 {
// mainModel.certificates.passport.passportType = item.value?.first ?? ""
} else if item.id == .id17 {
mainModel.certificates.passport.number = item.message ?? ""
} else if item.id == .id18 {
mainModel.certificates.passport.issueAt = item.message ?? ""
} else if item.id == .id19 {
mainModel.certificates.passport.issueDateStartAt = item.message ?? ""
} else if item.id == .id20 {
mainModel.certificates.passport.issueDateEndAt = item.message ?? ""
}
}
// 更新身份证
func updateModel(_ model: YHCNIDCardModel) {
if model.name.count != 0 {
mainModel.subsetName = model.name
}
if model.birth.count != 0 {
mainModel.birthday = model.birth.toTimeString()
}
if model.gender.count != 0 {
if model.gender == "女" {
mainModel.setMale(false)
} else {
mainModel.setMale(true)
}
}
if model.term_begins.count != 0 {
mainModel.certificates.hkMacaoPass.issueDateStartAt = model.term_begins.toTimeString()
}
if model.end_of_term.count != 0 {
mainModel.certificates.hkMacaoPass.issueDateEndAt = model.end_of_term.toTimeString()
}
if model.issuing_authority.count != 0 {
mainModel.certificates.hkMacaoPass.issueAt = model.issuing_authority
}
if model.card_num.count != 0 {
mainModel.certificates.hkMacaoPass.number = model.card_num
}
}
// 更新港澳通行证
func updateModel(_ model: YHHKIDCardModel) {
if model.name.count != 0 {
mainModel.subsetName = model.name
}
if model.birth.count != 0 {
mainModel.birthday = model.birth.toTimeString()
}
if model.gender.count != 0 {
if model.gender == "女" {
mainModel.setMale(false)
} else {
mainModel.setMale(true)
}
}
if model.term_begins.count != 0 {
mainModel.certificates.hkMacaoPass.issueDateStartAt = model.term_begins.toTimeString()
}
if model.end_of_term.count != 0 {
mainModel.certificates.hkMacaoPass.issueDateEndAt = model.end_of_term.toTimeString()
}
if model.issuing_authority.count != 0 {
mainModel.certificates.hkMacaoPass.issueAt = model.issuing_authority
}
if model.card_num.count != 0 {
mainModel.certificates.hkMacaoPass.number = model.card_num
}
}
func updateModel(_ type: YHCardType, isFront: Bool, url: String) {
switch type {
case .identity:
if isFront {
mainModel.certificates.cnIdentityCard.imgFront = url
} else {
mainModel.certificates.cnIdentityCard.imgBack = url
}
case .passport:
if isFront {
mainModel.certificates.hkMacaoPass.imgFront = url
} else {
mainModel.certificates.hkMacaoPass.imgBack = url
}
}
}
// 上传方法
func uploadImage(_ image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let strUrl = "https://test-comserver.galaxy-immi.com/oss/upload/storage"
let boundary = UUID().uuidString
let headers: HTTPHeaders = [
"Content-type": "multipart/form-data; boundary=\(boundary)",
"businessCode": "4001001"
]
let _ = YHNetRequest.uplaodRequest(url: strUrl, headers: headers, image: image) { [weak self] json, code in
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(json.data as? String, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(nil, error)
}
} failBlock: { err in
callBackBlock(nil, err)
}
}
func getPublicImageUrl(_ url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let strUrl = "https://test-comserver.galaxy-immi.com/oss/storage/convertToPublicURL" + "?fileUrl=\(url)"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(json.data as? String, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(nil, error)
}
} failBlock: { err in
callBackBlock(nil,err)
}
}
func requestCnIDCardMessage(_ url: String, callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.cnIdCard
let params: [String : Any] = ["url": url]
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHCNIDCardModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false, nil)
return
}
self.updateModel(result)
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
func requestHkIDCardMessage(_ url: String, callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.hkIdCard
let params: [String : Any] = ["url": url]
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHHKIDCardModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false, nil)
return
}
self.updateModel(result)
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
...@@ -14,8 +14,8 @@ class YHFamilyRequestViewModel { ...@@ -14,8 +14,8 @@ class YHFamilyRequestViewModel {
//请求所有家庭成员信息 //请求所有家庭成员信息
func getFamilyInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func getFamilyInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
// let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi // let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
YHHUD.show(.progress(message: "数据加载中...")) YHHUD.show(.progress(message: "数据加载中..."))
...@@ -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