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

// 学历/专业资格

parent dc428ae0
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
import UIKit import UIKit
import SwifterSwift import SwifterSwift
import Toast_Swift
class YHEducationDetailVC: YHBaseViewController { class YHEducationDetailVC: YHBaseViewController {
//【WARNING!】新添加 传orderId 已有信息传detailId
// 订单ID // 订单ID
var orderId: Int = 0 var orderId: Int = 0
// 学历ID // 学历ID
...@@ -82,9 +84,9 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -82,9 +84,9 @@ class YHEducationDetailVC: YHBaseViewController {
} }
loadInfo() loadInfo()
if self.detailId != 0 { // 有学历ID则有历史学历 if self.detailId != 0 { // 有学历ID则该学历已存在
getDetailInfo() getDetailInfo()
} else { } else { // 该学历是新添加的
detailInfo.orderId = orderId detailInfo.orderId = orderId
} }
} }
...@@ -136,7 +138,7 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -136,7 +138,7 @@ class YHEducationDetailVC: YHBaseViewController {
item08.tips = "请输入城市".local item08.tips = "请输入城市".local
} else { } else {
item08.value = detailInfo.schoolAddress?.area?.joined(separator: ",") item08.value = detailInfo.schoolAddress?.area.joined(separator: ",")
item08.placeHolder = "请选择出生城市".local item08.placeHolder = "请选择出生城市".local
item08.tips = "请选择出生城市".local item08.tips = "请选择出生城市".local
} }
...@@ -190,7 +192,11 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -190,7 +192,11 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
// 只有国外城市才需输入,国内城市使用的是选择器 // 只有国外城市才需输入,国内城市使用的是选择器
if detailItem.type == .educationCity { if detailItem.type == .educationCity {
detailInfo.schoolAddress?.foreign = text if let text = text, !text.isEmpty {
detailInfo.schoolAddress?.foreign = text
} else {
detailInfo.schoolAddress?.foreign = ""
}
} else if detailItem.type == .educationMajor { } else if detailItem.type == .educationMajor {
detailInfo.professional = text detailInfo.professional = text
...@@ -386,7 +392,9 @@ extension YHEducationDetailVC { ...@@ -386,7 +392,9 @@ extension YHEducationDetailVC {
[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 {
detailInfo = self.educationRequest.educationDetailInfo! if let educationDetailInfo = self.educationRequest.educationDetailInfo {
detailInfo = educationDetailInfo
}
loadInfo() loadInfo()
} }
} }
...@@ -394,7 +402,7 @@ extension YHEducationDetailVC { ...@@ -394,7 +402,7 @@ extension YHEducationDetailVC {
func saveDetailInfo() { func saveDetailInfo() {
// detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理 // detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理
let dict:[String : Any] = ["verify": 0, let dict:[String : Any] = ["verify": 0,
"id": detailInfo.id, "id": detailInfo.id,
"order_id": detailInfo.orderId, "order_id": detailInfo.orderId,
...@@ -405,7 +413,7 @@ extension YHEducationDetailVC { ...@@ -405,7 +413,7 @@ extension YHEducationDetailVC {
"graduate_time": detailInfo.graduateTime ?? "", "graduate_time": detailInfo.graduateTime ?? "",
"professional": detailInfo.professional ?? "", "professional": detailInfo.professional ?? "",
"school_address_aboard": "", "school_address_aboard": "",
"type": "", "type": detailInfo.type ?? "",
"school_address": ["country": detailInfo.schoolAddress?.country ?? "", "school_address": ["country": detailInfo.schoolAddress?.country ?? "",
"area": detailInfo.schoolAddress?.area ?? "", "area": detailInfo.schoolAddress?.area ?? "",
"foreign": detailInfo.schoolAddress?.foreign ?? ""], "foreign": detailInfo.schoolAddress?.foreign ?? ""],
...@@ -415,9 +423,13 @@ extension YHEducationDetailVC { ...@@ -415,9 +423,13 @@ extension YHEducationDetailVC {
[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.show(.success(message: "保存成功")) self.view.makeToast("保存成功", duration: 1.0, position:ToastPosition.center)
} else { } else {
// YHHUD.show(.error(message: "保存失败")) self.view.makeToast("保存失败", duration: 1.0, position:ToastPosition.center)
}
DispatchQueue.main.asyncAfter(deadline:.now()+1.0) {
self.view.hideToast()
} }
} }
} }
......
...@@ -7,11 +7,18 @@ ...@@ -7,11 +7,18 @@
// //
import UIKit import UIKit
import Toast_Swift
class YHProfessionalQualificationVC: YHBaseViewController { class YHProfessionalQualificationVC: YHBaseViewController {
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel() //【WARNING!】新添加 传orderId 已有信息传detailId
var familyMemberInfo: YHFamilyMemberGroupInfo? // 订单ID
var orderId: String = ""
// 专业ID
var detailId: String = ""
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
// 专业详情信息
var detailInfo = YHQualificationDetailInfo()
var isChildsEditMode: YHFormTitleItemEditType = .none var isChildsEditMode: YHFormTitleItemEditType = .none
var isBrothersEditMode: YHFormTitleItemEditType = .none var isBrothersEditMode: YHFormTitleItemEditType = .none
...@@ -44,7 +51,7 @@ class YHProfessionalQualificationVC: YHBaseViewController { ...@@ -44,7 +51,7 @@ class YHProfessionalQualificationVC: YHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.gk_navTitle = "学历X".local self.gk_navTitle = "专业资格及会员资格".local
view.backgroundColor = UIColor(hexString:"#F8F8F8") view.backgroundColor = UIColor(hexString:"#F8F8F8")
createUI() createUI()
} }
...@@ -57,6 +64,11 @@ class YHProfessionalQualificationVC: YHBaseViewController { ...@@ -57,6 +64,11 @@ class YHProfessionalQualificationVC: YHBaseViewController {
view.addSubview(tableView); view.addSubview(tableView);
view.addSubview(bottomView) view.addSubview(bottomView)
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
saveDetailInfo()
}
bottomView.snp.makeConstraints { make in bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
...@@ -72,23 +84,41 @@ class YHProfessionalQualificationVC: YHBaseViewController { ...@@ -72,23 +84,41 @@ class YHProfessionalQualificationVC: YHBaseViewController {
} }
loadInfo() loadInfo()
if !self.detailId.isEmpty { // 有专业ID则该专业已存在
reqeustDetailInfo()
} else { // 该专业是新添加的
detailInfo.orderId = orderId
}
} }
func loadInfo() { func loadInfo() {
items.removeAll() items.removeAll()
let title0 = YHFormTitleItem(type: .mainApplicantEducation) let title0 = YHFormTitleItem(type: .mainApplicantEducation)
let item00 = YHFormDetailItem(type: .qualificationCertificateName) let item00 = YHFormDetailItem(type: .qualificationCertificateName)
item00.placeHolder = "请选择资格证书名称".local item00.placeHolder = "请选择资格证书名称".local
item00.value = detailInfo.qualification
let item01 = YHFormDetailItem(type: .conferAgencyFullName) let item01 = YHFormDetailItem(type: .conferAgencyFullName)
item01.placeHolder = "请输入颁授机构全称".local item01.placeHolder = "请输入颁授机构全称".local
item01.value = detailInfo.college
let item02 = YHFormDetailItem(type: .conferTime) let item02 = YHFormDetailItem(type: .conferTime)
item02.placeHolder = "请选择颁授年份".local item02.placeHolder = "请选择颁授年份".local
item02.value = detailInfo.promulgation
let item03 = YHFormDetailItem(type: .conferCountry) let item03 = YHFormDetailItem(type: .conferCountry)
item03.placeHolder = "请选择颁授国家/地区".local item03.placeHolder = "请选择颁授国家/地区".local
item03.value = detailInfo.collegeAddress.country
let item04 = YHFormDetailItem(type: .conferCity) let item04 = YHFormDetailItem(type: .conferCity)
item04.placeHolder = "请选择颁授城市".local item04.placeHolder = "请选择颁授城市".local
if detailInfo.isCollegeInAboard() {
item04.value = detailInfo.collegeAddress.foreign
} else {
item04.value = detailInfo.collegeAddress.area.joined(separator: ",")
}
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02, item03, item04] let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02, item03, item04]
items.append(arr0) items.append(arr0)
...@@ -136,14 +166,34 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo ...@@ -136,14 +166,34 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
// 只有国外城市才需输入,国内城市使用的是选择器
if detailItem.type == .conferCity {
if let text = text, !text.isEmpty {
detailInfo.collegeAddress.foreign = text
} else {
detailInfo.collegeAddress.foreign = ""
}
}
if isEditEnd {
loadInfo()
// saveDetailInfo()
}
}
return cell return cell
} else if cellType == .selectSheet { } else if cellType == .selectSheet {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = "" cell.detail = detailItem.value
return cell return cell
} }
} }
...@@ -186,8 +236,6 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo ...@@ -186,8 +236,6 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
let arr = items[indexPath.section] let arr = items[indexPath.section]
let item:YHFormItemProtocol = arr[indexPath.row] let item:YHFormItemProtocol = arr[indexPath.row]
// 标题 // 标题
if item is YHFormTitleItem { if item is YHFormTitleItem {
return return
...@@ -200,7 +248,9 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo ...@@ -200,7 +248,9 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
[weak self] selectType in [weak self] selectType in
guard let self = self else { return } guard let self = self else { return }
detailInfo.qualification = selectType.title
loadInfo()
saveDetailInfo()
} }
} else if detailItem.type == .conferTime { // 授权年份 } else if detailItem.type == .conferTime { // 授权年份
...@@ -208,7 +258,9 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo ...@@ -208,7 +258,9 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
YHDatePickView.show(type: .yyyy) { YHDatePickView.show(type: .yyyy) {
[weak self] date in [weak self] date in
guard let self = self else { return } guard let self = self else { return }
detailInfo.promulgation = date
loadInfo()
saveDetailInfo()
} }
} else if detailItem.type == .conferCountry { // 授权国家/地区 } else if detailItem.type == .conferCountry { // 授权国家/地区
...@@ -217,15 +269,23 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo ...@@ -217,15 +269,23 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
vc.backLocationStringController = { vc.backLocationStringController = {
[weak self] country in [weak self] country in
guard let self = self else { return } guard let self = self else { return }
detailInfo.collegeAddress.country = country
loadInfo()
saveDetailInfo()
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} else if detailItem.type == .conferCity { // 授权城市 } else if detailItem.type == .conferCity { // 授权城市
if detailInfo.isCollegeInAboard() { return }
let vc = YHAddressViewController() let vc = YHAddressViewController()
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.collegeAddress.area = [string1, string2, string3, string4]
loadInfo()
saveDetailInfo()
} }
self.present(vc, animated: true) self.present(vc, animated: true)
} }
...@@ -272,7 +332,56 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo ...@@ -272,7 +332,56 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
} }
return .defaultType return .defaultType
} }
}
extension YHProfessionalQualificationVC {
func reqeustDetailInfo() {
self.educationRequest.getQualificationDetailInfo(id:self.detailId) {
[weak self] success, error in
guard let self = self else { return }
if success {
if let qualificationDetailInfo = self.educationRequest.qualificationDetailInfo {
detailInfo = qualificationDetailInfo
}
loadInfo()
}
}
}
func saveDetailInfo() {
var dict:[String : Any] = [:]
if detailId.isEmpty { // 新增数据
dict = ["verify" : 0,
"college":detailInfo.college,
"college_address_aboard":"",
"id":"",
"order_id" : detailInfo.orderId,
"promulgation" : detailInfo.promulgation,
"qualification" : detailInfo.qualification,
"college_address":["area":[],
"country":"",
"details":"",
"foreign":""]]
} else { // 已有数据
dict = detailInfo.toDictionary() ?? [:]
dict["verify"] = 0
}
print(dict)
self.educationRequest.saveQualificationInfo(params: dict) {
[weak self] success, error in
guard let self = self else { return }
if success {
YHHUD.flash(message: "保存成功")
} else {
YHHUD.flash(message: "保存失败")
}
}
}
} }
...@@ -34,8 +34,8 @@ class YHEducationListInfo: SmartCodable { ...@@ -34,8 +34,8 @@ class YHEducationListInfo: SmartCodable {
} }
class YHEducationInfo: SmartCodable { class YHEducationInfo: SmartCodable {
var id: Int = -1 var id: Int = 0
var orderId: Int = -1 var orderId: Int = 0
var college: String? var college: String?
var background: String? var background: String?
var professional: String? var professional: String?
...@@ -60,8 +60,8 @@ class YHEducationInfo: SmartCodable { ...@@ -60,8 +60,8 @@ class YHEducationInfo: SmartCodable {
} }
class YHQualificationInfo: SmartCodable { class YHQualificationInfo: SmartCodable {
var id: Int = -1 var id: Int = 0
var orderId: Int = -1 var orderId: Int = 0
var qualification: String? var qualification: String?
var vacantNum: Int = 0 var vacantNum: Int = 0
...@@ -92,7 +92,7 @@ class YHEducationDetailInfo: SmartCodable { ...@@ -92,7 +92,7 @@ class YHEducationDetailInfo: SmartCodable {
var degreeType: String? var degreeType: String?
var remark: String? var remark: String?
var average: String? var average: String?
var schoolAddress: YHSchoolAddress? var schoolAddress: YHCollegeAddress?
var schoolAddressAboard: Int = 0 var schoolAddressAboard: Int = 0
var oldId: Int = 0 var oldId: Int = 0
var createdAt: String? var createdAt: String?
...@@ -142,29 +142,89 @@ class YHEducationDetailInfo: SmartCodable { ...@@ -142,29 +142,89 @@ class YHEducationDetailInfo: SmartCodable {
// 学校是否在国外 默认是在国内 // 学校是否在国外 默认是在国内
func isSchoolInAboard() -> Bool { func isSchoolInAboard() -> Bool {
guard let schoolAddress = schoolAddress else { return false } guard let schoolAddress = schoolAddress else { return false }
guard let country = schoolAddress.country else { return false } if schoolAddress.country.isEmpty { return false }
if country.contains("中国") { if schoolAddress.country.contains("中国") {
return false return false
} }
return true return true
} }
} }
class YHSchoolAddress: Codable { class YHCollegeAddress: Codable {
var area: [String]?
var country: String? var area: [String] = []
var foreign: String? var country: String = ""
var details: String = ""
var foreign: String = ""
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case area = "area" case area = "area"
case country = "country" case country = "country"
case details = "details"
case foreign = "foreign" case foreign = "foreign"
} }
required init(area: [String]?, country: String?, foreign: String?) { required init() {
self.area = area
self.country = country
self.foreign = foreign
} }
} }
class YHQualificationDetailInfo: SmartCodable {
var id: String = ""
var orderId: String = ""
var college: String = ""
var collegeAddress: YHCollegeAddress = YHCollegeAddress()
var collegeAddressAboard: Int = 0
var promulgation: String = ""
var qualification: String = ""
var remark: String = ""
var oldId: Int = 0
var createdAt: String = ""
var updatedAt: String = ""
var deletedAt: String = ""
var operatorName: String = ""
var operatorEnglishName: String = ""
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 collegeAddress = "college_address"
case collegeAddressAboard = "college_address_aboard"
case promulgation = "promulgation"
case qualification = "qualification"
case remark = "remark"
case oldId = "old_id"
case createdAt = "created_at"
case updatedAt = "updated_at"
case deletedAt = "deleted_at"
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"
}
// 学校是否在国外 默认是在国内
func isCollegeInAboard() -> Bool {
if collegeAddress.country.isEmpty { return false }
if collegeAddress.country.contains("中国") {
return false
}
return true
}
required init() {
}
}
...@@ -12,7 +12,9 @@ class YHEducationRequestViewModel { ...@@ -12,7 +12,9 @@ class YHEducationRequestViewModel {
// 学历和专业信息 // 学历和专业信息
var educationInfo: YHEducationListInfo? var educationInfo: YHEducationListInfo?
// 学历详情信息 // 学历详情信息
var educationDetailInfo:YHEducationDetailInfo? var educationDetailInfo: YHEducationDetailInfo?
// 专业详情信息
var qualificationDetailInfo: YHQualificationDetailInfo?
// 请求学历和专业证书信息 // 请求学历和专业证书信息
func requestEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func requestEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
...@@ -104,4 +106,148 @@ class YHEducationRequestViewModel { ...@@ -104,4 +106,148 @@ class YHEducationRequestViewModel {
} }
} }
// 删除学历
func deleteEducationInfo(id:Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.deleteEducationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:["id" : id]) {[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)
}
}
// 删除专业
func deleteQualificationInfo(id:Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Qualification.deleteQualificationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:["id" : id]) {[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)
}
}
// 保存所有
func saveAllEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.saveAllEduAndQuaInfoApi
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)
}
}
// 获取专业详情
func getQualificationDetailInfo(id:String, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Qualification.getQualificationDetailInfoApi
let _ = YHNetRequest.getRequest(url: strUrl, params:["id" : id]) {[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 = YHQualificationDetailInfo.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
qualificationDetailInfo = resultModel
callBackBlock(true,nil)
} failBlock: { err in
callBackBlock(false,err)
}
}
// 保存专业信息
func saveQualificationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
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()
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)
}
}
} }
...@@ -12,6 +12,14 @@ class YHEducationInfoCell: UITableViewCell { ...@@ -12,6 +12,14 @@ class YHEducationInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHEducationInfoCell" static let cellReuseIdentifier = "YHEducationInfoCell"
let horizonalGap = 18.0 let horizonalGap = 18.0
var deleteBlock:(()->Void)?
var isShowDeleteBtn:Bool = false {
didSet {
deleteButton.isHidden = !isShowDeleteBtn
timeLabel.isHidden = isShowDeleteBtn
arrowImgView.isHidden = isShowDeleteBtn
}
}
lazy var titleLabel: UILabel = { lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
...@@ -38,6 +46,17 @@ class YHEducationInfoCell: UITableViewCell { ...@@ -38,6 +46,17 @@ class YHEducationInfoCell: UITableViewCell {
return label return label
}() }()
private lazy var deleteButton: UIButton = {
let btn = UIButton()
btn.setTitle("删除".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(.failColor, for: .normal)
btn.addTarget(self, action: #selector(didClickDeleteBtn(btn:)), for: .touchUpInside)
btn.isHidden = true
return btn
}()
private lazy var arrowImgView: UIImageView = { private lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow")) let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView return imgView
...@@ -66,6 +85,13 @@ class YHEducationInfoCell: UITableViewCell { ...@@ -66,6 +85,13 @@ class YHEducationInfoCell: UITableViewCell {
setupUI() setupUI()
} }
@objc func didClickDeleteBtn(btn:UIButton) {
if let deleteBlock = deleteBlock {
deleteBlock()
}
}
func setupUI() { func setupUI() {
self.selectionStyle = .none self.selectionStyle = .none
...@@ -74,6 +100,7 @@ class YHEducationInfoCell: UITableViewCell { ...@@ -74,6 +100,7 @@ class YHEducationInfoCell: UITableViewCell {
contentView.addSubview(timeLabel) contentView.addSubview(timeLabel)
contentView.addSubview(arrowImgView) contentView.addSubview(arrowImgView)
contentView.addSubview(bottomLine) contentView.addSubview(bottomLine)
contentView.addSubview(deleteButton)
titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal) titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
...@@ -88,6 +115,12 @@ class YHEducationInfoCell: UITableViewCell { ...@@ -88,6 +115,12 @@ class YHEducationInfoCell: UITableViewCell {
make.centerY.equalTo(titleLabel) make.centerY.equalTo(titleLabel)
} }
deleteButton.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(64, 40))
make.centerY.equalTo(titleLabel)
make.right.equalToSuperview()
}
arrowImgView.snp.makeConstraints { make in arrowImgView.snp.makeConstraints { make in
make.width.height.equalTo(20.0) make.width.height.equalTo(20.0)
make.centerY.equalTo(titleLabel) make.centerY.equalTo(titleLabel)
......
...@@ -49,6 +49,20 @@ class YHAllApiName { ...@@ -49,6 +49,20 @@ class YHAllApiName {
static let getEducationDetailInfoApi = "frontend/education/detail" static let getEducationDetailInfoApi = "frontend/education/detail"
// 保存学历信息 // 保存学历信息
static let saveEducationInfoApi = "frontend/education/save" static let saveEducationInfoApi = "frontend/education/save"
// 删除学历
static let deleteEducationInfoApi = "frontend/education/del"
// 保存所有信息
static let saveAllEduAndQuaInfoApi = "frontend/education/save_all"
}
struct Qualification {
// 获取学历详情信息
static let getQualificationDetailInfoApi = "frontend/qualification/detail"
// 删除专业
static let deleteQualificationInfoApi = "frontend/qualification/del"
// 保存专业
static let saveQualificationInfoApi = "frontend/qualification/save"
} }
//Users //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