Commit 7655f492 authored by David黄金龙's avatar David黄金龙

Merge commit '1b440ceb' into davidhuang

* commit '1b440ceb':
  //  职业选择
  // 父母信息
  // 证件信息
parents b0cf7a41 1b440ceb
......@@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */
04010B952B6A1DE90093F3BB /* YHSaveAndSubmitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */; };
040FA3372B6F701E0069D17F /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040FA3362B6F701E0069D17F /* File.swift */; };
041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52862B5657B3007EBCEB /* IMAppKey.swift */; };
041B528B2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528A2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift */; };
041B528D2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */; };
......@@ -20,7 +19,7 @@
041B52D62B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */; };
041B52DB2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */; };
041B52DD2B60A889007EBCEB /* YHTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DC2B60A889007EBCEB /* YHTest.swift */; };
042FBBBB2B62806D00F9DE23 /* YHCertificateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBBA2B62806D00F9DE23 /* YHCertificateViewController.swift */; };
042FBBBB2B62806D00F9DE23 /* YHCertificateInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */; };
042FBBBD2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBBC2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift */; };
042FBBBF2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */; };
042FBBC12B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */; };
......@@ -31,6 +30,7 @@
042FBBCB2B65058000F9DE23 /* YHChildBasicInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBCA2B65058000F9DE23 /* YHChildBasicInfoVC.swift */; };
042FBBD42B67A2FE00F9DE23 /* YHFormPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBD32B67A2F900F9DE23 /* YHFormPickerView.swift */; };
042FBBD62B67BDD500F9DE23 /* YHBrotherInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */; };
043955212B70955200955D49 /* YHFormPickerViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043955202B70955200955D49 /* YHFormPickerViewType.swift */; };
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */; };
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */; };
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */; };
......@@ -71,7 +71,7 @@
04A7BC8F2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */; };
04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */; };
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; };
04D765732B6A173C0055ECBB /* YHSpouseInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D765722B6A173C0055ECBB /* YHSpouseInfoVC.swift */; };
04D765732B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D765722B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; };
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; };
......@@ -232,7 +232,6 @@
/* Begin PBXFileReference section */
04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSaveAndSubmitView.swift; sourceTree = "<group>"; };
040FA3362B6F701E0069D17F /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
041B52862B5657B3007EBCEB /* IMAppKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMAppKey.swift; sourceTree = "<group>"; };
041B528A2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemQuestionCell.swift; sourceTree = "<group>"; };
041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDoubleChoiceCell.swift; sourceTree = "<group>"; };
......@@ -244,7 +243,7 @@
041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpouseInitialInfoVC.swift; sourceTree = "<group>"; };
041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyInitialInfo.swift; sourceTree = "<group>"; };
041B52DC2B60A889007EBCEB /* YHTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTest.swift; sourceTree = "<group>"; };
042FBBBA2B62806D00F9DE23 /* YHCertificateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateViewController.swift; sourceTree = "<group>"; };
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoController.swift; sourceTree = "<group>"; };
042FBBBC2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemSelectSheetCell.swift; sourceTree = "<group>"; };
042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpouseBasicInfoVC.swift; sourceTree = "<group>"; };
042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDegreeInfoCell.swift; sourceTree = "<group>"; };
......@@ -255,6 +254,7 @@
042FBBCA2B65058000F9DE23 /* YHChildBasicInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChildBasicInfoVC.swift; sourceTree = "<group>"; };
042FBBD32B67A2F900F9DE23 /* YHFormPickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFormPickerView.swift; sourceTree = "<group>"; };
042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBrotherInfoVC.swift; sourceTree = "<group>"; };
043955202B70955200955D49 /* YHFormPickerViewType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormPickerViewType.swift; sourceTree = "<group>"; };
0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVerificationCodeLoginController.swift; sourceTree = "<group>"; };
0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPhoneMessageView.swift; sourceTree = "<group>"; };
0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeResultViewController.swift; sourceTree = "<group>"; };
......@@ -295,7 +295,7 @@
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>"; };
04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; };
04D765722B6A173C0055ECBB /* YHSpouseInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpouseInfoVC.swift; sourceTree = "<group>"; };
04D765722B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpouseInfoContainerVC.swift; sourceTree = "<group>"; };
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; };
987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
......@@ -462,7 +462,6 @@
040FA3352B6F700F0069D17F /* M */ = {
isa = PBXGroup;
children = (
040FA3362B6F701E0069D17F /* File.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -508,9 +507,9 @@
isa = PBXGroup;
children = (
041B52972B5E8EA0007EBCEB /* YHFamilyMemberFormVC.swift */,
04D765722B6A173C0055ECBB /* YHSpouseInfoVC.swift */,
04D765722B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift */,
041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateViewController.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */,
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBC62B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift */,
......@@ -534,6 +533,7 @@
isa = PBXGroup;
children = (
042FBBD32B67A2F900F9DE23 /* YHFormPickerView.swift */,
043955202B70955200955D49 /* YHFormPickerViewType.swift */,
);
path = PickerView;
sourceTree = "<group>";
......@@ -1494,7 +1494,7 @@
A5ACE9392B4564F7002C94D2 /* UIDevice+Extension.swift in Sources */,
041B52912B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift in Sources */,
A5ACE9422B4564F7002C94D2 /* AppDelegate+Extension.swift in Sources */,
04D765732B6A173C0055ECBB /* YHSpouseInfoVC.swift in Sources */,
04D765732B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift in Sources */,
A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */,
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */,
A5ACE93E2B4564F7002C94D2 /* UIImage+Extension.swift in Sources */,
......@@ -1527,6 +1527,7 @@
A5ACE9382B4564F7002C94D2 /* UIApplication+Extension.swift in Sources */,
0468D44B2B625AAB00CFB916 /* YHItemModel.swift in Sources */,
041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */,
043955212B70955200955D49 /* YHFormPickerViewType.swift in Sources */,
0468D42B2B55019900CFB916 /* YHAnalytics.swift in Sources */,
A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */,
042FBBBD2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift in Sources */,
......@@ -1544,12 +1545,11 @@
A5C5B3292B57CCBE00A7C5D1 /* YHDavidCell4.swift in Sources */,
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */,
A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */,
042FBBBB2B62806D00F9DE23 /* YHCertificateViewController.swift in Sources */,
042FBBBB2B62806D00F9DE23 /* YHCertificateInfoController.swift in Sources */,
042FBBC72B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift in Sources */,
A5234E2A2B6E349600A33433 /* YHBasicInfoFillBottomView.swift in Sources */,
04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */,
0468D4792B68A08600CFB916 /* YHAddressViewController.swift in Sources */,
040FA3372B6F701E0069D17F /* File.swift in Sources */,
A5ACE9562B4564F7002C94D2 /* YHBouncesContentView.swift in Sources */,
042FBBCB2B65058000F9DE23 /* YHChildBasicInfoVC.swift in Sources */,
A5ACE9302B4564F7002C94D2 /* Algorithm.swift in Sources */,
......
//
// File.swift
// galaxy
//
// Created by edy on 2024/2/4.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Alamofire
struct ArrayEncoding: ParameterEncoding {
func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
var request = try URLEncoding().encode(urlRequest, with: parameters)
request.url = URL(string: request.url!.absoluteString.replacingOccurrences(of: "%5B%5D=", with: "="))
return request
}
}
//
// YHCertificateViewController.swift
// YHCertificateInfoController.swift
// galaxy
//
// Created by edy on 2024/1/25.
......@@ -8,10 +8,11 @@
import UIKit
class YHCertificateViewController: YHBaseViewController {
class YHCertificateInfoController: YHBaseViewController {
var familyMember:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var certificates:YHCertificates = YHCertificates()
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -63,9 +64,25 @@ class YHCertificateViewController: YHBaseViewController {
guard let familyMember = familyMember else { return }
if let cer = familyMember.certificatesd {
// var isValid = true
// if let cer = familyMember.certificates, cer.peel is [String: Any] {
// let dict = cer.peel as! [String: Any]
// let cer = YHCertificates.deserialize(dict: dict)
// if let cer = cer {
// certificates = cer
// } else {
// isValid = false
// }
// } else {
// isValid = false
// }
if let cer = familyMember.certificates {
certificates = cer
} else {
}
// if !isValid {
else {
certificates.cnIdentityCard = YHCNIdentityCard()
certificates.passport = YHCNIdentityCard()
if familyMember.isHandled == 1 { // 要办理港澳通行证
......@@ -77,6 +94,7 @@ class YHCertificateViewController: YHBaseViewController {
func loadCertificateInfo() {
guard let familyMember = familyMember else { return }
items.removeAll()
// 中国身份证 信息必有
......@@ -113,11 +131,11 @@ class YHCertificateViewController: YHBaseViewController {
// 护照及其他旅行证件 信息必有
let title2 = YHFormTitleItem(type: .passPortOrTravelInfo)
let item20 = YHFormDetailItem(type: .certificateType)
let item21 = YHFormDetailItem(type: .certificateNumber)
let item22 = YHFormDetailItem(type: .certificateSignPlace)
let item23 = YHFormDetailItem(type: .certificateSignDate)
let item24 = YHFormDetailItem(type: .certificateValidDate)
let item20 = YHFormDetailItem(type: .certificateType, isNeed: false)
let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: false)
let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: false)
let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: false)
let item24 = YHFormDetailItem(type: .certificateValidDate, isNeed: false)
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24]
items.append(arr2)
if let passport = certificates.passport {
......@@ -132,7 +150,7 @@ class YHCertificateViewController: YHBaseViewController {
}
}
extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSource {
extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
......@@ -157,20 +175,48 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.titleLabel.text = item.getTitle()
return cell
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
let title = arr[0] as! YHFormTitleItem
if detailItem.type == .chinaIdentityCardNumber || detailItem.type == .certificateSignPlace { // 证件号码和签发地需要填写
if detailItem.type == .chinaIdentityCardNumber || detailItem.type == .certificateSignPlace || detailItem.type == .traverlPassportNumber || detailItem.type == .certificateNumber { // 证件号码和签发地需要填写
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
let titleItem = arr[0] as! YHFormTitleItem
if detailItem.type == .chinaIdentityCardNumber {
cell.title = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码")
} else {
cell.title = detailItem.getTitle()
cell.isMust = detailItem.isNeed
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
if detailItem.type == .chinaIdentityCardNumber {
self.familyMember?.certificates?.cnIdentityCard?.number = text
} else if detailItem.type == .traverlPassportNumber {
self.familyMember?.certificates?.hkMacaoPass?.number = text
} else if detailItem.type == .certificateNumber {
self.familyMember?.certificates?.passport?.number = text
} else if detailItem.type == .certificateSignPlace { // 签发地
if title.type == .chinaIdCardInfo {
self.familyMember?.certificates?.cnIdentityCard?.issueAt = text
} else if title.type == .hkAndMacaoPassport {
self.familyMember?.certificates?.hkMacaoPass?.issueAt = text
} else if title.type == .passPortOrTravelInfo {
self.familyMember?.certificates?.passport?.issueAt = text
}
}
if isEditEnd {
self.save()
}
}
return cell
}
......@@ -178,20 +224,20 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
if detailItem.type == .certificateType || detailItem.type == .certificateSignDate {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = "中国"
cell.detail = detailItem.value
return cell
}
if detailItem.type == .certificateValidDate {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemExpireDateCell.cellReuseIdentifier, for: indexPath) as! YHFormItemExpireDateCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.title = detailItem.getTitle()
return cell
}
return createDefaultCell(indexPath)
......@@ -246,9 +292,6 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHSpouseBasicInfoVC()
self.navigationController?.pushViewController(vc)
if !(0..<items.count).contains(indexPath.section) { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if !(0..<arr.count).contains(indexPath.row) { return }
......@@ -259,6 +302,7 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
let title = arr[0] as! YHFormTitleItem
if detailItem.type == .certificateValidDate ||
detailItem.type == .certificateSignDate { // 届满日期 签发日期
......@@ -266,19 +310,51 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
YHDatePickView.show(type: .yyyymmdd) { [weak self] date in
let dataArr = date.components(separatedBy: YHDatePickView.separator)
print(dataArr)
guard let self = self else { return }
guard let familyMember = self.familyMember else { return }
if let familyMember = self?.familyMember {
if familyMember.relationType == .child {
}
var certificate = familyMember.certificates?.cnIdentityCard
if title.type == .chinaIdCardInfo {
certificate = familyMember.certificates?.cnIdentityCard
} else if title.type == .hkAndMacaoPassport {
certificate = familyMember.certificates?.hkMacaoPass
} else if title.type == .passPortOrTravelInfo {
certificate = familyMember.certificates?.passport
}
changeCertificateDate(certificate, type: detailItem.type, date: date)
self.loadCertificateInfo()
save()
}
} else if detailItem.type == .certificateType { // 选择证件类别
var selectType:YHFormPickerViewSubType = .certificate(.passport)
if let passPortType = self.familyMember?.certificates?.passport?.passportType,
let subType = YHPickerViewCertificateType(rawValue: passPortType)
{
selectType = YHFormPickerViewSubType.certificate(subType)
}
YHFormPickerView.show(type: .certificate, selectType:selectType) {
[weak self] selectType in
guard let self = self else { return }
self.familyMember?.certificates?.passport?.passportType = selectType.index
self.loadCertificateInfo()
self.save()
}
}
return
}
}
func changeCertificateDate(_ certificate:YHCNIdentityCard?, type:YHFormDetailItemType, date:String?) {
if type == .certificateSignDate {
certificate?.issueDateStartAt = date
} else if type == .certificateValidDate {
certificate?.issueDateEndAt = date
}
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
......@@ -296,5 +372,11 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
cell.layer.mask = nil
}
}
func save() {
if let delegate = delegate {
delegate.saveInfo?()
}
}
}
......@@ -436,39 +436,40 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFamilyMember {
let detailItem = item as! YHFamilyMember
// 配偶
if detailItem.relationType == .spouse {
let vc = YHSpouseInfoContainerVC()
vc.spouse = detailItem
vc.orderId = orderId
self.navigationController?.pushViewController(vc)
return
}
// 父母
if detailItem.relationType == .father || detailItem.relationType == .mother {
let vc = YHParentInfoVC()
vc.parentInfo = detailItem
self.navigationController?.pushViewController(vc)
return
}
// 子女
if detailItem.relationType == .child {
let vc = YHChildInitialInfoVC()
vc.child = detailItem
self.navigationController?.pushViewController(vc)
return
}
// 兄弟姐妹
if detailItem.relationType == .brother {
let vc = YHBrotherInfoVC()
vc.brotherInfo = detailItem
self.navigationController?.pushViewController(vc)
return
}
// 配偶
if detailItem.relationType == .spouse {
let vc = YHSpouseInfoVC()
vc.spouse = detailItem
vc.orderId = orderId
self.navigationController?.pushViewController(vc)
return
}
// 父母
if detailItem.relationType == .father || detailItem.relationType == .mother {
let vc = YHParentInfoVC()
vc.parentInfo = detailItem
self.navigationController?.pushViewController(vc)
return
}
// 子女
if detailItem.relationType == .child {
let vc = YHChildInitialInfoVC()
vc.child = detailItem
self.navigationController?.pushViewController(vc)
return
}
// 兄弟姐妹
if detailItem.relationType == .brother {
let vc = YHBrotherInfoVC()
vc.brotherInfo = detailItem
self.navigationController?.pushViewController(vc)
return
}
}
}
......
......@@ -11,8 +11,15 @@ import UIKit
class YHParentInfoVC: YHBaseViewController {
var parentInfo: YHFamilyMember?
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
var bottomView: YHSaveAndSubmitView = {
let view = YHSaveAndSubmitView.createView()
view.isHiddenSave = true
return view
}()
lazy var tableView: UITableView = {
......@@ -40,7 +47,9 @@ class YHParentInfoVC: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "父母信息填写".local
if let parentInfo = parentInfo {
gk_navTitle = parentInfo.relationType == .father ? "父亲信息填写".local : "母亲信息填写".local
}
createUI()
loadBasicInfo()
}
......@@ -48,9 +57,23 @@ class YHParentInfoVC: YHBaseViewController {
func createUI() {
view.addSubview(tableView);
view.addSubview(bottomView)
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
self.submitInfo()
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.height.equalTo(YHSaveAndSubmitView.height)
}
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-100)
make.bottom.equalTo(bottomView.snp.top)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
}
......@@ -65,52 +88,88 @@ class YHParentInfoVC: YHBaseViewController {
items.removeAll()
// 基本信息
let title0:YHFormItemProtocol = YHFormTitleItem(type: .basicInfo)
let item00:YHFormItemProtocol = YHFormDetailItem(type: .onlyDoubleChoice)
let title0 = YHFormTitleItem(type: .basicInfo)
let item00 = YHFormDetailItem(type: .onlyDoubleChoice)
item00.value = String(parentInfo.isDead())
let arr0:[YHFormItemProtocol] = [title0, item00]
// 父母亲信息
var arr1 = [YHFormItemProtocol]()
if parentInfo.relationType == .father { // 父亲
let title1:YHFormItemProtocol = YHFormTitleItem(type: .fatherInfo)
let item10:YHFormItemProtocol = YHFormDetailItem(type: .fatherName)
arr1.append(contentsOf: [title1, item10])
let title1 = YHFormTitleItem(type: .fatherInfo)
let item10 = YHFormDetailItem(type: .fatherName)
item10.value = parentInfo.subsetName
arr1.append(title1)
arr1.append(item10)
} else { // 母亲
let title1:YHFormItemProtocol = YHFormTitleItem(type: .motherInfo)
let item10:YHFormItemProtocol = YHFormDetailItem(type: .motherName)
arr1.append(contentsOf: [title1, item10])
let title1 = YHFormTitleItem(type: .motherInfo)
let item10 = YHFormDetailItem(type: .motherName)
item10.value = parentInfo.subsetName
arr1.append(title1)
arr1.append(item10)
}
let item11:YHFormItemProtocol = YHFormDetailItem(type: .birthday)
let item12:YHFormItemProtocol = YHFormDetailItem(type: .birthNation)
let item13:YHFormItemProtocol = YHFormDetailItem(type: .birthCity)
arr1.append(contentsOf: [item11, item12, item13])
let item11 = YHFormDetailItem(type: .birthday)
item11.value = parentInfo.birthday
let item12 = YHFormDetailItem(type: .birthNation)
item12.value = String(parentInfo.isBirthOverSeas())
if parentInfo.deceased != 1 { // 健在
let item14:YHFormItemProtocol = YHFormDetailItem(type: .marriageState)
arr1.append(item14)
}
let item13 = YHFormDetailItem(type: .birthCity)
// 职业信息
let title2:YHFormItemProtocol = YHFormTitleItem(type: .occupationInfo)
let item20:YHFormItemProtocol = YHFormDetailItem(type: .occupation)
let arr2:[YHFormItemProtocol] = [title2, item20]
// 居住信息
let title3:YHFormItemProtocol = YHFormTitleItem(type: .liveInfo)
let item30:YHFormItemProtocol = YHFormDetailItem(type: .liveNationOrArea)
let arr3:[YHFormItemProtocol] = [title3, item30]
if parentInfo.isBirthOverSeas() {
item13.value = parentInfo.birthPlace?.foreign
item13.placeHolder = "请输入".local
} else {
item13.value = parentInfo.birthPlace?.area?.joined(separator: ",")
item13.placeHolder = "请选择".local
}
let arr:[YHFormItemProtocol] = [item11, item12, item13]
arr1.append(contentsOf: arr)
// 香港身份证
let title4:YHFormItemProtocol = YHFormTitleItem(type: .hkIdentityCardInfo)
let item40:YHFormItemProtocol = YHFormDetailItem(type: .isHaveHkIdentityCard)
let item41:YHFormItemProtocol = YHFormDetailItem(type: .hkIdentityCardNumber)
let arr4:[YHFormItemProtocol] = [title4, item40, item41]
if parentInfo.isDead() {
items.append(contentsOf: [arr0, arr1])
}
items.append(contentsOf: [arr0, arr1, arr2, arr3, arr4])
if !parentInfo.isDead() { // 健在
let item14 = YHFormDetailItem(type: .marriageState)
item14.value = parentInfo.married
arr1.append(item14)
// 职业信息
let title2 = YHFormTitleItem(type: .occupationInfo)
let item20 = YHFormDetailItem(type: .occupation)
item20.value = parentInfo.occupation
item20.placeHolder = "请输入".local
var arr2:[YHFormItemProtocol] = [title2, item20]
if parentInfo.isNowHaveJob() {
let item21 = YHFormDetailItem(type: .occupationName)
item21.value = parentInfo.occupationName
item21.placeHolder = "请输入".local
arr2.append(item21)
}
// 居住信息
let title3 = YHFormTitleItem(type: .liveInfo)
let item30 = YHFormDetailItem(type: .liveNationOrArea)
item30.value = parentInfo.liveCountry
let arr3:[YHFormItemProtocol] = [title3, item30]
// 香港身份证
let title4 = YHFormTitleItem(type: .hkIdentityCardInfo)
let item40 = YHFormDetailItem(type: .isHaveHkIdentityCard)
item40.value = String(parentInfo.isHaveHKIdentityCard())
var arr4:[YHFormItemProtocol] = [title4, item40]
if parentInfo.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber)
item41.value = parentInfo.hkIdentityCard
arr4.append(item41)
}
items.append(contentsOf: [arr0, arr1, arr2, arr3, arr4])
}
tableView.reloadData()
}
func getCellType(_ item: Any) ->HKFormItemCellType {
......@@ -120,23 +179,35 @@ class YHParentInfoVC: YHBaseViewController {
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthCity {
var isBirthOverSeas = false
if let parentInfo = parentInfo {
isBirthOverSeas = parentInfo.isBirthOverSeas()
}
if isBirthOverSeas {
return .inputText
} else {
return .selectSheet
}
}
if detailItem.type == .fatherName
|| detailItem.type == .motherName
|| detailItem.type == .nationOrArea
|| detailItem.type == .hkIdentityCardNumber
|| detailItem.type == .motherName
|| detailItem.type == .occupationName
|| detailItem.type == .hkIdentityCardNumber
{
return .inputText
}
if detailItem.type == .birthday
|| detailItem.type == .birthCity
|| detailItem.type == .marriageState
|| detailItem.type == .occupation
|| detailItem.type == .liveNationOrArea
{
return .selectSheet
}
if detailItem.type == .birthNation
|| detailItem.type == .isHaveHkIdentityCard
if detailItem.type == .birthNation || detailItem.type == .isHaveHkIdentityCard
{
return .twoChoice
}
......@@ -177,72 +248,117 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell
}
if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.title = item.getTitle()
return cell
}
if cellType == .selectSheet { // 点击选择列表cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
if cellType == .addItem { // 新增item cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = item.getTitle()
return cell
}
if cellType == .twoChoice { // 问答双项选择cell
if item is YHFormDetailItem {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.title = item.getTitle()
cell.answerArr = nil
let detailItem = item as! YHFormDetailItem
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthNation {
let answers = [YHFormChoiceItem(title: "国内".local, isSelect: true),
YHFormChoiceItem(title: "国外".local, isSelect: false)]
cell.answerArr = answers
} else if detailItem.type == .isHaveHkIdentityCard {
if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textChange = {
let answers = [YHFormChoiceItem(title: "是".local, isSelect: true),
YHFormChoiceItem(title: "否".local, isSelect: false)]
cell.answerArr = answers
[weak self] (text, isEditEnd) in
guard let self = self else { return }
if detailItem.type == .fatherName {
self.parentInfo?.subsetName = text
} else if detailItem.type == .birthCity {
self.parentInfo?.birthPlace?.foreign = text
} else if detailItem.type == .occupationName {
self.parentInfo?.occupationName = text
} else if detailItem.type == .hkIdentityCardNumber {
self.parentInfo?.hkIdentityCard = text
}
if isEditEnd {
self.loadBasicInfo()
self.submitInfo()
}
}
return cell
}
return cell
}
if cellType == .onlyTwoChoice { // 仅有双项选择cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemOnlyDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemOnlyDoubleChoiceCell
var isDead = 0
if let dead = parentInfo?.deceased, dead == 1 { // 已故
isDead = 1
if cellType == .selectSheet { // 点击选择列表cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
return cell
}
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: isDead != 1),
YHFormChoiceItem(title: "已故".local, isSelect: isDead == 1)]
cell.answerArr = answers
cell.answerBlock = { [weak self]
(arr, selectIndex) in
let selectItem:YHFormChoiceItem = arr[selectIndex]
self?.parentInfo?.deceased = (selectItem.title == "已故" ? 1 : 0)
self?.loadBasicInfo()
if cellType == .twoChoice { // 问答双项选择cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed
cell.title = item.getTitle()
cell.answerArr = nil
if detailItem.type == .birthNation { // 出生国家
var select = false
if let value = detailItem.value {
select = Bool(value)!
}
let answers = [YHFormChoiceItem(title: "国内".local, isSelect: !select),
YHFormChoiceItem(title: "国外".local, isSelect: select)]
cell.answerArr = answers
cell.answerBlock = {
[weak self] (answers, index) in
guard let self = self else { return }
let selectItem = answers[index]
self.parentInfo?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
}
} else if detailItem.type == .isHaveHkIdentityCard { // 是否办理过香港身份证
var select = false
if let value = detailItem.value {
select = Bool(value)!
}
let answers = [YHFormChoiceItem(title: "是".local, isSelect: select),
YHFormChoiceItem(title: "否".local, isSelect: !select)]
cell.answerArr = answers
cell.answerBlock = {
[weak self] (answers, index) in
guard let self = self else { return }
let selectItem = answers[index]
if detailItem.type == .isHaveHkIdentityCard {
self.parentInfo?.setHaveHKIdentityCard(selectItem.title == "是".local)
}
self.loadBasicInfo()
}
}
return cell
}
return cell
}
if cellType == .addItem { // 新增item cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = item.getTitle()
return cell
}
if cellType == .degreeDetailInfo { // 学位cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDegreeInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDegreeInfoCell
cell.title = item.getTitle()
return cell
if cellType == .onlyTwoChoice { // 仅有双项选择cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemOnlyDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemOnlyDoubleChoiceCell
var isDead = false
if let parentInfo = parentInfo, parentInfo.isDead() { // 已故
isDead = true
}
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: !isDead),
YHFormChoiceItem(title: "已故".local, isSelect: isDead)]
cell.answerArr = answers
cell.answerBlock = { [weak self]
(arr, selectIndex) in
let selectItem:YHFormChoiceItem = arr[selectIndex]
self?.parentInfo?.setIsDead(selectItem.title == "已故")
self?.loadBasicInfo()
}
return cell
}
}
return createDefaultCell(indexPath)
}
......@@ -293,6 +409,72 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if !(0..<items.count).contains(indexPath.section) { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if !(0..<arr.count).contains(indexPath.row) { return }
let item = arr[indexPath.row]
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthday { // 出生日期
YHDatePickView.show(type: .yyyymmdd) { [weak self] date in
guard let self = self else { return }
if detailItem.type == .birthday {
self.parentInfo?.birthday = date
}
self.loadBasicInfo()
}
} else if detailItem.type == .birthCity { // 出生城市
var isBirthOverSeas = false
if let parentInfo = parentInfo {
isBirthOverSeas = parentInfo.isOverSeasOver1Year()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
let vc = YHAddressViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.birthPlace?.area = [string2, string3, string4]
self.loadBasicInfo()
}
self.present(vc, animated: true)
} else if detailItem.type == .occupation { // 职业
let occupation = self.parentInfo?.occupation ?? ""
YHFormPickerView.show(type: .occupation, selectTitle:occupation ) {
[weak self] selectType in
guard let self = self else { return }
self.parentInfo?.occupation = selectType.title
self.loadBasicInfo()
}
} else if detailItem.type == .marriageState { // 婚姻
let marriage = self.parentInfo?.married
YHFormPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectType in
guard let self = self else { return }
self.parentInfo?.married = selectType.title
self.loadBasicInfo()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
let vc = YHAddressViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.liveCountry = string2
self.loadBasicInfo()
}
self.present(vc, animated: true)
}
}
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
......@@ -312,3 +494,24 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
}
}
}
extension YHParentInfoVC {
func submitInfo() {
guard let parentInfo = parentInfo else { return }
guard let info = parentInfo.toDictionary() else { return }
let dict:[String: Any] = ["orderId":parentInfo.orderId,
"relation":parentInfo.relationType.rawValue,
"step":parentInfo.step,
"next":false,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in
if success {
}
}
}
}
......@@ -25,9 +25,8 @@ enum HKFormItemCellType: Int {
class YHSpouseBasicInfoVC: YHBaseViewController {
var spouse:YHFamilyMember?
var cardInfo: YHCNIdentityCard?
weak var delegate:YHSpouseInfoVCProtocol?
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
lazy var tableView: UITableView = {
......@@ -292,7 +291,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textChange = {
[weak self] text in
[weak self] (text, isEditEnd) in
guard let self = self else { return }
if detailItem.type == .spouseName {
self.spouse?.subsetName = text
......
......@@ -11,10 +11,11 @@ import UIKit
@objc protocol YHSpouseInfoVCProtocol {
@objc optional func updateStepView()
@objc optional func saveInfo()
}
class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
......@@ -23,13 +24,12 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
var spouse:YHFamilyMember? {
didSet {
initalInfoVC.spouse = spouse
passportInfoVC.familyMember = spouse
certificateVC.familyMember = spouse
basicInfoVC.spouse = spouse
}
}
var currentIndex = 0 {
didSet {
currentIndex %= self.children.count
stepView.currentIndex = currentIndex
......@@ -53,7 +53,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
let initalInfoVC = YHSpouseInitialInfoVC()
let uploadVC = UIViewController()
let passportInfoVC = YHCertificateViewController()
let certificateVC = YHCertificateInfoController()
let basicInfoVC = YHSpouseBasicInfoVC()
override func viewDidLoad() {
......@@ -66,7 +66,8 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
guard let spouse = spouse else { return }
initalInfoVC.delegate = self
certificateVC.delegate = self
basicInfoVC.delegate = self
updateStepView()
......@@ -84,7 +85,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
self.save()
self.saveInfo()
}
stepView.snp.makeConstraints { make in
......@@ -118,11 +119,11 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
self.addChild(initalInfoVC)
self.addChild(uploadVC)
self.addChild(passportInfoVC)
self.addChild(certificateVC)
self.addChild(basicInfoVC)
self.view.addSubview(basicInfoVC.view)
self.view.addSubview(passportInfoVC.view)
self.view.addSubview(certificateVC.view)
self.view.addSubview(uploadVC.view)
self.view.addSubview(initalInfoVC.view)
......@@ -152,15 +153,23 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
}
extension YHSpouseInfoVC {
func save() {
extension YHSpouseInfoContainerVC {
func saveInfo() {
guard let spouse = spouse else { return }
guard let info = spouse.toDictionary() else { return }
let arr = info["has_degree_json"] as! [[String:Any]]
let parmas:[String:Any] = info
guard var info = spouse.toDictionary() else { return }
// let certi = [ "cnIdentityCard":
// ["id":116871,"number":"421087199005010811","issue_at":"深圳","issue_date_start_at":"2017-01-01","issue_date_end_at":"2029-01-01","img_front":"","img_back":""],
// "passport":["id":116872,"number":"421087199005010811","issue_at":"深圳","issue_date_start_at":"2020-01-01","issue_date_end_at":"2023-01-01","img_front":"","img_back":"","passport_type":3],
// "hkMacaoPass":["id":118182,"number":"P103265(1)","issue_at":"SFAA","issue_date_start_at":"2024-01-31","issue_date_end_at":"2024-01-31","img_front":"","img_back":""]
// ]
//
// if let cer = info["certificates"] {
// info["certificates"] = certi
// }
let cer = info["certificates"]
let dict:[String: Any] = ["orderId":self.orderId,
"relation":spouse.relationType.rawValue,
"step":0,
......
......@@ -240,7 +240,7 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder
cell.textChange = {
[weak self] text in
[weak self] (text, isEditEnd) in
guard let self = self else { return }
self.spouse?.address?.details = text
......
......@@ -536,6 +536,8 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var childStepchild: YHChildStepchildClass?
// 在港信息
var childInHk: YHChildStepchildClass?
// 证件数组 (中国身份证、香港身份证、护照等)
var certificates: YHCertificates?
// mark any
var countryIdentity: SmartAny?
......@@ -556,11 +558,6 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
// 婚前刑事
var surname: String?
// mark any
// var certificates: YHCertificates?
var certificates: SmartAny?
var certificatesd: YHCertificates?
enum CodingKeys: String, CodingKey {
case id = "id"
case deceased = "deceased"
......@@ -700,6 +697,19 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
self.hasDegree = val ? "1" : "0"
}
// 是否已故
func isDead() -> Bool {
return self.deceased == 1
}
func setIsDead(_ val:Bool) {
self.deceased = (val ? 1 : 0)
}
// 是否在职
func isNowHaveJob() -> Bool {
return self.occupation == "在职"
}
var relationType:YHFamilyMemberType {
......
......@@ -27,310 +27,6 @@
import UIKit
enum YHFormPickerViewType: Int {
// 按自然顺序递增
case none = 0
// 学位
case degree
// 学位有无
case ownDegree
// 婚姻
case marriage
// 授课形式
case edution
// 职业
case occupation
// 性别
case gender
// 证件
case certificate
// 在港身份
case identity
// 颁发地区
case degreeLocation
}
enum YHFormPickerViewSubType {
case none
case marriage(YHPickerViewMarriageType)
case degree(YHPickerViewDegreeType)
case ownDegree(YHPickerViewHasDegreeType)
case education(YHPickerViewEducationType)
case occupation(YHPickerViewOccupationType)
case gender(YHPickerViewGenderType)
case certificate(YHPickerViewCertificateType)
case identity(YHPickerViewIdentityType)
case degreeLocation(YHPickerViewDegreeLocationType)
var title:String {
switch self {
case .none:
return "".local
case .ownDegree(.hasDegree):
return "有学位".local
case .ownDegree(.noDegree):
return "无学位".local
case .marriage(.unmarriage):
return "未婚".local
case .marriage(.marriaged):
return "已婚".local
case .marriage(.separated):
return "分居".local
case .marriage(.divorced):
return "离婚".local
case .marriage(.widowed):
return "丧偶".local
case .degree(.bachelor):
return "学士学位".local
case .degree(.master):
return "硕士学位".local
case .degree(.doctor):
return "博士学位".local
case .education(.fullTime):
return "全日制".local
case .education(.partTime):
return "兼职制".local
case.education(.distanceCourses):
return "遥距课程".local
case .occupation(.onTheJob):
return "在职".local
case .occupation(.retire):
return "退休".local
case .occupation(.unemployed):
return "无业".local
case .occupation(.student):
return "学生".local
case .gender(.male):
return "男".local
case .gender(.female):
return "女".local
case .certificate(.passport):
return "护照".local
case .certificate(.travelPassport):
return "旅游通行证".local
case .certificate(.diplomaticPassport):
return "外交护照".local
case .certificate(.chineseStatelessTravelPassport):
return "中国发无国籍旅游证件".local
case .certificate(.otherStatelessTravelPassport):
return "其他无国籍旅行证件".local
case .certificate(.unitedNationsPassport):
return "联合国通行证".local
case .certificate(.officialPassport):
return "公务护照".local
case .identity(.student):
return "学生".local
case .identity(.employment):
return "就业".local
case .identity(.residence):
return "居留".local
case .identity(.visit):
return "访问".local
case .identity(.other):
return "其他".local
case .degreeLocation(.domestic):
return "国内 (颁发)".local
case .degreeLocation(.forgin):
return "国外 (颁发)".local
}
return ""
}
var index:Int {
switch self {
case .none:
return 0
case .marriage(.unmarriage):
return 0
case .marriage(.marriaged):
return 1
case .marriage(.separated):
return 2
case .marriage(.divorced):
return 3
case .marriage(.widowed):
return 4
case .degree(.bachelor):
return 1
case .degree(.master):
return 2
case .degree(.doctor):
return 3
case .education(.fullTime):
return 0
case .education(.partTime):
return 1
case.education(.distanceCourses):
return 2
case .occupation(.onTheJob):
return 0
case .occupation(.retire):
return 1
case .occupation(.unemployed):
return 2
case .occupation(.student):
return 3
case .gender(.male):
return 0
case .gender(.female):
return 1
case .certificate(.passport):
return 0
case .certificate(.travelPassport):
return 1
case .certificate(.diplomaticPassport):
return 2
case .certificate(.chineseStatelessTravelPassport):
return 3
case .certificate(.otherStatelessTravelPassport):
return 4
case .certificate(.unitedNationsPassport):
return 5
case .certificate(.officialPassport):
return 6
case .ownDegree(.noDegree):
return 0
case .ownDegree(.hasDegree):
return 1
case .identity(.student):
return 0
case .identity(.employment):
return 1
case .identity(.residence):
return 2
case .identity(.visit):
return 3
case .identity(.other):
return 4
case .degreeLocation(.domestic):
return 1
case .degreeLocation(.forgin):
return 2
}
}
}
enum YHPickerViewMarriageType: Int {
// 未婚
case unmarriage = 0
// 已婚
case marriaged = 1
// 离婚
case divorced = 2
// 分居
case separated = 3
// 丧偶
case widowed = 4
}
enum YHPickerViewDegreeType:Int {
// 学士
case bachelor = 1
// 硕士
case master = 2
// 博士
case doctor = 3
}
enum YHPickerViewEducationType {
// 全日制
case fullTime
// 兼读制
case partTime
// 遥距课程
case distanceCourses
}
enum YHPickerViewOccupationType {
// 在职
case onTheJob
// 退休
case retire
// 无业
case unemployed
// 学生
case student
}
enum YHPickerViewGenderType: Int {
// 男
case male = 0
// 女
case female = 1
}
enum YHPickerViewCertificateType: Int {
// 护照
case passport = 0
// 外交护照
case diplomaticPassport = 1
// 公务护照
case officialPassport = 2
// 中国发无国籍旅游证件
case chineseStatelessTravelPassport = 3
// 旅游通行证
case travelPassport = 4
// 联合国通行证
case unitedNationsPassport = 5
// 其他无国籍旅行证件
case otherStatelessTravelPassport = 6
}
enum YHPickerViewIdentityType: Int {
// 学生
case student = 0
// 就业
case employment = 1
// 居留
case residence = 2
// 访问
case visit = 3
// 其他
case other = 4
}
enum YHPickerViewHasDegreeType: Int {
// 无学位
case noDegree = 0
// 有学位
case hasDegree = 1
}
enum YHPickerViewDegreeLocationType:Int {
// 国内
case domestic = 1
// 国外
case forgin = 2
}
class YHFormPickerViewItem {
let type: YHFormPickerViewSubType
......@@ -464,6 +160,21 @@ class YHFormPickerView: UIView {
YHFormPickerViewItem(type: .occupation(.unemployed)),
YHFormPickerViewItem(type: .occupation(.student))],
// 职业2
.profession:
[YHFormPickerViewItem(type: .profession(.enterpriseManagerSenior)),
YHFormPickerViewItem(type: .profession(.enterpriseManagerJunior)),
YHFormPickerViewItem(type: .profession(.startOwnBusiness)),
YHFormPickerViewItem(type: .profession(.generalStaff)),
YHFormPickerViewItem(type: .profession(.professionals)),
YHFormPickerViewItem(type: .profession(.selfEmployed)),
YHFormPickerViewItem(type: .profession(.governmentEmployee)),
YHFormPickerViewItem(type: .profession(.student)),
YHFormPickerViewItem(type: .profession(.houseWife)),
YHFormPickerViewItem(type: .profession(.retirees)),
YHFormPickerViewItem(type: .profession(.graduates)),
YHFormPickerViewItem(type: .profession(.other))],
// 性别
.gender:
[YHFormPickerViewItem(type: .gender(.male)),
......@@ -477,7 +188,8 @@ class YHFormPickerView: UIView {
YHFormPickerViewItem(type: .certificate(.chineseStatelessTravelPassport)),
YHFormPickerViewItem(type: .certificate(.travelPassport)),
YHFormPickerViewItem(type: .certificate(.unitedNationsPassport)),
YHFormPickerViewItem(type: .certificate(.otherStatelessTravelPassport))],
YHFormPickerViewItem(type: .certificate(.otherStatelessTravelPassport)),
YHFormPickerViewItem(type: .certificate(.other))],
// 在港身份
.identity:
......@@ -496,6 +208,10 @@ class YHFormPickerView: UIView {
.degreeLocation:
[YHFormPickerViewItem(type: .degreeLocation(.domestic)),
YHFormPickerViewItem(type: .degreeLocation(.forgin))],
]
}()
......@@ -605,7 +321,7 @@ class YHFormPickerView: UIView {
var selectIndex:Int = -1
if let selectType = selectType, let arr = dataDict[type], !arr.isEmpty {
for (index, item) in arr.enumerated() {
if selectType.title == item.type.title {
if selectType.index == item.type.index {
selectIndex = index
break
}
......@@ -647,6 +363,8 @@ class YHFormPickerView: UIView {
return "是否拥有学位"
case .degreeLocation:
return "选择学位"
case .profession:
return "职业"
}
}
}
......@@ -801,6 +519,45 @@ extension YHFormPickerView {
} else if title == "国外 (颁发)".local {
return .degreeLocation(.forgin)
}
case .profession:
if title.contains("高级管理者") {
return .profession(.enterpriseManagerSenior)
} else if title.contains("包括初、中级层管理者") {
return .profession(.enterpriseManagerJunior)
} else if title.contains("自主创业") {
return .profession(.startOwnBusiness)
} else if title.contains("普通职员") {
return .profession(.generalStaff)
} else if title.contains("专业人员") {
return .profession(.professionals)
} else if title.contains("个体经营/承包商") {
return .profession(.selfEmployed)
} else if title.contains("政府机关干部/公务人员") {
return .profession(.governmentEmployee)
} else if title.contains("在校学生") {
return .profession(.student)
} else if title.contains("家庭主妇") {
return .profession(.houseWife)
} else if title.contains("退休人员") {
return .profession(.retirees)
} else if title.contains("应届毕业生") {
return .profession(.graduates)
} else if title.contains("其他") {
return .profession(.other)
}
}
return .none
}
......
//
// YHFormPickerViewType.swift
// galaxy
//
// Created by edy on 2024/2/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
enum YHFormPickerViewType: Int {
// 按自然顺序递增
case none = 0
// 学位
case degree
// 学位有无
case ownDegree
// 婚姻
case marriage
// 授课形式
case edution
// 职业
case occupation
// 职业2
case profession
// 性别
case gender
// 证件
case certificate
// 在港身份
case identity
// 颁发地区
case degreeLocation
}
enum YHPickerViewMarriageType: Int {
// 未婚
case unmarriage = 0
// 已婚
case marriaged = 1
// 离婚
case divorced = 2
// 分居
case separated = 3
// 丧偶
case widowed = 4
}
enum YHPickerViewDegreeType:Int {
// 学士
case bachelor = 1
// 硕士
case master = 2
// 博士
case doctor = 3
}
enum YHPickerViewEducationType {
// 全日制
case fullTime
// 兼读制
case partTime
// 遥距课程
case distanceCourses
}
enum YHPickerViewOccupationType {
// 在职
case onTheJob
// 退休
case retire
// 无业
case unemployed
// 学生
case student
}
enum YHPicerViewProfessionType: Int {
// 企业管理者 (高级管理者)
case enterpriseManagerSenior = 0
// 企业管理者 (包括初、中级层管理者)
case enterpriseManagerJunior
// 自主创业 (有实际运营的公司)
case startOwnBusiness
// 普通职员 (办公室/写字楼)
case generalStaff
// 专业人员 (医生/教师/律师/记者/文体)
case professionals
// 个体经营/承包商
case selfEmployed
// 政府机关干部/公务人员
case governmentEmployee
// 在校学生
case student
// 家庭主妇
case houseWife
// 退休人员
case retirees
// 应届毕业生
case graduates
// 其他
case other
}
enum YHPickerViewGenderType: Int {
// 男
case male = 0
// 女
case female = 1
}
enum YHPickerViewCertificateType: Int {
// 护照
case passport = 3
// 外交护照
case diplomaticPassport = 4
// 公务护照
case officialPassport = 5
// 中国发无国籍旅游证件
case chineseStatelessTravelPassport = 6
// 旅游通行证
case travelPassport = 7
// 联合国通行证
case unitedNationsPassport = 8
// 其他无国籍旅行证件
case otherStatelessTravelPassport = 9
// 其他
case other = 10
}
enum YHPickerViewIdentityType: Int {
// 学生
case student = 0
// 就业
case employment = 1
// 居留
case residence = 2
// 访问
case visit = 3
// 其他
case other = 4
}
enum YHPickerViewHasDegreeType: Int {
// 无学位
case noDegree = 0
// 有学位
case hasDegree = 1
}
enum YHPickerViewDegreeLocationType:Int {
// 国内
case domestic = 1
// 国外
case forgin = 2
}
enum YHFormPickerViewSubType {
case none
case marriage(YHPickerViewMarriageType)
case degree(YHPickerViewDegreeType)
case ownDegree(YHPickerViewHasDegreeType)
case education(YHPickerViewEducationType)
case occupation(YHPickerViewOccupationType)
case gender(YHPickerViewGenderType)
case certificate(YHPickerViewCertificateType)
case identity(YHPickerViewIdentityType)
case degreeLocation(YHPickerViewDegreeLocationType)
case profession(YHPicerViewProfessionType)
var title:String {
switch self {
case .none:
return "".local
case .ownDegree(.hasDegree):
return "有学位".local
case .ownDegree(.noDegree):
return "无学位".local
case .marriage(.unmarriage):
return "未婚".local
case .marriage(.marriaged):
return "已婚".local
case .marriage(.separated):
return "分居".local
case .marriage(.divorced):
return "离婚".local
case .marriage(.widowed):
return "丧偶".local
case .degree(.bachelor):
return "学士学位".local
case .degree(.master):
return "硕士学位".local
case .degree(.doctor):
return "博士学位".local
case .education(.fullTime):
return "全日制".local
case .education(.partTime):
return "兼职制".local
case.education(.distanceCourses):
return "遥距课程".local
case .occupation(.onTheJob):
return "在职".local
case .occupation(.retire):
return "退休".local
case .occupation(.unemployed):
return "无业".local
case .occupation(.student):
return "学生".local
case .gender(.male):
return "男".local
case .gender(.female):
return "女".local
case .certificate(.passport):
return "护照".local
case .certificate(.travelPassport):
return "旅游通行证".local
case .certificate(.diplomaticPassport):
return "外交护照".local
case .certificate(.chineseStatelessTravelPassport):
return "中国发无国籍旅游证件".local
case .certificate(.otherStatelessTravelPassport):
return "其他无国籍旅行证件".local
case .certificate(.unitedNationsPassport):
return "联合国通行证".local
case .certificate(.officialPassport):
return "公务护照".local
case .certificate(.other):
return "其他".local
case .identity(.student):
return "学生".local
case .identity(.employment):
return "就业".local
case .identity(.residence):
return "居留".local
case .identity(.visit):
return "访问".local
case .identity(.other):
return "其他".local
case .degreeLocation(.domestic):
return "国内 (颁发)".local
case .degreeLocation(.forgin):
return "国外 (颁发)".local
case .profession(.enterpriseManagerSenior):
return "企业管理者 (高级管理者)".local
case .profession(.enterpriseManagerJunior):
return "企业管理者 (包括初、中级层管理者)".local
case .profession(.startOwnBusiness):
return "自主创业 (有实际运营的公司)".local
case .profession(.generalStaff):
return "普通职员 (办公室/写字楼)".local
case .profession(.professionals):
return "专业人员 (医生/教师/律师/记者/文体)".local
case .profession(.selfEmployed):
return "个体经营/承包商".local
case .profession(.governmentEmployee):
return "政府机关干部/公务人员".local
case .profession(.student):
return "在校学生".local
case .profession(.houseWife):
return "家庭主妇".local
case .profession(.retirees):
return "退休人员".local
case .profession(.graduates):
return "应届毕业生".local
case .profession(.other):
return "其他".local
return ""
}
}
var index:Int {
switch self {
case .none:
return 0
case .marriage(.unmarriage):
return 0
case .marriage(.marriaged):
return 1
case .marriage(.separated):
return 2
case .marriage(.divorced):
return 3
case .marriage(.widowed):
return 4
case .degree(.bachelor):
return 1
case .degree(.master):
return 2
case .degree(.doctor):
return 3
case .education(.fullTime):
return 0
case .education(.partTime):
return 1
case.education(.distanceCourses):
return 2
case .occupation(.onTheJob):
return 0
case .occupation(.retire):
return 1
case .occupation(.unemployed):
return 2
case .occupation(.student):
return 3
case .gender(.male):
return 0
case .gender(.female):
return 1
case .certificate(.passport):
return 3
case .certificate(.diplomaticPassport):
return 4
case .certificate(.officialPassport):
return 5
case .certificate(.chineseStatelessTravelPassport):
return 6
case .certificate(.travelPassport):
return 7
case .certificate(.unitedNationsPassport):
return 8
case .certificate(.otherStatelessTravelPassport):
return 9
case .certificate(.other):
return 10
case .ownDegree(.noDegree):
return 0
case .ownDegree(.hasDegree):
return 1
case .identity(.student):
return 0
case .identity(.employment):
return 1
case .identity(.residence):
return 2
case .identity(.visit):
return 3
case .identity(.other):
return 4
case .degreeLocation(.domestic):
return 1
case .degreeLocation(.forgin):
return 2
case .profession(.enterpriseManagerSenior):
return 0
case .profession(.enterpriseManagerJunior):
return 1
case .profession(.startOwnBusiness):
return 2
case .profession(.generalStaff):
return 3
case .profession(.professionals):
return 4
case .profession(.selfEmployed):
return 5
case .profession(.governmentEmployee):
return 6
case .profession(.student):
return 7
case .profession(.houseWife):
return 8
case .profession(.retirees):
return 9
case .profession(.graduates):
return 10
case .profession(.other):
return 11
}
return -1
}
}
......@@ -14,7 +14,8 @@ class YHFormItemInputTextCell: UITableViewCell {
// 是否必填 如必填title会展示红色*
var isMust = false
var textChange:((String?)->Void)?
// BOOL值表示编辑是否结束
var textChange:((String?, Bool)->Void)?
var title:String? {
didSet {
......@@ -70,6 +71,7 @@ class YHFormItemInputTextCell: UITableViewCell {
textField.tintColor = UIColor.mainTextColor
textField.textColor = UIColor.mainTextColor
textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
textField.addTarget(self, action: #selector(textFieldEditEnd(textField:)), for: .editingDidEnd)
return textField
}()
......@@ -105,8 +107,13 @@ class YHFormItemInputTextCell: UITableViewCell {
@objc func textFieldChanged(textField:UITextField) {
if let textChange = textChange {
textChange(textField.text)
textChange(textField.text, false)
}
}
@objc func textFieldEditEnd(textField:UITextField) {
if let textChange = textChange {
textChange(textField.text, true)
}
}
}
......@@ -11,11 +11,27 @@ import UIKit
class YHSaveAndSubmitView: UIView {
static let submitBtnHeight = 48.0
static let saveBtnWidth = 86.0
static let gap = 8.0
static let height = submitBtnHeight+gap*2
var saveBlock:(()->Void)?
var submitBlock:(()->Void)?
// 是否隐藏保存按钮
var isHiddenSave:Bool = false {
didSet {
self.saveBtn.isHidden = isHiddenSave
self.saveBtn.snp.updateConstraints { make in
make.width.equalTo(isHiddenSave ? 0 : Self.saveBtnWidth)
}
self.submitBtn.snp.updateConstraints { make in
make.left.equalTo(saveBtn.snp.right).offset(isHiddenSave ? 0.0 : 10)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
lazy var submitBtn:UIButton = {
let btn = UIButton()
......@@ -71,7 +87,8 @@ class YHSaveAndSubmitView: UIView {
saveBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.size.equalTo(CGSize(width: 86.0, height: Self.submitBtnHeight))
make.height.equalTo(Self.submitBtnHeight)
make.width.equalTo(Self.saveBtnWidth)
make.top.equalTo(Self.gap)
}
......
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