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 {
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
child?.step = item.step
stepView.maxIndex = cur+1
}
if cur+1 > stepView.maxIndex {
stepView.maxIndex = cur+1
} }
print("currentIndex:\(currentStep)")
}
}
......
......@@ -267,6 +267,14 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = detailItem.getTitle()
cell.text = detailItem.value
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 = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......
......@@ -246,7 +246,9 @@ extension YHSpouseInfoContainerVC {
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
spouse?.step = item.step
stepView.maxIndex = cur+1
if cur+1 > stepView.maxIndex {
stepView.maxIndex = cur+1
}
}
print("currentIndex:\(currentStep)")
}
......
......@@ -8,6 +8,7 @@
import UIKit
import SmartCodable
import SwifterSwift
class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
......@@ -232,6 +233,14 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder
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 = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......
......@@ -69,15 +69,17 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
guard let familyMember = familyMember else { return }
items.removeAll()
// 中国身份证 信息必有
// 中国身份证
let isChinaCardMust = familyMember.isChinese()
let title0 = YHFormTitleItem(type: .chinaIdCardInfo)
let item01 = YHFormDetailItem(type: .chinaIdentityCardNumber, value:familyMember.certificates.cnIdentityCard.number, tips: "请输入中国身份证号".local)
let item02 = YHFormDetailItem(type: .certificateSignPlace, value:familyMember.certificates.cnIdentityCard.issueAt, tips: "请输入签发地".local)
let item03 = YHFormDetailItem(type: .certificateSignDate, value:familyMember.certificates.cnIdentityCard.issueDateStartAt, tips: "请选择签发日期".local)
let item04 = YHFormDetailItem(type: .certificateValidDate, value:familyMember.certificates.cnIdentityCard.issueDateEndAt, tips: "请选择签发日期".local)
let item01 = YHFormDetailItem(type: .chinaIdentityCardNumber, isNeed:isChinaCardMust, value:familyMember.certificates.cnIdentityCard.number, tips: "请输入正确的中国身份证号".local)
let item02 = YHFormDetailItem(type: .certificateSignPlace, isNeed:isChinaCardMust, value:familyMember.certificates.cnIdentityCard.issueAt, tips: "请输入签发地".local)
let item03 = YHFormDetailItem(type: .certificateSignDate, isNeed:isChinaCardMust, value:familyMember.certificates.cnIdentityCard.issueDateStartAt, tips: "请选择签发日期".local)
let item04 = YHFormDetailItem(type: .certificateValidDate, isNeed:isChinaCardMust, value:familyMember.certificates.cnIdentityCard.issueDateEndAt, tips: "请选择签发日期".local)
let arr0:[YHFormItemProtocol] = [title0, item01, item02, item03, item04]
items.append(arr0)
// 港澳通行证 非必须
if familyMember.isNeedHandleHKPassPort() {
......@@ -91,6 +93,7 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
}
// 护照及其他旅行证件 信息必有
let isPassPortMust = !familyMember.isChinese()
let title2 = YHFormTitleItem(type: .passPortOrTravelInfo)
// 证件类别名称
......@@ -99,11 +102,11 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
if let item = YHSheetPickerView.getItem(type:.certificate, index:passPortType) {
value = item.title
}
let item20 = YHFormDetailItem(type: .certificateType, isNeed: false, value:value, tips:"请选择证件类别".local)
let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: false, value: familyMember.certificates.passport.number, tips: "请输入证件号码".local)
let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: false, value: familyMember.certificates.passport.issueAt, tips:"请输入签发地".local)
let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: false, value:familyMember.certificates.passport.issueDateStartAt, tips:"请选择签发日期".local)
let item24 = YHFormDetailItem(type: .certificateValidDate, isNeed: false, value:familyMember.certificates.passport.issueDateEndAt,tips:"请选择届满日期".local)
let item20 = YHFormDetailItem(type: .certificateType, isNeed: isPassPortMust, value:value, tips:"请选择证件类别".local)
let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: isPassPortMust, value: familyMember.certificates.passport.number, tips: "请输入证件号码".local)
let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: isPassPortMust, value: familyMember.certificates.passport.issueAt, tips:"请输入签发地".local)
let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: isPassPortMust, value:familyMember.certificates.passport.issueDateStartAt, 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]
items.append(arr2)
......@@ -150,7 +153,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......@@ -352,17 +354,20 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
func checkIntegrity() -> Bool {
guard let familyMember = familyMember else { return false}
// 验证身份证
if familyMember.certificates.cnIdentityCard.number.count <= 0
|| familyMember.certificates.cnIdentityCard.issueAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateStartAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateEndAt.count <= 0
{
return false
// 国籍为中国需验证身份证
if familyMember.isChinese() {
if familyMember.certificates.cnIdentityCard.number.count <= 0
|| familyMember.certificates.cnIdentityCard.issueAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateStartAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateEndAt.count <= 0
{
return false
}
}
// 如果选了办理过港澳通行证,则需要验证港澳通行证
if familyMember.isNeedHandleHKPassPort() {
// 如果选了办理过港澳通行证,则需要验证港澳通行证
if familyMember.certificates.hkMacaoPass.number.count <= 0
|| familyMember.certificates.hkMacaoPass.issueAt.count <= 0
|| familyMember.certificates.hkMacaoPass.issueDateStartAt.count <= 0
......@@ -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
}
......
......@@ -172,6 +172,13 @@ class YHFamilyMemberInfoVC: YHBaseViewController {
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
var parents = [YHFormItemProtocol]()
let item0 = YHFormTitleItem(type: .parent)
......@@ -188,17 +195,8 @@ class YHFamilyMemberInfoVC: YHBaseViewController {
mother.relationType = .mother
parents.append(mother)
}
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
var brotherArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .brother), YHFormAddItem(type: .addBrother)]
......
......@@ -970,6 +970,11 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
}
// 国籍是否是中国
func isChinese() -> Bool {
return nationality == "中国-China"
}
// 是否随行
func isFollow() -> Bool {
return follow == 1
......
......@@ -204,18 +204,6 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
func setTips(_ tips:String?, isShow:Bool) {
tipsLabel.text = tips
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 {
}
// BOOL值表示编辑是否结束
var textChange:((String?, Bool)->Void)?
var textInputCondtion:((inout String?)->Bool)?
var title:String? {
didSet {
......@@ -164,13 +164,25 @@ class YHFormItemInputTextCell: UITableViewCell {
@objc func textFieldChanged(textField:UITextField) {
if let textChange = textChange {
textChange(textField.text, false)
if let textInputCondtion = textInputCondtion {
if textInputCondtion(&textField.text) {
textChange(textField.text, false)
}
} else {
textChange(textField.text, false)
}
}
}
@objc func textFieldEditEnd(textField:UITextField) {
if let textChange = textChange {
textChange(textField.text, true)
if let textInputCondtion = textInputCondtion {
if textInputCondtion(&textField.text) {
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