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

判空提示

parent 83347472
...@@ -2158,7 +2158,7 @@ ...@@ -2158,7 +2158,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
...@@ -2184,7 +2184,7 @@ ...@@ -2184,7 +2184,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy; PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = com.adhoc.profile; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = dev.intelligenceGalaxy.profile;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
...@@ -2200,7 +2200,7 @@ ...@@ -2200,7 +2200,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
...@@ -2226,7 +2226,7 @@ ...@@ -2226,7 +2226,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy; PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = com.adhoc.profile; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = dev.intelligenceGalaxy.profile;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
......
...@@ -90,11 +90,23 @@ class YHMainApplicantInformationViewController: YHBaseViewController { ...@@ -90,11 +90,23 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
let bottom = YHBottomNextView() let bottom = YHBottomNextView()
bottom.nextblock = { [weak self] in bottom.nextblock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
if self.viewModel.isCanNext(self.stepView.currentIndex) {
self.stepView.currentIndex = self.stepView.currentIndex + 1 self.stepView.currentIndex = self.stepView.currentIndex + 1
self.viewModel.updateMainInformation(.submit) {[weak self] success in self.viewModel.updateMainInformation(.submit) {[weak self] success in
guard let self = self else { return } guard let self = self else { return }
self.isShowPrompt = false
self.stepView.currentIndex = self.stepView.currentIndex self.stepView.currentIndex = self.stepView.currentIndex
if self.stepView.currentIndex == self.stepView.dataSource?.count {
YHHUD.flash(message: "提交成功")
self.navigationController?.popViewController()
} else {
self.updateDataSource()
}
}
} else {
self.isShowPrompt = true
self.updateDataSource() self.updateDataSource()
YHHUD.flash(message: "请完善信息")
} }
} }
bottom.saveBlock = { [weak self] in bottom.saveBlock = { [weak self] in
...@@ -131,14 +143,16 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable ...@@ -131,14 +143,16 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
cell.informationBlock = {[weak self] model in cell.informationBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
self.viewModel.updateModel(model) self.viewModel.updateModel(model)
let id = model.id
if id != .id32 && id != .id4 && id != .id8 && id != .id9 && id != .id12 && id != .id13 && id != .id21 && id != .id22 && id != .id23 && id != .id34 && id != .id29 && id != .id30 && id != .id35 {
self.updateDataSource() self.updateDataSource()
} }
}
return cell return cell
} }
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let count = dataSource?[indexPath.row].models?.count ?? 0
if stepView.currentIndex == 1 { if stepView.currentIndex == 1 {
return 217.0 return 217.0
} else { } else {
...@@ -146,15 +160,23 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable ...@@ -146,15 +160,23 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
var h = 0 var h = 0
for i in 0..<array.count { for i in 0..<array.count {
let data = array[i] let data = array[i]
if data.id == .id3 || data.id == .id4 || data.id == .id18 { let isShow = data.isShowPrompts ?? false
h = h + 132 let message = data.message ?? ""
} else if data.id == .id13 { if data.id == .id3 || data.id == .id4 || data.id == .id32 || data.id == .id33 {
if isShow && message.count == 0 {
h = h + 72 + 20
} else {
h = h + 72 h = h + 72
}
} else {
if isShow && message.count == 0 {
h = h + 52 + 20
} else { } else {
h = h + 52 h = h + 52
} }
} }
return CGFloat(count * 52 + 52 + 14) }
return CGFloat(h + 52 + 14)
} }
} }
} }
...@@ -54,7 +54,7 @@ enum YHItemID: Int { ...@@ -54,7 +54,7 @@ enum YHItemID: Int {
case id32 = 31 // 现居住地址 海外地址 case id32 = 31 // 现居住地址 海外地址
case id33 = 32 // 是否海外居住一年以上 case id33 = 32 // 是否海外居住一年以上
case id34 = 33 // 主申请人信息 出生城市国外 case id34 = 33 // 主申请人信息 出生城市国外
case id35 = 34 // 香港ID号码
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
import UIKit import UIKit
import Alamofire
class YHImagePickerView: UIView { class YHImagePickerView: UIView {
var backImage: ((UIImage) -> Void)? var backImage: ((UIImage) -> Void)?
...@@ -27,6 +28,13 @@ class YHImagePickerView: UIView { ...@@ -27,6 +28,13 @@ class YHImagePickerView: UIView {
var cannalButton: UIButton! var cannalButton: UIButton!
var lineView: UIView! var lineView: UIView!
static func show(callBack: @escaping ((UIImage) -> Void)) {
let view = YHImagePickerView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.backImage = callBack
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1) backgroundColor = UIColor(white: 0.5, alpha: 0.1)
...@@ -199,9 +207,35 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro ...@@ -199,9 +207,35 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage { if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
// 将图片显示给UIImageView // 将图片显示给UIImageView
if let block = backImage { // if let block = backImage {
block(image) // block(image)
self.dismiss() // self.dismiss()
// }
//将选择的图片保存到Document目录下
let fileManager = FileManager.default
let rootPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,
.userDomainMask, true)[0] as String
let filePath = "\(rootPath)/pickedimage.jpg"
let imageData = image.jpegData(compressionQuality: 1.0)
fileManager.createFile(atPath: filePath, contents: imageData, attributes: nil)
//上传图片
if (fileManager.fileExists(atPath: filePath)){
//取得NSURL
let imageURL = URL(fileURLWithPath: filePath)
//使用Alamofire上传
AF.upload(imageURL, to: "https://test-comserver.galaxy-immi.com/oss/upload/storage")
.responseString { response in
switch response.result {
case .success(let value):
print("Success: \(value)")
case .failure(let error): break
}
}
} }
} else { } else {
printLog("pick image wrong") printLog("pick image wrong")
...@@ -215,3 +249,4 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro ...@@ -215,3 +249,4 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
} }
} }
...@@ -189,6 +189,7 @@ class YHItemView: UIView { ...@@ -189,6 +189,7 @@ class YHItemView: UIView {
} else { } else {
buttonState(isLeft: true) buttonState(isLeft: true)
} }
} else { } else {
leftButton.isHidden = true leftButton.isHidden = true
} }
...@@ -204,9 +205,9 @@ class YHItemView: UIView { ...@@ -204,9 +205,9 @@ class YHItemView: UIView {
if dataSource.isShowPrompts ?? false { if dataSource.isShowPrompts ?? false {
if dataSource.message?.count != 0 { if dataSource.message?.count != 0 {
showPromptLabel.isHidden = false
} else {
showPromptLabel.isHidden = true showPromptLabel.isHidden = true
} else {
showPromptLabel.isHidden = false
} }
} else { } else {
showPromptLabel.isHidden = true showPromptLabel.isHidden = true
...@@ -368,6 +369,9 @@ extension YHItemView: UITextFieldDelegate { ...@@ -368,6 +369,9 @@ extension YHItemView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string) let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
dataSource?.message = newText dataSource?.message = newText
if let block = block {
block(dataSource ?? YHItemModel())
}
return true return true
} }
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
import UIKit import UIKit
import Alamofire
enum YHCardType: Int { enum YHCardType: Int {
case identity = 0 case identity = 0
...@@ -147,7 +148,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -147,7 +148,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
backSurfaceLabel = { backSurfaceLabel = {
let label = UILabel() let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12) label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.contentBkgColor label.textColor = UIColor.subTextColor
label.textAlignment = .center label.textAlignment = .center
return label return label
}() }()
...@@ -162,7 +163,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -162,7 +163,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
frontImageButton = { frontImageButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_front"), for: .normal) button.setBackgroundImage(UIImage(named: "service_card_front"), for: .normal)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside) button.addTarget(self, action: #selector(frontImageClick), for: .touchUpInside)
return button return button
}() }()
centerView.addSubview(frontImageButton) centerView.addSubview(frontImageButton)
...@@ -176,7 +177,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -176,7 +177,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
backSurfaceImageButton = { backSurfaceImageButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_back"), for: .normal) button.setBackgroundImage(UIImage(named: "service_card_back"), for: .normal)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside) button.addTarget(self, action: #selector(backSurfaceImageClick), for: .touchUpInside)
return button return button
}() }()
centerView.addSubview(backSurfaceImageButton) centerView.addSubview(backSurfaceImageButton)
...@@ -195,9 +196,23 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -195,9 +196,23 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
window?.addSubview(view) window?.addSubview(view)
} }
@objc func frontImageClick() {
YHImagePickerView.show() { image in
}
}
@objc func backSurfaceImageClick() {
YHImagePickerView.show() { image in
}
}
func updataData() { func updataData() {
titleLabel.text = "中国身份证(选填)" titleLabel.text = "中国身份证(选填)"
frontLabel.text = "身份证人像面" frontLabel.text = "身份证人像面"
backSurfaceLabel.text = "身份证国徽面" backSurfaceLabel.text = "身份证国徽面"
} }
} }
...@@ -89,18 +89,38 @@ class YHMainInformationTableViewCell: UITableViewCell { ...@@ -89,18 +89,38 @@ class YHMainInformationTableViewCell: UITableViewCell {
func updateAllViews() { func updateAllViews() {
titleLabel.text = dataSource?.title titleLabel.text = dataSource?.title
mainItemView.removeSubviews() mainItemView.removeSubviews()
var y = 0
for i in 0 ..< (dataSource?.models?.count ?? 0) { for i in 0 ..< (dataSource?.models?.count ?? 0) {
let line = UIView() let line = UIView()
line.backgroundColor = UIColor.separatorColor line.backgroundColor = UIColor.separatorColor
mainItemView.addSubview(line) mainItemView.addSubview(line)
line.snp.makeConstraints { make in line.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.top.equalTo(52 * i) make.top.equalTo(y)
make.height.equalTo(1) make.height.equalTo(1)
make.right.equalTo(-18) make.right.equalTo(-18)
} }
y = y + 1
var h = 51
let data = dataSource?.models?[i] ?? YHItemModel()
let isShow = data.isShowPrompts ?? false
let message = data.message ?? ""
if data.id == .id3 || data.id == .id4 || data.id == .id32 || data.id == .id33 {
if isShow && message.count == 0 {
h = 71 + 20
} else {
h = 71
}
} else {
if isShow && message.count == 0 {
h = 51 + 20
} else {
h = 51
}
}
let itemView = YHItemView() let itemView = YHItemView()
itemView.dataSource = dataSource?.models?[i] itemView.dataSource = data
itemView.block = {[weak self] model in itemView.block = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
if let block = self.informationBlock { if let block = self.informationBlock {
...@@ -110,10 +130,11 @@ class YHMainInformationTableViewCell: UITableViewCell { ...@@ -110,10 +130,11 @@ class YHMainInformationTableViewCell: UITableViewCell {
mainItemView.addSubview(itemView) mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in itemView.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.top.equalTo(52 * i + 1) make.top.equalTo(y)
make.height.equalTo(51) make.height.equalTo(h)
make.right.equalTo(-18) make.right.equalTo(-18)
} }
y = y + h
} }
} }
} }
...@@ -13,7 +13,6 @@ enum YHSaveType: Int { ...@@ -13,7 +13,6 @@ enum YHSaveType: Int {
case submit = 1 case submit = 1
} }
class YHMainApplicantInformationViewModel: YHBaseViewModel { class YHMainApplicantInformationViewModel: YHBaseViewModel {
var mainModel: YHMainInformationModel = YHMainInformationModel() var mainModel: YHMainInformationModel = YHMainInformationModel()
...@@ -35,7 +34,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -35,7 +34,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let item1 = YHItemModel(id: .id3, isNeed: true, title: "省市地区", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt) let item1 = YHItemModel(id: .id3, isNeed: true, title: "省市地区", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt)
let item2 = YHItemModel(id: .id4, isNeed: true, title: "详细地址", isUserKeyBoard: true, prompts: "请填写小区、楼栋、单元室等", message: mainModel.address?.details, isShowPrompts: isShowPrompt) let item2 = YHItemModel(id: .id4, isNeed: true, title: "详细地址", isUserKeyBoard: true, prompts: "请填写小区、楼栋、单元室等", message: mainModel.address?.details, isShowPrompts: isShowPrompt)
let item11 = YHItemModel(id: .id32, isNeed: true, title: "详细地址", isUserKeyBoard: true, prompts: "请选择", message: mainModel.address?.foreign, isShowPrompts: isShowPrompt) let item11 = YHItemModel(id: .id32, isNeed: true, title: "详细地址", isUserKeyBoard: true, prompts: "请输入", message: mainModel.address?.foreign, isShowPrompts: isShowPrompt)
let item22 = YHItemModel(id: .id33, isNeed: true, title: "是否在海外居住一年及以上", isUserKeyBoard: false, prompts: "", message: "\(mainModel.is_live_oversea_year ?? 0)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt) let item22 = YHItemModel(id: .id33, isNeed: true, title: "是否在海外居住一年及以上", isUserKeyBoard: false, prompts: "", message: "\(mainModel.is_live_oversea_year ?? 0)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt)
let section1 = YHSectionItemModel(title: "现居住地址", models: [item4, item1, item2]) let section1 = YHSectionItemModel(title: "现居住地址", models: [item4, item1, item2])
let section11 = YHSectionItemModel(title: "现居住地址", models: [item4, item11, item22]) let section11 = YHSectionItemModel(title: "现居住地址", models: [item4, item11, item22])
...@@ -50,10 +49,15 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -50,10 +49,15 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
} }
func getDocumentInformation(_ isShowPrompt: Bool) -> [YHSectionItemModel] { func getDocumentInformation(_ isShowPrompt: Bool) -> [YHSectionItemModel] {
let item = YHItemModel(id: .id8, isNeed: true, title: "身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.cn_identity_card?.number, isShowPrompts: isShowPrompt) var flag = false
let item1 = YHItemModel(id: .id9, isNeed: true, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.cn_identity_card?.issue_at, isShowPrompts: isShowPrompt) let nationality = mainModel.nationality ?? ""
let item2 = YHItemModel(id: .id10, isNeed: true, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.cn_identity_card?.issue_date_start_at, type: .time, isShowPrompts: isShowPrompt) if nationality.contains("中国") {
let item3 = YHItemModel(id: .id11, isNeed: true, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.cn_identity_card?.issue_date_end_at, type: .time, isShowPrompts: isShowPrompt) flag = true
}
let item = YHItemModel(id: .id8, isNeed: flag, title: "身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.cn_identity_card?.number, isShowPrompts: isShowPrompt)
let item1 = YHItemModel(id: .id9, isNeed: flag, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.cn_identity_card?.issue_at, isShowPrompts: isShowPrompt)
let item2 = YHItemModel(id: .id10, isNeed: flag, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.cn_identity_card?.issue_date_start_at, type: .time, isShowPrompts: isShowPrompt)
let item3 = YHItemModel(id: .id11, isNeed: flag, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.cn_identity_card?.issue_date_end_at, type: .time, isShowPrompts: isShowPrompt)
let section = YHSectionItemModel(title: "中国身份证", models: [item, item1, item2, item3]) let section = YHSectionItemModel(title: "中国身份证", models: [item, item1, item2, item3])
let item10 = YHItemModel(id: .id12, isNeed: true, title: "身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.hk_macao_pass?.number, isShowPrompts: isShowPrompt) let item10 = YHItemModel(id: .id12, isNeed: true, title: "身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.hk_macao_pass?.number, isShowPrompts: isShowPrompt)
...@@ -80,7 +84,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -80,7 +84,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let item1 = YHItemModel(id: .id22, isNeed: false, title: "曾用名", isUserKeyBoard: true, prompts: "请与户口本一致,若无则不填", message: mainModel.used_name, isShowPrompts: isShowPrompt) let item1 = YHItemModel(id: .id22, isNeed: false, title: "曾用名", isUserKeyBoard: true, prompts: "请与户口本一致,若无则不填", message: mainModel.used_name, isShowPrompts: isShowPrompt)
let item2 = YHItemModel(id: .id23, isNeed: false, title: "婚前姓氏", isUserKeyBoard: true, prompts: "如有则填写,仅支持输入字母", message: mainModel.surname, isShowPrompts: isShowPrompt) let item2 = YHItemModel(id: .id23, isNeed: false, title: "婚前姓氏", isUserKeyBoard: true, prompts: "如有则填写,仅支持输入字母", message: mainModel.surname, isShowPrompts: isShowPrompt)
let item3 = YHItemModel(id: .id24, isNeed: true, title: "出生日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.birthday, type: .time, isShowPrompts: isShowPrompt) let item3 = YHItemModel(id: .id24, isNeed: true, title: "出生日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.birthday, type: .time, isShowPrompts: isShowPrompt)
let item4 = YHItemModel(id: .id25, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.birth_place_aboard ?? 0)", leftButtonString: "国内", rightButtonString: "国外", isShowPrompts: isShowPrompt) let item4 = YHItemModel(id: .id25, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.birth_place_aboard ?? 0)", leftButtonString: "国外", rightButtonString: "国内", isShowPrompts: isShowPrompt)
var string = "" var string = ""
if let array = mainModel.birth_place?.area { if let array = mainModel.birth_place?.area {
for item in array { for item in array {
...@@ -88,7 +92,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -88,7 +92,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
} }
} }
let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt) let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt)
let item55 = YHItemModel(id: .id34, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请选择", message: mainModel.birth_place?.foreign, isShowPrompts: isShowPrompt) let item55 = YHItemModel(id: .id34, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.birth_place?.foreign, isShowPrompts: isShowPrompt)
let item6 = YHItemModel(id: .id27, isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: mainModel.sex, type: .sex) let item6 = YHItemModel(id: .id27, isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: mainModel.sex, type: .sex)
let item7 = YHItemModel(id: .id28, isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: mainModel.married, type: .marry, isShowPrompts: isShowPrompt) let item7 = YHItemModel(id: .id28, isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: mainModel.married, type: .marry, isShowPrompts: isShowPrompt)
var item555 = item5 var item555 = item5
...@@ -102,7 +106,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -102,7 +106,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let section1 = YHSectionItemModel(title: "联系方式", models: [item8, item9]) let section1 = YHSectionItemModel(title: "联系方式", models: [item8, item9])
let item10 = YHItemModel(id: .id31, isNeed: true, title: "是否办理过", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.has_hk_id ?? 0)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt) let item10 = YHItemModel(id: .id31, isNeed: true, title: "是否办理过", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.has_hk_id ?? 0)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt)
let item11 = YHItemModel(id: .id29, isNeed: true, title: "香港身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.hk_id_number, isShowPrompts: isShowPrompt) let item11 = YHItemModel(id: .id35, isNeed: true, title: "香港身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.hk_id_number, isShowPrompts: isShowPrompt)
let section2 = YHSectionItemModel(title: "香港身份证", models: [item10]) let section2 = YHSectionItemModel(title: "香港身份证", models: [item10])
let section22 = YHSectionItemModel(title: "香港身份证", models: [item10, item11]) let section22 = YHSectionItemModel(title: "香港身份证", models: [item10, item11])
var section222 = section2 var section222 = section2
...@@ -196,6 +200,8 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -196,6 +200,8 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
mainModel.is_live_oversea_year = item.value?.first?.int mainModel.is_live_oversea_year = item.value?.first?.int
case .id34: case .id34:
mainModel.birth_place?.foreign = item.message mainModel.birth_place?.foreign = item.message
case .id35:
mainModel.hk_id_number = item.message
} }
} }
...@@ -295,4 +301,94 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -295,4 +301,94 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
callBackBlock(false) callBackBlock(false)
} }
} }
func isCanNext(_ step: Int) -> Bool {
if step == 0 {
let nationality = mainModel.nationality ?? ""
let country = mainModel.address?.country ?? ""
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 ?? 0
let has_hk_id = mainModel.has_hk_id ?? 0
if country.contains("中国") {
if nationality.count != 0 && country.count != 0 && area.count != 0 && details.count != 0 {
return true
} else {
return false
}
} else {
if nationality.count != 0 && country.count != 0 && foreign.count != 0 {
return true
} else {
return false
}
}
} else if step == 1 {
return true
} else if step == 2 {
let cn_identity_card_number = mainModel.certificates?.cn_identity_card?.number ?? ""
let cn_identity_card_issue_at = mainModel.certificates?.cn_identity_card?.issue_at ?? ""
let cn_identity_card_issue_date_start_at = mainModel.certificates?.cn_identity_card?.issue_date_start_at ?? ""
let cn_identity_card_issue_date_end_at = mainModel.certificates?.cn_identity_card?.issue_date_end_at ?? ""
let hk_macao_pass_number = mainModel.certificates?.hk_macao_pass?.number ?? ""
let hk_macao_pass_issue_at = mainModel.certificates?.hk_macao_pass?.issue_at ?? ""
let hk_macao_pass_issue_date_start_at = mainModel.certificates?.hk_macao_pass?.issue_date_start_at ?? ""
let hk_macao_pass_issue_date_end_at = mainModel.certificates?.hk_macao_pass?.issue_date_end_at ?? ""
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
}
}
} else {
let username = mainModel.username ?? ""
let birthday = mainModel.birthday ?? ""
let birth_place_aboard = mainModel.birth_place_aboard ?? 0
let birth_place_area = mainModel.birth_place?.area ?? []
let birth_place_foreign = mainModel.birth_place?.foreign ?? ""
let sex = mainModel.sex ?? ""
let married = mainModel.married ?? ""
let mobile = mainModel.mobile ?? ""
let email = mainModel.email ?? ""
let has_hk_id = mainModel.has_hk_id ?? 0
let hk_id_numbe = mainModel.hk_id_number ?? ""
if birth_place_aboard == 1 {
if username.count != 0 && birthday.count != 0 && birth_place_foreign.count != 0 && sex.count != 0 && married.count != 0 && mobile.count != 0 && email.count != 0 {
if has_hk_id == 1 {
if hk_id_numbe.count != 0 {
return true
} else {
return false
}
} else {
return true
}
} else {
return false
}
} else {
if username.count != 0 && birthday.count != 0 && birth_place_area.count != 0 && sex.count != 0 && married.count != 0 && mobile.count != 0 && email.count != 0 {
if has_hk_id == 1 {
if hk_id_numbe.count != 0 {
return true
} else {
return false
}
} else {
return true
}
} else {
return false
}
}
}
}
} }
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