Commit 147a45d4 authored by Steven杜宇's avatar Steven杜宇

// 证件信息

parent 36d096b0
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
04010B952B6A1DE90093F3BB /* YHSaveAndSubmitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */; }; 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 */; }; 041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52862B5657B3007EBCEB /* IMAppKey.swift */; };
041B528B2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528A2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift */; }; 041B528B2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528A2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift */; };
041B528D2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */; }; 041B528D2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */; };
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
041B52D62B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */; }; 041B52D62B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */; };
041B52DB2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */; }; 041B52DB2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */; };
041B52DD2B60A889007EBCEB /* YHTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DC2B60A889007EBCEB /* YHTest.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 */; }; 042FBBBD2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBBC2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift */; };
042FBBBF2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */; }; 042FBBBF2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */; };
042FBBC12B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */; }; 042FBBC12B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */; };
...@@ -228,7 +227,6 @@ ...@@ -228,7 +227,6 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSaveAndSubmitView.swift; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDoubleChoiceCell.swift; sourceTree = "<group>"; };
...@@ -240,7 +238,7 @@ ...@@ -240,7 +238,7 @@
041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpouseInitialInfoVC.swift; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDegreeInfoCell.swift; sourceTree = "<group>"; };
...@@ -454,7 +452,6 @@ ...@@ -454,7 +452,6 @@
040FA3352B6F700F0069D17F /* M */ = { 040FA3352B6F700F0069D17F /* M */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
040FA3362B6F701E0069D17F /* File.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -502,7 +499,7 @@ ...@@ -502,7 +499,7 @@
041B52972B5E8EA0007EBCEB /* YHFamilyMemberFormVC.swift */, 041B52972B5E8EA0007EBCEB /* YHFamilyMemberFormVC.swift */,
04D765722B6A173C0055ECBB /* YHSpouseInfoVC.swift */, 04D765722B6A173C0055ECBB /* YHSpouseInfoVC.swift */,
041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */, 041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateViewController.swift */, 042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */, 042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */,
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */, 042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBC62B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift */, 042FBBC62B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift */,
...@@ -1520,12 +1517,11 @@ ...@@ -1520,12 +1517,11 @@
A5C5B3292B57CCBE00A7C5D1 /* YHDavidCell4.swift in Sources */, A5C5B3292B57CCBE00A7C5D1 /* YHDavidCell4.swift in Sources */,
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */, 049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */,
A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */, A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */,
042FBBBB2B62806D00F9DE23 /* YHCertificateViewController.swift in Sources */, 042FBBBB2B62806D00F9DE23 /* YHCertificateInfoController.swift in Sources */,
042FBBC72B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift in Sources */, 042FBBC72B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift in Sources */,
A5234E2A2B6E349600A33433 /* YHBasicInfoFillBottomView.swift in Sources */, A5234E2A2B6E349600A33433 /* YHBasicInfoFillBottomView.swift in Sources */,
04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */, 04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */,
0468D4792B68A08600CFB916 /* YHAddressViewController.swift in Sources */, 0468D4792B68A08600CFB916 /* YHAddressViewController.swift in Sources */,
040FA3372B6F701E0069D17F /* File.swift in Sources */,
A5ACE9562B4564F7002C94D2 /* YHBouncesContentView.swift in Sources */, A5ACE9562B4564F7002C94D2 /* YHBouncesContentView.swift in Sources */,
042FBBCB2B65058000F9DE23 /* YHChildBasicInfoVC.swift in Sources */, 042FBBCB2B65058000F9DE23 /* YHChildBasicInfoVC.swift in Sources */,
A5ACE9302B4564F7002C94D2 /* Algorithm.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 // galaxy
// //
// Created by edy on 2024/1/25. // Created by edy on 2024/1/25.
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
import UIKit import UIKit
class YHCertificateViewController: YHBaseViewController { class YHCertificateInfoController: YHBaseViewController {
var familyMember:YHFamilyMember? var familyMember:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var certificates:YHCertificates = YHCertificates() var certificates:YHCertificates = YHCertificates()
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]() var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
...@@ -63,9 +64,25 @@ class YHCertificateViewController: YHBaseViewController { ...@@ -63,9 +64,25 @@ class YHCertificateViewController: YHBaseViewController {
guard let familyMember = familyMember else { return } 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 certificates = cer
} else { }
// if !isValid {
else {
certificates.cnIdentityCard = YHCNIdentityCard() certificates.cnIdentityCard = YHCNIdentityCard()
certificates.passport = YHCNIdentityCard() certificates.passport = YHCNIdentityCard()
if familyMember.isHandled == 1 { // 要办理港澳通行证 if familyMember.isHandled == 1 { // 要办理港澳通行证
...@@ -77,6 +94,7 @@ class YHCertificateViewController: YHBaseViewController { ...@@ -77,6 +94,7 @@ class YHCertificateViewController: YHBaseViewController {
func loadCertificateInfo() { func loadCertificateInfo() {
guard let familyMember = familyMember else { return }
items.removeAll() items.removeAll()
// 中国身份证 信息必有 // 中国身份证 信息必有
...@@ -113,11 +131,11 @@ class YHCertificateViewController: YHBaseViewController { ...@@ -113,11 +131,11 @@ class YHCertificateViewController: YHBaseViewController {
// 护照及其他旅行证件 信息必有 // 护照及其他旅行证件 信息必有
let title2 = YHFormTitleItem(type: .passPortOrTravelInfo) let title2 = YHFormTitleItem(type: .passPortOrTravelInfo)
let item20 = YHFormDetailItem(type: .certificateType) let item20 = YHFormDetailItem(type: .certificateType, isNeed: false)
let item21 = YHFormDetailItem(type: .certificateNumber) let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: false)
let item22 = YHFormDetailItem(type: .certificateSignPlace) let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: false)
let item23 = YHFormDetailItem(type: .certificateSignDate) let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: false)
let item24 = YHFormDetailItem(type: .certificateValidDate) let item24 = YHFormDetailItem(type: .certificateValidDate, isNeed: false)
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24] let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24]
items.append(arr2) items.append(arr2)
if let passport = certificates.passport { if let passport = certificates.passport {
...@@ -132,7 +150,7 @@ class YHCertificateViewController: YHBaseViewController { ...@@ -132,7 +150,7 @@ class YHCertificateViewController: YHBaseViewController {
} }
} }
extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSource { extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
return items.count return items.count
...@@ -157,20 +175,48 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -157,20 +175,48 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.titleLabel.text = item.getTitle() cell.titleLabel.text = item.getTitle()
return cell return cell
} }
if item is YHFormDetailItem { if item is YHFormDetailItem {
let detailItem = item as! 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 cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
let titleItem = arr[0] as! YHFormTitleItem cell.isMust = detailItem.isNeed
if detailItem.type == .chinaIdentityCardNumber { cell.placeHolder = detailItem.placeHolder
cell.title = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码") cell.title = detailItem.getTitle()
} else { cell.text = detailItem.value
cell.title = detailItem.getTitle()
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 return cell
} }
...@@ -178,20 +224,20 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -178,20 +224,20 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
if detailItem.type == .certificateType || detailItem.type == .certificateSignDate { if detailItem.type == .certificateType || detailItem.type == .certificateSignDate {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = "中国" cell.detail = detailItem.value
return cell return cell
} }
if detailItem.type == .certificateValidDate { if detailItem.type == .certificateValidDate {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemExpireDateCell.cellReuseIdentifier, for: indexPath) as! YHFormItemExpireDateCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemExpireDateCell.cellReuseIdentifier, for: indexPath) as! YHFormItemExpireDateCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = detailItem.value
return cell return cell
} }
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.title = detailItem.getTitle()
return cell
} }
return createDefaultCell(indexPath) return createDefaultCell(indexPath)
...@@ -246,9 +292,6 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -246,9 +292,6 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHSpouseBasicInfoVC()
self.navigationController?.pushViewController(vc)
if !(0..<items.count).contains(indexPath.section) { return } if !(0..<items.count).contains(indexPath.section) { return }
let arr:[YHFormItemProtocol] = items[indexPath.section] let arr:[YHFormItemProtocol] = items[indexPath.section]
if !(0..<arr.count).contains(indexPath.row) { return } if !(0..<arr.count).contains(indexPath.row) { return }
...@@ -259,6 +302,7 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -259,6 +302,7 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
} }
if item is YHFormDetailItem { if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem let detailItem = item as! YHFormDetailItem
let title = arr[0] as! YHFormTitleItem
if detailItem.type == .certificateValidDate || if detailItem.type == .certificateValidDate ||
detailItem.type == .certificateSignDate { // 届满日期 签发日期 detailItem.type == .certificateSignDate { // 届满日期 签发日期
...@@ -266,19 +310,51 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -266,19 +310,51 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
YHDatePickView.show(type: .yyyymmdd) { [weak self] date in YHDatePickView.show(type: .yyyymmdd) { [weak self] date in
let dataArr = date.components(separatedBy: YHDatePickView.separator) let dataArr = date.components(separatedBy: YHDatePickView.separator)
print(dataArr) print(dataArr)
guard let self = self else { return }
guard let familyMember = self.familyMember else { return }
if let familyMember = self?.familyMember { var certificate = familyMember.certificates?.cnIdentityCard
if familyMember.relationType == .child { 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 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) { func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理 // 复用时需清理
...@@ -296,5 +372,11 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -296,5 +372,11 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
cell.layer.mask = nil cell.layer.mask = nil
} }
} }
func save() {
if let delegate = delegate {
delegate.saveInfo?()
}
}
} }
...@@ -436,39 +436,40 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -436,39 +436,40 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFamilyMember { if item is YHFamilyMember {
let detailItem = item as! YHFamilyMember let detailItem = item as! YHFamilyMember
// 配偶
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
}
// 配偶
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
}
} }
} }
......
...@@ -25,9 +25,8 @@ enum HKFormItemCellType: Int { ...@@ -25,9 +25,8 @@ enum HKFormItemCellType: Int {
class YHSpouseBasicInfoVC: YHBaseViewController { class YHSpouseBasicInfoVC: YHBaseViewController {
var spouse:YHFamilyMember? var spouse:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var cardInfo: YHCNIdentityCard?
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]() var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
...@@ -292,7 +291,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -292,7 +291,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.textChange = { cell.textChange = {
[weak self] text in [weak self] (text, isEditEnd) in
guard let self = self else { return } guard let self = self else { return }
if detailItem.type == .spouseName { if detailItem.type == .spouseName {
self.spouse?.subsetName = text self.spouse?.subsetName = text
......
...@@ -11,6 +11,7 @@ import UIKit ...@@ -11,6 +11,7 @@ import UIKit
@objc protocol YHSpouseInfoVCProtocol { @objc protocol YHSpouseInfoVCProtocol {
@objc optional func updateStepView() @objc optional func updateStepView()
@objc optional func saveInfo()
} }
...@@ -23,13 +24,12 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -23,13 +24,12 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
var spouse:YHFamilyMember? { var spouse:YHFamilyMember? {
didSet { didSet {
initalInfoVC.spouse = spouse initalInfoVC.spouse = spouse
passportInfoVC.familyMember = spouse certificateVC.familyMember = spouse
basicInfoVC.spouse = spouse basicInfoVC.spouse = spouse
} }
} }
var currentIndex = 0 { var currentIndex = 0 {
didSet { didSet {
currentIndex %= self.children.count currentIndex %= self.children.count
stepView.currentIndex = currentIndex stepView.currentIndex = currentIndex
...@@ -53,7 +53,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -53,7 +53,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
let initalInfoVC = YHSpouseInitialInfoVC() let initalInfoVC = YHSpouseInitialInfoVC()
let uploadVC = UIViewController() let uploadVC = UIViewController()
let passportInfoVC = YHCertificateViewController() let certificateVC = YHCertificateInfoController()
let basicInfoVC = YHSpouseBasicInfoVC() let basicInfoVC = YHSpouseBasicInfoVC()
override func viewDidLoad() { override func viewDidLoad() {
...@@ -66,7 +66,8 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -66,7 +66,8 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
guard let spouse = spouse else { return } guard let spouse = spouse else { return }
initalInfoVC.delegate = self initalInfoVC.delegate = self
certificateVC.delegate = self
basicInfoVC.delegate = self
updateStepView() updateStepView()
...@@ -84,7 +85,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -84,7 +85,7 @@ class YHSpouseInfoVC: 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.save() self.saveInfo()
} }
stepView.snp.makeConstraints { make in stepView.snp.makeConstraints { make in
...@@ -118,11 +119,11 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -118,11 +119,11 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
self.addChild(initalInfoVC) self.addChild(initalInfoVC)
self.addChild(uploadVC) self.addChild(uploadVC)
self.addChild(passportInfoVC) self.addChild(certificateVC)
self.addChild(basicInfoVC) self.addChild(basicInfoVC)
self.view.addSubview(basicInfoVC.view) self.view.addSubview(basicInfoVC.view)
self.view.addSubview(passportInfoVC.view) self.view.addSubview(certificateVC.view)
self.view.addSubview(uploadVC.view) self.view.addSubview(uploadVC.view)
self.view.addSubview(initalInfoVC.view) self.view.addSubview(initalInfoVC.view)
...@@ -153,14 +154,22 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -153,14 +154,22 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
} }
extension YHSpouseInfoVC { extension YHSpouseInfoVC {
func save() { func saveInfo() {
guard let spouse = spouse else { return } guard let spouse = spouse else { return }
guard let info = spouse.toDictionary() else { return } guard var info = spouse.toDictionary() else { return }
let arr = info["has_degree_json"] as! [[String:Any]] // let certi = [ "cnIdentityCard":
let parmas:[String:Any] = info // ["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, let dict:[String: Any] = ["orderId":self.orderId,
"relation":spouse.relationType.rawValue, "relation":spouse.relationType.rawValue,
"step":0, "step":0,
......
...@@ -240,7 +240,7 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -240,7 +240,7 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.text = detailItem.value cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.textChange = { cell.textChange = {
[weak self] text in [weak self] (text, isEditEnd) in
guard let self = self else { return } guard let self = self else { return }
self.spouse?.address?.details = text self.spouse?.address?.details = text
......
...@@ -536,6 +536,8 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -536,6 +536,8 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var childStepchild: YHChildStepchildClass? var childStepchild: YHChildStepchildClass?
// 在港信息 // 在港信息
var childInHk: YHChildStepchildClass? var childInHk: YHChildStepchildClass?
// 证件数组 (中国身份证、香港身份证、护照等)
var certificates: YHCertificates?
// mark any // mark any
var countryIdentity: SmartAny? var countryIdentity: SmartAny?
...@@ -556,11 +558,6 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -556,11 +558,6 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
// 婚前刑事 // 婚前刑事
var surname: String? var surname: String?
// mark any
// var certificates: YHCertificates?
var certificates: SmartAny?
var certificatesd: YHCertificates?
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id = "id" case id = "id"
case deceased = "deceased" case deceased = "deceased"
......
...@@ -128,6 +128,9 @@ enum YHFormPickerViewSubType { ...@@ -128,6 +128,9 @@ enum YHFormPickerViewSubType {
return "联合国通行证".local return "联合国通行证".local
case .certificate(.officialPassport): case .certificate(.officialPassport):
return "公务护照".local return "公务护照".local
case .certificate(.other):
return "其他".local
case .identity(.student): case .identity(.student):
return "学生".local return "学生".local
case .identity(.employment): case .identity(.employment):
...@@ -195,19 +198,21 @@ enum YHFormPickerViewSubType { ...@@ -195,19 +198,21 @@ enum YHFormPickerViewSubType {
return 1 return 1
case .certificate(.passport): case .certificate(.passport):
return 0
case .certificate(.travelPassport):
return 1
case .certificate(.diplomaticPassport):
return 2
case .certificate(.chineseStatelessTravelPassport):
return 3 return 3
case .certificate(.otherStatelessTravelPassport): case .certificate(.diplomaticPassport):
return 4 return 4
case .certificate(.unitedNationsPassport):
return 5
case .certificate(.officialPassport): case .certificate(.officialPassport):
return 5
case .certificate(.chineseStatelessTravelPassport):
return 6 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): case .ownDegree(.noDegree):
return 0 return 0
...@@ -231,8 +236,8 @@ enum YHFormPickerViewSubType { ...@@ -231,8 +236,8 @@ enum YHFormPickerViewSubType {
return 2 return 2
} }
return -1
} }
} }
...@@ -287,19 +292,21 @@ enum YHPickerViewGenderType: Int { ...@@ -287,19 +292,21 @@ enum YHPickerViewGenderType: Int {
enum YHPickerViewCertificateType: Int { enum YHPickerViewCertificateType: Int {
// 护照 // 护照
case passport = 0 case passport = 3
// 外交护照 // 外交护照
case diplomaticPassport = 1 case diplomaticPassport = 4
// 公务护照 // 公务护照
case officialPassport = 2 case officialPassport = 5
// 中国发无国籍旅游证件 // 中国发无国籍旅游证件
case chineseStatelessTravelPassport = 3 case chineseStatelessTravelPassport = 6
// 旅游通行证 // 旅游通行证
case travelPassport = 4 case travelPassport = 7
// 联合国通行证 // 联合国通行证
case unitedNationsPassport = 5 case unitedNationsPassport = 8
// 其他无国籍旅行证件 // 其他无国籍旅行证件
case otherStatelessTravelPassport = 6 case otherStatelessTravelPassport = 9
// 其他
case other = 10
} }
...@@ -477,7 +484,8 @@ class YHFormPickerView: UIView { ...@@ -477,7 +484,8 @@ class YHFormPickerView: UIView {
YHFormPickerViewItem(type: .certificate(.chineseStatelessTravelPassport)), YHFormPickerViewItem(type: .certificate(.chineseStatelessTravelPassport)),
YHFormPickerViewItem(type: .certificate(.travelPassport)), YHFormPickerViewItem(type: .certificate(.travelPassport)),
YHFormPickerViewItem(type: .certificate(.unitedNationsPassport)), YHFormPickerViewItem(type: .certificate(.unitedNationsPassport)),
YHFormPickerViewItem(type: .certificate(.otherStatelessTravelPassport))], YHFormPickerViewItem(type: .certificate(.otherStatelessTravelPassport)),
YHFormPickerViewItem(type: .certificate(.other))],
// 在港身份 // 在港身份
.identity: .identity:
...@@ -496,6 +504,8 @@ class YHFormPickerView: UIView { ...@@ -496,6 +504,8 @@ class YHFormPickerView: UIView {
.degreeLocation: .degreeLocation:
[YHFormPickerViewItem(type: .degreeLocation(.domestic)), [YHFormPickerViewItem(type: .degreeLocation(.domestic)),
YHFormPickerViewItem(type: .degreeLocation(.forgin))], YHFormPickerViewItem(type: .degreeLocation(.forgin))],
] ]
}() }()
...@@ -605,7 +615,7 @@ class YHFormPickerView: UIView { ...@@ -605,7 +615,7 @@ class YHFormPickerView: UIView {
var selectIndex:Int = -1 var selectIndex:Int = -1
if let selectType = selectType, let arr = dataDict[type], !arr.isEmpty { if let selectType = selectType, let arr = dataDict[type], !arr.isEmpty {
for (index, item) in arr.enumerated() { for (index, item) in arr.enumerated() {
if selectType.title == item.type.title { if selectType.index == item.type.index {
selectIndex = index selectIndex = index
break break
} }
......
...@@ -14,7 +14,8 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -14,7 +14,8 @@ class YHFormItemInputTextCell: UITableViewCell {
// 是否必填 如必填title会展示红色* // 是否必填 如必填title会展示红色*
var isMust = false var isMust = false
var textChange:((String?)->Void)? // BOOL值表示编辑是否结束
var textChange:((String?, Bool)->Void)?
var title:String? { var title:String? {
didSet { didSet {
...@@ -70,6 +71,7 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -70,6 +71,7 @@ class YHFormItemInputTextCell: UITableViewCell {
textField.tintColor = UIColor.mainTextColor textField.tintColor = UIColor.mainTextColor
textField.textColor = UIColor.mainTextColor textField.textColor = UIColor.mainTextColor
textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged) textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
textField.addTarget(self, action: #selector(textFieldEditEnd(textField:)), for: .editingDidEnd)
return textField return textField
}() }()
...@@ -105,8 +107,13 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -105,8 +107,13 @@ class YHFormItemInputTextCell: UITableViewCell {
@objc func textFieldChanged(textField:UITextField) { @objc func textFieldChanged(textField:UITextField) {
if let textChange = textChange { if let textChange = textChange {
textChange(textField.text) textChange(textField.text, false)
}
}
@objc func textFieldEditEnd(textField:UITextField) {
if let textChange = textChange {
textChange(textField.text, true)
} }
} }
} }
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