Commit dc428ae0 authored by Steven杜宇's avatar Steven杜宇

// 学历信息

parent cfbb8cdc
......@@ -335,7 +335,7 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource
} else if indexPath.row == 3 {
//学历/专业资格
let vc = YHEducationalQualificationVC()
vc.orderId = orderId
// vc.orderId = orderId
vc.orderId = 133971
navigationController?.pushViewController(vc)
......
......@@ -14,7 +14,7 @@ class YHFamilyRequestViewModel {
//请求所有家庭成员信息
func getFamilyInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.familyInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
YHHUD.show(.progress(message: "数据加载中..."))
......@@ -82,7 +82,7 @@ if let brother = dic["brother"], brother is [[String: Any]] {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.familyInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
......@@ -109,7 +109,7 @@ if let brother = dic["brother"], brother is [[String: Any]] {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.familyMemberDeleteApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyMemberDeleteApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in
YHHUD.hide()
......
......@@ -21,7 +21,11 @@
print(selectType.title)
}
// 【扩展新类型】
1)先增加一个YHFormPickerViewType类型
2)再扩展其关联类型 YHFormPickerViewSubType
3)补充新增类型后的方法 YHFormPickerView的getSubType方法 YHFormPickerViewSubType的title和index方法
4)填充数据源 详情见 属性 dataDict 懒加载方法
*/
......@@ -209,7 +213,7 @@ class YHFormPickerView: UIView {
[YHFormPickerViewItem(type: .degreeLocation(.domestic)),
YHFormPickerViewItem(type: .degreeLocation(.forgin))],
// 专业证书
.professionCertificate:
[YHFormPickerViewItem(type: .professionCertificate(.CFA)),
YHFormPickerViewItem(type: .professionCertificate(.CFP)),
......
......@@ -11,7 +11,7 @@ import UIKit
class YHEducationalQualificationVC: YHBaseViewController {
var orderId:Int?
var orderId:Int = 0
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
var familyMemberInfo: YHFamilyMemberGroupInfo?
var isChildsEditMode: YHFormTitleItemEditType = .none
......@@ -55,6 +55,7 @@ class YHEducationalQualificationVC: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
requestEducationInfo()
}
func createUI() {
......@@ -76,7 +77,6 @@ class YHEducationalQualificationVC: YHBaseViewController {
}
loadInfo()
requestEducationInfo()
}
func loadInfo() {
......@@ -186,6 +186,23 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
} else {
cell.title = ""
}
cell.clickBlock = {
[weak self] in
guard let self = self else { return }
if detailItem.type == .addEducation { // 学历
let vc = YHEducationDetailVC()
vc.orderId = self.orderId
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .addCertificateInfo { // 证书
let vc = YHProfessionalQualificationVC()
self.navigationController?.pushViewController(vc)
}
return
}
return cell
}
......@@ -207,6 +224,21 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
let answers = [YHFormChoiceItem(title: "是".local, isSelect: select0),YHFormChoiceItem(title: "否".local, isSelect: select1)]
cell.answerArr = answers
cell.answerBlock = {
[weak self] (arr, selectIndex) in
guard let self = self else { return }
let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? 1 : 2)
if detailItem.key == "qualification" {
self.educationInfo?.qualification = option
} else if detailItem.key == "graduate" {
self.educationInfo?.graduate = option
}
loadInfo()
}
return cell
}
......@@ -308,15 +340,6 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
}
if item is YHFormAddItem {
let detailItem = item as! YHFormAddItem
if detailItem.type == .addEducation {
let vc = YHEducationDetailVC()
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .addCertificateInfo {
let vc = YHProfessionalQualificationVC()
self.navigationController?.pushViewController(vc)
}
return
}
......@@ -324,6 +347,10 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
let detailItem = item as! YHFormDetailItem
if detailItem.type == .educationInfo { // 学历
let vc = YHEducationDetailVC()
if let eduList = educationInfo?.eduList, indexPath.row-1 < eduList.count {
let eduInfo = eduList[indexPath.row-1]
vc.detailId = eduInfo.id
}
self.navigationController?.pushViewController(vc)
return
}
......@@ -333,9 +360,6 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
return
}
}
let vc = YHEducationDetailVC()
self.navigationController?.pushViewController(vc)
}
func createDefaultCell(_ indexPath: IndexPath) -> UITableViewCell {
......@@ -364,7 +388,7 @@ extension YHEducationalQualificationVC {
// 请求家庭成员信息
func requestEducationInfo() {
self.educationRequest.requestEducationInfo(params: ["order_id": self.orderId!]) {
self.educationRequest.requestEducationInfo(params: ["order_id": self.orderId]) {
[weak self] success, error in
guard let self = self else { return }
if success {
......
......@@ -9,7 +9,7 @@
import UIKit
import SmartCodable
class YHEducationListInfo:SmartCodable {
class YHEducationListInfo: SmartCodable {
var eduList: [YHEducationInfo]?
var eduCount: Int = 0
var quaList: [YHQualificationInfo]?
......@@ -76,3 +76,95 @@ class YHQualificationInfo: SmartCodable {
}
}
class YHEducationDetailInfo: SmartCodable {
var id: Int = 0
var orderId: Int = 0
var college: String?
var isTop: Int = 0
var type: String?
var admissionTime: String?
var graduateTime: String?
var background: String?
var professional: String?
var degreeType: String?
var remark: String?
var average: String?
var schoolAddress: YHSchoolAddress?
var schoolAddressAboard: Int = 0
var oldId: Int = 0
var createdAt: String?
var updatedAt: String?
var deletedAt: SmartAny?
var isShow: Int = 0
var operatorName: SmartAny?
var operatorEnglishName: SmartAny?
var operatorId: Int = 0
var matchListing: Int = 0
var createFromAppid: Int = 0
var updateFromAppid: Int = 0
var customerCenterId: Int = 0
enum CodingKeys: String, CodingKey {
case id = "id"
case orderId = "order_id"
case college = "college"
case isTop = "is_top"
case type = "type"
case admissionTime = "admission_time"
case graduateTime = "graduate_time"
case background = "background"
case professional = "professional"
case degreeType = "degree_type"
case remark = "remark"
case average = "average"
case schoolAddress = "school_address"
case schoolAddressAboard = "school_address_aboard"
case oldId = "old_id"
case createdAt = "created_at"
case updatedAt = "updated_at"
case deletedAt = "deleted_at"
case isShow = "is_show"
case operatorName = "operator_name"
case operatorEnglishName = "operator_english_name"
case operatorId = "operator_id"
case matchListing = "match_listing"
case createFromAppid = "create_from_appid"
case updateFromAppid = "update_from_appid"
case customerCenterId = "customer_center_id"
}
required init() {
}
// 学校是否在国外 默认是在国内
func isSchoolInAboard() -> Bool {
guard let schoolAddress = schoolAddress else { return false }
guard let country = schoolAddress.country else { return false }
if country.contains("中国") {
return false
}
return true
}
}
class YHSchoolAddress: Codable {
var area: [String]?
var country: String?
var foreign: String?
enum CodingKeys: String, CodingKey {
case area = "area"
case country = "country"
case foreign = "foreign"
}
required init(area: [String]?, country: String?, foreign: String?) {
self.area = area
self.country = country
self.foreign = foreign
}
}
......@@ -9,14 +9,17 @@
import UIKit
class YHEducationRequestViewModel {
// 学历和专业信息
var educationInfo: YHEducationListInfo?
// 学历详情信息
var educationDetailInfo:YHEducationDetailInfo?
// 添加家庭成员
// 请求学历和专业证书信息
func requestEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.educationInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.getEducationAndQulificationInfoApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
......@@ -41,4 +44,64 @@ class YHEducationRequestViewModel {
callBackBlock(false,err)
}
}
// 获取学历详情
func getEducationDetailInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.getEducationDetailInfoApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
let dic = model.data?.peel as? [AnyHashable : Any]
guard let resultModel = YHEducationDetailInfo.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
educationDetailInfo = resultModel
callBackBlock(true,nil)
} failBlock: { err in
callBackBlock(false,err)
}
}
// 保存学历
func saveEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
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()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
if model.code == NetWorkCode.success.rawValue {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
......@@ -32,19 +32,23 @@ class YHAllApiName {
//保存其他资料信息
static let updateOtherInfoApi = "frontend/order/updateOrderOtherInformation"
}
struct Family {
// 获取家庭成员信息 添加家庭成员也用这个
static let familyInfoApi = "frontend/order/information/family"
// 删除家庭成员信息
static let familyMemberDeleteApi = "frontend/order/information/family/delete"
}
struct Education {
// 获取学历及证书相关信息
static let educationInfoApi = "frontend/education/list"
static let getEducationAndQulificationInfoApi = "frontend/education/list"
// 获取学历详情信息
static let getEducationDetailInfoApi = "frontend/education/detail"
// 保存学历信息
static let saveEducationInfoApi = "frontend/education/save"
}
//Users
......
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