Commit e513af05 authored by pete谢兆麟's avatar pete谢兆麟

工作经验

parent cc4b6479
......@@ -10,6 +10,11 @@
040450CF2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */; };
0408C3632BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0408C3622BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift */; };
0409BEEB2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0409BEEA2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift */; };
040AE9762CE7195600310241 /* YHWorkExperienceListReasonTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9752CE7195600310241 /* YHWorkExperienceListReasonTableViewCell.swift */; };
040AE9782CE73BA600310241 /* YHWorkExperiencePositionTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9772CE73BA600310241 /* YHWorkExperiencePositionTableViewCell.swift */; };
040AE97A2CE73D9E00310241 /* YHWorkExperiencePositionViewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9792CE73D9E00310241 /* YHWorkExperiencePositionViewViewController.swift */; };
040AE97C2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE97B2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift */; };
040AE97E2CE7464000310241 /* YHWorkExperiencePositionListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE97D2CE7464000310241 /* YHWorkExperiencePositionListTableViewCell.swift */; };
04129E862CD0C8490072F87B /* YHAliYunLogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */; };
041390692C1081FA0098CB8A /* YHFileListEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */; };
0414708B2C88627B00B7B688 /* YHButlerServiceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */; };
......@@ -978,6 +983,11 @@
040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentMultiLineTipsCell.swift; sourceTree = "<group>"; };
0408C3622BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerControlView.swift; sourceTree = "<group>"; };
0409BEEA2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPrincipleProfileListCell.swift; sourceTree = "<group>"; };
040AE9752CE7195600310241 /* YHWorkExperienceListReasonTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperienceListReasonTableViewCell.swift; sourceTree = "<group>"; };
040AE9772CE73BA600310241 /* YHWorkExperiencePositionTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperiencePositionTableViewCell.swift; sourceTree = "<group>"; };
040AE9792CE73D9E00310241 /* YHWorkExperiencePositionViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperiencePositionViewViewController.swift; sourceTree = "<group>"; };
040AE97B2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperiencePositionViewModel.swift; sourceTree = "<group>"; };
040AE97D2CE7464000310241 /* YHWorkExperiencePositionListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperiencePositionListTableViewCell.swift; sourceTree = "<group>"; };
04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAliYunLogManager.swift; sourceTree = "<group>"; };
041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListEmptyView.swift; sourceTree = "<group>"; };
0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceManager.swift; sourceTree = "<group>"; };
......@@ -2802,6 +2812,7 @@
045EEDC12B9F171A0022A143 /* YHWorkExperienceViewModel.swift */,
045EEDC22B9F171A0022A143 /* YHCompanyViewModel.swift */,
045EEDC32B9F171A0022A143 /* YHWorkItemListViewModel.swift */,
040AE97B2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
......@@ -2830,6 +2841,7 @@
045EEDD12B9F171A0022A143 /* YHWorkExperienceListViewController.swift */,
045EEDD22B9F171A0022A143 /* YHWorkExampleViewController.swift */,
045EEDD32B9F171A0022A143 /* YHImageClipperViewController.swift */,
040AE9792CE73D9E00310241 /* YHWorkExperiencePositionViewViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -2859,6 +2871,9 @@
045EEDE72B9F171A0022A143 /* YHResultBottomView.swift */,
045EEDE82B9F171A0022A143 /* YHWorkFileItemView.swift */,
043B0A342C1190C6008A9BBA /* YHSelectFileSheetView.swift */,
040AE9752CE7195600310241 /* YHWorkExperienceListReasonTableViewCell.swift */,
040AE9772CE73BA600310241 /* YHWorkExperiencePositionTableViewCell.swift */,
040AE97D2CE7464000310241 /* YHWorkExperiencePositionListTableViewCell.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -5503,6 +5518,7 @@
04CA2BFD2CB7C36D00F36DE7 /* YHResignUploadDocListCell.swift in Sources */,
045EEF0B2B9F171A0022A143 /* YHBasicInfoFillViewController.swift in Sources */,
0430E6582C7434F2000511E2 /* YHAdopterNewPeopleViewController.swift in Sources */,
040AE97A2CE73D9E00310241 /* YHWorkExperiencePositionViewViewController.swift in Sources */,
A582B2452BBA4CF9009D098C /* YHHKPlanDocModel.swift in Sources */,
045EEF142B9F171A0022A143 /* YHItemModel.swift in Sources */,
047AB5E62CD083CE002A3573 /* YHButlerMessageReportHandler.swift in Sources */,
......@@ -5567,6 +5583,7 @@
048787D12BCE61B20036E221 /* YHServiceNoOrderView.swift in Sources */,
A567E5AC2BD7643D00D5D5A0 /* YHAgreementAlertView.swift in Sources */,
04F243372C958FB100DF2C74 /* YHHKImmigrationRecordsVC.swift in Sources */,
040AE97C2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift in Sources */,
04CE1ADD2C2AD91F001CB80A /* YHActivityDetailCell.swift in Sources */,
04AA19FD2BB40D5C00C1CBBD /* Applegate(JPush).swift in Sources */,
04912F7E2CB7B2BA00CC3105 /* YHResignAppointOptionResultCell.swift in Sources */,
......@@ -5894,6 +5911,7 @@
04C85DE12C3677CB008B20D6 /* YHConsultantQRCodeView.swift in Sources */,
A567E5A32BD7643D00D5D5A0 /* YHHomeBannerView.swift in Sources */,
A5ACE9402B4564F7002C94D2 /* String+Extension.swift in Sources */,
040AE9782CE73BA600310241 /* YHWorkExperiencePositionTableViewCell.swift in Sources */,
04CCEDFB2CA142010026EA70 /* YHHKImmigrationRecordsStatisticsModel.swift in Sources */,
045EEEE42B9F171A0022A143 /* YHMySignatureDetailModel.swift in Sources */,
A5DF9C652C78B5A400CE48E6 /* YHUploadCertificateViewModel.swift in Sources */,
......@@ -6100,6 +6118,7 @@
A5FD63C12B62616D00D1D9DA /* YHInformationPerfectModel.swift in Sources */,
044F395C2CB8D58A007CA277 /* YHVisaRenewalPayInfoBaseCell.swift in Sources */,
A567E5A62BD7643D00D5D5A0 /* YHHomeSearchView.swift in Sources */,
040AE97E2CE7464000310241 /* YHWorkExperiencePositionListTableViewCell.swift in Sources */,
045792212CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift in Sources */,
045EEE912B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemView.swift in Sources */,
04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */,
......@@ -6212,6 +6231,7 @@
045EEEB82B9F171A0022A143 /* YHWorkExampleMessageView.swift in Sources */,
04256E142C75BD2700A37BA4 /* YHPayMemberItemsView.swift in Sources */,
04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */,
040AE9762CE7195600310241 /* YHWorkExperienceListReasonTableViewCell.swift in Sources */,
045EEEA22B9F171A0022A143 /* YHWorkExperienceProjectModel.swift in Sources */,
04213B332C4A084600797900 /* YHHomeInfoClassifyModel.swift in Sources */,
04F316442C3568F000024164 /* YHAboutGalaxyViewController.swift in Sources */,
......
......@@ -19,6 +19,11 @@ class YHDocumentPromptTableViewCell: UITableViewCell {
updatePrompt()
}
}
var workList: Int = 0 {
didSet {
updateWorkPrompt()
}
}
override func awakeFromNib() {
super.awakeFromNib()
......@@ -120,7 +125,14 @@ class YHDocumentPromptTableViewCell: UITableViewCell {
subTitleLabel.attributed.text = a + aa
}
}
func updateWorkPrompt() {
let a: ASAttributedString = .init("温馨提示:优才获批后,您需要提供获批时在职公司盖章的赴港居留同意书,请您知悉。", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.subTextColor2))
let aa: ASAttributedString = .init("查看示例模板", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.brandMainColor), .underline(.single), .action {
})
subTitleLabel.attributed.text = a + aa
}
}
......@@ -17,6 +17,7 @@ class YHWorkExperienceListViewController: YHBaseViewController {
var isMore: Bool = false
var orderId: Int = 0
var showPrompt: Bool = false
override func viewDidLoad() {
super.viewDidLoad()
viewModel = YHWorkItemListViewModel()
......@@ -57,6 +58,8 @@ class YHWorkExperienceListViewController: YHBaseViewController {
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHWorkExperienceListTableViewCell.self)
tableView.register(cellWithClass: YHDocumentPromptTableViewCell.self)
tableView.register(cellWithClass: YHWorkExperienceListReasonTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
......@@ -130,55 +133,75 @@ class YHWorkExperienceListViewController: YHBaseViewController {
extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceListTableViewCell.self)
cell.showPrompt = showPrompt
cell.dataSource = dataSource
if isMore {
cell.more()
} else {
cell.cannal()
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
let firstModel = self.dataSource?.first
let vc = YHWorkExperienceViewController()
vc.workExperienceID = "\(model.id ?? 0)"
vc.orderID = self.orderId
vc.isShowMessageSelect = true
if firstModel?.id == model.id {
vc.isShowMessageSelect = false
}
self.navigationController?.pushViewController(vc, animated: true)
}
cell.deleteBlock = {[weak self] model in
guard let self = self else { return }
self.showDeleteAlert(model)
}
cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return }
self.isMore = isMore
}
cell.newWorkBlock = {[weak self] in
guard let self = self else { return }
if self.dataSource?.count == 10 {
YHHUD.flash(message: "新增工作经历不能超过10条")
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHDocumentPromptTableViewCell.self)
cell.workList = 0
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
} else if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceListTableViewCell.self)
cell.showPrompt = showPrompt
cell.dataSource = dataSource
if isMore {
cell.more()
} else {
cell.cannal()
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
let firstModel = self.dataSource?.first
let vc = YHWorkExperienceViewController()
vc.isShowMessageSelect = true
vc.workExperienceID = "\(model.id ?? 0)"
vc.orderID = self.orderId
vc.isShowMessageSelect = true
if firstModel?.id == model.id {
vc.isShowMessageSelect = false
}
self.navigationController?.pushViewController(vc, animated: true)
}
cell.deleteBlock = {[weak self] model in
guard let self = self else { return }
self.showDeleteAlert(model)
}
cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return }
self.isMore = isMore
}
cell.newWorkBlock = {[weak self] in
guard let self = self else { return }
if self.dataSource?.count == 10 {
YHHUD.flash(message: "新增工作经历不能超过10条")
} else {
let vc = YHWorkExperienceViewController()
vc.isShowMessageSelect = true
vc.orderID = self.orderId
self.navigationController?.pushViewController(vc, animated: true)
}
}
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
} else if indexPath.row == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceListReasonTableViewCell.self)
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
}
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
return UITableViewCell()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
return 104
}
if indexPath.row == 2 {
return 540
}
let number = dataSource?.count ?? 0
var height = 23 + 154
if let data = dataSource {
......
//
// YHWorkExperiencePositionViewViewController.swift
// galaxy
//
// Created by EDY on 2024/11/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkExperiencePositionViewViewController: YHBaseViewController {
var bottomView: YHBottomNextView!
var tableView: UITableView!
var viewModel: YHWorkExperiencePositionViewModel!
var baseDataSource: [YHSectionWorkExperienceModel]?
var introductionDataSource: [YHWorkExperienceProjectModel]?
var fileDataSource: [YHWorkExperienceFileModel]?
var workExperienceID: String?
var orderID: Int = 0
var isMore: Bool = false
var isShowPrompt: Bool = false
var isShowMessageSelect: Bool = true
var isKeyboardShow: Bool = false
var selectEditItem = YHWorkExperienceFileModel()
override func viewDidLoad() {
super.viewDidLoad()
viewModel = YHWorkExperiencePositionViewModel()
gk_navTitle = "职位信息填写"
gk_navBackgroundColor = .white
gk_navBarAlpha = 1.0
setView()
getData()
}
func getData() {
self.baseDataSource = self.viewModel.getBaseDataSource(false)
updateDataSource()
}
func updateDataSource() {
bottomView.nextButton.setTitle("提交", for: .normal)
self.tableView.reloadData()
}
func setView() {
tableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHWorkExperiencePositionListTableViewCell.self)
tableView.register(cellWithClass: YHWorkExperiencePositionTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.bottom.equalTo(view)
}
bottomView = {
let bottom = YHBottomNextView()
bottom.nextblock = { [weak self] in
bottom.nextButton.isEnabled = false
guard let self = self else { return }
// if self.viewModel.isCanNext(self.stepView.currentIndex) {
// self.viewModel.mainModel.step = self.stepView.currentIndex
// self.viewModel.saveWorkDetail(1, orderID: self.orderID, callBackBlock: {[weak self] flag, error in
// guard let self = self else { return }
// bottom.nextButton.isEnabled = true
// if let error = error {
// YHHUD.flash(message: error.errorMsg )
// } else {
// YHHUD.hideFlashMessage()
// if self.stepView.currentIndex == 3 {
// YHHUD.flash(message: "提交成功")
// self.navigationController?.popViewController()
// } else {
// self.stepView.currentIndex = self.stepView.currentIndex + 1
// self.updateDataSource()
// }
// }
// })
// } else {
// bottom.nextButton.isEnabled = true
// self.isShowPrompt = true
// self.updateDataSource()
// YHHUD.flash(message: "您还有信息未填写")
// }
}
bottom.saveBlock = { [weak self] in
guard let self = self else { return }
// self.viewModel.saveWorkDetail(0, orderID: self.orderID, callBackBlock: {[weak self] flag, error in
// guard let self = self else { return }
// if let error = error {
// YHHUD.flash(message: error.errorMsg )
// } else {
// YHHUD.flash(message: "保存成功")
// }
// })
}
return bottom
}()
view.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalTo(view)
make.height.equalTo(k_Height_safeAreaInsetsBottom() + 64)
}
bottomView.layoutIfNeeded()
bottomView.nextButton.addYinHeGradualLayer()
}
func showDeleteAlert(_ model: YHWorkExperienceProjectModel) {
YHCommonAlertView.show("", "确定要删除该项目介绍吗?", "取消", "确认") {[weak self] in
guard let self = self else { return }
}
}
func showDeleteAlert(_ model: YHWorkExperienceFileModel) {
YHCommonAlertView.show("", "确定要删除吗?", "取消", "确认") {[weak self] in
guard let self = self else { return }
for i in 0..<(self.fileDataSource?.count ?? 0) {
let data = self.fileDataSource?[i]
if data?.fileName == model.fileName {
self.fileDataSource?.remove(at: i)
self.tableView.reloadData()
self.viewModel.mainModel.file = self.fileDataSource ?? []
return
}
}
}
}
deinit {
NotificationCenter.default.removeObserver(self)
}
}
extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionListTableViewCell.self)
cell.country = self.viewModel.mainModel.location.country
cell.dataSource = baseDataSource?[indexPath.row]
cell.workExperienceBlock = {[weak self] model in
guard let self = self else { return }
self.viewModel.updateModel(model)
let id = model.id
if id != .id1 && id != .id3 && id != .id4 && id != .id7 && id != .id8 && id != .id12 && id != .id14 && id != .id16 && id != .id17 && id != .id18 {
self.updateDataSource()
}
}
cell.companyBlock = {[weak self] company in
guard let self = self else { return }
// self.viewModel.updateModel(company)
self.updateDataSource()
}
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionTableViewCell.self)
cell.showPrompt = isShowPrompt
// cell.dataSource = dataSource
if isMore {
cell.more()
} else {
cell.cannal()
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
// let firstModel = self.dataSource?.first
// let vc = YHWorkExperienceViewController()
// vc.workExperienceID = "\(model.id ?? 0)"
// vc.orderID = self.orderId
// vc.isShowMessageSelect = true
// if firstModel?.id == model.id {
// vc.isShowMessageSelect = false
// }
// self.navigationController?.pushViewController(vc, animated: true)
}
cell.deleteBlock = {[weak self] model in
guard let self = self else { return }
// self.showDeleteAlert(model)
}
cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return }
self.isMore = isMore
}
cell.newWorkBlock = {[weak self] in
guard let self = self else { return }
// if self.dataSource?.count == 10 {
// YHHUD.flash(message: "新增工作经历不能超过10条")
// } else {
// let vc = YHWorkExperienceViewController()
// vc.isShowMessageSelect = true
// vc.orderID = self.orderId
// self.navigationController?.pushViewController(vc, animated: true)
// }
}
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
let array = baseDataSource?[indexPath.row].models ?? []
var h = 0
for i in 0..<array.count {
let data = array[i]
let message = data.message ?? ""
let isShow = data.isShowPrompts ?? false
if data.id == .id13 {
h = h + 72
} else {
h = h + 52
}
if isShow && message.count == 0 {
h = h + 20
}
}
return CGFloat(h + 52 + 14)
} else {
return UITableView.automaticDimension
}
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 7))
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 7
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
}
......@@ -165,6 +165,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
tableView.register(cellWithClass: YHWorkIntroductionTableViewCell.self)
tableView.register(cellWithClass: YHWorkMessageSelectTableViewCell.self)
tableView.register(cellWithClass: YHWorkFileSyncTableViewCell.self)
tableView.register(cellWithClass: YHWorkExperiencePositionTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
......@@ -429,7 +430,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
if stepView.currentIndex == 4 {
return 1
}
return baseDataSource?.count ?? 0
return 2
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
......@@ -637,23 +638,70 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
}
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceTableViewCell.self)
cell.country = self.viewModel.mainModel.location.country
cell.dataSource = baseDataSource?[indexPath.row]
cell.workExperienceBlock = {[weak self] model in
guard let self = self else { return }
self.viewModel.updateModel(model)
let id = model.id
if id != .id1 && id != .id3 && id != .id4 && id != .id7 && id != .id8 && id != .id12 && id != .id14 && id != .id16 && id != .id17 && id != .id18 {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceTableViewCell.self)
cell.country = self.viewModel.mainModel.location.country
cell.dataSource = baseDataSource?[indexPath.row]
cell.workExperienceBlock = {[weak self] model in
guard let self = self else { return }
self.viewModel.updateModel(model)
let id = model.id
if id != .id1 && id != .id3 && id != .id4 && id != .id7 && id != .id8 && id != .id12 && id != .id14 && id != .id16 && id != .id17 && id != .id18 {
self.updateDataSource()
}
}
cell.companyBlock = {[weak self] company in
guard let self = self else { return }
self.viewModel.updateModel(company)
self.updateDataSource()
}
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionTableViewCell.self)
cell.showPrompt = isShowPrompt
// cell.dataSource = dataSource
if isMore {
cell.more()
} else {
cell.cannal()
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
// let firstModel = self.dataSource?.first
// let vc = YHWorkExperienceViewController()
// vc.workExperienceID = "\(model.id ?? 0)"
// vc.orderID = self.orderId
// vc.isShowMessageSelect = true
// if firstModel?.id == model.id {
// vc.isShowMessageSelect = false
// }
// self.navigationController?.pushViewController(vc, animated: true)
}
cell.deleteBlock = {[weak self] model in
guard let self = self else { return }
// self.showDeleteAlert(model)
}
cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return }
self.isMore = isMore
}
cell.newWorkBlock = {[weak self] in
guard let self = self else { return }
// if self.dataSource?.count == 10 {
// YHHUD.flash(message: "新增工作经历不能超过10条")
// } else {
// let vc = YHWorkExperienceViewController()
// vc.isShowMessageSelect = true
// vc.orderID = self.orderId
// self.navigationController?.pushViewController(vc, animated: true)
// }
let vc = YHWorkExperiencePositionViewViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
}
cell.companyBlock = {[weak self] company in
guard let self = self else { return }
self.viewModel.updateModel(company)
self.updateDataSource()
}
return cell
}
}
......@@ -664,24 +712,53 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
let count = fileDataSource?.count ?? 0
return CGFloat(69 * count + 171)
} else {
let array = baseDataSource?[indexPath.row].models ?? []
var h = 0
for i in 0..<array.count {
let data = array[i]
let message = data.message ?? ""
let isShow = data.isShowPrompts ?? false
if data.id == .id3 || data.id == .id4 || data.id == .id18 {
h = h + 132
} else if data.id == .id13 {
h = h + 72
} else {
h = h + 52
}
if isShow && message.count == 0 {
h = h + 20
if indexPath.row == 0 {
let array = baseDataSource?[indexPath.row].models ?? []
var h = 0
for i in 0..<array.count {
let data = array[i]
let message = data.message ?? ""
let isShow = data.isShowPrompts ?? false
if data.id == .id3 || data.id == .id4 || data.id == .id18 {
h = h + 132
} else if data.id == .id13 {
h = h + 72
} else {
h = h + 52
}
if isShow && message.count == 0 {
h = h + 20
}
}
return CGFloat(h + 52 + 14)
} else {
// let number = dataSource?.count ?? 0
var height = 23 + 154
// if let data = dataSource {
// for item in data {
// if item.company_name == "" {
// height = height + 52
// } else {
// let text = item.company_name // 要显示的文本内容
// let font = UIFont.PFSC_B(ofSize: 14) // 字体大小
// let maxWidth = 143.0 // 最大宽度限制
//
// // 创建NSAttributedString对象并设置属性
// let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any]
// _ = NSMutableAttributedString(string: text ?? "", attributes: attributes)
//
// // 根据指定的最大宽度和字体大小计算文本的高度
// let size = (text! as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size
// if size.height > 20 {
// height = height + 96
// } else {
// height = height + 76
// }
// }
// }
// }
return CGFloat(height)
}
return CGFloat(h + 52 + 14)
}
}
......
//
// YHWorkExperienceListReasonTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/11/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHWorkExperienceListReasonTableViewCell: UITableViewCell {
var centerView: UIView!
var titleLabel: UILabel!
var lineView: UIView!
var messageLabel: UILabel!
var messageTwoLabel: UILabel!
var messageView: UIView!
var messageTextField: UITextView!
var promptsLabel: UILabel!
var messageNumberLabel: UILabel!
var messageTwoView: UIView!
var messageTwoTextField: UITextView!
var promptsTwoLabel: UILabel!
var messageTwoNumberLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(7)
make.bottom.equalTo(-7)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 17)
label.text = "工作时间说明"
label.textColor = UIColor.mainTextColor
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(23)
make.height.equalTo(24)
make.right.equalTo(-20)
}
lineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(52)
make.height.equalTo(1)
}
messageLabel = {
let label = UILabel()
label.numberOfLines = 0
let a: ASAttributedString = .init("*", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.failColor))
let aa: ASAttributedString = .init(" 检测到您的", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor(hex:0x8893a2)))
let aaa: ASAttributedString = .init("工作时间有重叠", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.failColor))
let aaaa: ASAttributedString = .init(" 。请确认是否正确填报,若填报无误请在此处说明工作时间重叠的原因~", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor(hex:0x8893a2)))
label.attributed.text = a + aa + aaa + aaaa
return label
}()
centerView.addSubview(messageLabel)
messageLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(68)
}
messageTwoLabel = {
let label = UILabel()
label.numberOfLines = 0
let a: ASAttributedString = .init("*", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.failColor))
let aa: ASAttributedString = .init(" 检测到您的", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor(hex:0x8893a2)))
let aaa: ASAttributedString = .init("工作时间有空窗", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.failColor))
let aaaa: ASAttributedString = .init("。请确认是否正确填报,若填报无误请在此处说明工作时间空窗的原因~", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor(hex:0x8893a2)))
label.attributed.text = a + aa + aaa + aaaa
return label
}()
centerView.addSubview(messageTwoLabel)
messageTwoLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(306)
}
messageView = {
let view = UIView()
view.backgroundColor = UIColor.contentBkgColor
view.layer.cornerRadius = 1
return view
}()
centerView.addSubview(messageView)
messageView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(112)
make.height.equalTo(160)
}
messageTextField = {
let textField = UITextView()
textField.font = UIFont.PFSC_R(ofSize: 14)
textField.backgroundColor = .clear
textField.delegate = self
return textField
}()
centerView.addSubview(messageTextField)
messageTextField.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(112)
make.height.equalTo(128)
}
promptsLabel = {
let prompts = UILabel()
prompts.font = UIFont.PFSC_R(ofSize: 14)
prompts.textColor = UIColor(hex: 0xc0c0c0)
prompts.text = "如:工作时间灵活,可自由安排"
prompts.numberOfLines = 0
prompts.backgroundColor = .clear
return prompts
}()
centerView.addSubview(promptsLabel)
promptsLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.top.equalTo(116)
}
messageNumberLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.text = "0/1000"
label.textAlignment = .right
label.textColor = UIColor(hex: 0xd5dae1)
return label
}()
centerView.addSubview(messageNumberLabel)
messageNumberLabel.snp.makeConstraints { make in
make.right.equalTo(-30)
make.top.equalTo(240)
make.height.equalTo(20)
}
messageTwoView = {
let view = UIView()
view.backgroundColor = UIColor.contentBkgColor
view.layer.cornerRadius = 1
return view
}()
centerView.addSubview(messageTwoView)
messageTwoView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(350)
make.height.equalTo(160)
}
messageTwoTextField = {
let textField = UITextView()
textField.font = UIFont.PFSC_R(ofSize: 14)
textField.backgroundColor = .clear
textField.delegate = self
return textField
}()
centerView.addSubview(messageTwoTextField)
messageTwoTextField.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(350)
make.height.equalTo(128)
}
promptsTwoLabel = {
let prompts = UILabel()
prompts.font = UIFont.PFSC_R(ofSize: 14)
prompts.textColor = UIColor(hex: 0xc0c0c0)
prompts.text = "如:为创业做准备或进行自我提升,期间未就职于任何单位"
prompts.backgroundColor = .clear
prompts.numberOfLines = 0
return prompts
}()
centerView.addSubview(promptsTwoLabel)
promptsTwoLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.top.equalTo(352)
}
messageTwoNumberLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.text = "0/1000"
label.textAlignment = .right
label.textColor = UIColor(hex: 0xd5dae1)
return label
}()
centerView.addSubview(messageTwoNumberLabel)
messageTwoNumberLabel.snp.makeConstraints { make in
make.right.equalTo(-30)
make.top.equalTo(478)
make.height.equalTo(20)
}
}
}
extension YHWorkExperienceListReasonTableViewCell: UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) {
let number = textView.text.count
if textView.text.count != 0 {
if textView == messageTextField {
promptsLabel.isHidden = true
messageNumberLabel.text = "\(number)/1000"
} else {
promptsTwoLabel.isHidden = true
messageTwoNumberLabel.text = "\(number)/1000"
}
} else {
if textView == messageTextField {
promptsLabel.isHidden = false
messageNumberLabel.text = "\(number)/1000"
} else {
promptsTwoLabel.isHidden = false
messageTwoNumberLabel.text = "\(number)/1000"
}
}
}
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newLength = (textView.text as NSString).length + text.count - range.length
return newLength <= 1000
}
}
//
// YHWorkExperiencePositionListTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/11/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkExperiencePositionListTableViewCell: UITableViewCell {
typealias WorkExperienceBlock = (_ model: YHWorkExperienceModel) -> ()
typealias CompanyBlock = (_ model: YHCompanyModelListModel) -> ()
var companyBlock: CompanyBlock?
var workExperienceBlock: WorkExperienceBlock?
var centerView: UIView!
var titleLabel: UILabel!
var mainItemView: UIView!
var country: String = ""
var dataSource: YHSectionWorkExperienceModel?{
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(7)
make.bottom.equalTo(-7)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(20)
make.right.equalTo(-18)
}
mainItemView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
centerView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(52)
}
}
func updateAllViews() {
titleLabel.text = dataSource?.title
mainItemView.removeSubviews()
var y = 0
for i in 0 ..< (dataSource?.models?.count ?? 0) {
let line = UIView()
line.backgroundColor = UIColor.separatorColor
mainItemView.addSubview(line)
line.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(y)
make.height.equalTo(1)
make.right.equalTo(-18)
}
y = y + 1
let data = dataSource?.models?[i]
let isShow = data?.isShowPrompts ?? false
let message = data?.message ?? ""
var h = 51
if data?.id == .id13 {
h = 71
}
if isShow && message.count == 0 {
h = h + 20
}
let itemView = YHWorkExperienceItemView()
itemView.dataSource = data
itemView.country = country
itemView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.workExperienceBlock {
block(model)
}
}
itemView.companyBlock = {[weak self] company in
guard let self = self else { return }
if let block = self.companyBlock {
block(company)
}
}
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(y)
make.height.equalTo(h)
make.right.equalTo(-18)
}
y = y + h
}
}
}
//
// YHWorkExperiencePositionTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/11/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkExperiencePositionTableViewCell: UITableViewCell {
typealias ExperienceListBlock = (_ model: YHWorkItemListModel) -> ()
typealias IsMoreBlock = (_ isMore: Bool) -> ()
typealias NewWorkBlock = () -> ()
var clickBlock: ExperienceListBlock?
var deleteBlock: ExperienceListBlock?
var isMoreBlock: IsMoreBlock?
var newWorkBlock: NewWorkBlock?
var centerView: UIView!
var titleLabel: UILabel!
var subTitleLabel: UILabel!
var cannalButton: UIButton!
var moreButton: UIButton!
var mainItemView: UIView!
var bottomView: YHWorkItemAddView!
var showPrompt: Bool = false
var dataSource: [YHWorkItemListModel]?{
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(14)
make.bottom.equalTo(-7)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 17)
label.text = "主申请人工作经历"
label.textColor = UIColor.mainTextColor
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(23)
make.height.equalTo(24)
make.right.equalTo(-20)
}
subTitleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.text = "(从最近一份全职工作开始,直至毕业后的第一份工作)"
label.textColor = UIColor.labelTextColor2
return label
}()
centerView.addSubview(subTitleLabel)
subTitleLabel.snp.makeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(50)
make.height.equalTo(20)
make.right.equalTo(-20)
}
cannalButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("取消操作", for: .normal)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.addTarget(self, action: #selector(cannal), for: .touchUpInside)
button.isHidden = true
return button
}()
centerView.addSubview(cannalButton)
cannalButton.snp.makeConstraints { make in
make.right.equalTo(-18)
make.top.equalTo(24)
make.height.equalTo(20)
make.width.equalTo(60)
}
moreButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "work_more"), for: .normal)
button.addTarget(self, action: #selector(more), for: .touchUpInside)
return button
}()
centerView.addSubview(moreButton)
moreButton.snp.makeConstraints { make in
make.right.equalTo(-18)
make.top.equalTo(24)
make.height.equalTo(24)
make.width.equalTo(24)
}
mainItemView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
centerView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalTo(-65)
make.top.equalTo(85)
}
bottomView = {
let view = YHWorkItemAddView()
view.addBtn.setTitle("新增工作经验".local, for: .normal)
view.clickBlock = {[weak self] in
guard let self = self else { return }
if let block = self.newWorkBlock {
block()
}
}
return view
}()
centerView.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.right.bottom.equalTo(-18)
make.left.equalTo(18)
make.height.equalTo(45)
}
}
func updateAllViews() {
mainItemView.removeSubviews()
guard let dataSource = dataSource else {
let line = UIView()
line.backgroundColor = UIColor.separatorColor
mainItemView.addSubview(line)
line.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalToSuperview()
make.height.equalTo(1)
make.right.equalTo(-18)
}
let itemView = YHWorkItemView()
itemView.dataSource = YHWorkItemListModel()
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(1)
make.height.equalTo(51)
make.right.equalTo(-18)
}
return
}
var total = 0
for i in 0 ..< dataSource.count {
let line = UIView()
line.backgroundColor = UIColor.separatorColor
mainItemView.addSubview(line)
line.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(total)
make.height.equalTo(1)
make.right.equalTo(-18)
}
total = total + 1
let itemView = YHWorkItemView()
itemView.clickBlock = {[weak self] model in
guard let self = self else { return }
if let block = self.clickBlock {
block(model)
}
}
itemView.deleteBlock = {[weak self] model in
guard let self = self else { return }
if let block = self.deleteBlock {
block(model)
}
}
let model = dataSource[i]
itemView.tag = 4000 + i
itemView.dataSource = dataSource[i]
itemView.showPrompt = showPrompt
var h = 0
if model.company_name == "" {
h = 51
} else {
let text = model.company_name // 要显示的文本内容
let font = UIFont.PFSC_B(ofSize: 14) // 字体大小
let maxWidth = 143.0 // 最大宽度限制
// 创建NSAttributedString对象并设置属性
let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any]
_ = NSMutableAttributedString(string: text ?? "", attributes: attributes)
// 根据指定的最大宽度和字体大小计算文本的高度
let size = (text! as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size
if size.height > 20 {
h = 95
} else {
h = 75
}
}
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(total)
make.height.equalTo(h)
make.right.equalTo(-18)
}
total = total + h
}
}
@objc func cannal() {
moreButton.isHidden = false
cannalButton.isHidden = true
for i in 0..<(dataSource?.count ?? 0) {
let view = mainItemView.viewWithTag(4000 + i) as! YHWorkItemView
view.isShowDelete(i, isShow: false)
}
if let block = isMoreBlock {
block(false)
}
}
@objc func more() {
moreButton.isHidden = true
cannalButton.isHidden = false
for i in 0..<(dataSource?.count ?? 0) {
let view = mainItemView.viewWithTag(4000 + i) as! YHWorkItemView
view.isShowDelete(i, isShow: true)
}
if let block = isMoreBlock {
block(true)
}
}
}
//
// YHWorkExperiencePositionViewModel.swift
// galaxy
//
// Created by EDY on 2024/11/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkExperiencePositionViewModel: YHBaseViewModel {
var mainModel: YHWorkExperienceDetailModel = YHWorkExperienceDetailModel()
override init() {
super.init()
}
func getBaseDataSource(_ isShowPrompt: Bool) -> [YHSectionWorkExperienceModel] {
let item = YHWorkExperienceModel(id: .id1, isNeed: true, title: "职位名称", isUserKeyBoard: true, prompts: "请输入", message: mainModel.company_name, isShowPrompts: isShowPrompt, alertMessage:"请输入")
let item1 = YHWorkExperienceModel(id: .id2, isNeed: true, title: "职责性质", isUserKeyBoard: true, prompts: "请输入", message: mainModel.industry, isShowPrompts: isShowPrompt, alertMessage:"请输入")
let item2 = YHWorkExperienceModel(id: .id3, isNeed: false, title: "开始就职年月", isUserKeyBoard: false, prompts: "请选择", message: mainModel.company_introduce, type: .time)
let item3 = YHWorkExperienceModel(id: .id4, isNeed: false, title: "结束就职年月", isUserKeyBoard: true, prompts: "请选择", message: mainModel.company_website, type: .time)
let item6 = YHWorkExperienceModel(id: .id5, isNeed: true, title: "经验领域", isUserKeyBoard: false, prompts: "请选择", message: mainModel.location.country, type: .country, isShowPrompts: isShowPrompt, alertMessage:"请选择")
let item11 = YHWorkExperienceModel(id: .id13, isNeed: false, title: "相关工作经验是否属于国际工作经验", isUserKeyBoard: false, prompts: "", message: "\(mainModel.international_work_experience)", leftButtonString: "是", rightButtonString: "否")
let item4 = YHWorkExperienceModel(id: .id5, isNeed: true, title: "工作国家/地区", isUserKeyBoard: false, prompts: "请选择", message: mainModel.location.country, type: .country, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
var string = ""
let array = mainModel.location.area
for item in array {
if string.count != 0 {
string = string + "/" + item
} else {
string = string + item
}
}
let item5 = YHWorkExperienceModel(id: .id6, isNeed: true, title: "工作城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
let item55 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "工作城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.location.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入工作国家/地区")
let addressCountry = mainModel.location.country
var section = YHSectionWorkExperienceModel()
if addressCountry.contains("中国") {
section = YHSectionWorkExperienceModel(title: "企业信息", models: [item, item1, item2, item3, item6, item11, item4, item5])
} else {
section = YHSectionWorkExperienceModel(title: "企业信息", models: [item, item1, item2, item3, item6, item11, item4, item55])
}
return [section]
}
func updateModel(_ item: YHWorkExperienceModel) {
guard let type = item.id else { return }
switch type {
case .id1: // 用人单位
mainModel.company_name = item.message ?? ""
case .id2: // 用人单位性质
mainModel.industry = item.message ?? ""
case .id3: // 用人单位介绍
mainModel.company_introduce = item.message ?? ""
case .id4: // 用人单位官网
mainModel.company_website = item.message ?? ""
case .id5: // 工作地区国家
mainModel.location.country = item.message ?? ""
case .id6: // 工作城市 国内
mainModel.location.area = item.value ?? []
case .id7: // 工作城市国外
mainModel.location.foreign = item.message ?? ""
case .id8: // 职位
mainModel.position = item.message ?? ""
case .id9: // 入职年月
let format = DateFormatter()
format.dateFormat = "yyyy-MM"
if let selectDate = format.date(from:item.message ?? "") {
let selectTimeInterval = selectDate.timeIntervalSince1970
let currentTimeInterval = Date().timeIntervalSince1970
if selectTimeInterval > currentTimeInterval {
YHHUD.flash(message: "入职日期不能晚于当前日期")
} else {
guard let endDate = format.date(from: mainModel.departure_time) else {
mainModel.entry_time = item.message ?? ""
return
}
let endTimeInterval = endDate.timeIntervalSince1970
if selectTimeInterval > endTimeInterval {
YHHUD.flash(message: "入职日期不能晚于离职日期")
} else {
mainModel.entry_time = item.message ?? ""
}
}
}
case .id10: // 离职年月
let format = DateFormatter()
format.dateFormat = "yyyy-MM"
if let selectDate = format.date(from:item.message ?? ""), let startDate = format.date(from:mainModel.entry_time) {
let selectTimeInterval = selectDate.timeIntervalSince1970
let startTimeInterval = startDate.timeIntervalSince1970
if selectTimeInterval < startTimeInterval {
YHHUD.flash(message: "离职日期不能早于入职日期")
} else {
mainModel.departure_time = item.message ?? ""
}
} else {
mainModel.departure_time = item.message ?? ""
}
case .id11: // 工作证明文件
mainModel.work_certificate = item.message ?? ""
case .id12: // 职责性质
mainModel.duty = item.message ?? ""
case .id13: // 是否国际工作经验
mainModel.international_work_experience = Int(item.value?.first ?? "0") ?? 0
case .id14: // 企业人数规模
mainModel.company_member_total = Int(item.message ?? "0") ?? 0
case .id15: // 行政架构层级
mainModel.administrative_level = Int(item.value?.first ?? "0") ?? 0
case .id16: // 下属管理人数
mainModel.company_manage_total = Int(item.message ?? "0") ?? 0
case .id17: // 公司营业额/港元
mainModel.turnover = Int(item.message ?? "0") ?? 0
case .id18: // 公司性质/范畴/所属行业
mainModel.business_nature = item.message ?? ""
case .id19: // 职位水平类型
mainModel.professional_level = Int(item.value?.first ?? "0") ?? 0
case .id20: // 高管证明文件
mainModel.executives_certificate = item.message ?? ""
case .id21: // 高管在职开始时间
let format = DateFormatter()
format.dateFormat = "yyyy-MM"
if let selectDate = format.date(from:item.message ?? "") {
let selectTimeInterval = selectDate.timeIntervalSince1970
let currentTimeInterval = Date().timeIntervalSince1970
if selectTimeInterval > currentTimeInterval {
YHHUD.flash(message: "高管在职开始时间不能晚于当前日期")
} else {
guard let endDate = format.date(from: mainModel.top_manager_end_at) else {
mainModel.top_manager_start_at = item.message ?? ""
return
}
let endTimeInterval = endDate.timeIntervalSince1970
if selectTimeInterval > endTimeInterval {
YHHUD.flash(message: "高管在职开始时间不能晚于离职日期")
} else {
mainModel.top_manager_start_at = item.message ?? ""
}
}
}
case .id22: // 高管在职结束时间
let format = DateFormatter()
format.dateFormat = "yyyy-MM"
if let selectDate = format.date(from:item.message ?? ""), let startDate = format.date(from:mainModel.top_manager_start_at) {
let selectTimeInterval = selectDate.timeIntervalSince1970
let startTimeInterval = startDate.timeIntervalSince1970
if selectTimeInterval < startTimeInterval {
YHHUD.flash(message: "高管在职结束时间不能早于开始日期")
} else {
mainModel.top_manager_end_at = item.message ?? ""
}
} else {
mainModel.top_manager_end_at = item.message ?? ""
}
}
}
func isCanNext(_ step: Int) -> Bool {
if step == 0 {
let companyName = mainModel.company_name //公司名称
let industry = mainModel.industry //用人单位性质
let country = mainModel.location.country //工作国家
let area = mainModel.location.area //工作城市
let foreign = mainModel.location.foreign //工作城市 国外
let entryTime = mainModel.entry_time //入职年月
let departureTime = mainModel.departure_time //离职年月
let workCertificate = mainModel.work_certificate //工作证明文件
let duty = mainModel.duty //职责性质
let companyMemberTotal = mainModel.company_member_total //企业人数规模
let companyManageTotal = mainModel.company_manage_total //下属管理人数
let professionalLevel = mainModel.professional_level //职位水平类别
let executivesCertificate = mainModel.executives_certificate //高管证明文件
let topManagerStartAt = mainModel.top_manager_start_at //高管在职开始时间
let topManagerEndAt = mainModel.top_manager_end_at //高管在职开始时间
guard companyName.count > 0 else { return false }
guard industry.count > 0 else { return false }
guard country.count > 0 else { return false }
guard entryTime.count > 0 else { return false }
guard workCertificate.count > 0 else { return false }
guard duty.count > 0 else { return false }
guard companyMemberTotal >= 0 else { return false }
guard companyManageTotal >= 0 else { return false }
guard professionalLevel > 0 else { return false }
if country.contains("中国") {
guard area.count > 0 else { return false }
} else {
guard foreign.count > 0 else { return false }
}
if professionalLevel == 1 {
guard executivesCertificate.count > 0 else { return false }
guard topManagerStartAt.count > 0 else { return false }
guard topManagerEndAt.count > 0 else { return false }
}
return true
} else if step == 1 {
let message = mainModel.wduty
guard message.count > 0 else { return false }
return true
} else if step == 2 {
let message = mainModel.highlights
guard message.count > 0 else { return false }
return true
} else if step == 3 {
return true
} else {
return true
}
}
}
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