Commit 1c44327b authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '6f32074f' into xiezhaolin

parents d08b263e 6f32074f
......@@ -18,7 +18,7 @@
041B52912B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */; };
041B52932B5E6CBA007EBCEB /* YHFormItemTitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52922B5E6CBA007EBCEB /* YHFormItemTitleCell.swift */; };
041B52952B5E7037007EBCEB /* YHFormItemAddCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52942B5E7037007EBCEB /* YHFormItemAddCell.swift */; };
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */; };
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift */; };
041B52D62B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52D52B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift */; };
041B52DB2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */; };
041B52DD2B60A889007EBCEB /* YHTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DC2B60A889007EBCEB /* YHTest.swift */; };
......@@ -75,12 +75,12 @@
0468D47E2B68CEA200CFB916 /* YHImagePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D47D2B68CEA200CFB916 /* YHImagePickerView.swift */; };
0468D4802B6914E600CFB916 /* YHSelectCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D47F2B6914E600CFB916 /* YHSelectCountryViewController.swift */; };
0468D4822B6A2A8500CFB916 /* YHSelectCountryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4812B6A2A8500CFB916 /* YHSelectCountryViewModel.swift */; };
04754A952B96FF3D00F8ADCA /* UITextField+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */; };
0469750E2B96C0B900A0CB66 /* YHImageClipperViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0469750D2B96C0B900A0CB66 /* YHImageClipperViewController.swift */; };
046975102B96C13700A0CB66 /* YHClipperView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0469750F2B96C13700A0CB66 /* YHClipperView.swift */; };
046975122B96C77000A0CB66 /* YHClipperButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 046975112B96C77000A0CB66 /* YHClipperButton.swift */; };
046975162B96EB2200A0CB66 /* YHImageResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 046975152B96EB2200A0CB66 /* YHImageResultViewController.swift */; };
046975182B96EEB200A0CB66 /* YHResultBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 046975172B96EEB200A0CB66 /* YHResultBottomView.swift */; };
04754A952B96FF3D00F8ADCA /* UITextField+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */; };
04808C062B4686510056D53C /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04808C042B4686510056D53C /* ATAuthSDK.bundle */; };
04808C082B4686C10056D53C /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04808C032B4686510056D53C /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
......@@ -333,7 +333,7 @@
041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemEnterDetailCell.swift; sourceTree = "<group>"; };
041B52922B5E6CBA007EBCEB /* YHFormItemTitleCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemTitleCell.swift; sourceTree = "<group>"; };
041B52942B5E7037007EBCEB /* YHFormItemAddCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemAddCell.swift; sourceTree = "<group>"; };
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberInfoVC.swift; sourceTree = "<group>"; };
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberInfoListVC.swift; sourceTree = "<group>"; };
041B52D52B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpousePrimaryInfoVC.swift; sourceTree = "<group>"; };
041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyInitialInfo.swift; sourceTree = "<group>"; };
041B52DC2B60A889007EBCEB /* YHTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTest.swift; sourceTree = "<group>"; };
......@@ -390,12 +390,12 @@
0468D47D2B68CEA200CFB916 /* YHImagePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImagePickerView.swift; sourceTree = "<group>"; };
0468D47F2B6914E600CFB916 /* YHSelectCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectCountryViewController.swift; sourceTree = "<group>"; };
0468D4812B6A2A8500CFB916 /* YHSelectCountryViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectCountryViewModel.swift; sourceTree = "<group>"; };
04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField+Extension.swift"; sourceTree = "<group>"; };
0469750D2B96C0B900A0CB66 /* YHImageClipperViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImageClipperViewController.swift; sourceTree = "<group>"; };
0469750F2B96C13700A0CB66 /* YHClipperView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHClipperView.swift; sourceTree = "<group>"; };
046975112B96C77000A0CB66 /* YHClipperButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHClipperButton.swift; sourceTree = "<group>"; };
046975152B96EB2200A0CB66 /* YHImageResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImageResultViewController.swift; sourceTree = "<group>"; };
046975172B96EEB200A0CB66 /* YHResultBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResultBottomView.swift; sourceTree = "<group>"; };
04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField+Extension.swift"; sourceTree = "<group>"; };
04808C032B4686510056D53C /* ATAuthSDK_D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ATAuthSDK_D.framework; sourceTree = "<group>"; };
04808C042B4686510056D53C /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ATAuthSDK.bundle; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
......@@ -682,13 +682,11 @@
041B52962B5E8E3B007EBCEB /* C */ = {
isa = PBXGroup;
children = (
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift */,
04C8F4802B720DAB00ADF59B /* Spouse(配偶) */,
04754A962B97286F00F8ADCA /* Certificates(证书上传和证书信息) */,
04754A972B97289200F8ADCA /* Parents&Brothers(父母和兄弟姐妹) */,
04C8F4812B720DCD00ADF59B /* Child(子女) */,
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -816,6 +814,24 @@
path = YHAddressPicker;
sourceTree = "<group>";
};
04754A962B97286F00F8ADCA /* Certificates(证书上传和证书信息) */ = {
isa = PBXGroup;
children = (
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
);
path = "Certificates(证书上传和证书信息)";
sourceTree = "<group>";
};
04754A972B97289200F8ADCA /* Parents&Brothers(父母和兄弟姐妹) */ = {
isa = PBXGroup;
children = (
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */,
);
path = "Parents&Brothers(父母和兄弟姐妹)";
sourceTree = "<group>";
};
04808C022B4686510056D53C /* Frameworks */ = {
isa = PBXGroup;
children = (
......@@ -2020,7 +2036,7 @@
04E86E5B2B84BF2000A35F4B /* YHWorkExampleTypeView.swift in Sources */,
042FBBBD2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift in Sources */,
A5FD63C32B63438A00D1D9DA /* YHContactMainItemStatusModel.swift in Sources */,
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift in Sources */,
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift in Sources */,
0468D47B2B68A08600CFB916 /* YHAddressPresentAnimated.swift in Sources */,
A5C382CF2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift in Sources */,
0468D4782B68A08600CFB916 /* YHAddressModel.swift in Sources */,
......
......@@ -368,7 +368,7 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource
} else if indexPath.row == 1 {
//家庭程序信息
let vc = YHFamilyMemberInfoVC(orderId: orderId ?? 0)
let vc = YHFamilyMemberInfoListVC(orderId: orderId ?? 0)
vc.orderId = orderId ?? 0
navigationController?.pushViewController(vc)
......
......@@ -70,7 +70,7 @@ class YHEducationDetailVC: YHBaseViewController {
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
saveDetailInfo(isNeedPop: true)
saveDetailInfo(isNeedPop: true, isShowToast: true)
}
bottomView.submitBlock = {
......@@ -228,7 +228,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
if isEditEnd {
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
}
......@@ -311,7 +311,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
}
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
self.navigationController?.pushViewController(vc)
......@@ -323,7 +323,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.teachingFormat = selectType.title
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
......@@ -340,7 +340,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
}
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
......@@ -352,7 +352,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.degree = selectType.title
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
......@@ -364,7 +364,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.degreeType = selectItem.title
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
......@@ -377,7 +377,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.schoolAddress.country = country
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
self.navigationController?.pushViewController(vc)
......@@ -390,10 +390,17 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
detailInfo.schoolAddress.area = [string1, string2, string3, string4]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
detailInfo.schoolAddress.area = citys
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
self.present(vc, animated: true)
......@@ -480,7 +487,7 @@ extension YHEducationDetailVC {
YHHUD.flash(message: "资料还未填完")
return
}
saveDetailInfo(isNeedPop: true)
saveDetailInfo(isNeedPop: true, isShowToast: true)
}
// 检查填写信息完整性
......@@ -509,7 +516,7 @@ extension YHEducationDetailVC {
}
// 保存信息 isNeedPop:保存成功后是否退出该页面
func saveDetailInfo(isNeedPop:Bool) {
func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) {
// detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理
// let dict:[String : Any] = [
......@@ -531,17 +538,21 @@ extension YHEducationDetailVC {
guard var dict:[String:Any] = detailInfo.toDictionary() else { return }
dict["order_id"] = self.orderId
self.educationRequest.saveEducationInfo(params: dict) {
self.educationRequest.saveEducationInfo(params: dict, isSilent: !isShowToast) {
[weak self] success, error in
guard let self = self else { return }
if success {
YHHUD.flash(message: "保存成功")
if isShowToast {
YHHUD.flash(message: "保存成功")
}
if isNeedPop {
self.navigationController?.popViewController(animated: true)
}
} else {
YHHUD.flash(message: "保存失败")
if isShowToast {
YHHUD.flash(message: "保存失败")
}
}
}
}
......
......@@ -153,7 +153,7 @@ class YHEducationInfoListVC: YHBaseViewController {
let title2 = YHFormTitleItem(type: .edutionalCertificateNameAndBirthday)
var arr2:[YHFormItemProtocol] = [title2]
// 问题集合
let questions = YHQuestionInfo.getEducationQuestion()
let questions = YHQuestionInfo.getEducationQuestion(eduList: educationInfo)
for questionInfo in questions {
if questionInfo.key == "qualification" {
questionInfo.answer = educationInfo.isNameSame
......
......@@ -308,7 +308,14 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
detailInfo.issuingAddr.area = [string1, string2, string3, string4]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
detailInfo.issuingAddr.area = citys
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false, isShowToast: false)
......@@ -391,12 +398,12 @@ extension YHQualificationDetailVC {
func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) {
var dict:[String : Any] = ["orderId":self.orderId]
var quaDict:[String : Any] = detailInfo.toDictionary() ?? [:]
let quaDict:[String : Any] = detailInfo.toDictionary() ?? [:]
dict["qua_data"] = quaDict
print(dict)
self.educationRequest.saveQualificationInfo(params: dict) {
self.educationRequest.saveQualificationInfo(params: dict, isSilent:!isShowToast) {
[weak self] success, error in
guard let self = self else { return }
if success {
......
......@@ -17,6 +17,10 @@ class YHEducationListInfo: SmartCodable {
var isSpouseNameSame:Bool?
// 1=已婚,2=未婚,3=离婚,4=分居,5=丧偶,6=事实婚姻,7=鳏寡
var married: Int = 0
func isMarried() ->Bool {
return married != 2
}
enum CodingKeys: String, CodingKey {
case orderId = "order_id"
......
......@@ -71,15 +71,19 @@ class YHEducationRequestViewModel {
}
// 保存学历
func saveEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
func saveEducationInfo(params:[String:Any], isSilent:Bool, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
if !isSilent {
YHHUD.show(.progress(message: "数据加载中..."))
}
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.saveEducationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
if !isSilent {
YHHUD.hide()
}
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
......@@ -195,15 +199,19 @@ class YHEducationRequestViewModel {
}
// 保存专业信息
func saveQualificationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
func saveQualificationInfo(params:[String:Any], isSilent:Bool, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
if !isSilent {
YHHUD.show(.progress(message: "数据加载中..."))
}
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Qualification.saveQualificationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
if !isSilent {
YHHUD.hide()
}
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
......
......@@ -37,7 +37,7 @@ class YHQuestionInfo: SmartCodable, YHFormItemProtocol {
extension YHQuestionInfo {
// 【问题】学历证书姓名及出生日期正确性
static func getEducationQuestion() -> [YHQuestionInfo] {
static func getEducationQuestion(eduList:YHEducationListInfo) -> [YHQuestionInfo] {
let path = Bundle.main.path(forResource: "YHQuestionList", ofType: "plist")
let questions:[Dictionary] = NSArray(contentsOfFile:path!) as! [Dictionary<String, Any>]
var res:[YHQuestionInfo] = []
......@@ -45,7 +45,13 @@ extension YHQuestionInfo {
guard let questionInfo = YHQuestionInfo.deserialize(dict: dict as? [AnyHashable : Any]) else {
continue
}
res.append(questionInfo)
if questionInfo.key == "graduate" {
if eduList.isMarried() {
res.append(questionInfo)
}
} else {
res.append(questionInfo)
}
}
return res
}
......
......@@ -455,7 +455,14 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.birthPlace.area = [string2, string3]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.child?.birthPlace.area = citys
self.loadInfo()
save()
}
......
......@@ -13,6 +13,8 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var child:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var isNeedShowError = false
// 是否随行能编辑
var isFollowCanEdit = true
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -54,6 +56,7 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
items.removeAll()
isFollowCanEdit = !child.is18YearsOld()
// 随行
let title0 = YHFormTitleItem(type: .accompany)
let item00 = YHFormDetailItem(type: .ownCustody, value:String(child.isOwnCustody()))
......@@ -205,15 +208,23 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .twoChoice {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.isCanEdit = true
var select = false
if let value = detailItem.value {
select = Bool(value)!
}
if detailItem.type == .isAccompanyToHK, let child = child, child.is18YearsOld() { // 是否随行至香港
// 年满18岁不能随行
select = false
cell.isCanEdit = isFollowCanEdit
}
let answers = [YHFormChoiceItem(title: "是".local, isSelect: select),YHFormChoiceItem(title: "否".local, isSelect: !select)]
cell.answerArr = answers
......@@ -363,23 +374,37 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.address.area = [string2, string3]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.child?.address.area = citys
self.loadInfo()
}
self.present(vc, animated: true)
} else if detailItem.type == .birthday { // 出生日期
// 子女选择年满18岁则【是否随行至香港】默认选择否,不可修改
// 如果未年满18岁则【是否随行至香港】可选择【是/否】,可修改
YHDatePickView.show(type: .yyyymmdd) { [weak self] date in
guard let self = self else { return }
if detailItem.type == .birthday {
self.child?.birthday = date
guard let child = child else { return }
child.birthday = date
isFollowCanEdit = !child.is18YearsOld()
}
self.loadInfo()
}
}
}
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
......
......@@ -408,7 +408,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
var isBirthOverSeas = false
if let brotherInfo = brotherInfo {
isBirthOverSeas = brotherInfo.isOverSeasOver1Year()
isBirthOverSeas = brotherInfo.isBirthOverSeas()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
......@@ -418,7 +418,14 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.brotherInfo?.birthPlace.area = [string2, string3]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.brotherInfo?.birthPlace.area = citys
self.loadInfo()
saveInfoSilent()
}
......
......@@ -453,7 +453,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
var isBirthOverSeas = false
if let parentInfo = parentInfo {
isBirthOverSeas = parentInfo.isOverSeasOver1Year()
isBirthOverSeas = parentInfo.isBirthOverSeas()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
......@@ -463,7 +463,14 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.birthPlace.area = [string2, string3]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.parentInfo?.birthPlace.area = citys
self.loadInfo()
saveInfoSilent()
}
......
......@@ -643,7 +643,14 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.spouse?.birthPlace.area = [string2, string3]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.spouse?.birthPlace.area = citys
loadInfo()
save()
}
......
......@@ -326,7 +326,14 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.spouse?.address.area = [string2, string3]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.spouse?.address.area = citys
self.loadInfo()
save()
}
......
......@@ -14,7 +14,7 @@ enum YHFormTitleItemEditType:Int {
case canCancel = 3
}
class YHFamilyMemberInfoVC: YHBaseViewController {
class YHFamilyMemberInfoListVC: YHBaseViewController {
var orderId:Int
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
......@@ -230,7 +230,7 @@ class YHFamilyMemberInfoVC: YHBaseViewController {
}
}
extension YHFamilyMemberInfoVC {
extension YHFamilyMemberInfoListVC {
// 请求家庭成员信息
func requestFamilyInfo() {
......@@ -293,7 +293,7 @@ extension YHFamilyMemberInfoVC {
}
}
extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHFamilyMemberInfoListVC : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
......@@ -368,17 +368,30 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.detailLabel.text = "还未开始填写".local
}
if detailItem.relationType == .child || detailItem.relationType == .brother {
if detailItem.subsetName == nil || detailItem.subsetName == "" { // 姓名为空
if detailItem.relationType == .child {
cell.title = String(format: "子女%d".local, indexPath.row)
} else if detailItem.relationType == .brother {
cell.title = String(format: "兄弟姐妹%d".local, indexPath.row)
}
} else {
cell.title = detailItem.subsetName
if isEmptyString(detailItem.subsetName) { // 姓名为空
if detailItem.relationType == .child {
cell.title = String(format: "子女%d".local, indexPath.row)
} else if detailItem.relationType == .brother {
cell.title = String(format: "兄弟姐妹%d".local, indexPath.row)
}
} else {
var name = ""
if detailItem.relationType == .father {
name = "父亲"
} else if detailItem.relationType == .mother {
name = "母亲"
} else if detailItem.relationType == .spouse {
name = "配偶"
} else if detailItem.relationType == .child {
name = "子女"
} else if detailItem.relationType == .brother {
name = "兄弟姐妹"
}
name += "-"
name += detailItem.subsetName
cell.title = name
}
cell.isShowDeleteBtn = false
cell.deleteBlock = nil
if detailItem.relationType == .child || detailItem.relationType == .brother {
......@@ -462,6 +475,7 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
if formItem.type == .addChild || formItem.type == .addBrother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = formItem.getTitle()
cell.clickBlock = { [weak self] in
guard let self = self else { return }
if formItem.type == .addBrother {
......
......@@ -1123,6 +1123,41 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
self.childStepchild.has = (val ? "Y" : "N")
}
// 根据生日推算年龄
func getAge(birthday:String) ->Int {
let arr = birthday.components(separatedBy: YHDatePickView.separator)
if arr.count == 3 {
let year = Int(arr[0]) ?? 0
let month = Int(arr[1]) ?? 0
let day = Int(arr[2]) ?? 0
let now = Date()
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
let current = formatter.string(from: now)
let curArr = current.components(separatedBy:"-")
if curArr.count == 3 {
let cyear = Int(curArr[0]) ?? 0
let cmonth = Int(curArr[1]) ?? 0
let cday = Int(curArr[2]) ?? 0
var age = cyear - year
if cmonth < month {
age -= 1
} else if cmonth == month && cday < day {
age -= 1
}
return age
}
}
return 0
}
func is18YearsOld() -> Bool {
let age = getAge(birthday: birthday)
return age >= 18
}
var relationType:YHFamilyMemberType {
get {
......
......@@ -38,6 +38,13 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
// 是否必须字段
var isMust:Bool = false
var answerBlock:(([YHFormChoiceItem], Int)->Void)?
// 是否能点击两个按钮
var isCanEdit:Bool = true {
didSet {
answer1Btn.isUserInteractionEnabled = isCanEdit
answer2Btn.isUserInteractionEnabled = isCanEdit
}
}
var title:String? {
didSet {
......
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