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

// 学历资格

parent e563e66e
......@@ -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,18 +538,22 @@ 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 {
if isShowToast {
YHHUD.flash(message: "保存成功")
}
if isNeedPop {
self.navigationController?.popViewController(animated: true)
}
} else {
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 {
......
......@@ -18,6 +18,10 @@ class YHEducationListInfo: SmartCodable {
// 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"
case eduList = "edu_list"
......
......@@ -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?)->()) {
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
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?)->()) {
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
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,8 +45,14 @@ extension YHQuestionInfo {
guard let questionInfo = YHQuestionInfo.deserialize(dict: dict as? [AnyHashable : Any]) else {
continue
}
if questionInfo.key == "graduate" {
if eduList.isMarried() {
res.append(questionInfo)
}
} else {
res.append(questionInfo)
}
}
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