Commit 87795154 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  // 家庭成员
  家庭成员
  // 家庭成员
parents 48257a09 eaeb8a6f
...@@ -197,8 +197,9 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -197,8 +197,9 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] { if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step currentStep = item.step
child?.step = item.step child?.step = item.step
if cur+1 > stepView.maxIndex {
stepView.maxIndex = cur+1 stepView.maxIndex = cur+1
} } }
print("currentIndex:\(currentStep)") print("currentIndex:\(currentStep)")
} }
} }
......
...@@ -267,6 +267,14 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -267,6 +267,14 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips) cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
cell.textInputCondtion = {
text in
if let textStr = text {
let max = 100
text = textStr.count > max ? textStr[safe: ..<max] : textStr
}
return true
}
cell.textChange = { cell.textChange = {
[weak self] (text, isEditEnd) in [weak self] (text, isEditEnd) in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -246,8 +246,10 @@ extension YHSpouseInfoContainerVC { ...@@ -246,8 +246,10 @@ extension YHSpouseInfoContainerVC {
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] { if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step currentStep = item.step
spouse?.step = item.step spouse?.step = item.step
if cur+1 > stepView.maxIndex {
stepView.maxIndex = cur+1 stepView.maxIndex = cur+1
} }
}
print("currentIndex:\(currentStep)") print("currentIndex:\(currentStep)")
} }
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
import UIKit import UIKit
import SmartCodable import SmartCodable
import SwifterSwift
class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol { class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
...@@ -232,6 +233,14 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -232,6 +233,14 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.text = detailItem.value cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips) cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textInputCondtion = {
text in
if let textStr = text {
let max = 100
text = textStr.count > max ? textStr[safe: ..<max] : textStr
}
return true
}
cell.textChange = { cell.textChange = {
[weak self] (text, isEditEnd) in [weak self] (text, isEditEnd) in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -69,16 +69,18 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol { ...@@ -69,16 +69,18 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
guard let familyMember = familyMember else { return } guard let familyMember = familyMember else { return }
items.removeAll() items.removeAll()
// 中国身份证 信息必有 // 中国身份证
let isChinaCardMust = familyMember.isChinese()
let title0 = YHFormTitleItem(type: .chinaIdCardInfo) let title0 = YHFormTitleItem(type: .chinaIdCardInfo)
let item01 = YHFormDetailItem(type: .chinaIdentityCardNumber, value:familyMember.certificates.cnIdentityCard.number, tips: "请输入中国身份证号".local) let item01 = YHFormDetailItem(type: .chinaIdentityCardNumber, isNeed:isChinaCardMust, value:familyMember.certificates.cnIdentityCard.number, tips: "请输入正确的中国身份证号".local)
let item02 = YHFormDetailItem(type: .certificateSignPlace, value:familyMember.certificates.cnIdentityCard.issueAt, tips: "请输入签发地".local) let item02 = YHFormDetailItem(type: .certificateSignPlace, isNeed:isChinaCardMust, value:familyMember.certificates.cnIdentityCard.issueAt, tips: "请输入签发地".local)
let item03 = YHFormDetailItem(type: .certificateSignDate, value:familyMember.certificates.cnIdentityCard.issueDateStartAt, tips: "请选择签发日期".local) let item03 = YHFormDetailItem(type: .certificateSignDate, isNeed:isChinaCardMust, value:familyMember.certificates.cnIdentityCard.issueDateStartAt, tips: "请选择签发日期".local)
let item04 = YHFormDetailItem(type: .certificateValidDate, value:familyMember.certificates.cnIdentityCard.issueDateEndAt, tips: "请选择签发日期".local) let item04 = YHFormDetailItem(type: .certificateValidDate, isNeed:isChinaCardMust, value:familyMember.certificates.cnIdentityCard.issueDateEndAt, tips: "请选择签发日期".local)
let arr0:[YHFormItemProtocol] = [title0, item01, item02, item03, item04] let arr0:[YHFormItemProtocol] = [title0, item01, item02, item03, item04]
items.append(arr0) items.append(arr0)
// 港澳通行证 非必须 // 港澳通行证 非必须
if familyMember.isNeedHandleHKPassPort() { if familyMember.isNeedHandleHKPassPort() {
let title1 = YHFormTitleItem(type: .hkAndMacaoPassport) let title1 = YHFormTitleItem(type: .hkAndMacaoPassport)
...@@ -91,6 +93,7 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol { ...@@ -91,6 +93,7 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
} }
// 护照及其他旅行证件 信息必有 // 护照及其他旅行证件 信息必有
let isPassPortMust = !familyMember.isChinese()
let title2 = YHFormTitleItem(type: .passPortOrTravelInfo) let title2 = YHFormTitleItem(type: .passPortOrTravelInfo)
// 证件类别名称 // 证件类别名称
...@@ -99,11 +102,11 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol { ...@@ -99,11 +102,11 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
if let item = YHSheetPickerView.getItem(type:.certificate, index:passPortType) { if let item = YHSheetPickerView.getItem(type:.certificate, index:passPortType) {
value = item.title value = item.title
} }
let item20 = YHFormDetailItem(type: .certificateType, isNeed: false, value:value, tips:"请选择证件类别".local) let item20 = YHFormDetailItem(type: .certificateType, isNeed: isPassPortMust, value:value, tips:"请选择证件类别".local)
let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: false, value: familyMember.certificates.passport.number, tips: "请输入证件号码".local) let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: isPassPortMust, value: familyMember.certificates.passport.number, tips: "请输入证件号码".local)
let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: false, value: familyMember.certificates.passport.issueAt, tips:"请输入签发地".local) let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: isPassPortMust, value: familyMember.certificates.passport.issueAt, tips:"请输入签发地".local)
let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: false, value:familyMember.certificates.passport.issueDateStartAt, tips:"请选择签发日期".local) let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: isPassPortMust, value:familyMember.certificates.passport.issueDateStartAt, tips:"请选择签发日期".local)
let item24 = YHFormDetailItem(type: .certificateValidDate, isNeed: false, value:familyMember.certificates.passport.issueDateEndAt,tips:"请选择届满日期".local) let item24 = YHFormDetailItem(type: .certificateValidDate, isNeed: isPassPortMust, value:familyMember.certificates.passport.issueDateEndAt,tips:"请选择届满日期".local)
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24] let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24]
items.append(arr2) items.append(arr2)
...@@ -150,7 +153,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour ...@@ -150,7 +153,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips) cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textChange = { cell.textChange = {
[weak self] (text, isEditEnd) in [weak self] (text, isEditEnd) in
guard let self = self else { return } guard let self = self else { return }
...@@ -352,7 +354,8 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour ...@@ -352,7 +354,8 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
func checkIntegrity() -> Bool { func checkIntegrity() -> Bool {
guard let familyMember = familyMember else { return false} guard let familyMember = familyMember else { return false}
// 验证身份证 // 国籍为中国需验证身份证
if familyMember.isChinese() {
if familyMember.certificates.cnIdentityCard.number.count <= 0 if familyMember.certificates.cnIdentityCard.number.count <= 0
|| familyMember.certificates.cnIdentityCard.issueAt.count <= 0 || familyMember.certificates.cnIdentityCard.issueAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateStartAt.count <= 0 || familyMember.certificates.cnIdentityCard.issueDateStartAt.count <= 0
...@@ -360,9 +363,11 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour ...@@ -360,9 +363,11 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
{ {
return false return false
} }
}
if familyMember.isNeedHandleHKPassPort() {
// 如果选了办理过港澳通行证,则需要验证港澳通行证 // 如果选了办理过港澳通行证,则需要验证港澳通行证
if familyMember.isNeedHandleHKPassPort() {
if familyMember.certificates.hkMacaoPass.number.count <= 0 if familyMember.certificates.hkMacaoPass.number.count <= 0
|| familyMember.certificates.hkMacaoPass.issueAt.count <= 0 || familyMember.certificates.hkMacaoPass.issueAt.count <= 0
|| familyMember.certificates.hkMacaoPass.issueDateStartAt.count <= 0 || familyMember.certificates.hkMacaoPass.issueDateStartAt.count <= 0
...@@ -373,6 +378,18 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour ...@@ -373,6 +378,18 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
} }
} }
// 是老外需验证护照
if !familyMember.isChinese() {
if familyMember.certificates.passport.number.count <= 0
|| familyMember.certificates.passport.issueAt.count <= 0
|| familyMember.certificates.passport.issueDateStartAt.count <= 0
|| familyMember.certificates.passport.issueDateEndAt.count <= 0
|| familyMember.certificates.passport.passPortType == -1
{
return false
}
}
return true return true
} }
......
...@@ -172,6 +172,13 @@ class YHFamilyMemberInfoVC: YHBaseViewController { ...@@ -172,6 +172,13 @@ class YHFamilyMemberInfoVC: YHBaseViewController {
items.append(sponseArray) items.append(sponseArray)
} }
// 子女section
var childArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .child), YHFormAddItem(type: .addChild)]
if let childs = familyMemberInfo?.child, !childs.isEmpty {
childArr.insert(contentsOf: childs, at:1)
}
items.append(childArr)
// 父母section // 父母section
var parents = [YHFormItemProtocol]() var parents = [YHFormItemProtocol]()
let item0 = YHFormTitleItem(type: .parent) let item0 = YHFormTitleItem(type: .parent)
...@@ -188,18 +195,9 @@ class YHFamilyMemberInfoVC: YHBaseViewController { ...@@ -188,18 +195,9 @@ class YHFamilyMemberInfoVC: YHBaseViewController {
mother.relationType = .mother mother.relationType = .mother
parents.append(mother) parents.append(mother)
} }
items.append(parents) items.append(parents)
// 子女section
var childArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .child), YHFormAddItem(type: .addChild)]
if let childs = familyMemberInfo?.child, !childs.isEmpty {
childArr.insert(contentsOf: childs, at:1)
}
items.append(childArr)
// 兄妹section // 兄妹section
var brotherArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .brother), YHFormAddItem(type: .addBrother)] var brotherArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .brother), YHFormAddItem(type: .addBrother)]
if let brothers = familyMemberInfo?.brother, !brothers.isEmpty { if let brothers = familyMemberInfo?.brother, !brothers.isEmpty {
......
...@@ -970,6 +970,11 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -970,6 +970,11 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
} }
// 国籍是否是中国
func isChinese() -> Bool {
return nationality == "中国-China"
}
// 是否随行 // 是否随行
func isFollow() -> Bool { func isFollow() -> Bool {
return follow == 1 return follow == 1
......
...@@ -204,18 +204,6 @@ class YHFormItemDoubleChoiceCell: UITableViewCell { ...@@ -204,18 +204,6 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
func setTips(_ tips:String?, isShow:Bool) { func setTips(_ tips:String?, isShow:Bool) {
tipsLabel.text = tips tipsLabel.text = tips
tipsLabel.isHidden = !isShow tipsLabel.isHidden = !isShow
var tipsHeight = 0.0
if let tips = tips, tips.count > 0 {
var bounds = CGRect()
let maxWidth = KScreenWidth-16*2-horizonalGap*2
bounds = NSString(string:tips).boundingRect(with: CGSize(width:maxWidth, height: .greatestFiniteMagnitude), options: [.usesLineFragmentOrigin], attributes: [.font : titleFont], context: nil)
tipsHeight = Double(ceill(Float80(bounds.size.height)))
}
tipsLabel.snp.updateConstraints { make in
make.height.equalTo(tipsHeight)
}
self.setNeedsLayout()
self.layoutIfNeeded()
} }
// 更新答案按钮选中状态 // 更新答案按钮选中状态
......
...@@ -22,7 +22,7 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -22,7 +22,7 @@ class YHFormItemInputTextCell: UITableViewCell {
} }
// BOOL值表示编辑是否结束 // BOOL值表示编辑是否结束
var textChange:((String?, Bool)->Void)? var textChange:((String?, Bool)->Void)?
var textInputCondtion:((inout String?)->Bool)?
var title:String? { var title:String? {
didSet { didSet {
...@@ -164,13 +164,25 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -164,13 +164,25 @@ class YHFormItemInputTextCell: UITableViewCell {
@objc func textFieldChanged(textField:UITextField) { @objc func textFieldChanged(textField:UITextField) {
if let textChange = textChange { if let textChange = textChange {
if let textInputCondtion = textInputCondtion {
if textInputCondtion(&textField.text) {
textChange(textField.text, false) textChange(textField.text, false)
} }
} else {
textChange(textField.text, false)
}
}
} }
@objc func textFieldEditEnd(textField:UITextField) { @objc func textFieldEditEnd(textField:UITextField) {
if let textChange = textChange { if let textChange = textChange {
if let textInputCondtion = textInputCondtion {
if textInputCondtion(&textField.text) {
textChange(textField.text, true) textChange(textField.text, true)
} }
} else {
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