Commit a97c540f authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  国家
  // 静默保存
  // 学历资格
  调试主申请人接口
  国家
  接口添加
  upload 封装
parents e0753515 1abfcb9b
...@@ -325,28 +325,32 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource ...@@ -325,28 +325,32 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource
if indexPath.row == 0 { if indexPath.row == 0 {
//主申请人信息 //主申请人信息
let vc = YHMainApplicantInformationViewController() let vc = YHMainApplicantInformationViewController()
vc.orderId = orderId ?? 0
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
} else if indexPath.row == 1 { } else if indexPath.row == 1 {
//家庭程序信息 //家庭程序信息
let vc = YHFamilyMemberInfoVC(orderId: orderId ?? 0) let vc = YHFamilyMemberInfoVC(orderId: orderId ?? 0)
vc.orderId = 133971 vc.orderId = orderId ?? 0
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
} else if indexPath.row == 2 { } else if indexPath.row == 2 {
//基本信息 //基本信息
let vc = YHBasicInfoFillViewController() let vc = YHBasicInfoFillViewController()
vc.orderId = orderId vc.orderId = orderId
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
} else if indexPath.row == 3 { } else if indexPath.row == 3 {
//学历/专业资格 //学历/专业资格
let vc = YHEducationInfoListVC() let vc = YHEducationInfoListVC()
// vc.orderId = orderId vc.orderId = orderId ?? 0
vc.orderId = 133971
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
} else if indexPath.row == 4 { } else if indexPath.row == 4 {
//工作经历 //工作经历
let vc = YHWorkExperienceListViewController() let vc = YHWorkExperienceListViewController()
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
} else if indexPath.row == 5 { } else if indexPath.row == 5 {
//其他信息 //其他信息
let vc = YHOtherInfoFillViewController() let vc = YHOtherInfoFillViewController()
......
...@@ -11,7 +11,8 @@ import SwifterSwift ...@@ -11,7 +11,8 @@ import SwifterSwift
import Toast_Swift import Toast_Swift
class YHEducationDetailVC: YHBaseViewController { class YHEducationDetailVC: YHBaseViewController {
//【WARNING!】新添加 传orderId 已有信息传detailId
//【WARNING!】新添加 传orderId 已有信息传detailId和orderId
// 订单ID // 订单ID
var orderId: Int = 0 var orderId: Int = 0
// 学历ID // 学历ID
...@@ -94,8 +95,6 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -94,8 +95,6 @@ class YHEducationDetailVC: YHBaseViewController {
loadInfo() loadInfo()
if self.detailId != 0 { // 有学历ID则该学历已存在 if self.detailId != 0 { // 有学历ID则该学历已存在
getDetailInfo() getDetailInfo()
} else { // 该学历是新添加的
detailInfo.orderId = orderId
} }
} }
...@@ -112,7 +111,7 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -112,7 +111,7 @@ class YHEducationDetailVC: YHBaseViewController {
let item01 = YHFormDetailItem(type: .educationStyle) let item01 = YHFormDetailItem(type: .educationStyle)
item01.placeHolder = "请选择授课形式".local item01.placeHolder = "请选择授课形式".local
item01.tips = "请选择授课形式".local item01.tips = "请选择授课形式".local
item01.value = detailInfo.type item01.value = detailInfo.teachingFormat
let item02 = YHFormDetailItem(type: .educationTime) let item02 = YHFormDetailItem(type: .educationTime)
item02.placeHolder = "请选择年月".local item02.placeHolder = "请选择年月".local
...@@ -128,12 +127,12 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -128,12 +127,12 @@ class YHEducationDetailVC: YHBaseViewController {
let item04 = YHFormDetailItem(type: .educationMajor) let item04 = YHFormDetailItem(type: .educationMajor)
item04.placeHolder = "请输入专业".local item04.placeHolder = "请输入专业".local
item04.tips = "请输入专业".local item04.tips = "请输入专业".local
item04.value = detailInfo.professional item04.value = detailInfo.major
let item05 = YHFormDetailItem(type: .educationDegree) let item05 = YHFormDetailItem(type: .educationDegree)
item05.placeHolder = "请选择学位".local item05.placeHolder = "请选择学位".local
item05.tips = "请选择学位".local item05.tips = "请选择学位".local
item05.value = detailInfo.background item05.value = detailInfo.degree
let item06 = YHFormDetailItem(type: .degreeType) let item06 = YHFormDetailItem(type: .degreeType)
item06.placeHolder = "请选择学位类型".local item06.placeHolder = "请选择学位类型".local
...@@ -222,9 +221,9 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -222,9 +221,9 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .educationMajor { } else if detailItem.type == .educationMajor {
if let text = text, !text.isEmpty { if let text = text, !text.isEmpty {
detailInfo.professional = text detailInfo.major = text
} else { } else {
detailInfo.professional = "" detailInfo.major = ""
} }
} }
if isEditEnd { if isEditEnd {
...@@ -329,7 +328,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -329,7 +328,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
YHFormPickerView.show(type: .edution, selectType: .education(.fullTime)) { YHFormPickerView.show(type: .edution, selectType: .education(.fullTime)) {
[weak self] selectType in [weak self] selectType in
guard let self = self else { return } guard let self = self else { return }
detailInfo.type = selectType.title detailInfo.teachingFormat = selectType.title
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false)
...@@ -358,7 +357,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -358,7 +357,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
YHFormPickerView.show(type: .degree, selectType: .degree(.bachelor)) { YHFormPickerView.show(type: .degree, selectType: .degree(.bachelor)) {
[weak self] selectType in [weak self] selectType in
guard let self = self else { return } guard let self = self else { return }
detailInfo.background = selectType.title detailInfo.degree = selectType.title
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false)
...@@ -496,11 +495,11 @@ extension YHEducationDetailVC { ...@@ -496,11 +495,11 @@ extension YHEducationDetailVC {
func checkIntegrity() -> Bool { func checkIntegrity() -> Bool {
if detailInfo.college.isEmpty if detailInfo.college.isEmpty
|| detailInfo.type.isEmpty || detailInfo.teachingFormat.isEmpty
|| detailInfo.admissionTime.isEmpty || detailInfo.admissionTime.isEmpty
|| detailInfo.graduateTime.isEmpty || detailInfo.graduateTime.isEmpty
|| detailInfo.professional.isEmpty || detailInfo.major.isEmpty
|| detailInfo.background.isEmpty || detailInfo.degree.isEmpty
|| detailInfo.degreeType.isEmpty || detailInfo.degreeType.isEmpty
|| detailInfo.schoolAddress.country.isEmpty || detailInfo.schoolAddress.country.isEmpty
{ {
...@@ -521,21 +520,24 @@ extension YHEducationDetailVC { ...@@ -521,21 +520,24 @@ extension YHEducationDetailVC {
func saveDetailInfo(isNeedPop:Bool) { func saveDetailInfo(isNeedPop:Bool) {
// detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理 // detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理
let dict:[String : Any] = ["verify": 0, // let dict:[String : Any] = [
"id": detailInfo.id, // "order_id":
"order_id": detailInfo.orderId, // "id": detailInfo.id,
"admission_time": detailInfo.admissionTime, // "admission_time": detailInfo.admissionTime,
"background": detailInfo.background, // "background": detailInfo.major,
"college": detailInfo.college, // "college": detailInfo.college,
"degree_type": detailInfo.degreeType, // "degree_type": detailInfo.degreeType,
"graduate_time": detailInfo.graduateTime, // "graduate_time": detailInfo.graduateTime,
"professional": detailInfo.professional, // "professional": detailInfo.major,
"school_address_aboard": "", // "school_address_aboard": "",
"type": detailInfo.type, // "type": detailInfo.teachingFormat,
"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],
] // ]
guard var dict:[String:Any] = detailInfo.toDictionary() else { return }
dict["order_id"] = self.orderId
self.educationRequest.saveEducationInfo(params: dict) { self.educationRequest.saveEducationInfo(params: dict) {
[weak self] success, error in [weak self] success, error in
......
...@@ -156,10 +156,10 @@ class YHEducationInfoListVC: YHBaseViewController { ...@@ -156,10 +156,10 @@ class YHEducationInfoListVC: YHBaseViewController {
let questions = YHQuestionInfo.getEducationQuestion() let questions = YHQuestionInfo.getEducationQuestion()
for questionInfo in questions { for questionInfo in questions {
if questionInfo.key == "qualification" { if questionInfo.key == "qualification" {
questionInfo.answer = educationInfo.qualification questionInfo.answer = educationInfo.isNameSame
} else if questionInfo.key == "graduate" { } else if questionInfo.key == "graduate" {
questionInfo.answer = educationInfo.graduate questionInfo.answer = educationInfo.isSpouseNameSame
} }
arr2.append(questionInfo) arr2.append(questionInfo)
} }
...@@ -256,7 +256,7 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -256,7 +256,7 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .addCertificateInfo { // 证书 } else if detailItem.type == .addCertificateInfo { // 证书
let vc = YHQualificationDetailVC() let vc = YHQualificationDetailVC()
vc.orderId = String(self.orderId) vc.orderId = self.orderId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
return return
...@@ -273,11 +273,9 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -273,11 +273,9 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
var select0 = false var select0 = false
var select1 = false var select1 = false
if detailItem.answer == 1 { if let answer = detailItem.answer {
select0 = true select0 = answer
select1 = !answer
} else if detailItem.answer == 2 {
select1 = true
} }
let answers = [YHFormChoiceItem(title: "是".local, isSelect: select0),YHFormChoiceItem(title: "否".local, isSelect: select1)] let answers = [YHFormChoiceItem(title: "是".local, isSelect: select0),YHFormChoiceItem(title: "否".local, isSelect: select1)]
...@@ -288,12 +286,12 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -288,12 +286,12 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
let selectItem:YHFormChoiceItem = arr[selectIndex] let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? 1 : 2) let option = (selectItem.title == "是".local ? true : false)
if detailItem.key == "qualification" { if detailItem.key == "qualification" {
self.educationInfo?.qualification = option self.educationInfo?.isNameSame = option
} else if detailItem.key == "graduate" { } else if detailItem.key == "graduate" {
self.educationInfo?.graduate = option self.educationInfo?.isSpouseNameSame = option
} }
loadInfo() loadInfo()
} }
...@@ -335,8 +333,8 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -335,8 +333,8 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHEducationInfoCell.cellReuseIdentifier, for: indexPath) as! YHEducationInfoCell let cell = tableView.dequeueReusableCell(withIdentifier: YHEducationInfoCell.cellReuseIdentifier, for: indexPath) as! YHEducationInfoCell
cell.titleLabel.text = eduInfo.college cell.titleLabel.text = eduInfo.college
cell.subTitleLabel.text = "" cell.subTitleLabel.text = ""
if let professional = eduInfo.professional, let background = eduInfo.background { if let major = eduInfo.major, let degree = eduInfo.degree {
cell.subTitleLabel.text = String("\(background)-\(professional)") cell.subTitleLabel.text = String("\(degree)-\(major)")
} }
cell.timeLabel.text = "" cell.timeLabel.text = ""
if let admissionTime = eduInfo.admissionTime, let graduateTime = eduInfo.graduateTime { if let admissionTime = eduInfo.admissionTime, let graduateTime = eduInfo.graduateTime {
...@@ -443,6 +441,7 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -443,6 +441,7 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
if let eduList = educationInfo?.eduList, indexPath.row-1 < eduList.count { if let eduList = educationInfo?.eduList, indexPath.row-1 < eduList.count {
let eduInfo = eduList[indexPath.row-1] let eduInfo = eduList[indexPath.row-1]
vc.detailId = eduInfo.id vc.detailId = eduInfo.id
vc.orderId = self.orderId
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
return return
...@@ -451,7 +450,8 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -451,7 +450,8 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
let vc = YHQualificationDetailVC() let vc = YHQualificationDetailVC()
if let quaList = educationInfo?.quaList, indexPath.row-1 < quaList.count { if let quaList = educationInfo?.quaList, indexPath.row-1 < quaList.count {
let quaInfo = quaList[indexPath.row-1] let quaInfo = quaList[indexPath.row-1]
vc.detailId = String(quaInfo.id) vc.detailId = quaInfo.id
vc.orderId = self.orderId
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
return return
...@@ -489,7 +489,7 @@ extension YHEducationInfoListVC { ...@@ -489,7 +489,7 @@ extension YHEducationInfoListVC {
[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 {
educationInfo = self.educationRequest.educationInfo educationInfo = self.educationRequest.listInfo
loadInfo() loadInfo()
} }
} }
...@@ -523,9 +523,9 @@ extension YHEducationInfoListVC { ...@@ -523,9 +523,9 @@ extension YHEducationInfoListVC {
func saveInfo() { func saveInfo() {
let params = ["go_next": 0, let params = ["go_next": 0,
"graduate": educationInfo?.graduate ?? 0, "graduate": educationInfo?.isSpouseNameSame ?? 0,
"order_id": self.orderId, "order_id": self.orderId,
"qualification": educationInfo?.qualification ?? 0] "qualification": educationInfo?.isNameSame ?? 0] as [String : Any]
self.educationRequest.saveAllEducationInfo(params: params) { self.educationRequest.saveAllEducationInfo(params: params) {
[weak self] success, error in [weak self] success, error in
...@@ -571,7 +571,7 @@ extension YHEducationInfoListVC { ...@@ -571,7 +571,7 @@ extension YHEducationInfoListVC {
} }
// 检查所有问题是否有未答项 // 检查所有问题是否有未答项
if educationInfo.qualification == 0 || educationInfo.graduate == 0 { if educationInfo.isNameSame == nil || educationInfo.isSpouseNameSame == nil {
return false return false
} }
return true return true
......
...@@ -11,11 +11,11 @@ import Toast_Swift ...@@ -11,11 +11,11 @@ import Toast_Swift
class YHQualificationDetailVC: YHBaseViewController { class YHQualificationDetailVC: YHBaseViewController {
//【WARNING!】新添加 传orderId 已有信息传detailId //【WARNING!】新添加 传orderId 已有信息传detailId和orderId
// 订单ID // 订单ID
var orderId: String = "" var orderId:Int = 0
// 专业ID // 专业ID
var detailId: String = "" var detailId: Int = 0
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel() let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
// 专业详情信息 // 专业详情信息
var detailInfo = YHQualificationDetailInfo() var detailInfo = YHQualificationDetailInfo()
...@@ -68,7 +68,7 @@ class YHQualificationDetailVC: YHBaseViewController { ...@@ -68,7 +68,7 @@ class YHQualificationDetailVC: 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 = {
[weak self] in [weak self] in
...@@ -90,10 +90,8 @@ class YHQualificationDetailVC: YHBaseViewController { ...@@ -90,10 +90,8 @@ class YHQualificationDetailVC: YHBaseViewController {
} }
loadInfo() loadInfo()
if !self.detailId.isEmpty { // 有专业ID则该专业已存在 if self.detailId != 0 { // 有专业ID则该专业已存在
reqeustDetailInfo() reqeustDetailInfo()
} else { // 该专业是新添加的
detailInfo.orderId = orderId
} }
} }
...@@ -105,32 +103,32 @@ class YHQualificationDetailVC: YHBaseViewController { ...@@ -105,32 +103,32 @@ class YHQualificationDetailVC: YHBaseViewController {
let item00 = YHFormDetailItem(type: .qualificationCertificateName) let item00 = YHFormDetailItem(type: .qualificationCertificateName)
item00.placeHolder = "请选择资格证书名称".local item00.placeHolder = "请选择资格证书名称".local
item00.tips = "请选择资格证书名称".local item00.tips = "请选择资格证书名称".local
item00.value = detailInfo.qualification item00.value = detailInfo.certName
let item01 = YHFormDetailItem(type: .conferAgencyFullName) let item01 = YHFormDetailItem(type: .conferAgencyFullName)
item01.placeHolder = "请输入颁授机构".local item01.placeHolder = "请输入颁授机构".local
item01.tips = "请输入颁授机构".local item01.tips = "请输入颁授机构".local
item01.value = detailInfo.college item01.value = detailInfo.issuingAgent
let item02 = YHFormDetailItem(type: .conferTime) let item02 = YHFormDetailItem(type: .conferTime)
item02.placeHolder = "请选择颁授年份".local item02.placeHolder = "请选择颁授年份".local
item02.tips = "请选择颁授年份".local item02.tips = "请选择颁授年份".local
item02.value = detailInfo.promulgation item02.value = String(detailInfo.issuingYear)
let item03 = YHFormDetailItem(type: .conferCountry) let item03 = YHFormDetailItem(type: .conferCountry)
item03.placeHolder = "请选择颁授国家/地区".local item03.placeHolder = "请选择颁授国家/地区".local
item02.tips = "请选择颁授国家/地区".local item02.tips = "请选择颁授国家/地区".local
item03.value = detailInfo.collegeAddress.country item03.value = detailInfo.issuingAddr.country
let item04 = YHFormDetailItem(type: .conferCity) let item04 = YHFormDetailItem(type: .conferCity)
if detailInfo.isCollegeInAboard() { if detailInfo.isCollegeInAboard() {
item04.placeHolder = "请输入颁授城市".local item04.placeHolder = "请输入颁授城市".local
item04.tips = "请输入颁授城市".local item04.tips = "请输入颁授城市".local
item04.value = detailInfo.collegeAddress.foreign item04.value = detailInfo.issuingAddr.foreign
} else { } else {
item04.placeHolder = "请选择颁授城市".local item04.placeHolder = "请选择颁授城市".local
item04.tips = "请选择颁授城市".local item04.tips = "请选择颁授城市".local
item04.value = detailInfo.collegeAddress.area.joined(separator: ",") item04.value = detailInfo.issuingAddr.area.joined(separator: ",")
} }
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02, item03, item04] let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02, item03, item04]
...@@ -188,21 +186,21 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -188,21 +186,21 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .conferCity { if detailItem.type == .conferCity {
if let text = text, !text.isEmpty { if let text = text, !text.isEmpty {
detailInfo.collegeAddress.foreign = text detailInfo.issuingAddr.foreign = text
} else { } else {
detailInfo.collegeAddress.foreign = "" detailInfo.issuingAddr.foreign = ""
} }
} else if detailItem.type == .conferAgencyFullName { } else if detailItem.type == .conferAgencyFullName {
if let text = text, !text.isEmpty { if let text = text, !text.isEmpty {
detailInfo.college = text detailInfo.issuingAgent = text
} else { } else {
detailInfo.college = "" detailInfo.issuingAgent = ""
} }
} }
if isEditEnd { if isEditEnd {
loadInfo() loadInfo()
if !detailId.isEmpty { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
} }
...@@ -274,10 +272,10 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -274,10 +272,10 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
[weak self] selectType in [weak self] selectType in
guard let self = self else { return } guard let self = self else { return }
detailInfo.qualification = selectType.title detailInfo.certName = selectType.title
loadInfo() loadInfo()
if !detailId.isEmpty { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
...@@ -286,10 +284,10 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -286,10 +284,10 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
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 detailInfo.issuingYear = Int(date) ?? 2024
loadInfo() loadInfo()
if !detailId.isEmpty { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
...@@ -299,10 +297,10 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -299,10 +297,10 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
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 detailInfo.issuingAddr.country = country
loadInfo() loadInfo()
if !detailId.isEmpty { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
...@@ -315,10 +313,10 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -315,10 +313,10 @@ 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.collegeAddress.area = [string1, string2, string3, string4] detailInfo.issuingAddr.area = [string1, string2, string3, string4]
loadInfo() loadInfo()
if !detailId.isEmpty { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
self.present(vc, animated: true) self.present(vc, animated: true)
...@@ -392,27 +390,14 @@ extension YHQualificationDetailVC { ...@@ -392,27 +390,14 @@ extension YHQualificationDetailVC {
} }
} }
// 保存数据 isNeedPop:保存成功后是否需要退出该页面 // 保存数据
func saveDetailInfo(isNeedPop:Bool) { // @param isNeedPop:保存成功后是否需要退出该页面
// @param isShowToast: 请求完成后是否弹Toast
var dict:[String : Any] = [:] func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) {
if detailId.isEmpty { // 新增数据
dict = ["verify" : 0, var dict:[String : Any] = ["orderId":self.orderId]
"college":detailInfo.college, var quaDict:[String : Any] = detailInfo.toDictionary() ?? [:]
"college_address_aboard":"", dict["qua_data"] = quaDict
"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) print(dict)
...@@ -420,13 +405,17 @@ extension YHQualificationDetailVC { ...@@ -420,13 +405,17 @@ extension YHQualificationDetailVC {
[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: "保存失败")
}
} }
} }
} }
...@@ -441,25 +430,26 @@ extension YHQualificationDetailVC { ...@@ -441,25 +430,26 @@ extension YHQualificationDetailVC {
YHHUD.flash(message: "资料还未填完") YHHUD.flash(message: "资料还未填完")
return return
} }
saveDetailInfo(isNeedPop: true) saveDetailInfo(isNeedPop: true, isShowToast: true)
} }
// 检查填写信息完整性 // 检查填写信息完整性
func checkIntegrity() -> Bool { func checkIntegrity() -> Bool {
if detailInfo.qualification.isEmpty if detailInfo.certName.isEmpty
|| detailInfo.college.isEmpty || detailInfo.issuingAgent.isEmpty
|| detailInfo.promulgation.isEmpty || detailInfo.issuingYear <= 0
|| detailInfo.collegeAddress.country.isEmpty || detailInfo.issuingAddr.country.isEmpty
{ {
return false return false
} }
if detailInfo.isCollegeInAboard(), detailInfo.collegeAddress.foreign.isEmpty { if detailInfo.isCollegeInAboard(), detailInfo.issuingAddr.foreign.isEmpty {
return false return false
} }
if !detailInfo.isCollegeInAboard(), detailInfo.collegeAddress.area.count <= 0 { if !detailInfo.isCollegeInAboard(), detailInfo.issuingAddr.area.count <= 0 {
return false return false
} }
return true return true
......
...@@ -10,21 +10,20 @@ import UIKit ...@@ -10,21 +10,20 @@ import UIKit
import SmartCodable import SmartCodable
class YHEducationListInfo: SmartCodable { class YHEducationListInfo: SmartCodable {
var orderId: Int = 0
var eduList: [YHEducationInfo]? var eduList: [YHEducationInfo]?
var eduCount: Int = 0
var quaList: [YHQualificationInfo]? var quaList: [YHQualificationInfo]?
var quaCount: Int = 0 var isNameSame:Bool?
var qualification: Int = 0 var isSpouseNameSame:Bool?
var graduate: Int = 0 // 1=已婚,2=未婚,3=离婚,4=分居,5=丧偶,6=事实婚姻,7=鳏寡
var married: Int = 0 var married: Int = 0
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case orderId = "order_id"
case eduList = "edu_list" case eduList = "edu_list"
case eduCount = "edu_count"
case quaList = "qua_list" case quaList = "qua_list"
case quaCount = "qua_count" case isNameSame = "is_name_same"
case qualification = "qualification" case isSpouseNameSame = "is_spouse_name_same"
case graduate = "graduate"
case married = "married" case married = "married"
} }
...@@ -35,20 +34,18 @@ class YHEducationListInfo: SmartCodable { ...@@ -35,20 +34,18 @@ class YHEducationListInfo: SmartCodable {
class YHEducationInfo: SmartCodable { class YHEducationInfo: SmartCodable {
var id: Int = 0 var id: Int = 0
var orderId: Int = 0
var college: String? var college: String?
var background: String? var major: String?
var professional: String? var degree: String?
var admissionTime: String? var admissionTime: String?
var graduateTime: String? var graduateTime: String?
var vacantNum: Int = 0 var vacantNum: Int = 0
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id = "id" case id = "id"
case orderId = "order_id"
case college = "college" case college = "college"
case background = "background" case major = "major"
case professional = "professional" case degree = "degree"
case admissionTime = "admission_time" case admissionTime = "admission_time"
case graduateTime = "graduate_time" case graduateTime = "graduate_time"
case vacantNum = "vacant_num" case vacantNum = "vacant_num"
...@@ -61,13 +58,11 @@ class YHEducationInfo: SmartCodable { ...@@ -61,13 +58,11 @@ class YHEducationInfo: SmartCodable {
class YHQualificationInfo: SmartCodable { class YHQualificationInfo: SmartCodable {
var id: Int = 0 var id: Int = 0
var orderId: Int = 0
var qualification: String? var qualification: String?
var vacantNum: Int = 0 var vacantNum: Int = 0
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id = "id" case id = "id"
case orderId = "order_id"
case qualification = "qualification" case qualification = "qualification"
case vacantNum = "vacant_num" case vacantNum = "vacant_num"
} }
...@@ -81,59 +76,27 @@ class YHQualificationInfo: SmartCodable { ...@@ -81,59 +76,27 @@ class YHQualificationInfo: SmartCodable {
class YHEducationDetailInfo: SmartCodable { class YHEducationDetailInfo: SmartCodable {
var id: Int = 0 var id: Int = 0
var orderId: Int = 0
var college: String = "" var college: String = ""
var isTop: Int = 0 var teachingFormat: String = ""
var type: String = ""
var admissionTime: String = "" var admissionTime: String = ""
var graduateTime: String = "" var graduateTime: String = ""
var background: String = "" var degree: String = ""
var professional: String = "" var major: String = ""
var degreeType: String = "" var degreeType: String = ""
var remark: String = ""
var average: String = ""
var schoolAddress: YHCollegeAddress = YHCollegeAddress() var schoolAddress: YHCollegeAddress = YHCollegeAddress()
var schoolAddressAboard: Int = 0 var isAboardSchool: Bool = false
var oldId: Int = 0
var createdAt: String = ""
var updatedAt: String = ""
var deletedAt: String = ""
var isShow: Int = 0
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 { enum CodingKeys: String, CodingKey {
case id = "id" case id = "id"
case orderId = "order_id"
case college = "college" case college = "college"
case isTop = "is_top" case teachingFormat = "teaching_format"
case type = "type"
case admissionTime = "admission_time" case admissionTime = "admission_time"
case graduateTime = "graduate_time" case graduateTime = "graduate_time"
case background = "background" case degree = "degree"
case professional = "professional" case major = "major"
case degreeType = "degree_type" case degreeType = "degree_type"
case remark = "remark"
case average = "average"
case schoolAddress = "school_address" case schoolAddress = "school_address"
case schoolAddressAboard = "school_address_aboard" case isAboardSchool = "is_aboard_school"
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() { required init() {
...@@ -169,52 +132,26 @@ class YHCollegeAddress: Codable { ...@@ -169,52 +132,26 @@ class YHCollegeAddress: Codable {
} }
class YHQualificationDetailInfo: SmartCodable { class YHQualificationDetailInfo: SmartCodable {
var id: String = "" var id: Int = 0
var orderId: String = "" var certName: String = ""
var college: String = "" var issuingAgent: String = ""
var collegeAddress: YHCollegeAddress = YHCollegeAddress() var issuingYear: Int = 0
var collegeAddressAboard: Int = 0 var issuingAddr: YHCollegeAddress = YHCollegeAddress()
var promulgation: String = "" var isAboardAddr: Bool = false
var qualification: String = ""
var remark: String = "" enum CodingKeys: String, CodingKey {
var oldId: Int = 0 case id = "id"
var createdAt: String = "" case certName = "cert_name"
var updatedAt: String = "" case issuingAgent = "issuing_agent"
var deletedAt: String = "" case issuingYear = "issuing_year"
var operatorName: String = "" case issuingAddr = "issuing_addr"
var operatorEnglishName: String = "" case isAboardAddr = "is_aboard_addr"
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 { func isCollegeInAboard() -> Bool {
if collegeAddress.country.isEmpty { return false } if issuingAddr.country.isEmpty { return false }
if collegeAddress.country.contains("中国") { if issuingAddr.country.contains("中国") {
return false return false
} }
return true return true
......
...@@ -10,7 +10,7 @@ import UIKit ...@@ -10,7 +10,7 @@ import UIKit
class YHEducationRequestViewModel { class YHEducationRequestViewModel {
// 学历和专业信息 // 学历和专业信息
var educationInfo: YHEducationListInfo? var listInfo: YHEducationListInfo?
// 学历详情信息 // 学历详情信息
var educationDetailInfo: YHEducationDetailInfo? var educationDetailInfo: YHEducationDetailInfo?
// 专业详情信息 // 专业详情信息
...@@ -21,7 +21,7 @@ class YHEducationRequestViewModel { ...@@ -21,7 +21,7 @@ class YHEducationRequestViewModel {
YHHUD.show(.progress(message: "数据加载中...")) YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.getEducationAndQulificationInfoApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.getEducationAndQulificationInfoListApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
...@@ -39,7 +39,7 @@ class YHEducationRequestViewModel { ...@@ -39,7 +39,7 @@ class YHEducationRequestViewModel {
callBackBlock(false,nil) callBackBlock(false,nil)
return return
} }
educationInfo = resultModel listInfo = resultModel
callBackBlock(true,nil) callBackBlock(true,nil)
} failBlock: { err in } failBlock: { err in
...@@ -191,7 +191,7 @@ class YHEducationRequestViewModel { ...@@ -191,7 +191,7 @@ class YHEducationRequestViewModel {
} }
// 获取专业详情 // 获取专业详情
func getQualificationDetailInfo(id:String, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func getQualificationDetailInfo(id:Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中...")) YHHUD.show(.progress(message: "数据加载中..."))
...@@ -207,15 +207,21 @@ class YHEducationRequestViewModel { ...@@ -207,15 +207,21 @@ class YHEducationRequestViewModel {
return return
} }
printLog("model 是 ==> \(model)") printLog("model 是 ==> \(model)")
let dic = model.data?.peel as? [AnyHashable : Any] if let dic = model.data?.peel as? [AnyHashable : Any] {
guard let resultModel = YHQualificationDetailInfo.deserialize(dict: dic as? [AnyHashable : Any]) else { guard let quaDict = dic["qua_data"] as? [AnyHashable : Any] , let resultModel = YHQualificationDetailInfo.deserialize(dict:quaDict as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
qualificationDetailInfo = resultModel
callBackBlock(true,nil)
return
} else {
callBackBlock(false,nil) callBackBlock(false,nil)
return return
} }
qualificationDetailInfo = resultModel
callBackBlock(true,nil)
} failBlock: { err in } failBlock: { err in
callBackBlock(false,err) callBackBlock(false,err)
} }
......
...@@ -13,7 +13,7 @@ class YHQuestionInfo: SmartCodable, YHFormItemProtocol { ...@@ -13,7 +13,7 @@ class YHQuestionInfo: SmartCodable, YHFormItemProtocol {
var key: String = "" var key: String = ""
var question: String = "" var question: String = ""
var answer: Int = 0 var answer: Bool?
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case key = "key" case key = "key"
......
...@@ -16,6 +16,7 @@ class YHMainApplicantInformationViewController: YHBaseViewController { ...@@ -16,6 +16,7 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
var viewModel: YHMainApplicantInformationViewModel! var viewModel: YHMainApplicantInformationViewModel!
var dataSource: [YHSectionItemModel]? var dataSource: [YHSectionItemModel]?
var isShowPrompt: Bool = false var isShowPrompt: Bool = false
var orderId: Int = 0
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -27,7 +28,7 @@ class YHMainApplicantInformationViewController: YHBaseViewController { ...@@ -27,7 +28,7 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
} }
func getData() { func getData() {
viewModel.requestMainInformation("133969") {[weak self] success, error in viewModel.requestMainInformation("\(orderId)") {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.stepView.currentIndex = self.viewModel.mainModel.step ?? 0 self.stepView.currentIndex = self.viewModel.mainModel.step ?? 0
self.updateDataSource() self.updateDataSource()
......
...@@ -19,8 +19,8 @@ struct YHMainInformationModel: SmartCodable { ...@@ -19,8 +19,8 @@ struct YHMainInformationModel: SmartCodable {
var birthday: String? var birthday: String?
var age: String? var age: String?
var birth_place_aboard: Int? var birth_place_aboard: Int?
var sex: String? var sex: Int?
var married: String? var married: Int?
var mobile: String? var mobile: String?
var email: String? var email: String?
var address_aboard: Int? var address_aboard: Int?
......
...@@ -206,37 +206,8 @@ extension YHImagePickerView: UIGestureRecognizerDelegate { ...@@ -206,37 +206,8 @@ extension YHImagePickerView: UIGestureRecognizerDelegate {
extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerControllerDelegate { extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage { if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
// 将图片显示给UIImageView uploadImage(image: image)
// if let block = backImage { self.dismiss()
// block(image)
// self.dismiss()
// }
//将选择的图片保存到Document目录下
let fileManager = FileManager.default
let rootPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,
.userDomainMask, true)[0] as String
let filePath = "\(rootPath)/pickedimage.jpg"
let imageData = image.jpegData(compressionQuality: 1.0)
fileManager.createFile(atPath: filePath, contents: imageData, attributes: nil)
//上传图片
if (fileManager.fileExists(atPath: filePath)){
//取得NSURL
let imageURL = URL(fileURLWithPath: filePath)
//使用Alamofire上传
AF.upload(imageURL, to: "https://test-comserver.galaxy-immi.com/oss/upload/storage")
.responseString { response in
switch response.result {
case .success(let value):
print("Success: \(value)")
case .failure(let error): break
}
}
}
} else { } else {
printLog("pick image wrong") printLog("pick image wrong")
} }
...@@ -248,5 +219,74 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro ...@@ -248,5 +219,74 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
} }
//原生上传
func uploadImage(imageURL: URL) {
let url = URL(string: "https://test-comserver.galaxy-immi.com/oss/upload/storage")! // 设置上传接口地址
var request = URLRequest(url: url)
request.httpMethod = "POST"
do {
let imageData = try Data(contentsOf: imageURL) // 读取要上传的图片数据
let boundary = UUID().uuidString // 生成随机边界字符串
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
request.addValue("4001001", forHTTPHeaderField: "businessCode")
var body = ""
body += "--\(boundary)\r\n"
body += "Content-Disposition: form-data; name=\"file\"; filename=\"image.jpg\"\r\n" // 根据需求修改文件名称
body += "Content-Type: image/jpeg\r\n\r\n" // 根据实际情况指定正确的MIME类型
if let data = imageData.base64EncodedString(options: .lineLength76Characters).addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics) {
let encodedBody = body + "\r\n" + data + "\r\n" + "--" + boundary + "--"
guard let postData = encodedBody.data(using: String.Encoding.utf8) else { return }
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
if let error = error {
print("Error: \(error)")
} else if let httpResponse = response as? HTTPURLResponse {
switch httpResponse.statusCode {
case 200..<300:
if let data = data {
let string = String(data: data, encoding: .utf8)
}
print("Upload successful.")
default:
print("Failed to upload the image with status code: \(httpResponse.statusCode)")
}
}
}
task.resume()
}
} catch {
print("Error reading image file: \(error)")
}
}
// Alamofire上传
func uploadImage(image: UIImage) {
// 获取图片的二进制数据
guard let imageData = image.jpegData(compressionQuality: 1) else { return }
let boundary = UUID().uuidString
let headers: HTTPHeaders = [
"Content-type": "multipart/form-data; boundary=\(boundary)",
"businessCode": "4001001"
]
// 创建MultipartFormData对象
var multipartFormData = MultipartFormData()
// 将图片添加到multipartFormData中
multipartFormData.append(imageData, withName: "file", fileName: "image.jpg", mimeType: "image/jpeg")
// 发送POST请求
let uploadRequest = AF.upload(multipartFormData: multipartFormData, to: "https://test-comserver.galaxy-immi.com/oss/upload/storage", headers: headers)
uploadRequest.responseString(completionHandler: { string in
printLog("\n网络请求已返回 string=\(string)")
})
}
} }
...@@ -133,7 +133,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -133,7 +133,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
frontLabel = { frontLabel = {
let label = UILabel() let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12) label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.contentBkgColor label.textColor = UIColor.subTextColor
label.textAlignment = .center label.textAlignment = .center
return label return label
}() }()
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
import UIKit import UIKit
import SmartCodable
enum YHSaveType: Int { enum YHSaveType: Int {
case save = 0 case save = 0
...@@ -93,8 +94,8 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -93,8 +94,8 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
} }
let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt) let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt)
let item55 = YHItemModel(id: .id34, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.birth_place?.foreign, isShowPrompts: isShowPrompt) let item55 = YHItemModel(id: .id34, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.birth_place?.foreign, isShowPrompts: isShowPrompt)
let item6 = YHItemModel(id: .id27, isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: mainModel.sex, type: .sex) let item6 = YHItemModel(id: .id27, isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.sex ?? 0)", type: .sex)
let item7 = YHItemModel(id: .id28, isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: mainModel.married, type: .marry, isShowPrompts: isShowPrompt) let item7 = YHItemModel(id: .id28, isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.married ?? 0)", type: .marry, isShowPrompts: isShowPrompt)
var item555 = item5 var item555 = item5
if mainModel.birth_place_aboard == 1 { if mainModel.birth_place_aboard == 1 {
item555 = item55 item555 = item55
...@@ -185,9 +186,9 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -185,9 +186,9 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
case .id26: case .id26:
mainModel.birth_place?.area = item.value mainModel.birth_place?.area = item.value
case .id27: case .id27:
mainModel.sex = item.value?.first mainModel.sex = item.value?.first?.int
case .id28: case .id28:
mainModel.married = item.value?.first mainModel.married = item.value?.first?.int
case .id29: case .id29:
mainModel.mobile = item.message mainModel.mobile = item.message
case .id30: case .id30:
...@@ -207,8 +208,11 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -207,8 +208,11 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
func requestMainInformation(_ orderID: String, callBackBlock:@escaping (_ success: YHMainInformationModel?, _ error:YHErrorModel?)->()) { func requestMainInformation(_ orderID: String, callBackBlock:@escaping (_ success: YHMainInformationModel?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/order-information/get_information?order_id=\(orderID)" // /infoflow/order-information/get_information?order_id=9402
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.getInformation
// let strUrl = "http://192.168.25.48:18088/" + YHAllApiName.OrderInformation.getInformation
let params: [String : Any] = ["order_id": orderID]
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象 //1. json字符串 转 对象
guard let self = self else { return } guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else { guard let model = NetBaseModel.deserialize(dict: json) else {
...@@ -293,7 +297,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -293,7 +297,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
"hk_macao_pass": hkID, "hk_macao_pass": hkID,
"passport": passport] "passport": passport]
] ]
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/order-information/update_information" let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.updateInformation
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
guard let self = self else { return } guard let self = self else { return }
callBackBlock(true) callBackBlock(true)
...@@ -354,14 +358,14 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -354,14 +358,14 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let birth_place_aboard = mainModel.birth_place_aboard ?? 0 let birth_place_aboard = mainModel.birth_place_aboard ?? 0
let birth_place_area = mainModel.birth_place?.area ?? [] let birth_place_area = mainModel.birth_place?.area ?? []
let birth_place_foreign = mainModel.birth_place?.foreign ?? "" let birth_place_foreign = mainModel.birth_place?.foreign ?? ""
let sex = mainModel.sex ?? "" let sex = mainModel.sex ?? 0
let married = mainModel.married ?? "" let married = mainModel.married ?? 0
let mobile = mainModel.mobile ?? "" let mobile = mainModel.mobile ?? ""
let email = mainModel.email ?? "" let email = mainModel.email ?? ""
let has_hk_id = mainModel.has_hk_id ?? 0 let has_hk_id = mainModel.has_hk_id ?? 0
let hk_id_numbe = mainModel.hk_id_number ?? "" let hk_id_numbe = mainModel.hk_id_number ?? ""
if birth_place_aboard == 1 { if birth_place_aboard == 1 {
if username.count != 0 && birthday.count != 0 && birth_place_foreign.count != 0 && sex.count != 0 && married.count != 0 && mobile.count != 0 && email.count != 0 { if username.count != 0 && birthday.count != 0 && birth_place_foreign.count != 0 && mobile.count != 0 && email.count != 0 {
if has_hk_id == 1 { if has_hk_id == 1 {
if hk_id_numbe.count != 0 { if hk_id_numbe.count != 0 {
return true return true
...@@ -375,7 +379,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -375,7 +379,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
return false return false
} }
} else { } else {
if username.count != 0 && birthday.count != 0 && birth_place_area.count != 0 && sex.count != 0 && married.count != 0 && mobile.count != 0 && email.count != 0 { if username.count != 0 && birthday.count != 0 && birth_place_area.count != 0 && mobile.count != 0 && email.count != 0 {
if has_hk_id == 1 { if has_hk_id == 1 {
if hk_id_numbe.count != 0 { if hk_id_numbe.count != 0 {
return true return true
......
...@@ -14,7 +14,8 @@ class YHSelectCountryViewModel: NSObject { ...@@ -14,7 +14,8 @@ class YHSelectCountryViewModel: NSObject {
} }
func requestCountry(_ key: String, callBackBlock:@escaping (_ success: [YHCountryMessage?]?, _ error:YHErrorModel?)->()) { func requestCountry(_ key: String, callBackBlock:@escaping (_ success: [YHCountryMessage?]?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/country?keyword=\(key)" let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.countryInformation + "?keyword = \(key)"
YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象 //1. json字符串 转 对象
guard let self = self else { return } guard let self = self else { return }
......
...@@ -155,6 +155,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -155,6 +155,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (indexPath.row >= items.count) { return } if (indexPath.row >= items.count) { return }
if !checkLogin() { if !checkLogin() {
......
...@@ -52,12 +52,18 @@ class YHAllApiName { ...@@ -52,12 +52,18 @@ class YHAllApiName {
} }
struct Education { struct Education {
// 获取学历及证书相关信息 // 获取教育和专业资格列表
static let getEducationAndQulificationInfoApi = "frontend/education/list" // static let getEducationAndQulificationInfoApi = "frontend/education/list"
static let getEducationAndQulificationInfoListApi = "infoflow/getEducationList"
// 获取学历详情信息 // 获取学历详情信息
static let getEducationDetailInfoApi = "frontend/education/detail" // static let getEducationDetailInfoApi = "frontend/education/detail"
static let getEducationDetailInfoApi = "infoflow/getEducationDetail"
// 保存学历信息 // 保存学历信息
static let saveEducationInfoApi = "frontend/education/save" // static let saveEducationInfoApi = "frontend/education/save"
static let saveEducationInfoApi = "infoflow/saveEducationData"
// 删除学历 // 删除学历
static let deleteEducationInfoApi = "frontend/education/del" static let deleteEducationInfoApi = "frontend/education/del"
// 保存所有信息 // 保存所有信息
...@@ -66,11 +72,13 @@ class YHAllApiName { ...@@ -66,11 +72,13 @@ class YHAllApiName {
struct Qualification { struct Qualification {
// 获取学历详情信息 // 获取学历详情信息
static let getQualificationDetailInfoApi = "frontend/qualification/detail" // static let getQualificationDetailInfoApi = "frontend/qualification/detail"
static let getQualificationDetailInfoApi = "infoflow/getQuaDetail"
// 删除专业 // 删除专业
static let deleteQualificationInfoApi = "frontend/qualification/del" static let deleteQualificationInfoApi = "frontend/qualification/del"
// 保存专业 // 保存专业详情
static let saveQualificationInfoApi = "frontend/qualification/save" // static let saveQualificationInfoApi = "frontend/qualification/save"
static let saveQualificationInfoApi = "infoflow/saveQualification"
} }
...@@ -93,4 +101,13 @@ class YHAllApiName { ...@@ -93,4 +101,13 @@ class YHAllApiName {
// static let updateBasicInfoApi = "frontend/basics/update_basics" // static let updateBasicInfoApi = "frontend/basics/update_basics"
static let updateBasicInfoApi = "infoflow/basics/update_basics" static let updateBasicInfoApi = "infoflow/basics/update_basics"
} }
struct OrderInformation {
//主申请人获取信息
static let getInformation = "infoflow/order-information/get_information"
// 主申请人信息更新
static let updateInformation = "infoflow/order-information/update_information"
// 主申请人国家信息
static let countryInformation = "infoflow/country"
}
} }
...@@ -171,6 +171,32 @@ class YHNetRequest: NSObject { ...@@ -171,6 +171,32 @@ class YHNetRequest: NSObject {
return httpRequest return httpRequest
} }
///开始请求
func uploadRequest(_ headers: HTTPHeaders,_ image: UIImage) -> Request? {
guard YHNetworkStatusManager.shared.isNetWorkOK == true else {
YHHUD.flash(message: "网络异常")
return httpRequest
}
guard let imageData = image.jpegData(compressionQuality: 1) else { return httpRequest }
var multipartFormData = MultipartFormData()
// 将图片添加到multipartFormData中
multipartFormData.append(imageData, withName: "file", fileName: "image.jpg", mimeType: "image/jpeg")
// 发送POST请求
let uploadRequest = AF.upload(multipartFormData: multipartFormData, to: "https://test-comserver.galaxy-immi.com/oss/upload/storage", headers: headers)
uploadRequest.responseString(completionHandler: { string in
#if DEBUG
printLog("\n网络请求已返回 string=\(string)")
#endif
self.completeHandle(string: string)
})
return uploadRequest
}
/// 请求response完成处理 /// 请求response完成处理
func completeHandle(string: AFDataResponse<String>) { func completeHandle(string: AFDataResponse<String>) {
let responseResult = string.result let responseResult = string.result
...@@ -206,6 +232,7 @@ class YHNetRequest: NSObject { ...@@ -206,6 +232,7 @@ class YHNetRequest: NSObject {
let dittt = self.handleJsonObjectNullValue(serverDict) let dittt = self.handleJsonObjectNullValue(serverDict)
suclock(dittt as? [String : Any] ?? [:], statusCode) suclock(dittt as? [String : Any] ?? [:], statusCode)
// suclock(serverDict, statusCode)
} else { } else {
guard let errorBlock = self.failure else { return } guard let errorBlock = self.failure else { return }
...@@ -260,4 +287,9 @@ extension YHNetRequest { ...@@ -260,4 +287,9 @@ extension YHNetRequest {
printLog("\n发起请求的URL是===> url = \(url)") printLog("\n发起请求的URL是===> url = \(url)")
return YHNetRequest().url(url).requestType(.post).params(params).success(successBlock).failed(failBlock).startRequest() return YHNetRequest().url(url).requestType(.post).params(params).success(successBlock).failed(failBlock).startRequest()
} }
class func uplaodRequest(url:String, headers:HTTPHeaders, image: UIImage, successBlock: SuccessHandlerType!, failBlock: FailureHandlerType!) -> Request? {
printLog("\n发起请求的URL是===> url = \(url)")
return YHNetRequest().url(url).success(successBlock).failed(failBlock).uploadRequest(headers, image)
}
} }
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