Commit a876489f 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 7ea30b89 addfd7c5
......@@ -210,6 +210,24 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textInputCondtion = {
textField in
var max = -1
if detailItem.type == .educationMajor ||
detailItem.type == .educationCity {
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......
......@@ -184,6 +184,24 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textInputCondtion = {
textField in
var max = -1
if detailItem.type == .conferAgencyFullName ||
detailItem.type == .conferCity {
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......
......@@ -98,6 +98,9 @@ class YHCollegeSearchBar: UIView {
}
@objc func textFieldChanged(textField:UITextField) {
let text = textField.text ?? ""
let max = 100
textField.text = (text.count > max ? text[safe: ..<max] : text)
if let textChange = textChange {
textChange(textField.text)
}
......
......@@ -154,7 +154,12 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isNeed && detailItem.isShowTips)
if detailItem.type == .chinaIdentityCardNumber {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isNeed && detailItem.value?.count != 18)
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isNeed && detailItem.isShowTips)
}
cell.textInputCondtion = {
textField in
......@@ -162,7 +167,7 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
if detailItem.type == .chinaIdentityCardNumber { // 身份证
max = 18
} else if detailItem.type == .certificateSignPlace { // 签发地
max = 100
max = 50
} else if detailItem.type == .traverlPassportNumber ||
detailItem.type == .certificateNumber {
max = 50
......@@ -379,7 +384,7 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
let isChinaCardMust = familyMember.isChinese() && familyMember.relationType != .child
if isChinaCardMust {
if familyMember.certificates.cnIdentityCard.number.count <= 0
if familyMember.certificates.cnIdentityCard.number.count != 18
|| familyMember.certificates.cnIdentityCard.issueAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateStartAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateEndAt.count <= 0
......
......@@ -265,11 +265,18 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
if detailItem.type == .befourMarryFirstName {
cell.textField.keyboardType = .asciiCapable // 英文键盘
} else {
cell.textField.keyboardType = .default
}
cell.textInputCondtion = {
textField in
if detailItem.type == .befourMarryFirstName { // 仅支持输入最多30个大写字母
let regex = "[^A-Z]+"
let regex = "[^A-Za-z]+"
textField.limitInputWithPattern(pattern:regex, 30)
return true
}
......@@ -302,7 +309,10 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
self.child?.usedName = text ?? ""
} else if detailItem.type == .befourMarryFirstName {
self.child?.surname = text ?? ""
let tt = text?.uppercased()
self.child?.surname = tt ?? ""
cell.textField.text = tt
} else if detailItem.type == .birthCity {
self.child?.birthPlace.foreign = text ?? ""
......
......@@ -391,11 +391,18 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
if detailItem.type == .befourMarryFirstName {
cell.textField.keyboardType = .asciiCapable // 英文键盘
} else {
cell.textField.keyboardType = .default
}
cell.textInputCondtion = {
textField in
if detailItem.type == .befourMarryFirstName { // 仅支持输入最多30个大写字母
let regex = "[^A-Z]+"
let regex = "[^A-Za-z]+"
textField.limitInputWithPattern(pattern:regex, 30)
return true
}
......@@ -425,7 +432,12 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .everName {
self.spouse?.usedName = text ?? ""
} else if detailItem.type == .befourMarryFirstName {
self.spouse?.surname = text ?? ""
let tt = text?.uppercased()
self.spouse?.surname = tt ?? ""
cell.textField.text = tt
} else if detailItem.type == .birthCity {
self.spouse?.birthPlace.foreign = text ?? ""
} else if detailItem.type == .occupationName {
......
......@@ -306,7 +306,7 @@ extension YHFamilyMemberInfoListVC {
if let errMsg = error?.errorMsg, errMsg.count > 0 {
errorMsg = errMsg
}
YHHUD.flash(message: errorMsg)
YHHUD.flash(message: errorMsg, duration:3)
}
}
}
......
......@@ -69,7 +69,7 @@ class YHFormItemInputTextCell: UITableViewCell {
return label
}()
private lazy var textField:UITextField = {
lazy var textField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.placeholder = "请输入"
......
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