Commit 003e08b0 authored by Steven杜宇's avatar Steven杜宇

// 学历资格

parent 2940b8ee
...@@ -495,6 +495,8 @@ ...@@ -495,6 +495,8 @@
047F3DCD2CE2F96E001B2A6D /* YHGCFamilyMemberInfoListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047F3DCC2CE2F96E001B2A6D /* YHGCFamilyMemberInfoListVC.swift */; }; 047F3DCD2CE2F96E001B2A6D /* YHGCFamilyMemberInfoListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047F3DCC2CE2F96E001B2A6D /* YHGCFamilyMemberInfoListVC.swift */; };
047F3DCF2CE2FB64001B2A6D /* YHGCCertificateUploadVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047F3DCE2CE2FB64001B2A6D /* YHGCCertificateUploadVC.swift */; }; 047F3DCF2CE2FB64001B2A6D /* YHGCCertificateUploadVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047F3DCE2CE2FB64001B2A6D /* YHGCCertificateUploadVC.swift */; };
047F3DD12CE2FB81001B2A6D /* YHGCCertificateInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047F3DD02CE2FB81001B2A6D /* YHGCCertificateInfoController.swift */; }; 047F3DD12CE2FB81001B2A6D /* YHGCCertificateInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047F3DD02CE2FB81001B2A6D /* YHGCCertificateInfoController.swift */; };
047F3DD52CE446F6001B2A6D /* YHGCEducationDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047F3DD42CE446F6001B2A6D /* YHGCEducationDetailVC.swift */; };
047F3DD72CE44E02001B2A6D /* YHGCEducationCerUploadCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047F3DD62CE44E02001B2A6D /* YHGCEducationCerUploadCell.swift */; };
0480582F2C7CA77900502CAA /* YHDisappointHKAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480582E2C7CA77900502CAA /* YHDisappointHKAlertView.swift */; }; 0480582F2C7CA77900502CAA /* YHDisappointHKAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480582E2C7CA77900502CAA /* YHDisappointHKAlertView.swift */; };
048058312C7DBDC900502CAA /* YHTravelCertificateTipsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048058302C7DBDC900502CAA /* YHTravelCertificateTipsView.swift */; }; 048058312C7DBDC900502CAA /* YHTravelCertificateTipsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048058302C7DBDC900502CAA /* YHTravelCertificateTipsView.swift */; };
048058332C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048058322C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift */; }; 048058332C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048058322C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift */; };
...@@ -1488,6 +1490,8 @@ ...@@ -1488,6 +1490,8 @@
047F3DCC2CE2F96E001B2A6D /* YHGCFamilyMemberInfoListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCFamilyMemberInfoListVC.swift; sourceTree = "<group>"; }; 047F3DCC2CE2F96E001B2A6D /* YHGCFamilyMemberInfoListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCFamilyMemberInfoListVC.swift; sourceTree = "<group>"; };
047F3DCE2CE2FB64001B2A6D /* YHGCCertificateUploadVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateUploadVC.swift; sourceTree = "<group>"; }; 047F3DCE2CE2FB64001B2A6D /* YHGCCertificateUploadVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateUploadVC.swift; sourceTree = "<group>"; };
047F3DD02CE2FB81001B2A6D /* YHGCCertificateInfoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateInfoController.swift; sourceTree = "<group>"; }; 047F3DD02CE2FB81001B2A6D /* YHGCCertificateInfoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateInfoController.swift; sourceTree = "<group>"; };
047F3DD42CE446F6001B2A6D /* YHGCEducationDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCEducationDetailVC.swift; sourceTree = "<group>"; };
047F3DD62CE44E02001B2A6D /* YHGCEducationCerUploadCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCEducationCerUploadCell.swift; sourceTree = "<group>"; };
0480582E2C7CA77900502CAA /* YHDisappointHKAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDisappointHKAlertView.swift; sourceTree = "<group>"; }; 0480582E2C7CA77900502CAA /* YHDisappointHKAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDisappointHKAlertView.swift; sourceTree = "<group>"; };
048058302C7DBDC900502CAA /* YHTravelCertificateTipsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTravelCertificateTipsView.swift; sourceTree = "<group>"; }; 048058302C7DBDC900502CAA /* YHTravelCertificateTipsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTravelCertificateTipsView.swift; sourceTree = "<group>"; };
048058322C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTravelCertificateTipsCell.swift; sourceTree = "<group>"; }; 048058322C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTravelCertificateTipsCell.swift; sourceTree = "<group>"; };
...@@ -3614,6 +3618,7 @@ ...@@ -3614,6 +3618,7 @@
047F3DB32CDF3728001B2A6D /* V */ = { 047F3DB32CDF3728001B2A6D /* V */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
047F3DD62CE44E02001B2A6D /* YHGCEducationCerUploadCell.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3622,6 +3627,7 @@ ...@@ -3622,6 +3627,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
047F3DB52CDF3898001B2A6D /* YHGCEducationInfoListVC.swift */, 047F3DB52CDF3898001B2A6D /* YHGCEducationInfoListVC.swift */,
047F3DD42CE446F6001B2A6D /* YHGCEducationDetailVC.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -6315,6 +6321,7 @@ ...@@ -6315,6 +6321,7 @@
04F2435F2C9D1C0600DF2C74 /* YHHKRecordsStayingPersonnelCell.swift in Sources */, 04F2435F2C9D1C0600DF2C74 /* YHHKRecordsStayingPersonnelCell.swift in Sources */,
A5EB6C732C69FB9A0081FB6C /* YHOffivialApprovalSuccessCheckView.swift in Sources */, A5EB6C732C69FB9A0081FB6C /* YHOffivialApprovalSuccessCheckView.swift in Sources */,
04FD85682C21277800BEF9C5 /* YHMyNameCardAvatarInfoCell.swift in Sources */, 04FD85682C21277800BEF9C5 /* YHMyNameCardAvatarInfoCell.swift in Sources */,
047F3DD52CE446F6001B2A6D /* YHGCEducationDetailVC.swift in Sources */,
A566A79A2C219FA400980D06 /* YHHomeSalonAreaView.swift in Sources */, A566A79A2C219FA400980D06 /* YHHomeSalonAreaView.swift in Sources */,
04213B312C4917BD00797900 /* YHHomeInfoDetailViewController.swift in Sources */, 04213B312C4917BD00797900 /* YHHomeInfoDetailViewController.swift in Sources */,
A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */, A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */,
...@@ -6337,6 +6344,7 @@ ...@@ -6337,6 +6344,7 @@
A567E5A82BD7643D00D5D5A0 /* YHHomeWebBottomButton.swift in Sources */, A567E5A82BD7643D00D5D5A0 /* YHHomeWebBottomButton.swift in Sources */,
045EEEC02B9F171A0022A143 /* YHOtherInfoFillViewModel.swift in Sources */, 045EEEC02B9F171A0022A143 /* YHOtherInfoFillViewModel.swift in Sources */,
045EEEF22B9F171A0022A143 /* YHChildBasicInfoVC.swift in Sources */, 045EEEF22B9F171A0022A143 /* YHChildBasicInfoVC.swift in Sources */,
047F3DD72CE44E02001B2A6D /* YHGCEducationCerUploadCell.swift in Sources */,
A567E5A22BD7643D00D5D5A0 /* YHConfigManager.swift in Sources */, A567E5A22BD7643D00D5D5A0 /* YHConfigManager.swift in Sources */,
044EE2532C9565FF00A2FE3A /* YHResignGuidelinesExampleShareViewController.swift in Sources */, 044EE2532C9565FF00A2FE3A /* YHResignGuidelinesExampleShareViewController.swift in Sources */,
0418921F2C91BAAC00B9FB94 /* YHBaseDynamicCornerRadiusView.swift in Sources */, 0418921F2C91BAAC00B9FB94 /* YHBaseDynamicCornerRadiusView.swift in Sources */,
......
...@@ -20,6 +20,7 @@ enum HKFormItemCellType: Int { ...@@ -20,6 +20,7 @@ enum HKFormItemCellType: Int {
case degreeDetailInfo = 7 case degreeDetailInfo = 7
case onlyTwoChoice = 8 case onlyTwoChoice = 8
case question = 9 case question = 9
case educationCerUpload = 10
} }
......
...@@ -70,6 +70,8 @@ enum YHFormTitleItemType:Int, CaseIterable { ...@@ -70,6 +70,8 @@ enum YHFormTitleItemType:Int, CaseIterable {
case mainApplicantProfessionalQualification case mainApplicantProfessionalQualification
// 学历证书姓名及出生日期正确性 // 学历证书姓名及出生日期正确性
case edutionalCertificateNameAndBirthday case edutionalCertificateNameAndBirthday
// 学历证件(选填)
case educationCertificate
...@@ -190,6 +192,8 @@ enum YHFormDetailItemType:Int { ...@@ -190,6 +192,8 @@ enum YHFormDetailItemType:Int {
case educationCountry case educationCountry
// 上课城市 // 上课城市
case educationCity case educationCity
// 学历证件上传
case educationCerUpload
// 证书信息 // 证书信息
case certificateInfo case certificateInfo
...@@ -294,7 +298,8 @@ class YHFormTitleItem : YHFormItemProtocol { ...@@ -294,7 +298,8 @@ class YHFormTitleItem : YHFormItemProtocol {
return "主申请人专业资格及会员资格".local return "主申请人专业资格及会员资格".local
case .edutionalCertificateNameAndBirthday: case .edutionalCertificateNameAndBirthday:
return "学历证书姓名及出生日期正确性".local return "学历证书姓名及出生日期正确性".local
case .educationCertificate:
return "学历证件(选填)".local
} }
} }
...@@ -314,6 +319,8 @@ class YHFormTitleItem : YHFormItemProtocol { ...@@ -314,6 +319,8 @@ class YHFormTitleItem : YHFormItemProtocol {
return "(如有,非必填)".local return "(如有,非必填)".local
case .edutionalCertificateNameAndBirthday: case .edutionalCertificateNameAndBirthday:
return "".local return "".local
case .educationCertificate:
return "".local
case .isPreviousMarriageChild: case .isPreviousMarriageChild:
return "".local return "".local
case .accompany: case .accompany:
...@@ -523,6 +530,8 @@ class YHFormDetailItem : YHFormItemProtocol { ...@@ -523,6 +530,8 @@ class YHFormDetailItem : YHFormItemProtocol {
return "颁授国家/地区".local return "颁授国家/地区".local
case .conferCity: case .conferCity:
return "颁授城市".local return "颁授城市".local
case .educationCerUpload:
return "".local
} }
} }
......
//
// YHGCEducationDetailVC.swift
// galaxy
//
// Created by Dufet on 2024/11/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SwifterSwift
//import Toast_Swift
class YHGCEducationDetailVC: YHBaseViewController {
//【WARNING!】新添加 传orderId 已有信息传detailId和orderId
// 订单ID
var orderId: Int = 0
// 学历ID
var detailId: Int = 0
// 是否显示未填写错误提示
var isNeedShowError = false
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
var detailInfo: YHEducationDetailInfo = YHEducationDetailInfo()
var isChildsEditMode: YHFormTitleItemEditType = .none
var isBrothersEditMode: YHFormTitleItemEditType = .none
var items:[[YHFormItemProtocol]] = []
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.estimatedSectionHeaderHeight = 14.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = UIColor(hexString:"#F8F8F8")
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier)
tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier)
tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier)
tableView.register(YHFormItemSelectSheetCell.self, forCellReuseIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier)
tableView.register(YHGCEducationCerUploadCell.self, forCellReuseIdentifier: YHGCEducationCerUploadCell.cellReuseIdentifier)
return tableView
}()
var bottomView: YHSaveAndSubmitView = {
let view = YHSaveAndSubmitView.createView()
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navTitle = "学历".local
self.gk_navigationBar.backgroundColor = .white
view.backgroundColor = UIColor(hexString:"#F8F8F8")
createUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
func createUI() {
view.addSubview(tableView);
view.addSubview(bottomView)
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
saveDetailInfo(isSubmit:false, isNeedPop: true, isShowToast: true)
}
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
submitInfo()
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview()
make.height.equalTo(YHSaveAndSubmitView.height)
}
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
}
loadInfo()
if self.detailId != 0 { // 有学历ID则该学历已存在
getDetailInfo()
}
}
func loadInfo() {
items.removeAll()
let title0 = YHFormTitleItem(type: .mainApplicantEducation)
let item00 = YHFormDetailItem(type: .universityFullName)
item00.tips = "请选择学校".local
item00.value = detailInfo.college
// let item01 = YHFormDetailItem(type: .educationStyle)
// item01.tips = "请选择授课形式".local
// item01.value = detailInfo.teachingFormat
// let item02 = YHFormDetailItem(type: .educationTime)
// item02.tips = "请选择年月".local
// item02.value = detailInfo.admissionTime
let item03 = YHFormDetailItem(type: .graduateTime)
item03.tips = "请选择年月".local
item03.value = detailInfo.graduateTime
let item04 = YHFormDetailItem(type: .educationMajor)
item04.tips = "请输入专业".local
item04.value = detailInfo.major
let item05 = YHFormDetailItem(type: .educationDegree)
item05.tips = "请选择学位".local
item05.value = detailInfo.degree
// let item06 = YHFormDetailItem(type: .degreeType)
// item06.tips = "请选择学位类型".local
// item06.value = detailInfo.degreeType
let item07 = YHFormDetailItem(type: .educationCountry)
item07.tips = "请输入国家及地区".local
item07.value = detailInfo.schoolAddress.country
let item08 = YHFormDetailItem(type: .educationCity)
if detailInfo.isSchoolInAboard() {
item08.value = detailInfo.schoolAddress.foreign
item08.tips = "请输入城市".local
} else {
item08.value = detailInfo.schoolAddress.area.joined(separator: ",")
item08.tips = "请选择城市".local
}
let arr0:[YHFormItemProtocol] = [title0, item00, item03, item04, item05, item07, item08]
items.append(arr0)
// 学历证件(选填)
let title1 = YHFormTitleItem(type: .educationCertificate)
let item10 = YHFormDetailItem(type: .educationCerUpload)
let arr1:[YHFormItemProtocol] = [title1, item10]
items.append(arr1)
self.tableView.reloadData()
}
}
extension YHGCEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section >= items.count { return 0 }
let arr = items[section]
return arr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section >= items.count { return createDefaultCell(indexPath) }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return createDefaultCell(indexPath) }
let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFormTitleItem { // 是标题
let formItem = item as! YHFormTitleItem
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.setTitleAndSubTitle(title:formItem.getTitle())
return cell
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
let cellType = getCellType(detailItem)
if cellType == .inputText {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
var isValueValid = false
if let value = detailItem.value, !value.isEmpty {
isValueValid = true
}
cell.setTips(detailItem.tips, isShow: (isNeedShowError && !isValueValid))
cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textInputCondtion = {
textField in
var max = -1
if detailItem.type == .educationMajor {
max = 50
} else if detailItem.type == .educationCity {
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
// 只有国外城市才需输入,国内城市使用的是选择器
if detailItem.type == .educationCity {
if let text = text, !text.isEmpty {
detailInfo.schoolAddress.foreign = text
} else {
detailInfo.schoolAddress.foreign = ""
}
} else if detailItem.type == .educationMajor {
if let text = text, !text.isEmpty {
detailInfo.major = text
} else {
detailInfo.major = ""
}
}
if isEditEnd {
loadInfo()
saveInfoSilent()
}
}
return cell
} else if cellType == .selectSheet {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isShowTipsButton = (detailItem.type == .degreeType)
cell.tipsBtnClickBlock = {
YHWholeScreenTipsView.show(type: .degreeType, targetView: cell.tipsButton)
}
cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
var isValueValid = false
if let value = detailItem.value, !value.isEmpty {
isValueValid = true
}
cell.setTips(detailItem.tips, isShow: (isNeedShowError && !isValueValid))
return cell
} else if cellType == .educationCerUpload {
let cell = tableView.dequeueReusableCell(withIdentifier: YHGCEducationCerUploadCell.cellReuseIdentifier, for: indexPath) as! YHGCEducationCerUploadCell
return cell
}
}
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
return cell
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section >= items.count { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return }
createCorner(cell: cell, arr: arr, indexPath: indexPath)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 16.0
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 0.1
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let arr = items[indexPath.section]
let item:YHFormItemProtocol = arr[indexPath.row]
// 标题
if item is YHFormTitleItem {
return
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .universityFullName { // 选择大学名称
let vc = YHCollegeSearchViewController()
vc.orderId = self.orderId
vc.searchCollegeName = detailInfo.college
vc.selectBlock = {
[weak self] text in
guard let self = self else { return }
if let text = text, !text.isEmpty {
detailInfo.college = text
} else {
detailInfo.college = ""
}
loadInfo()
saveInfoSilent()
}
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .educationStyle { // 授课形式
YHSheetPickerView.show(type:.educationStyle, selectTitle:detailInfo.teachingFormat) {
[weak self] item in
guard let self = self else { return }
detailInfo.teachingFormat = item.title
loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .educationTime || detailItem.type == .graduateTime { // 入学及毕业年月
var title = ""
var dateStr = ""
if detailItem.type == .educationTime {
title = "选择入学日期"
dateStr = detailInfo.admissionTime
} else if detailItem.type == .graduateTime {
title = "选择毕业日期"
dateStr = detailInfo.graduateTime
}
YHDatePickView.show(type: .yyyymm, title: title, lastIsTaday: true, currentDay: dateStr) {
[weak self] dateStr in
guard let self = self else { return }
let format = DateFormatter()
format.dateFormat = "yyyy-MM"
if let selectDate = format.date(from:dateStr) {
let selectTimeInterval = selectDate.timeIntervalSince1970
let currentTimeInterval = Date().timeIntervalSince1970
if detailItem.type == .educationTime { // 选择入学日期
// 入学日期须早于当前日期
if selectTimeInterval > currentTimeInterval {
YHHUD.flash(message: "入学日期不能晚于当前日期")
return
}
if !detailInfo.graduateTime.isEmpty, let endDate = format.date(from:detailInfo.graduateTime) {
let endTimeInterval = endDate.timeIntervalSince1970
if selectTimeInterval > endTimeInterval {
YHHUD.flash(message: "入学日期不能晚于毕业日期")
return
}
}
detailInfo.admissionTime = dateStr
}
if detailItem.type == .graduateTime { // 选择毕业日期
if !detailInfo.admissionTime.isEmpty, let startDate = format.date(from:detailInfo.admissionTime) {
let startTimeInterval = startDate.timeIntervalSince1970
if selectTimeInterval < startTimeInterval {
YHHUD.flash(message: "毕业日期不能早于入学日期")
return
}
}
detailInfo.graduateTime = dateStr
}
}
loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .educationDegree { // 学位
YHSheetPickerView.show(type:.educationDegree, selectTitle:detailInfo.degree) {
[weak self] item in
guard let self = self else { return }
detailInfo.degree = item.title
loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .degreeType { // 学位类型
YHSheetPickerView.show(type: .degreeCategory, selectTitle:"工程学") {
[weak self] selectItem in
guard let self = self else { return }
detailInfo.degreeType = selectItem.title
loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .educationCountry { // 上课国家/地区
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] country in
guard let self = self else { return }
detailInfo.schoolAddress.country = country
detailInfo.isAboardSchool = detailInfo.isSchoolInAboard()
loadInfo()
saveInfoSilent()
}
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .educationCity { // 上课城市
if detailInfo.isSchoolInAboard() { return }
let vc = YHAddressViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
detailInfo.schoolAddress.area = citys
loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
}
}
}
func createDefaultCell(_ indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
return cell
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 设置每块section圆角
if (indexPath.row == 0) {
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
} else if (indexPath.row == arr.count-1) {
let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
} else {
cell.layer.mask = nil
}
}
func getCellType(_ item: Any) ->HKFormItemCellType {
if item is YHFormTitleItem {
return .title
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .educationCity {
if detailInfo.isSchoolInAboard() {
return .inputText
}
return .selectSheet
}
if detailItem.type == .educationMajor
{
return .inputText
}
if detailItem.type == .educationCerUpload {
return .educationCerUpload
}
if detailItem.type == .universityFullName
|| detailItem.type == .educationStyle
|| detailItem.type == .educationTime
|| detailItem.type == .graduateTime
|| detailItem.type == .educationDegree
|| detailItem.type == .degreeType
|| detailItem.type == .educationCountry
{
return .selectSheet
}
}
return .defaultType
}
}
extension YHGCEducationDetailVC {
func getDetailInfo() {
self.educationRequest.getEducationDetailInfo(params: ["id": self.detailId]) {
[weak self] success, error in
guard let self = self else { return }
if success {
if let educationDetailInfo = self.educationRequest.educationDetailInfo {
detailInfo = educationDetailInfo
}
loadInfo()
}
}
}
func submitInfo() {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return
}
saveDetailInfo(isSubmit:true, isNeedPop: true, isShowToast: true)
}
// 检查填写信息完整性
func checkIntegrity() -> Bool {
if detailInfo.college.isEmpty
|| detailInfo.graduateTime.isEmpty
|| detailInfo.major.isEmpty
|| detailInfo.degree.isEmpty
|| detailInfo.schoolAddress.country.isEmpty
{
return false
}
if detailInfo.isSchoolInAboard(), detailInfo.schoolAddress.foreign.isEmpty {
return false
}
if !detailInfo.isSchoolInAboard(), detailInfo.schoolAddress.area.count <= 0 {
return false
}
return true
}
func saveInfoSilent() {
if detailId != 0 {
saveDetailInfo(isSubmit:false, isNeedPop: false, isShowToast: false)
}
}
// 保存信息 isNeedPop:保存成功后是否退出该页面
func saveDetailInfo(isSubmit:Bool, isNeedPop:Bool, isShowToast:Bool) {
guard var dict:[String:Any] = detailInfo.toDictionary() else { return }
dict["order_id"] = self.orderId
dict["is_aboard_school"] = detailInfo.isSchoolInAboard()
self.educationRequest.saveEducationInfo(params: dict, isSilent: !isShowToast) {
[weak self] success, error in
guard let self = self else { return }
if success {
if isShowToast {
YHHUD.flash(message: isSubmit ? "提交成功":"保存成功" )
}
if isNeedPop {
self.navigationController?.popViewController(animated: true)
}
} else {
if isShowToast {
var errorMsg = isSubmit ? "提交失败" : "保存失败"
if let errMsg = error?.errorMsg, errMsg.count > 0 {
errorMsg = errMsg
}
YHHUD.flash(message: errorMsg)
}
}
}
}
}
...@@ -129,28 +129,28 @@ class YHGCEducationInfoListVC: YHBaseViewController { ...@@ -129,28 +129,28 @@ class YHGCEducationInfoListVC: YHBaseViewController {
items.append(arr0) items.append(arr0)
// 主申请人专业资格及会员资格 // 主申请人专业资格及会员资格
let title1 = YHFormTitleItem(type: .mainApplicantProfessionalQualification) // let title1 = YHFormTitleItem(type: .mainApplicantProfessionalQualification)
var arr1:[YHFormItemProtocol] = [title1] // var arr1:[YHFormItemProtocol] = [title1]
if let quaList = educationInfo.quaList { // if let quaList = educationInfo.quaList {
for (index, quaInfo) in quaList.enumerated() { // for (index, quaInfo) in quaList.enumerated() {
let item = YHFormDetailItem(type: .certificateInfo) // let item = YHFormDetailItem(type: .certificateInfo)
arr1.append(item) // arr1.append(item)
} // }
// 多专业可编辑删除状态 // // 多专业可编辑删除状态
if quaList.count <= 0 { // if quaList.count <= 0 {
isQualificationEditMode = .none // isQualificationEditMode = .none
} else { // } else {
if isQualificationEditMode == .none { // if isQualificationEditMode == .none {
isQualificationEditMode = .canEdit // isQualificationEditMode = .canEdit
} // }
} // }
} else { // } else {
isQualificationEditMode = .none // isQualificationEditMode = .none
} // }
// 新增学历信息 // 新增证书信息
arr1.append(YHFormAddItem(type: .addCertificateInfo)) // arr1.append(YHFormAddItem(type: .addCertificateInfo))
items.append(arr1) // items.append(arr1)
// 学历证书姓名及出生日期正确性 // 学历证书姓名及出生日期正确性
let title2 = YHFormTitleItem(type: .edutionalCertificateNameAndBirthday) let title2 = YHFormTitleItem(type: .edutionalCertificateNameAndBirthday)
...@@ -160,11 +160,11 @@ class YHGCEducationInfoListVC: YHBaseViewController { ...@@ -160,11 +160,11 @@ class YHGCEducationInfoListVC: YHBaseViewController {
for questionInfo in questions { for questionInfo in questions {
if questionInfo.key == "qualification" { if questionInfo.key == "qualification" {
questionInfo.answer = educationInfo.isNameSame questionInfo.answer = educationInfo.isNameSame
arr2.append(questionInfo)
} else if questionInfo.key == "graduate" { } else if questionInfo.key == "graduate" {
questionInfo.answer = educationInfo.isSpouseNameSame questionInfo.answer = educationInfo.isSpouseNameSame
} }
arr2.append(questionInfo)
} }
items.append(arr2) items.append(arr2)
...@@ -253,7 +253,7 @@ extension YHGCEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -253,7 +253,7 @@ extension YHGCEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
if detailItem.type == .addEducation { // 学历 if detailItem.type == .addEducation { // 学历
let vc = YHEducationDetailVC() let vc = YHGCEducationDetailVC()
vc.orderId = self.orderId vc.orderId = self.orderId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
...@@ -457,7 +457,7 @@ extension YHGCEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -457,7 +457,7 @@ extension YHGCEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormDetailItem { if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem let detailItem = item as! YHFormDetailItem
if detailItem.type == .educationInfo { // 学历 if detailItem.type == .educationInfo { // 学历
let vc = YHEducationDetailVC() let vc = YHGCEducationDetailVC()
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
...@@ -603,16 +603,16 @@ extension YHGCEducationInfoListVC { ...@@ -603,16 +603,16 @@ extension YHGCEducationInfoListVC {
} }
} }
// 检查所有证书信息是否有未填项 // 检查所有证书信息是否有未填项
if let quaList = educationInfo.quaList, quaList.count > 0 { // if let quaList = educationInfo.quaList, quaList.count > 0 {
for quaInfo in quaList { // for quaInfo in quaList {
if quaInfo.vacantNum > 0 { // if quaInfo.vacantNum > 0 {
return false // return false
} // }
} // }
} // }
// 检查所有问题是否有未答项 // 检查所有问题是否有未答项
if educationInfo.isNameSame == nil || educationInfo.isSpouseNameSame == nil { if educationInfo.isNameSame == nil {
return false return false
} }
return true return true
......
//
// YHGCEducationCerUploadCell.swift
// galaxy
//
// Created by Dufet on 2024/11/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHGCEducationCerUploadCell: UITableViewCell {
static let cellReuseIdentifier = "YHGCEducationCerUploadCell"
private lazy var topLine:UIView = {
let view = UIView()
view.backgroundColor = UIColor.init(hex: 0xE9ECF0)
return view
}()
lazy var tipsLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
let aa: ASAttributedString = .init("备注:为了进一步确认您的具体信息,如有相关", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor.init(hex: 0x8993A2)))
let bb: ASAttributedString = .init("学士学位证明文件", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor.brandMainColor))
let cc: ASAttributedString = .init(",请优先在列表上传。", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor.init(hex: 0x8993A2)))
label.attributed.text = aa + bb + cc
return label
}()
lazy var uploadContentView: UIView = {
let view = UIView()
return view
}()
lazy var uploadTitleLabel: UILabel = {
let label = UILabel()
let aa: ASAttributedString = .init("上传学历证件", .font(UIFont.PFSC_M(ofSize: 14)), .foreground(UIColor.mainTextColor))
label.attributed.text = aa
return label
}()
lazy var uploadLabel: UILabel = {
let label = UILabel()
label.textAlignment = .right
let aa: ASAttributedString = .init("去上传", .font(UIFont.PFSC_M(ofSize: 14)), .foreground(UIColor.brandMainColor))
label.attributed.text = aa
return label
}()
lazy var arrowImgV: UIImageView = {
let imgV = UIImageView(image: UIImage(named: "blue_right_arrow"))
return imgV
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
contentView.backgroundColor = .white
contentView.addSubview(topLine)
contentView.addSubview(tipsLabel)
contentView.addSubview(uploadContentView)
uploadContentView.addSubview(uploadTitleLabel)
uploadContentView.addSubview(uploadLabel)
uploadContentView.addSubview(arrowImgV)
topLine.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
tipsLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(topLine.snp.bottom).offset(16)
}
uploadContentView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(tipsLabel.snp.bottom).offset(12)
make.height.equalTo(52)
make.bottom.equalTo(-4)
}
uploadTitleLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview()
make.height.equalTo(20)
}
arrowImgV.snp.makeConstraints { make in
make.width.height.equalTo(20)
make.centerY.equalToSuperview()
make.right.equalTo(-20)
}
uploadLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(arrowImgV.snp.left)
make.height.equalTo(20)
}
}
}
...@@ -206,6 +206,7 @@ class YHGCFamilyMemberInfoListVC: YHBaseViewController { ...@@ -206,6 +206,7 @@ class YHGCFamilyMemberInfoListVC: YHBaseViewController {
// } // }
// items.append(brotherArr) // items.append(brotherArr)
let childCount = familyMemberInfo?.child?.count ?? 0 let childCount = familyMemberInfo?.child?.count ?? 0
if childCount <= 0 { if childCount <= 0 {
isChildsEditMode = .none isChildsEditMode = .none
......
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