Commit ece05fbb authored by pete谢兆麟's avatar pete谢兆麟

主申请人国家搜索优化 字段校验优化

parent ab4fbb8c
......@@ -138,7 +138,7 @@ extension YHSelectCountryViewController: UITableViewDelegate, UITableViewDataSou
let cell = tableView.dequeueReusableCell(withClass: YHCountryTableViewCell.self)
let cn = searchDataSource?[indexPath.row].name_cn ?? ""
let en = searchDataSource?[indexPath.row].name_en ?? ""
cell.titleLabel.text = cn + en
cell.titleLabel.text = cn + "-" + en
return cell
}
......@@ -149,7 +149,7 @@ extension YHSelectCountryViewController: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cn = searchDataSource?[indexPath.row].name_cn ?? ""
let en = searchDataSource?[indexPath.row].name_en ?? ""
let text = cn + en
let text = cn + "-" + en
if let backLocationStringController = backLocationStringController {
backLocationStringController(text)
self.navigationController?.popViewController()
......
......@@ -286,10 +286,12 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
}
func requestMainInformation(_ orderID: String, callBackBlock:@escaping (_ success: YHMainInformationModel?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.getInformation + "?order_id=\(orderID)"
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.getInformation
let param: [String: Any] = ["order_id": orderID]
// let strUrl = "http://192.168.25.48:18088/" + YHAllApiName.OrderInformation.getInformation + "?order_id=\(orderID)"
// let params: [String : Any] = ["order_id": orderID]
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
......@@ -479,20 +481,16 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let area = mainModel.address.area
let details = mainModel.address.details
let foreign = mainModel.address.foreign
let is_live_oversea_year = mainModel.is_live_oversea_year
let has_hk_id = mainModel.has_hk_id
let is_handled = mainModel.is_handled
guard nationality.count > 0 else { return false }
guard country.count > 0 else { return false }
if country.contains("中国") {
if nationality.count != 0 && country.count != 0 && area.count != 0 && details.count != 0 {
return true
} else {
return false
}
guard area.count > 0 else { return false }
guard details.count > 0 else { return false }
return true
} else {
if nationality.count != 0 && country.count != 0 && foreign.count != 0 {
return true
} else {
return false
}
guard foreign.count > 0 else { return false }
return true
}
} else if step == 1 {
return true
......@@ -511,27 +509,25 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let passport_issue_date_start_at = mainModel.certificates.passport.issue_date_start_at
let passport_issue_date_end_at = mainModel.certificates.passport.issue_date_end_at
let nationality = mainModel.nationality
if self.mainModel.is_handled == 1 {
guard hk_macao_pass_number.count > 0 else { return false }
guard hk_macao_pass_issue_at.count > 0 else { return false }
guard hk_macao_pass_issue_date_start_at.count > 0 else { return false }
guard hk_macao_pass_issue_date_end_at.count > 0 else { return false }
}
if nationality.contains("中国") {
if mainModel.has_hk_id == 1 {
if cn_identity_card_number.count != 0 && cn_identity_card_issue_at.count != 0 && cn_identity_card_issue_date_start_at.count != 0 && cn_identity_card_issue_date_end_at.count != 0 && hk_macao_pass_number.count != 0 && hk_macao_pass_issue_at.count != 0 && hk_macao_pass_issue_date_start_at.count != 0 && hk_macao_pass_issue_date_end_at.count != 0 {
return true
} else {
return false
}
} else {
if cn_identity_card_number.count != 0 && cn_identity_card_issue_at.count != 0 && cn_identity_card_issue_date_start_at.count != 0 && cn_identity_card_issue_date_end_at.count != 0 {
return true
} else {
return false
}
}
guard cn_identity_card_number.count > 0 else { return false }
guard cn_identity_card_issue_at.count > 0 else { return false }
guard cn_identity_card_issue_date_start_at.count > 0 else { return false }
guard cn_identity_card_issue_date_end_at.count > 0 else { return false }
} else {
if passport_type.count != 0 && passport_number.count != 0 && passport_issue_at.count != 0 && passport_issue_date_start_at.count != 0 && passport_issue_date_end_at.count != 0 {
return true
} else {
return false
}
guard passport_type.count > 0 else { return false }
guard passport_number.count > 0 else { return false }
guard passport_issue_at.count > 0 else { return false }
guard passport_issue_date_start_at.count > 0 else { return false }
guard passport_issue_date_end_at.count > 0 else { return false }
}
return true
} else {
let username = mainModel.username
let birthday = mainModel.birthday
......@@ -544,35 +540,20 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let email = mainModel.email
let has_hk_id = mainModel.has_hk_id
let hk_id_numbe = mainModel.hk_id_number
guard username.count > 0 else { return false }
guard birthday.count > 0 else { return false }
guard sex > 0 else { return false }
guard email.count > 0 else { return false }
guard mobile.count > 0 else { return false }
if birth_place_aboard == 1 {
if username.count != 0 && birthday.count != 0 && birth_place_foreign.count != 0 && mobile.count != 0 && email.count != 0 {
if has_hk_id == 1 {
if hk_id_numbe.isHKIdentityCardNumber() {
return true
} else {
return false
}
} else {
return true
}
} else {
return false
}
guard birth_place_foreign.count > 0 else { return false }
} else {
if username.count != 0 && birthday.count != 0 && birth_place_area.count != 0 && mobile.count != 0 && email.count != 0 {
if has_hk_id == 1 {
if hk_id_numbe.isHKIdentityCardNumber() {
return true
} else {
return false
}
} else {
return true
}
} else {
return false
}
guard birth_place_area.count > 0 else { return false }
}
if has_hk_id == 1 {
guard hk_id_numbe.count > 0 else { return false }
}
return true
}
}
}
......@@ -14,9 +14,9 @@ class YHSelectCountryViewModel: NSObject {
}
func requestCountry(_ key: String, callBackBlock:@escaping (_ success: [YHCountryMessage?]?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.countryInformation + "?keyword = \(key)"
YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.countryInformation
let param: [String: Any] = ["keyword": key]
let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
guard let self = self else { return }
let dic = json.data as? [Any]
guard let resultArray = [YHCountryMessage].deserialize(from: dic) else {
......
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