Commit 46fa7618 authored by Steven杜宇's avatar Steven杜宇

// 证书信息

parent 8e0d1f12
...@@ -8,12 +8,16 @@ ...@@ -8,12 +8,16 @@
import UIKit import UIKit
import GKNavigationBarSwift import GKNavigationBarSwift
import IQKeyboardManagerSwift
class YHBaseViewController: UIViewController { class YHBaseViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = UIColor(hex:0xf8f8f8) view.backgroundColor = UIColor(hex:0xf8f8f8)
#if DEBUG
IQKeyboardManager.shared.enable = true
#endif
gk_navBackgroundColor = .clear gk_navBackgroundColor = .clear
gk_navLineHidden = true gk_navLineHidden = true
gk_navBarAlpha = 0 gk_navBarAlpha = 0
......
...@@ -10,9 +10,9 @@ import UIKit ...@@ -10,9 +10,9 @@ import UIKit
class YHCertificateViewController: YHBaseViewController { class YHCertificateViewController: YHBaseViewController {
var spouse:YHFamilyMember? var familyMember:YHFamilyMember?
var cardInfo: YHCNIdentityCard? var certificates:YHCertificates = YHCertificates()
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]() var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
...@@ -57,28 +57,74 @@ class YHCertificateViewController: YHBaseViewController { ...@@ -57,28 +57,74 @@ class YHCertificateViewController: YHBaseViewController {
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16) make.right.equalToSuperview().offset(-16)
} }
guard let familyMember = familyMember else { return }
if let cer = familyMember.certificatesd {
certificates = cer
} else {
certificates.cnIdentityCard = YHCNIdentityCard()
certificates.passport = YHCNIdentityCard()
if familyMember.isHandled == 1 { // 要办理港澳通行证
certificates.hkMacaoPass = YHCNIdentityCard()
}
}
loadCertificateInfo()
} }
func loadCertificateInfo() { func loadCertificateInfo() {
items.removeAll()
// 中国身份证 信息必有
let title0 = YHFormTitleItem(type: .chinaIdCardInfo) let title0 = YHFormTitleItem(type: .chinaIdCardInfo)
let item01 = YHFormDetailItem(type: .certificateNumber) let item01 = YHFormDetailItem(type: .chinaIdentityCardNumber)
let item02 = YHFormDetailItem(type: .certificateSignPlace) let item02 = YHFormDetailItem(type: .certificateSignPlace)
let item03 = YHFormDetailItem(type: .certificateSignDate) let item03 = YHFormDetailItem(type: .certificateSignDate)
let item04 = YHFormDetailItem(type: .certificateValidDate) let item04 = YHFormDetailItem(type: .certificateValidDate)
let arr0:[YHFormItemProtocol] = [title0, item01, item02, item03, item04] let arr0:[YHFormItemProtocol] = [title0, item01, item02, item03, item04]
items.append(arr0)
if let cnIdentityCard = certificates.cnIdentityCard {
item01.value = cnIdentityCard.number
item02.value = cnIdentityCard.issueAt
item03.value = cnIdentityCard.issueDateStartAt
item04.value = cnIdentityCard.issueDateEndAt
}
let title1 = YHFormTitleItem(type: .passPortInfo) // 港澳通行证 非必须
let item10 = YHFormDetailItem(type: .cetificateType) if certificates.hkMacaoPass != nil {
let item11 = YHFormDetailItem(type: .certificateNumber) let title1 = YHFormTitleItem(type: .hkAndMacaoPassport)
let item12 = YHFormDetailItem(type: .certificateSignPlace) let item10 = YHFormDetailItem(type: .traverlPassportNumber)
let item13 = YHFormDetailItem(type: .certificateSignDate) let item11 = YHFormDetailItem(type: .certificateSignPlace)
let item14 = YHFormDetailItem(type: .certificateValidDate) let item12 = YHFormDetailItem(type: .certificateSignDate)
let item15 = YHFormDetailItem(type: .certificateSignPlace) let item13 = YHFormDetailItem(type: .certificateValidDate)
let arr1:[YHFormItemProtocol] = [title1, item10, item11, item12, item13]
let arr1:[YHFormItemProtocol] = [title1, item10, item11, item12, item13, item14, item15] items.append(arr1)
if let hkMacaoPass = certificates.hkMacaoPass {
items.append(contentsOf: [arr0, arr1]) item10.value = hkMacaoPass.number
item11.value = hkMacaoPass.issueAt
item12.value = hkMacaoPass.issueDateStartAt
item13.value = hkMacaoPass.issueDateEndAt
}
}
// 护照及其他旅行证件 信息必有
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 arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24]
items.append(arr2)
if let passport = certificates.passport {
item20.value = String(passport.passportType)
item21.value = passport.number
item22.value = passport.issueAt
item23.value = passport.issueDateStartAt
item24.value = passport.issueDateEndAt
}
tableView.reloadData() tableView.reloadData()
} }
} }
...@@ -115,10 +161,10 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -115,10 +161,10 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
let detailItem = item as! YHFormDetailItem let detailItem = item as! YHFormDetailItem
if detailItem.type == .certificateNumber || detailItem.type == .certificateSignPlace { // 证件号码和签发地需要填写 if detailItem.type == .chinaIdentityCardNumber || detailItem.type == .certificateSignPlace { // 证件号码和签发地需要填写
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 let titleItem = arr[0] as! YHFormTitleItem
if detailItem.type == .certificateNumber { if detailItem.type == .chinaIdentityCardNumber {
cell.titleLabel.text = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码") cell.titleLabel.text = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码")
} else { } else {
cell.titleLabel.text = detailItem.getTitle() cell.titleLabel.text = detailItem.getTitle()
...@@ -126,7 +172,7 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -126,7 +172,7 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
return cell return cell
} }
if detailItem.type == .cetificateType || 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.title = detailItem.getTitle() cell.title = detailItem.getTitle()
...@@ -190,6 +236,9 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -190,6 +236,9 @@ 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 }
...@@ -204,19 +253,21 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -204,19 +253,21 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
detailItem.type == .certificateSignDate { // 届满日期 签发日期 detailItem.type == .certificateSignDate { // 届满日期 签发日期
self.view?.endEditing(true) self.view?.endEditing(true)
YHDatePickView.show(type: .yyyymmdd) { 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)
if let familyMember = self?.familyMember {
if familyMember.relationType == .child {
}
}
} }
} }
return return
} }
let vc = YHSpouseBasicInfoVC()
self.navigationController?.pushViewController(vc)
} }
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) { func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
......
...@@ -318,6 +318,7 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -318,6 +318,7 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHCertificateViewController() let vc = YHCertificateViewController()
vc.familyMember = spouse
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
...@@ -38,8 +38,8 @@ enum YHFormTitleItemType:Int, CaseIterable { ...@@ -38,8 +38,8 @@ enum YHFormTitleItemType:Int, CaseIterable {
// 中国身份证 // 中国身份证
case chinaIdCardInfo case chinaIdCardInfo
// 护照 // 护照及其他旅行证件
case passPortInfo case passPortOrTravelInfo
// 配偶信息 // 配偶信息
case spouseInfo case spouseInfo
...@@ -92,9 +92,13 @@ enum YHFormDetailItemType:Int { ...@@ -92,9 +92,13 @@ enum YHFormDetailItemType:Int {
case isHandleHKPassPort case isHandleHKPassPort
// 证件类别 // 证件类别
case cetificateType case certificateType
// 证件号码 // 证件号码
case certificateNumber case certificateNumber
// 中国身份证号
case chinaIdentityCardNumber
// 旅行证件号码
case traverlPassportNumber
// 签发日期 // 签发日期
case certificateSignDate case certificateSignDate
// 届满日期 // 届满日期
...@@ -187,7 +191,7 @@ class YHFormAddItem : YHFormItemProtocol ...@@ -187,7 +191,7 @@ class YHFormAddItem : YHFormItemProtocol
class YHFormTitleItem : YHFormItemProtocol { class YHFormTitleItem : YHFormItemProtocol {
var type: YHFormTitleItemType var type: YHFormTitleItemType
init(type: YHFormTitleItemType) { init(type: YHFormTitleItemType) {
self.type = type self.type = type
} }
...@@ -212,7 +216,7 @@ class YHFormTitleItem : YHFormItemProtocol { ...@@ -212,7 +216,7 @@ class YHFormTitleItem : YHFormItemProtocol {
return "港澳通行证".local return "港澳通行证".local
case .chinaIdCardInfo: case .chinaIdCardInfo:
return "中国身份证".local return "中国身份证".local
case .passPortInfo: case .passPortOrTravelInfo:
return String(format: "%@(%@)", "护照及其他旅行证件".local, "选填".local) return String(format: "%@(%@)", "护照及其他旅行证件".local, "选填".local)
case .spouseInfo: case .spouseInfo:
return "配偶信息".local return "配偶信息".local
...@@ -262,7 +266,7 @@ class YHFormTitleItem : YHFormItemProtocol { ...@@ -262,7 +266,7 @@ class YHFormTitleItem : YHFormItemProtocol {
return "".local return "".local
case .chinaIdCardInfo: case .chinaIdCardInfo:
return "".local return "".local
case .passPortInfo: case .passPortOrTravelInfo:
return "".local return "".local
case .spouseInfo: case .spouseInfo:
return "".local return "".local
...@@ -297,6 +301,9 @@ class YHFormDetailItem : YHFormItemProtocol { ...@@ -297,6 +301,9 @@ class YHFormDetailItem : YHFormItemProtocol {
// 是否是必填项 // 是否是必填项
var isNeed: Bool = true var isNeed: Bool = true
var value: String?
// 是否随行 // 是否随行
var isAccompany:Bool = false var isAccompany:Bool = false
// 是否办理港澳通信证 // 是否办理港澳通信证
...@@ -336,12 +343,19 @@ class YHFormDetailItem : YHFormItemProtocol { ...@@ -336,12 +343,19 @@ class YHFormDetailItem : YHFormItemProtocol {
case .isHandleHKPassPort: case .isHandleHKPassPort:
return "是否办理".local return "是否办理".local
// 证件类别 // 证件类别
case .cetificateType: case .certificateType:
return "证件类别".local return "证件类别".local
// 证件号码 // 证件号码
case .certificateNumber: case .certificateNumber:
return "证件号码".local
// 证件号码
case .chinaIdentityCardNumber:
return "中国身份证号".local return "中国身份证号".local
// 旅行证件号码
case .traverlPassportNumber:
return "旅行证件号码".local
// 签发日期 // 签发日期
case .certificateSignDate: case .certificateSignDate:
return "签发日期".local return "签发日期".local
...@@ -547,6 +561,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -547,6 +561,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
// mark any // mark any
// var certificates: YHCertificates? // var certificates: YHCertificates?
var certificates: SmartAny? var certificates: SmartAny?
var certificatesd: YHCertificates?
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id = "id" case id = "id"
...@@ -687,24 +702,31 @@ class YHSubsetNamePinyin: SmartCodable { ...@@ -687,24 +702,31 @@ class YHSubsetNamePinyin: SmartCodable {
// MARK: - YHCertificates // MARK: - YHCertificates
class YHCertificates: SmartCodable { class YHCertificates: SmartCodable {
required init() {
}
var cnIdentityCard: YHCNIdentityCard? var cnIdentityCard: YHCNIdentityCard?
var passport: YHCNIdentityCard? var passport: YHCNIdentityCard?
var hkMacaoPass: YHCNIdentityCard?
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case cnIdentityCard = "cnIdentityCard" case cnIdentityCard = "cnIdentityCard"
case passport = "passport" case passport = "passport"
case hkMacaoPass = "hkMacaoPass"
}
required init() {
}
init(cnIdentityCard: YHCNIdentityCard?, passport: YHCNIdentityCard?, hkMacaoPass: YHCNIdentityCard?) {
self.cnIdentityCard = cnIdentityCard
self.passport = passport
self.hkMacaoPass = hkMacaoPass
} }
} }
// MARK: - YHCNIdentityCard // MARK: - YHCNIdentityCard
class YHCNIdentityCard: SmartCodable { class YHCNIdentityCard: SmartCodable {
required init() {
}
var id: Int = 0 var id: Int = 0
var number: String? var number: String?
...@@ -725,6 +747,20 @@ class YHCNIdentityCard: SmartCodable { ...@@ -725,6 +747,20 @@ class YHCNIdentityCard: SmartCodable {
case imgBack = "img_back" case imgBack = "img_back"
case passportType = "passport_type" case passportType = "passport_type"
} }
required init() {
}
init(id:Int, number: String?, issueAt:String?, issueDateStartAt: String?, imgFront: String?, imgBack: String?, passportType: Int) {
self.id = id
self.number = number
self.issueAt = issueAt
self.issueDateStartAt = issueDateStartAt
self.imgFront = imgFront
self.imgBack = imgBack
self.passportType = passportType
}
} }
// MARK: - YHHasDegreeJson // MARK: - YHHasDegreeJson
......
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