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

工作经验

parent cc4b6479
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
040450CF2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */; }; 040450CF2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */; };
0408C3632BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0408C3622BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift */; }; 0408C3632BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0408C3622BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift */; };
0409BEEB2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0409BEEA2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.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 */; }; 04129E862CD0C8490072F87B /* YHAliYunLogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */; };
041390692C1081FA0098CB8A /* YHFileListEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */; }; 041390692C1081FA0098CB8A /* YHFileListEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */; };
0414708B2C88627B00B7B688 /* YHButlerServiceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */; }; 0414708B2C88627B00B7B688 /* YHButlerServiceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */; };
...@@ -978,6 +983,11 @@ ...@@ -978,6 +983,11 @@
040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentMultiLineTipsCell.swift; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceManager.swift; sourceTree = "<group>"; };
...@@ -2802,6 +2812,7 @@ ...@@ -2802,6 +2812,7 @@
045EEDC12B9F171A0022A143 /* YHWorkExperienceViewModel.swift */, 045EEDC12B9F171A0022A143 /* YHWorkExperienceViewModel.swift */,
045EEDC22B9F171A0022A143 /* YHCompanyViewModel.swift */, 045EEDC22B9F171A0022A143 /* YHCompanyViewModel.swift */,
045EEDC32B9F171A0022A143 /* YHWorkItemListViewModel.swift */, 045EEDC32B9F171A0022A143 /* YHWorkItemListViewModel.swift */,
040AE97B2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift */,
); );
path = ViewModel; path = ViewModel;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2830,6 +2841,7 @@ ...@@ -2830,6 +2841,7 @@
045EEDD12B9F171A0022A143 /* YHWorkExperienceListViewController.swift */, 045EEDD12B9F171A0022A143 /* YHWorkExperienceListViewController.swift */,
045EEDD22B9F171A0022A143 /* YHWorkExampleViewController.swift */, 045EEDD22B9F171A0022A143 /* YHWorkExampleViewController.swift */,
045EEDD32B9F171A0022A143 /* YHImageClipperViewController.swift */, 045EEDD32B9F171A0022A143 /* YHImageClipperViewController.swift */,
040AE9792CE73D9E00310241 /* YHWorkExperiencePositionViewViewController.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2859,6 +2871,9 @@ ...@@ -2859,6 +2871,9 @@
045EEDE72B9F171A0022A143 /* YHResultBottomView.swift */, 045EEDE72B9F171A0022A143 /* YHResultBottomView.swift */,
045EEDE82B9F171A0022A143 /* YHWorkFileItemView.swift */, 045EEDE82B9F171A0022A143 /* YHWorkFileItemView.swift */,
043B0A342C1190C6008A9BBA /* YHSelectFileSheetView.swift */, 043B0A342C1190C6008A9BBA /* YHSelectFileSheetView.swift */,
040AE9752CE7195600310241 /* YHWorkExperienceListReasonTableViewCell.swift */,
040AE9772CE73BA600310241 /* YHWorkExperiencePositionTableViewCell.swift */,
040AE97D2CE7464000310241 /* YHWorkExperiencePositionListTableViewCell.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -5503,6 +5518,7 @@ ...@@ -5503,6 +5518,7 @@
04CA2BFD2CB7C36D00F36DE7 /* YHResignUploadDocListCell.swift in Sources */, 04CA2BFD2CB7C36D00F36DE7 /* YHResignUploadDocListCell.swift in Sources */,
045EEF0B2B9F171A0022A143 /* YHBasicInfoFillViewController.swift in Sources */, 045EEF0B2B9F171A0022A143 /* YHBasicInfoFillViewController.swift in Sources */,
0430E6582C7434F2000511E2 /* YHAdopterNewPeopleViewController.swift in Sources */, 0430E6582C7434F2000511E2 /* YHAdopterNewPeopleViewController.swift in Sources */,
040AE97A2CE73D9E00310241 /* YHWorkExperiencePositionViewViewController.swift in Sources */,
A582B2452BBA4CF9009D098C /* YHHKPlanDocModel.swift in Sources */, A582B2452BBA4CF9009D098C /* YHHKPlanDocModel.swift in Sources */,
045EEF142B9F171A0022A143 /* YHItemModel.swift in Sources */, 045EEF142B9F171A0022A143 /* YHItemModel.swift in Sources */,
047AB5E62CD083CE002A3573 /* YHButlerMessageReportHandler.swift in Sources */, 047AB5E62CD083CE002A3573 /* YHButlerMessageReportHandler.swift in Sources */,
...@@ -5567,6 +5583,7 @@ ...@@ -5567,6 +5583,7 @@
048787D12BCE61B20036E221 /* YHServiceNoOrderView.swift in Sources */, 048787D12BCE61B20036E221 /* YHServiceNoOrderView.swift in Sources */,
A567E5AC2BD7643D00D5D5A0 /* YHAgreementAlertView.swift in Sources */, A567E5AC2BD7643D00D5D5A0 /* YHAgreementAlertView.swift in Sources */,
04F243372C958FB100DF2C74 /* YHHKImmigrationRecordsVC.swift in Sources */, 04F243372C958FB100DF2C74 /* YHHKImmigrationRecordsVC.swift in Sources */,
040AE97C2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift in Sources */,
04CE1ADD2C2AD91F001CB80A /* YHActivityDetailCell.swift in Sources */, 04CE1ADD2C2AD91F001CB80A /* YHActivityDetailCell.swift in Sources */,
04AA19FD2BB40D5C00C1CBBD /* Applegate(JPush).swift in Sources */, 04AA19FD2BB40D5C00C1CBBD /* Applegate(JPush).swift in Sources */,
04912F7E2CB7B2BA00CC3105 /* YHResignAppointOptionResultCell.swift in Sources */, 04912F7E2CB7B2BA00CC3105 /* YHResignAppointOptionResultCell.swift in Sources */,
...@@ -5894,6 +5911,7 @@ ...@@ -5894,6 +5911,7 @@
04C85DE12C3677CB008B20D6 /* YHConsultantQRCodeView.swift in Sources */, 04C85DE12C3677CB008B20D6 /* YHConsultantQRCodeView.swift in Sources */,
A567E5A32BD7643D00D5D5A0 /* YHHomeBannerView.swift in Sources */, A567E5A32BD7643D00D5D5A0 /* YHHomeBannerView.swift in Sources */,
A5ACE9402B4564F7002C94D2 /* String+Extension.swift in Sources */, A5ACE9402B4564F7002C94D2 /* String+Extension.swift in Sources */,
040AE9782CE73BA600310241 /* YHWorkExperiencePositionTableViewCell.swift in Sources */,
04CCEDFB2CA142010026EA70 /* YHHKImmigrationRecordsStatisticsModel.swift in Sources */, 04CCEDFB2CA142010026EA70 /* YHHKImmigrationRecordsStatisticsModel.swift in Sources */,
045EEEE42B9F171A0022A143 /* YHMySignatureDetailModel.swift in Sources */, 045EEEE42B9F171A0022A143 /* YHMySignatureDetailModel.swift in Sources */,
A5DF9C652C78B5A400CE48E6 /* YHUploadCertificateViewModel.swift in Sources */, A5DF9C652C78B5A400CE48E6 /* YHUploadCertificateViewModel.swift in Sources */,
...@@ -6100,6 +6118,7 @@ ...@@ -6100,6 +6118,7 @@
A5FD63C12B62616D00D1D9DA /* YHInformationPerfectModel.swift in Sources */, A5FD63C12B62616D00D1D9DA /* YHInformationPerfectModel.swift in Sources */,
044F395C2CB8D58A007CA277 /* YHVisaRenewalPayInfoBaseCell.swift in Sources */, 044F395C2CB8D58A007CA277 /* YHVisaRenewalPayInfoBaseCell.swift in Sources */,
A567E5A62BD7643D00D5D5A0 /* YHHomeSearchView.swift in Sources */, A567E5A62BD7643D00D5D5A0 /* YHHomeSearchView.swift in Sources */,
040AE97E2CE7464000310241 /* YHWorkExperiencePositionListTableViewCell.swift in Sources */,
045792212CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift in Sources */, 045792212CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift in Sources */,
045EEE912B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemView.swift in Sources */, 045EEE912B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemView.swift in Sources */,
04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */, 04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */,
...@@ -6212,6 +6231,7 @@ ...@@ -6212,6 +6231,7 @@
045EEEB82B9F171A0022A143 /* YHWorkExampleMessageView.swift in Sources */, 045EEEB82B9F171A0022A143 /* YHWorkExampleMessageView.swift in Sources */,
04256E142C75BD2700A37BA4 /* YHPayMemberItemsView.swift in Sources */, 04256E142C75BD2700A37BA4 /* YHPayMemberItemsView.swift in Sources */,
04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */, 04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */,
040AE9762CE7195600310241 /* YHWorkExperienceListReasonTableViewCell.swift in Sources */,
045EEEA22B9F171A0022A143 /* YHWorkExperienceProjectModel.swift in Sources */, 045EEEA22B9F171A0022A143 /* YHWorkExperienceProjectModel.swift in Sources */,
04213B332C4A084600797900 /* YHHomeInfoClassifyModel.swift in Sources */, 04213B332C4A084600797900 /* YHHomeInfoClassifyModel.swift in Sources */,
04F316442C3568F000024164 /* YHAboutGalaxyViewController.swift in Sources */, 04F316442C3568F000024164 /* YHAboutGalaxyViewController.swift in Sources */,
......
...@@ -19,6 +19,11 @@ class YHDocumentPromptTableViewCell: UITableViewCell { ...@@ -19,6 +19,11 @@ class YHDocumentPromptTableViewCell: UITableViewCell {
updatePrompt() updatePrompt()
} }
} }
var workList: Int = 0 {
didSet {
updateWorkPrompt()
}
}
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
...@@ -120,7 +125,14 @@ class YHDocumentPromptTableViewCell: UITableViewCell { ...@@ -120,7 +125,14 @@ class YHDocumentPromptTableViewCell: UITableViewCell {
subTitleLabel.attributed.text = a + aa 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 { ...@@ -17,6 +17,7 @@ class YHWorkExperienceListViewController: YHBaseViewController {
var isMore: Bool = false var isMore: Bool = false
var orderId: Int = 0 var orderId: Int = 0
var showPrompt: Bool = false var showPrompt: Bool = false
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
viewModel = YHWorkItemListViewModel() viewModel = YHWorkItemListViewModel()
...@@ -57,6 +58,8 @@ class YHWorkExperienceListViewController: YHBaseViewController { ...@@ -57,6 +58,8 @@ class YHWorkExperienceListViewController: YHBaseViewController {
tableView.delegate = self tableView.delegate = self
tableView.dataSource = self tableView.dataSource = self
tableView.register(cellWithClass: YHWorkExperienceListTableViewCell.self) tableView.register(cellWithClass: YHWorkExperienceListTableViewCell.self)
tableView.register(cellWithClass: YHDocumentPromptTableViewCell.self)
tableView.register(cellWithClass: YHWorkExperienceListReasonTableViewCell.self)
return tableView return tableView
}() }()
view.addSubview(tableView) view.addSubview(tableView)
...@@ -130,55 +133,75 @@ class YHWorkExperienceListViewController: YHBaseViewController { ...@@ -130,55 +133,75 @@ class YHWorkExperienceListViewController: YHBaseViewController {
extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDataSource { extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1 return 3
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceListTableViewCell.self) if indexPath.row == 0 {
cell.showPrompt = showPrompt let cell = tableView.dequeueReusableCell(withClass: YHDocumentPromptTableViewCell.self)
cell.dataSource = dataSource cell.workList = 0
if isMore { cell.backgroundColor = .clear
cell.more() cell.contentView.backgroundColor = .clear
} else { return cell
cell.cannal() } else if indexPath.row == 1 {
} let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceListTableViewCell.self)
cell.clickBlock = {[weak self] model in cell.showPrompt = showPrompt
guard let self = self else { return } cell.dataSource = dataSource
let firstModel = self.dataSource?.first if isMore {
let vc = YHWorkExperienceViewController() cell.more()
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 { } else {
cell.cannal()
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
let firstModel = self.dataSource?.first
let vc = YHWorkExperienceViewController() let vc = YHWorkExperienceViewController()
vc.isShowMessageSelect = true vc.workExperienceID = "\(model.id ?? 0)"
vc.orderID = self.orderId vc.orderID = self.orderId
vc.isShowMessageSelect = true
if firstModel?.id == model.id {
vc.isShowMessageSelect = false
}
self.navigationController?.pushViewController(vc, animated: true) 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 return UITableViewCell()
cell.contentView.backgroundColor = .clear
return cell
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 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 let number = dataSource?.count ?? 0
var height = 23 + 154 var height = 23 + 154
if let data = dataSource { if let data = dataSource {
......
...@@ -165,6 +165,7 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -165,6 +165,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
tableView.register(cellWithClass: YHWorkIntroductionTableViewCell.self) tableView.register(cellWithClass: YHWorkIntroductionTableViewCell.self)
tableView.register(cellWithClass: YHWorkMessageSelectTableViewCell.self) tableView.register(cellWithClass: YHWorkMessageSelectTableViewCell.self)
tableView.register(cellWithClass: YHWorkFileSyncTableViewCell.self) tableView.register(cellWithClass: YHWorkFileSyncTableViewCell.self)
tableView.register(cellWithClass: YHWorkExperiencePositionTableViewCell.self)
return tableView return tableView
}() }()
view.addSubview(tableView) view.addSubview(tableView)
...@@ -429,7 +430,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -429,7 +430,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
if stepView.currentIndex == 4 { if stepView.currentIndex == 4 {
return 1 return 1
} }
return baseDataSource?.count ?? 0 return 2
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
...@@ -637,23 +638,70 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -637,23 +638,70 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} }
return cell return cell
} else { } else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceTableViewCell.self) if indexPath.row == 0 {
cell.country = self.viewModel.mainModel.location.country let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceTableViewCell.self)
cell.dataSource = baseDataSource?[indexPath.row] cell.country = self.viewModel.mainModel.location.country
cell.workExperienceBlock = {[weak self] model in cell.dataSource = baseDataSource?[indexPath.row]
guard let self = self else { return } cell.workExperienceBlock = {[weak self] model in
self.viewModel.updateModel(model) guard let self = self else { return }
let id = model.id self.viewModel.updateModel(model)
if id != .id1 && id != .id3 && id != .id4 && id != .id7 && id != .id8 && id != .id12 && id != .id14 && id != .id16 && id != .id17 && id != .id18 { 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() 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 ...@@ -664,24 +712,53 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
let count = fileDataSource?.count ?? 0 let count = fileDataSource?.count ?? 0
return CGFloat(69 * count + 171) return CGFloat(69 * count + 171)
} else { } else {
let array = baseDataSource?[indexPath.row].models ?? [] if indexPath.row == 0 {
var h = 0 let array = baseDataSource?[indexPath.row].models ?? []
for i in 0..<array.count { var h = 0
let data = array[i] for i in 0..<array.count {
let message = data.message ?? "" let data = array[i]
let isShow = data.isShowPrompts ?? false let message = data.message ?? ""
if data.id == .id3 || data.id == .id4 || data.id == .id18 { let isShow = data.isShowPrompts ?? false
h = h + 132 if data.id == .id3 || data.id == .id4 || data.id == .id18 {
} else if data.id == .id13 { h = h + 132
h = h + 72 } else if data.id == .id13 {
} else { h = h + 72
h = h + 52 } else {
} h = h + 52
if isShow && message.count == 0 { }
h = h + 20 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)
}
}
}
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