Commit 6f32074f authored by Steven杜宇's avatar Steven杜宇

// 学历资格

parent e563e66e
...@@ -70,7 +70,7 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -70,7 +70,7 @@ class YHEducationDetailVC: YHBaseViewController {
bottomView.saveBlock = { bottomView.saveBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
saveDetailInfo(isNeedPop: true) saveDetailInfo(isNeedPop: true, isShowToast: true)
} }
bottomView.submitBlock = { bottomView.submitBlock = {
...@@ -228,7 +228,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -228,7 +228,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
if isEditEnd { if isEditEnd {
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast:false)
} }
} }
} }
...@@ -311,7 +311,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -311,7 +311,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} }
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast:false)
} }
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
...@@ -323,7 +323,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -323,7 +323,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.teachingFormat = selectType.title detailInfo.teachingFormat = selectType.title
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast:false)
} }
} }
...@@ -340,7 +340,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -340,7 +340,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} }
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast:false)
} }
} }
...@@ -352,7 +352,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -352,7 +352,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.degree = selectType.title detailInfo.degree = selectType.title
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast:false)
} }
} }
...@@ -364,7 +364,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -364,7 +364,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.degreeType = selectItem.title detailInfo.degreeType = selectItem.title
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast:false)
} }
} }
...@@ -377,7 +377,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -377,7 +377,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.schoolAddress.country = country detailInfo.schoolAddress.country = country
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast:false)
} }
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
...@@ -390,10 +390,17 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -390,10 +390,17 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
vc.backLocationStringController = { vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in [weak self] (string1, string2, string3, string4) in
guard let self = self else { return } 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() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast:false)
} }
} }
self.present(vc, animated: true) self.present(vc, animated: true)
...@@ -480,7 +487,7 @@ extension YHEducationDetailVC { ...@@ -480,7 +487,7 @@ extension YHEducationDetailVC {
YHHUD.flash(message: "资料还未填完") YHHUD.flash(message: "资料还未填完")
return return
} }
saveDetailInfo(isNeedPop: true) saveDetailInfo(isNeedPop: true, isShowToast: true)
} }
// 检查填写信息完整性 // 检查填写信息完整性
...@@ -509,7 +516,7 @@ extension YHEducationDetailVC { ...@@ -509,7 +516,7 @@ extension YHEducationDetailVC {
} }
// 保存信息 isNeedPop:保存成功后是否退出该页面 // 保存信息 isNeedPop:保存成功后是否退出该页面
func saveDetailInfo(isNeedPop:Bool) { func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) {
// detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理 // detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理
// let dict:[String : Any] = [ // let dict:[String : Any] = [
...@@ -531,17 +538,21 @@ extension YHEducationDetailVC { ...@@ -531,17 +538,21 @@ extension YHEducationDetailVC {
guard var dict:[String:Any] = detailInfo.toDictionary() else { return } guard var dict:[String:Any] = detailInfo.toDictionary() else { return }
dict["order_id"] = self.orderId dict["order_id"] = self.orderId
self.educationRequest.saveEducationInfo(params: dict) { self.educationRequest.saveEducationInfo(params: dict, isSilent: !isShowToast) {
[weak self] success, error in [weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if success { if success {
YHHUD.flash(message: "保存成功") if isShowToast {
YHHUD.flash(message: "保存成功")
}
if isNeedPop { if isNeedPop {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
} else { } else {
YHHUD.flash(message: "保存失败") if isShowToast {
YHHUD.flash(message: "保存失败")
}
} }
} }
} }
......
...@@ -153,7 +153,7 @@ class YHEducationInfoListVC: YHBaseViewController { ...@@ -153,7 +153,7 @@ class YHEducationInfoListVC: YHBaseViewController {
let title2 = YHFormTitleItem(type: .edutionalCertificateNameAndBirthday) let title2 = YHFormTitleItem(type: .edutionalCertificateNameAndBirthday)
var arr2:[YHFormItemProtocol] = [title2] var arr2:[YHFormItemProtocol] = [title2]
// 问题集合 // 问题集合
let questions = YHQuestionInfo.getEducationQuestion() let questions = YHQuestionInfo.getEducationQuestion(eduList: educationInfo)
for questionInfo in questions { for questionInfo in questions {
if questionInfo.key == "qualification" { if questionInfo.key == "qualification" {
questionInfo.answer = educationInfo.isNameSame questionInfo.answer = educationInfo.isNameSame
......
...@@ -308,7 +308,14 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -308,7 +308,14 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
vc.backLocationStringController = { vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in [weak self] (string1, string2, string3, string4) in
guard let self = self else { return } 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() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false, isShowToast: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
...@@ -391,12 +398,12 @@ extension YHQualificationDetailVC { ...@@ -391,12 +398,12 @@ extension YHQualificationDetailVC {
func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) { func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) {
var dict:[String : Any] = ["orderId":self.orderId] var dict:[String : Any] = ["orderId":self.orderId]
var quaDict:[String : Any] = detailInfo.toDictionary() ?? [:] let quaDict:[String : Any] = detailInfo.toDictionary() ?? [:]
dict["qua_data"] = quaDict dict["qua_data"] = quaDict
print(dict) print(dict)
self.educationRequest.saveQualificationInfo(params: dict) { self.educationRequest.saveQualificationInfo(params: dict, isSilent:!isShowToast) {
[weak self] success, error in [weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if success { if success {
......
...@@ -17,6 +17,10 @@ class YHEducationListInfo: SmartCodable { ...@@ -17,6 +17,10 @@ class YHEducationListInfo: SmartCodable {
var isSpouseNameSame:Bool? var isSpouseNameSame:Bool?
// 1=已婚,2=未婚,3=离婚,4=分居,5=丧偶,6=事实婚姻,7=鳏寡 // 1=已婚,2=未婚,3=离婚,4=分居,5=丧偶,6=事实婚姻,7=鳏寡
var married: Int = 0 var married: Int = 0
func isMarried() ->Bool {
return married != 2
}
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case orderId = "order_id" case orderId = "order_id"
......
...@@ -71,15 +71,19 @@ class YHEducationRequestViewModel { ...@@ -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 strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.saveEducationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide() if !isSilent {
YHHUD.hide()
}
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == NetWorkCode.success.rawValue {
...@@ -195,15 +199,19 @@ class YHEducationRequestViewModel { ...@@ -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 strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Qualification.saveQualificationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide() if !isSilent {
YHHUD.hide()
}
guard let self = self else { return } guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue { if json.code == NetWorkCode.success.rawValue {
......
...@@ -37,7 +37,7 @@ class YHQuestionInfo: SmartCodable, YHFormItemProtocol { ...@@ -37,7 +37,7 @@ class YHQuestionInfo: SmartCodable, YHFormItemProtocol {
extension YHQuestionInfo { extension YHQuestionInfo {
// 【问题】学历证书姓名及出生日期正确性 // 【问题】学历证书姓名及出生日期正确性
static func getEducationQuestion() -> [YHQuestionInfo] { static func getEducationQuestion(eduList:YHEducationListInfo) -> [YHQuestionInfo] {
let path = Bundle.main.path(forResource: "YHQuestionList", ofType: "plist") let path = Bundle.main.path(forResource: "YHQuestionList", ofType: "plist")
let questions:[Dictionary] = NSArray(contentsOfFile:path!) as! [Dictionary<String, Any>] let questions:[Dictionary] = NSArray(contentsOfFile:path!) as! [Dictionary<String, Any>]
var res:[YHQuestionInfo] = [] var res:[YHQuestionInfo] = []
...@@ -45,7 +45,13 @@ extension YHQuestionInfo { ...@@ -45,7 +45,13 @@ extension YHQuestionInfo {
guard let questionInfo = YHQuestionInfo.deserialize(dict: dict as? [AnyHashable : Any]) else { guard let questionInfo = YHQuestionInfo.deserialize(dict: dict as? [AnyHashable : Any]) else {
continue continue
} }
res.append(questionInfo) if questionInfo.key == "graduate" {
if eduList.isMarried() {
res.append(questionInfo)
}
} else {
res.append(questionInfo)
}
} }
return res return res
} }
......
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