Commit 5fac66f3 authored by David黄金龙's avatar David黄金龙

Merge commit '70009ba4' into davidhuang

* commit '70009ba4':
  字段校验
  家庭信息
  省市区改成省市
parents 4fbdcb28 70009ba4
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
04010B952B6A1DE90093F3BB /* YHSaveAndSubmitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */; }; 04010B952B6A1DE90093F3BB /* YHSaveAndSubmitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */; };
040ED45F2B91711A005CA3F8 /* YHCNIDCardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040ED45E2B91711A005CA3F8 /* YHCNIDCardModel.swift */; }; 040ED45F2B91711A005CA3F8 /* YHCNIDCardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040ED45E2B91711A005CA3F8 /* YHCNIDCardModel.swift */; };
040ED4612B9173DE005CA3F8 /* YHHKIDCardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040ED4602B9173DE005CA3F8 /* YHHKIDCardModel.swift */; }; 040ED4612B9173DE005CA3F8 /* YHHKIDCardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040ED4602B9173DE005CA3F8 /* YHHKIDCardModel.swift */; };
040ED4632B91BC33005CA3F8 /* area.plist in Resources */ = {isa = PBXBuildFile; fileRef = 040ED4622B91BC33005CA3F8 /* area.plist */; };
0413A6D82B8C76290006D154 /* YHCertificateUploadVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */; }; 0413A6D82B8C76290006D154 /* YHCertificateUploadVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */; };
041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52862B5657B3007EBCEB /* IMAppKey.swift */; }; 041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52862B5657B3007EBCEB /* IMAppKey.swift */; };
041B528D2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */; }; 041B528D2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */; };
...@@ -65,7 +66,6 @@ ...@@ -65,7 +66,6 @@
0468D4512B67721700CFB916 /* YHMainInformationCardTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4502B67721700CFB916 /* YHMainInformationCardTableViewCell.swift */; }; 0468D4512B67721700CFB916 /* YHMainInformationCardTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4502B67721700CFB916 /* YHMainInformationCardTableViewCell.swift */; };
0468D4532B6782BE00CFB916 /* YHCardExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4522B6782BE00CFB916 /* YHCardExampleView.swift */; }; 0468D4532B6782BE00CFB916 /* YHCardExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4522B6782BE00CFB916 /* YHCardExampleView.swift */; };
0468D4552B6889A500CFB916 /* YHDatePickView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4542B6889A500CFB916 /* YHDatePickView.swift */; }; 0468D4552B6889A500CFB916 /* YHDatePickView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4542B6889A500CFB916 /* YHDatePickView.swift */; };
0468D4772B68A08600CFB916 /* area.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0468D4712B68A08600CFB916 /* area.plist */; };
0468D4782B68A08600CFB916 /* YHAddressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4722B68A08600CFB916 /* YHAddressModel.swift */; }; 0468D4782B68A08600CFB916 /* YHAddressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4722B68A08600CFB916 /* YHAddressModel.swift */; };
0468D4792B68A08600CFB916 /* YHAddressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4732B68A08600CFB916 /* YHAddressViewController.swift */; }; 0468D4792B68A08600CFB916 /* YHAddressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4732B68A08600CFB916 /* YHAddressViewController.swift */; };
0468D47A2B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4742B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift */; }; 0468D47A2B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4742B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift */; };
...@@ -309,6 +309,7 @@ ...@@ -309,6 +309,7 @@
04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSaveAndSubmitView.swift; sourceTree = "<group>"; }; 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSaveAndSubmitView.swift; sourceTree = "<group>"; };
040ED45E2B91711A005CA3F8 /* YHCNIDCardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCNIDCardModel.swift; sourceTree = "<group>"; }; 040ED45E2B91711A005CA3F8 /* YHCNIDCardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCNIDCardModel.swift; sourceTree = "<group>"; };
040ED4602B9173DE005CA3F8 /* YHHKIDCardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKIDCardModel.swift; sourceTree = "<group>"; }; 040ED4602B9173DE005CA3F8 /* YHHKIDCardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKIDCardModel.swift; sourceTree = "<group>"; };
040ED4622B91BC33005CA3F8 /* area.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = area.plist; sourceTree = "<group>"; };
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadVC.swift; sourceTree = "<group>"; }; 0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadVC.swift; sourceTree = "<group>"; };
041B52862B5657B3007EBCEB /* IMAppKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMAppKey.swift; sourceTree = "<group>"; }; 041B52862B5657B3007EBCEB /* IMAppKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMAppKey.swift; sourceTree = "<group>"; };
041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDoubleChoiceCell.swift; sourceTree = "<group>"; }; 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDoubleChoiceCell.swift; sourceTree = "<group>"; };
...@@ -364,7 +365,6 @@ ...@@ -364,7 +365,6 @@
0468D4502B67721700CFB916 /* YHMainInformationCardTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMainInformationCardTableViewCell.swift; sourceTree = "<group>"; }; 0468D4502B67721700CFB916 /* YHMainInformationCardTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMainInformationCardTableViewCell.swift; sourceTree = "<group>"; };
0468D4522B6782BE00CFB916 /* YHCardExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCardExampleView.swift; sourceTree = "<group>"; }; 0468D4522B6782BE00CFB916 /* YHCardExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCardExampleView.swift; sourceTree = "<group>"; };
0468D4542B6889A500CFB916 /* YHDatePickView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDatePickView.swift; sourceTree = "<group>"; }; 0468D4542B6889A500CFB916 /* YHDatePickView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDatePickView.swift; sourceTree = "<group>"; };
0468D4712B68A08600CFB916 /* area.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = area.plist; sourceTree = "<group>"; };
0468D4722B68A08600CFB916 /* YHAddressModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressModel.swift; sourceTree = "<group>"; }; 0468D4722B68A08600CFB916 /* YHAddressModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressModel.swift; sourceTree = "<group>"; };
0468D4732B68A08600CFB916 /* YHAddressViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressViewController.swift; sourceTree = "<group>"; }; 0468D4732B68A08600CFB916 /* YHAddressViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressViewController.swift; sourceTree = "<group>"; };
0468D4742B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressPickViewTableViewCell.swift; sourceTree = "<group>"; }; 0468D4742B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressPickViewTableViewCell.swift; sourceTree = "<group>"; };
...@@ -771,7 +771,7 @@ ...@@ -771,7 +771,7 @@
0468D4702B68A08600CFB916 /* YHAddressPicker */ = { 0468D4702B68A08600CFB916 /* YHAddressPicker */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0468D4712B68A08600CFB916 /* area.plist */, 040ED4622B91BC33005CA3F8 /* area.plist */,
0468D4722B68A08600CFB916 /* YHAddressModel.swift */, 0468D4722B68A08600CFB916 /* YHAddressModel.swift */,
0468D4732B68A08600CFB916 /* YHAddressViewController.swift */, 0468D4732B68A08600CFB916 /* YHAddressViewController.swift */,
0468D4742B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift */, 0468D4742B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift */,
...@@ -1681,7 +1681,7 @@ ...@@ -1681,7 +1681,7 @@
A5C5B2EE2B4F9B8800A7C5D1 /* Localizable.xcstrings in Resources */, A5C5B2EE2B4F9B8800A7C5D1 /* Localizable.xcstrings in Resources */,
042F88952B84AFC7008B60BD /* YHQuestionList.plist in Resources */, 042F88952B84AFC7008B60BD /* YHQuestionList.plist in Resources */,
A58951C52B398D1000225C19 /* Launch Screen.storyboard in Resources */, A58951C52B398D1000225C19 /* Launch Screen.storyboard in Resources */,
0468D4772B68A08600CFB916 /* area.plist in Resources */, 040ED4632B91BC33005CA3F8 /* area.plist in Resources */,
A51044182B493675006B60BB /* README.md in Resources */, A51044182B493675006B60BB /* README.md in Resources */,
A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */, A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */,
); );
......
...@@ -137,6 +137,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -137,6 +137,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
guard let self = self else { return } guard let self = self else { return }
if let targetStep = getStepForArrayIndex(index) { if let targetStep = getStepForArrayIndex(index) {
currentStep = targetStep currentStep = targetStep
child.step = targetStep
} }
print("index:\(index)") print("index:\(index)")
} }
......
...@@ -66,7 +66,9 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -66,7 +66,9 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}() }()
var bottomView: YHSaveAndSubmitView = { var bottomView: YHSaveAndSubmitView = {
return YHSaveAndSubmitView.createView() let view = YHSaveAndSubmitView.createView()
view.changeRightBtnTitle("下一步")
return view
}() }()
let primaryInfoVC = YHSpousePrimaryInfoVC() let primaryInfoVC = YHSpousePrimaryInfoVC()
......
...@@ -249,7 +249,7 @@ extension YHFamilyMemberInfoVC { ...@@ -249,7 +249,7 @@ extension YHFamilyMemberInfoVC {
// 添加兄弟姐妹子女 // 添加兄弟姐妹子女
func addFamilyMember(_ type:YHFamilyMemberType) { func addFamilyMember(_ type:YHFamilyMemberType) {
let dict:[String: Any] = ["orderId":self.orderId, let dict:[String: Any] = ["order_id":self.orderId,
"relation":String(type.rawValue), "relation":String(type.rawValue),
"step":0, "step":0,
"next":false, "next":false,
...@@ -543,6 +543,7 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -543,6 +543,7 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.relationType == .father || detailItem.relationType == .mother { if detailItem.relationType == .father || detailItem.relationType == .mother {
let vc = YHParentInfoVC() let vc = YHParentInfoVC()
vc.parentInfo = detailItem vc.parentInfo = detailItem
vc.orderId = orderId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
return return
} }
......
...@@ -11,6 +11,7 @@ import UIKit ...@@ -11,6 +11,7 @@ import UIKit
class YHParentInfoVC: YHBaseViewController { class YHParentInfoVC: YHBaseViewController {
var parentInfo: YHFamilyMember? var parentInfo: YHFamilyMember?
var orderId: Int = 0
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]() var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel() let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
// 是否显示未填写错误提示 // 是否显示未填写错误提示
...@@ -581,29 +582,27 @@ extension YHParentInfoVC { ...@@ -581,29 +582,27 @@ extension YHParentInfoVC {
func submitInfo() { func submitInfo() {
let isChecked = checkIntegrity() // let isChecked = checkIntegrity()
isNeedShowError = !isChecked // isNeedShowError = !isChecked
//
self.tableView .reloadData() // self.tableView .reloadData()
//
if !isChecked { // if !isChecked {
YHHUD.flash(message: "资料还未填完") // YHHUD.flash(message: "资料还未填完")
return // return
} // }
guard let parentInfo = parentInfo else { return } guard let parentInfo = parentInfo else { return }
guard let info = parentInfo.toDictionary() else { return } guard let info = parentInfo.toDictionary() else { return }
let dict:[String: Any] = ["orderId":parentInfo.orderId, let dict:[String: Any] = ["order_id":orderId,
"relation":parentInfo.relationType.rawValue, "relation":parentInfo.relation,
"step":parentInfo.step, "step":parentInfo.step,
"next":false, "next":false,
"info":info] "info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in
if success { YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
} }
} }
......
...@@ -157,7 +157,7 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -157,7 +157,7 @@ class YHFormItemSelectSheetCell: UITableViewCell {
arrowImgView.snp.makeConstraints { make in arrowImgView.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(20, 20)) make.size.equalTo(CGSizeMake(20, 20))
make.right.equalToSuperview().offset(-horizonalGap) make.right.equalToSuperview().offset(-horizonalGap)
make.centerY.equalTo(detailLabel) make.top.equalTo(titleLabel)
} }
topLine.snp.makeConstraints { make in topLine.snp.makeConstraints { make in
......
...@@ -140,6 +140,10 @@ class YHSaveAndSubmitView: UIView { ...@@ -140,6 +140,10 @@ class YHSaveAndSubmitView: UIView {
} }
} }
func changeRightBtnTitle(_ title:String?) {
submitBtn.setTitle(title, for: .normal)
}
@objc func didClickSubmitBtn() { @objc func didClickSubmitBtn() {
if let submitBlock = submitBlock { if let submitBlock = submitBlock {
submitBlock() submitBlock()
......
...@@ -29,7 +29,8 @@ class YHMainApplicantInformationViewController: YHBaseViewController { ...@@ -29,7 +29,8 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
func getData() { func getData() {
viewModel.requestMainInformation("\(orderId)") {[weak self] success, error in viewModel.requestMainInformation("\(orderId)") {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.stepView.currentIndex = self.viewModel.mainModel.step ?? 0 self.stepView.maxIndex = self.viewModel.mainModel.step
self.stepView.currentIndex = self.viewModel.mainModel.step
self.updateDataSource() self.updateDataSource()
} }
} }
...@@ -92,15 +93,19 @@ class YHMainApplicantInformationViewController: YHBaseViewController { ...@@ -92,15 +93,19 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
guard let self = self else { return } guard let self = self else { return }
if self.viewModel.isCanNext(self.stepView.currentIndex) { 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, self.orderId) {[weak self] success in self.viewModel.updateMainInformation(.submit, self.orderId) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.isShowPrompt = false if let error = error {
self.stepView.currentIndex = self.stepView.currentIndex YHHUD.flash(message: error.errorMsg )
if self.stepView.currentIndex == self.stepView.dataSource?.count {
YHHUD.flash(message: "提交成功")
self.navigationController?.popViewController()
} else { } else {
self.updateDataSource() self.isShowPrompt = false
self.stepView.currentIndex = self.stepView.currentIndex
if self.stepView.currentIndex == self.stepView.dataSource?.count {
YHHUD.flash(message: "提交成功")
self.navigationController?.popViewController()
} else {
self.updateDataSource()
}
} }
} }
} else { } else {
...@@ -111,8 +116,13 @@ class YHMainApplicantInformationViewController: YHBaseViewController { ...@@ -111,8 +116,13 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
} }
bottom.saveBlock = { [weak self] in bottom.saveBlock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
self.viewModel.updateMainInformation(.save, self.orderId) {[weak self] success in self.viewModel.updateMainInformation(.save, self.orderId) {[weak self] success, error in
guard let self = self else { return } guard let _ = self else { return }
if let error = error {
YHHUD.flash(message: error.errorMsg )
} else {
YHHUD.flash(message: "保存成功")
}
} }
} }
return bottom return bottom
...@@ -148,7 +158,7 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable ...@@ -148,7 +158,7 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
guard let self = self else { return } guard let self = self else { return }
self.viewModel.updateModel(model) self.viewModel.updateModel(model)
let id = model.id 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 { if id != .id32 && id != .id4 && id != .id8 && id != .id9 && id != .id12 && id != .id13 && id != .id17 && id != .id18 && id != .id21 && id != .id22 && id != .id23 && id != .id34 && id != .id29 && id != .id30 && id != .id35 {
self.updateDataSource() self.updateDataSource()
} }
} }
......
...@@ -70,8 +70,9 @@ struct YHItemModel { ...@@ -70,8 +70,9 @@ struct YHItemModel {
var type: YHItemSelectType? var type: YHItemSelectType?
var value: [String]? var value: [String]?
var isShowPrompts: Bool? var isShowPrompts: Bool?
var alertMessage: String?
init(id: YHItemID? = nil, isNeed: Bool? = nil, title: String? = nil, isUserKeyBoard: Bool? = nil, prompts: String? = nil, message: String? = nil, leftButtonString: String? = nil, rightButtonString: String? = nil, type: YHItemSelectType? = nil, value: [String]? = nil, isShowPrompts: Bool? = nil) { init(id: YHItemID? = nil, isNeed: Bool? = nil, title: String? = nil, isUserKeyBoard: Bool? = nil, prompts: String? = nil, message: String? = nil, leftButtonString: String? = nil, rightButtonString: String? = nil, type: YHItemSelectType? = nil, value: [String]? = nil, isShowPrompts: Bool? = nil, alertMessage: String? = nil) {
self.id = id self.id = id
self.isNeed = isNeed self.isNeed = isNeed
self.title = title self.title = title
...@@ -83,6 +84,7 @@ struct YHItemModel { ...@@ -83,6 +84,7 @@ struct YHItemModel {
self.type = type self.type = type
self.value = value self.value = value
self.isShowPrompts = isShowPrompts self.isShowPrompts = isShowPrompts
self.alertMessage = alertMessage
} }
} }
......
...@@ -10,7 +10,7 @@ import Foundation ...@@ -10,7 +10,7 @@ import Foundation
struct YHCountryModel { struct YHCountryModel {
var provincesArray: [YHProvincesModel] = [] var provincesArray: [YHProvincesModel] = []
init(dic: [String:[String:[String]]]) { init(dic: [String:[String]]) {
for (key,value) in dic { for (key,value) in dic {
let model = YHProvincesModel(name: key, dic: value) let model = YHProvincesModel(name: key, dic: value)
provincesArray.append(model) provincesArray.append(model)
...@@ -24,26 +24,18 @@ struct YHCountryModel { ...@@ -24,26 +24,18 @@ struct YHCountryModel {
struct YHProvincesModel { struct YHProvincesModel {
var provincesName: String = "" var provincesName: String = ""
var cityArray: [YHCityModel] = [] var cityArray: [YHCityModel] = []
init(name : String ,dic:[String: [String]]) { init(name : String ,dic:[String]) {
provincesName = name provincesName = name
for (key,value) in dic { for value in dic {
let model = YHCityModel(name: key, Arr: value) let model = YHCityModel(name: value)
cityArray.append(model) cityArray.append(model)
cityArray.sort { a, b in
a.cityName < b.cityName
}
} }
} }
} }
struct YHCityModel { struct YHCityModel {
var cityName: String = "" var cityName: String = ""
var areaArray: [String] = [] init(name: String) {
init(name: String,Arr: [String]) {
cityName = name cityName = name
for str in Arr {
areaArray.append(str)
}
areaArray.sort(by: <)
} }
} }
...@@ -12,7 +12,6 @@ import UIKit ...@@ -12,7 +12,6 @@ import UIKit
enum YHLocationPickViewTableViewType { enum YHLocationPickViewTableViewType {
case provinces //省份 case provinces //省份
case city //城市 case city //城市
case area //地区
} }
class YHAddressPickView: UIView { class YHAddressPickView: UIView {
...@@ -80,25 +79,6 @@ class YHAddressPickView: UIView { ...@@ -80,25 +79,6 @@ class YHAddressPickView: UIView {
model.cityName model.cityName
}) })
self.tableView.reloadData() self.tableView.reloadData()
case .area:
/// 选择地区时没有上方热门城市View,有titleSV
self.tableView.tableHeaderView = UIView()
self.tableView.frame = CGRect(x: 0, y: 136, width: UIScreen.main.bounds.width, height: 367)
self.titleSV.isHidden = false
self.leftLabel.isHidden = false
/// 通过修改titleSV中button的选中状态来修改它的颜色
for button in buttonArr {
button.isSelected = false
if button.tag == 2 {
button.isSelected = true
}
}
/// 滚动titleSV中button下滚动的Line
UIView.animate(withDuration: 0.3, animations: {() -> Void in
self.underLine.center = CGPoint(x: self.buttonArr[2].center.x, y: self.underLine.center.y)
})
self.dataArray = cityModel?.areaArray
self.tableView.reloadData()
} }
} }
} }
...@@ -206,8 +186,8 @@ class YHAddressPickView: UIView { ...@@ -206,8 +186,8 @@ class YHAddressPickView: UIView {
titleSV = UIScrollView(frame: CGRect(x: 0, y: 72, width: UIScreen.main.bounds.width, height: 44)) titleSV = UIScrollView(frame: CGRect(x: 0, y: 72, width: UIScreen.main.bounds.width, height: 44))
self.underLine = UIView(frame: CGRect(x: 0, y: 40, width: 30, height: 2)) self.underLine = UIView(frame: CGRect(x: 0, y: 40, width: 30, height: 2))
self.underLine.backgroundColor = selectColor self.underLine.backgroundColor = selectColor
for i in 0..<3 { for i in 0..<2 {
let button = UIButton(frame: CGRect(x: 24 + CGFloat(i) * (UIScreen.main.bounds.width - 47) / 3, y: 0, width: UIScreen.main.bounds.width / 3, height: 44)) let button = UIButton(frame: CGRect(x: 24 + CGFloat(i) * (UIScreen.main.bounds.width - 47) / 2, y: 0, width: UIScreen.main.bounds.width / 3, height: 44))
button.tag = Int(i) button.tag = Int(i)
if i == 1 { if i == 1 {
button.isSelected = true button.isSelected = true
...@@ -250,8 +230,6 @@ class YHAddressPickView: UIView { ...@@ -250,8 +230,6 @@ class YHAddressPickView: UIView {
let hotCity = ["北京市","上海市","广州市","深圳市","杭州市","南京市","苏州市","天津市","武汉市","长沙市","重庆市","成都市"] let hotCity = ["北京市","上海市","广州市","深圳市","杭州市","南京市","苏州市","天津市","武汉市","长沙市","重庆市","成都市"]
let tag = sender.tag let tag = sender.tag
setHotCityData(province: hotProvince[tag], city: hotCity[tag]) setHotCityData(province: hotProvince[tag], city: hotCity[tag])
self.tableViewType = .area
} }
/// 选择view.type /// 选择view.type
@objc private func onClickTitlebutton(sender: UIButton) { @objc private func onClickTitlebutton(sender: UIButton) {
...@@ -280,16 +258,19 @@ class YHAddressPickView: UIView { ...@@ -280,16 +258,19 @@ class YHAddressPickView: UIView {
}) { }) {
self.cityModel = cityModel self.cityModel = cityModel
self.selectedCity = city self.selectedCity = city
self.tableViewType = .area
} }
} }
} }
} }
let selectLocation = selectedProvince + " " + selectedCity + " " + selectedArea
if backLocationString != nil {
backLocationString!(selectLocation,selectedProvince,selectedCity,selectedArea)
}
} }
/// 从area.plist获取全部地区数据 /// 从area.plist获取全部地区数据
private func initLocationData() { private func initLocationData() {
guard let dic = NSDictionary(contentsOfFile: Bundle.main.path(forResource: "area", ofType: "plist") ?? "") as? [String:[String:[String]]] else { guard let dic = NSDictionary(contentsOfFile: Bundle.main.path(forResource: "area", ofType: "plist") ?? "") as? [String:[String]] else {
return return
} }
locationModel = YHCountryModel(dic: dic) locationModel = YHCountryModel(dic: dic)
...@@ -330,10 +311,6 @@ extension YHAddressPickView: UITableViewDelegate,UITableViewDataSource { ...@@ -330,10 +311,6 @@ extension YHAddressPickView: UITableViewDelegate,UITableViewDataSource {
/// 当前为选择城市状态时,保存选中城市,刷新状态为选择地区 /// 当前为选择城市状态时,保存选中城市,刷新状态为选择地区
selectedCity = (self.provincesModel?.cityArray[indexPath.row - 1])?.cityName ?? "" selectedCity = (self.provincesModel?.cityArray[indexPath.row - 1])?.cityName ?? ""
self.cityModel = self.provincesModel?.cityArray.first(where: {$0.cityName == selectedCity}) self.cityModel = self.provincesModel?.cityArray.first(where: {$0.cityName == selectedCity})
self.tableViewType = .area
case .area:
/// 当前为选择地区状态时,保存选中地区,执行回调block.将选中数据回调
selectedArea = self.dataArray![indexPath.row - 1]
let selectLocation = selectedProvince + " " + selectedCity + " " + selectedArea let selectLocation = selectedProvince + " " + selectedCity + " " + selectedArea
if backLocationString != nil { if backLocationString != nil {
backLocationString!(selectLocation,selectedProvince,selectedCity,selectedArea) backLocationString!(selectLocation,selectedProvince,selectedCity,selectedArea)
......
...@@ -155,7 +155,7 @@ class YHItemView: UIView { ...@@ -155,7 +155,7 @@ class YHItemView: UIView {
} }
messageTextField.placeholder = dataSource.prompts messageTextField.placeholder = dataSource.prompts
messageTextField.text = dataSource.message messageTextField.text = dataSource.message
showPromptLabel.text = "\(dataSource.prompts ?? "")" + "\(dataSource.title ?? "")" showPromptLabel.text = dataSource.alertMessage
if dataSource.isUserKeyBoard ?? false { if dataSource.isUserKeyBoard ?? false {
nextStepImageView.isHidden = true nextStepImageView.isHidden = true
centerButton.isHidden = true centerButton.isHidden = true
...@@ -167,12 +167,27 @@ class YHItemView: UIView { ...@@ -167,12 +167,27 @@ class YHItemView: UIView {
case .time: break case .time: break
case .image: break case .image: break
case .id: case .id:
messageTextField.text = YHFormPickerViewSubType.certificate(YHPickerViewCertificateType(rawValue: dataSource.message?.int ?? 0) ?? .chineseStatelessTravelPassport).title let arr = YHOtherInfoFillViewModel.arrIdType
arr.forEach { item in
if item["id"] == dataSource.message {
messageTextField.text = item["title"]
}
}
case .country: break case .country: break
case .sex: case .sex:
messageTextField.text = YHFormPickerViewSubType.gender(YHPickerViewGenderType(rawValue: dataSource.message?.int ?? 0) ?? .female).title let arr = YHOtherInfoFillViewModel.arrSex
arr.forEach { item in
if item["id"] == dataSource.message {
messageTextField.text = item["title"]
}
}
case .marry: case .marry:
messageTextField.text = YHFormPickerViewSubType.marriage(YHPickerViewMarriageType(rawValue: dataSource.message?.int ?? 0) ?? .unmarriage).title let arr = YHOtherInfoFillViewModel.arrMarry
arr.forEach { item in
if item["id"] == dataSource.message {
messageTextField.text = item["title"]
}
}
} }
} }
nextStepImageView.isHidden = false nextStepImageView.isHidden = false
...@@ -278,15 +293,16 @@ class YHItemView: UIView { ...@@ -278,15 +293,16 @@ class YHItemView: UIView {
} }
@objc func centerClick() { @objc func centerClick() {
UIViewController.current?.view.endEditing(true) // 收起键盘
guard let type = dataSource?.type else { return } guard let type = dataSource?.type else { return }
switch type { switch type {
case .normal: case .normal:
printLog("不需要跳转") printLog("不需要跳转")
case .address: case .address:
let addressPicker = YHAddressViewController( selectProvince: "上海市", selectCity: "" ) let addressPicker = YHAddressViewController()
addressPicker.backLocationStringController = { (address,province,city,area) in addressPicker.backLocationStringController = { (address,province,city,area) in
self.dataSource?.message = address self.dataSource?.message = address
self.dataSource?.value = [province, city, area] self.dataSource?.value = [province, city]
self.updateAllViews() self.updateAllViews()
if let block = self.block { if let block = self.block {
block(self.dataSource ?? YHItemModel()) block(self.dataSource ?? YHItemModel())
...@@ -315,10 +331,10 @@ class YHItemView: UIView { ...@@ -315,10 +331,10 @@ class YHItemView: UIView {
let window = UIApplication.shared.yhKeyWindow() let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view) window?.addSubview(view)
case .id: case .id:
YHFormPickerView.show(type: .certificate, selectTitle: "公务通行证") { selectType in YHOtherPickerView.show(type: .idType) {[weak self] data in
// 选择类型的标题 guard let self = self else { return }
self.dataSource?.message = selectType.title self.dataSource?.message = data.title
self.dataSource?.value = ["\(selectType.index)"] self.dataSource?.value = [data.index]
self.updateAllViews() self.updateAllViews()
if let block = self.block { if let block = self.block {
block(self.dataSource ?? YHItemModel()) block(self.dataSource ?? YHItemModel())
...@@ -335,20 +351,20 @@ class YHItemView: UIView { ...@@ -335,20 +351,20 @@ class YHItemView: UIView {
} }
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
case .sex: case .sex:
YHFormPickerView.show(type: .gender, selectType: .gender(.female)) { selectType in YHOtherPickerView.show(type: .sex) {[weak self] data in
// 选择类型的标题 guard let self = self else { return }
self.dataSource?.message = selectType.title self.dataSource?.message = data.title
self.dataSource?.value = ["\(selectType.index)"] self.dataSource?.value = [data.index]
self.updateAllViews() self.updateAllViews()
if let block = self.block { if let block = self.block {
block(self.dataSource ?? YHItemModel()) block(self.dataSource ?? YHItemModel())
} }
} }
case .marry: case .marry:
YHFormPickerView.show(type: .marriage, selectType: .marriage(.divorced)) { selectType in YHOtherPickerView.show(type: .marry) {[weak self] data in
// 选择类型的标题 guard let self = self else { return }
self.dataSource?.message = selectType.title self.dataSource?.message = data.title
self.dataSource?.value = ["\(selectType.index)"] self.dataSource?.value = [data.index]
self.updateAllViews() self.updateAllViews()
if let block = self.block { if let block = self.block {
block(self.dataSource ?? YHItemModel()) block(self.dataSource ?? YHItemModel())
...@@ -365,6 +381,26 @@ extension YHItemView: UITextFieldDelegate { ...@@ -365,6 +381,26 @@ 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)
if (dataSource?.id == .id9 || dataSource?.id == .id21 || dataSource?.id == .id22 || dataSource?.id == .id23) && newText.count > 30 {
return false
}
if (dataSource?.id == .id4 || dataSource?.id == .id32 || dataSource?.id == .id13 || dataSource?.id == .id18 || dataSource?.id == .id32 ) && newText.count > 100 {
return false
}
if (dataSource?.id == .id12 || dataSource?.id == .id17 || dataSource?.id == .id30) && newText.count > 50 {
return false
}
if (dataSource?.id == .id8) && newText.count > 20 {
return false
}
if (dataSource?.id == .id29 || dataSource?.id == .id35) && newText.count > 18 {
return false
}
var data = dataSource ?? YHItemModel() var data = dataSource ?? YHItemModel()
data.message = newText data.message = newText
if let block = block { if let block = block {
......
...@@ -23,6 +23,7 @@ class YHStepView: UIScrollView { ...@@ -23,6 +23,7 @@ class YHStepView: UIScrollView {
updateView(dataSource ?? []) updateView(dataSource ?? [])
} }
} }
var maxIndex: Int = 0
var stepSpace: CGFloat = 6 var stepSpace: CGFloat = 6
var lineWidth: CGFloat { var lineWidth: CGFloat {
guard let dataSource = dataSource else { return 0 } guard let dataSource = dataSource else { return 0 }
...@@ -141,7 +142,7 @@ class YHStepView: UIScrollView { ...@@ -141,7 +142,7 @@ class YHStepView: UIScrollView {
@objc func buttonClick(_ button: UIButton) { @objc func buttonClick(_ button: UIButton) {
let tag = button.tag let tag = button.tag
if tag - 1000 < currentIndex { if tag - 1000 <= maxIndex {
currentIndex = tag - 1000 currentIndex = tag - 1000
if let block = block { if let block = block {
block(currentIndex) block(currentIndex)
......
...@@ -26,6 +26,12 @@ enum YHOtherPickerViewType: Int { ...@@ -26,6 +26,12 @@ enum YHOtherPickerViewType: Int {
case level case level
// 高管证明文件 // 高管证明文件
case prove case prove
// 证件类别
case idType
// 性别
case sex
// 婚姻状况
case marry
} }
...@@ -248,6 +254,12 @@ class YHOtherPickerView: UIView { ...@@ -248,6 +254,12 @@ class YHOtherPickerView: UIView {
return "职位水平类别" return "职位水平类别"
case .prove: case .prove:
return "高管证明文件" return "高管证明文件"
case .idType:
return "选择证件类别"
case .sex:
return "选择性别"
case .marry:
return "选择婚姻状况"
default: default:
return "请选择" return "请选择"
} }
...@@ -283,7 +295,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource { ...@@ -283,7 +295,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat {
switch type { switch type {
case .nature,.certificate,.structure,.level,.prove: case .nature,.certificate,.structure,.level,.prove,.idType,.sex,.marry:
return 50 return 50
default: default:
return 70 return 70
...@@ -293,7 +305,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource { ...@@ -293,7 +305,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
switch type { switch type {
case .nature,.certificate,.structure,.level,.prove: case .nature,.certificate,.structure,.level,.prove,.idType,.sex,.marry:
let label = UILabel() let label = UILabel()
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_M(ofSize: 14) label.font = UIFont.PFSC_M(ofSize: 14)
...@@ -403,6 +415,30 @@ extension YHOtherPickerView { ...@@ -403,6 +415,30 @@ extension YHOtherPickerView {
arrData.append(model) arrData.append(model)
} }
title = getTitle(type: type) title = getTitle(type: type)
case .idType:
let arr = YHOtherInfoFillViewModel.arrIdType
arrData.removeAll()
arr.forEach { item in
let model = YHOtherPickerViewItemData(title: item["title"] ?? "-", subTitle: "", index: item["id"] ?? "-")
arrData.append(model)
}
title = getTitle(type: type)
case .sex:
let arr = YHOtherInfoFillViewModel.arrSex
arrData.removeAll()
arr.forEach { item in
let model = YHOtherPickerViewItemData(title: item["title"] ?? "-", subTitle: "", index: item["id"] ?? "-")
arrData.append(model)
}
title = getTitle(type: type)
case .marry:
let arr = YHOtherInfoFillViewModel.arrMarry
arrData.removeAll()
arr.forEach { item in
let model = YHOtherPickerViewItemData(title: item["title"] ?? "-", subTitle: "", index: item["id"] ?? "-")
arrData.append(model)
}
title = getTitle(type: type)
default: default:
return return
} }
......
...@@ -246,6 +246,60 @@ class YHOtherInfoFillViewModel: YHBaseViewModel { ...@@ -246,6 +246,60 @@ class YHOtherInfoFillViewModel: YHBaseViewModel {
"id": "盖章且签字的组织架构图和审计报告" "id": "盖章且签字的组织架构图和审计报告"
] ]
] ]
static let arrIdType : [[String : String]] = [
["title": "护照",
"id": "3"
],
["title": "外交护照",
"id": "4"
],
["title": "公务护照",
"id": "5"
],
["title": "中国发无国籍旅游证件",
"id": "6"
],
["title": "旅游通行证",
"id": "7"
],
["title": "联合国通行证",
"id": "8"
],
["title": "其他无国籍旅行证件",
"id": "9"
],
["title": "其他",
"id": "10"
]
]
static let arrSex : [[String : String]] = [
["title": "男",
"id": "1"
],
["title": "女",
"id": "2"
]
]
static let arrMarry : [[String : String]] = [
["title": "已婚",
"id": "0"
],
["title": "未婚",
"id": "1"
],
["title": "离婚",
"id": "2"
],
["title": "分居",
"id": "3"
],
["title": "丧偶",
"id": "4"
]
]
} }
extension YHOtherInfoFillViewModel { extension YHOtherInfoFillViewModel {
......
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