Commit 59f7b6c1 authored by David黄金龙's avatar David黄金龙

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

* 'qmas-1130' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  // 学历
  收入记录添加未输入提示,以及代码优化
  //  方案
  工作经验细节修改
  //  方案
  // 方案
parents 0b467705 0203b170
...@@ -116,6 +116,8 @@ ...@@ -116,6 +116,8 @@
042B20DA2CEB337100655093 /* YHImproveSchemeTemplateListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20D92CEB337100655093 /* YHImproveSchemeTemplateListCell.swift */; }; 042B20DA2CEB337100655093 /* YHImproveSchemeTemplateListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20D92CEB337100655093 /* YHImproveSchemeTemplateListCell.swift */; };
042B20DC2CEB69CB00655093 /* YHSchemeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20DB2CEB69CB00655093 /* YHSchemeModel.swift */; }; 042B20DC2CEB69CB00655093 /* YHSchemeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20DB2CEB69CB00655093 /* YHSchemeModel.swift */; };
042B20DF2CEB6A8F00655093 /* YHSchemeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20DE2CEB6A8F00655093 /* YHSchemeViewModel.swift */; }; 042B20DF2CEB6A8F00655093 /* YHSchemeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20DE2CEB6A8F00655093 /* YHSchemeViewModel.swift */; };
042B20E12CEC91CD00655093 /* YHMajorSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20E02CEC91CD00655093 /* YHMajorSearchViewController.swift */; };
042B20E32CEC92C400655093 /* YHMajorNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20E22CEC92C400655093 /* YHMajorNameCell.swift */; };
0430E63B2C6DA106000511E2 /* CGFloat+Extention.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */; }; 0430E63B2C6DA106000511E2 /* CGFloat+Extention.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */; };
0430E6422C72E120000511E2 /* YHAddAdoptersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6412C72E120000511E2 /* YHAddAdoptersViewController.swift */; }; 0430E6422C72E120000511E2 /* YHAddAdoptersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6412C72E120000511E2 /* YHAddAdoptersViewController.swift */; };
0430E6442C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */; }; 0430E6442C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */; };
...@@ -1141,6 +1143,8 @@ ...@@ -1141,6 +1143,8 @@
042B20D92CEB337100655093 /* YHImproveSchemeTemplateListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImproveSchemeTemplateListCell.swift; sourceTree = "<group>"; }; 042B20D92CEB337100655093 /* YHImproveSchemeTemplateListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImproveSchemeTemplateListCell.swift; sourceTree = "<group>"; };
042B20DB2CEB69CB00655093 /* YHSchemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeModel.swift; sourceTree = "<group>"; }; 042B20DB2CEB69CB00655093 /* YHSchemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeModel.swift; sourceTree = "<group>"; };
042B20DE2CEB6A8F00655093 /* YHSchemeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeViewModel.swift; sourceTree = "<group>"; }; 042B20DE2CEB6A8F00655093 /* YHSchemeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeViewModel.swift; sourceTree = "<group>"; };
042B20E02CEC91CD00655093 /* YHMajorSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMajorSearchViewController.swift; sourceTree = "<group>"; };
042B20E22CEC92C400655093 /* YHMajorNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMajorNameCell.swift; sourceTree = "<group>"; };
0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGFloat+Extention.swift"; sourceTree = "<group>"; }; 0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGFloat+Extention.swift"; sourceTree = "<group>"; };
0430E6412C72E120000511E2 /* YHAddAdoptersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAddAdoptersViewController.swift; sourceTree = "<group>"; }; 0430E6412C72E120000511E2 /* YHAddAdoptersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAddAdoptersViewController.swift; sourceTree = "<group>"; };
0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterMainTableViewCell.swift; sourceTree = "<group>"; }; 0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterMainTableViewCell.swift; sourceTree = "<group>"; };
...@@ -3139,6 +3143,7 @@ ...@@ -3139,6 +3143,7 @@
045EEE102B9F171A0022A143 /* YHEducationDetailVC.swift */, 045EEE102B9F171A0022A143 /* YHEducationDetailVC.swift */,
045EEE112B9F171A0022A143 /* YHEducationInfoListVC.swift */, 045EEE112B9F171A0022A143 /* YHEducationInfoListVC.swift */,
045EEE122B9F171A0022A143 /* YHCollegeSearchViewController.swift */, 045EEE122B9F171A0022A143 /* YHCollegeSearchViewController.swift */,
042B20E02CEC91CD00655093 /* YHMajorSearchViewController.swift */,
045EEE132B9F171A0022A143 /* YHQualificationDetailVC.swift */, 045EEE132B9F171A0022A143 /* YHQualificationDetailVC.swift */,
); );
path = C; path = C;
...@@ -3148,6 +3153,7 @@ ...@@ -3148,6 +3153,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
045EEE152B9F171A0022A143 /* YHCollegeNameCell.swift */, 045EEE152B9F171A0022A143 /* YHCollegeNameCell.swift */,
042B20E22CEC92C400655093 /* YHMajorNameCell.swift */,
045EEE162B9F171A0022A143 /* YHEducationInfoCell.swift */, 045EEE162B9F171A0022A143 /* YHEducationInfoCell.swift */,
047F3DD82CE601D1001B2A6D /* YHEducationCertificateConfirmCell.swift */, 047F3DD82CE601D1001B2A6D /* YHEducationCertificateConfirmCell.swift */,
047F3DDA2CE6DE91001B2A6D /* YHEducationMarkView.swift */, 047F3DDA2CE6DE91001B2A6D /* YHEducationMarkView.swift */,
...@@ -6103,6 +6109,7 @@ ...@@ -6103,6 +6109,7 @@
04256E1D2C75C74200A37BA4 /* YHAppointHKResultModel.swift in Sources */, 04256E1D2C75C74200A37BA4 /* YHAppointHKResultModel.swift in Sources */,
047F3DE62CE83A0F001B2A6D /* YHHKRequiredItemView.swift in Sources */, 047F3DE62CE83A0F001B2A6D /* YHHKRequiredItemView.swift in Sources */,
04CE1ADB2C2AD91F001CB80A /* YHActivityTitleItemView.swift in Sources */, 04CE1ADB2C2AD91F001CB80A /* YHActivityTitleItemView.swift in Sources */,
042B20E32CEC92C400655093 /* YHMajorNameCell.swift in Sources */,
A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */, A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */,
04CA2C2F2CBA5C9E00F36DE7 /* YHLookResignGuideLineView.swift in Sources */, 04CA2C2F2CBA5C9E00F36DE7 /* YHLookResignGuideLineView.swift in Sources */,
045792172CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift in Sources */, 045792172CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift in Sources */,
...@@ -6376,6 +6383,7 @@ ...@@ -6376,6 +6383,7 @@
A517A4E52BB6C4BB000DEECD /* YHDocumentFileItemView.swift in Sources */, A517A4E52BB6C4BB000DEECD /* YHDocumentFileItemView.swift in Sources */,
045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */, 045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */,
0419A0A42C49184300A5FCFA /* YHInvitationNumberItemView.swift in Sources */, 0419A0A42C49184300A5FCFA /* YHInvitationNumberItemView.swift in Sources */,
042B20E12CEC91CD00655093 /* YHMajorSearchViewController.swift in Sources */,
045EEEDD2B9F171A0022A143 /* YHCollegeNameCell.swift in Sources */, 045EEEDD2B9F171A0022A143 /* YHCollegeNameCell.swift in Sources */,
04F2432D2C94645000DF2C74 /* YHResignDocumentStatusCell.swift in Sources */, 04F2432D2C94645000DF2C74 /* YHResignDocumentStatusCell.swift in Sources */,
04256DFA2C742A1500A37BA4 /* YHFamilyGroupModel.swift in Sources */, 04256DFA2C742A1500A37BA4 /* YHFamilyGroupModel.swift in Sources */,
......
...@@ -222,7 +222,8 @@ extension YHInformationPerfectListVC { ...@@ -222,7 +222,8 @@ extension YHInformationPerfectListVC {
// vc.model = serviceCenterMainReqVM.allInfoScoreModel // vc.model = serviceCenterMainReqVM.allInfoScoreModel
// navigationController?.pushViewController(vc) // navigationController?.pushViewController(vc)
YHHUD.flash(message: "这里跳转 杜宇 新的我的方案") let vc = YHMyNewSchemeViewController()
navigationController?.pushViewController(vc)
} }
@objc func goInfoListVC( ) { @objc func goInfoListVC( ) {
......
...@@ -171,6 +171,8 @@ class YHImproveSchemeViewController: YHBaseViewController { ...@@ -171,6 +171,8 @@ class YHImproveSchemeViewController: YHBaseViewController {
} }
view.bringSubviewToFront(gk_navigationBar) view.bringSubviewToFront(gk_navigationBar)
tableView.reloadData() tableView.reloadData()
requestData()
} }
override func backItemClick(_ sender: Any) { override func backItemClick(_ sender: Any) {
...@@ -198,6 +200,7 @@ class YHImproveSchemeViewController: YHBaseViewController { ...@@ -198,6 +200,7 @@ class YHImproveSchemeViewController: YHBaseViewController {
let vc = YHInformationPerfectListVC() let vc = YHInformationPerfectListVC()
vc.orderId = orderId vc.orderId = orderId
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
return
} }
YHHUD.flash(message: error?.errorMsg ?? "修改失败") YHHUD.flash(message: error?.errorMsg ?? "修改失败")
} }
......
...@@ -204,10 +204,18 @@ class YHMyNewSchemeViewController: YHBaseViewController { ...@@ -204,10 +204,18 @@ class YHMyNewSchemeViewController: YHBaseViewController {
guard let self = self else { return } guard let self = self else { return }
titleLabel.text = "尊敬的\(viewModel.schemeModel.username)\(viewModel.schemeModel.sex)" titleLabel.text = "尊敬的\(viewModel.schemeModel.username)\(viewModel.schemeModel.sex)"
passArr = self.viewModel.schemeModel.comprehensive_evaluation.filter { passArr = self.viewModel.schemeModel.comprehensive_evaluation.filter {
$0.is_pass == true $0.isPass == true
} }
unpassArr = self.viewModel.schemeModel.comprehensive_evaluation.filter { unpassArr = self.viewModel.schemeModel.comprehensive_evaluation.filter {
$0.is_pass == false $0.isPass == false
}
for item in unpassArr {
if self.viewModel.schemeModel.comprehensive_evaluation_selected.contains(item.standardKey) {
item.is_select = true
} else {
item.is_select = false
}
} }
isPass = passArr.count >= 6 isPass = passArr.count >= 6
...@@ -248,17 +256,23 @@ class YHMyNewSchemeViewController: YHBaseViewController { ...@@ -248,17 +256,23 @@ class YHMyNewSchemeViewController: YHBaseViewController {
} }
func submitTargets() { func submitTargets() {
let targets: [String] = unpassArr.map {
return $0.standard_key let selectTargets: [YHComprehensiveEevaluationModel] = unpassArr.filter {
return $0.is_select
} }
let selectKeys: [String] = selectTargets.map {
return $0.standardKey
}
YHHUD.show(.progress(message: "提交中...")) YHHUD.show(.progress(message: "提交中..."))
viewModel.postSelectImproveTargets(orderId: orderId, targets: targets) { viewModel.postSelectImproveTargets(orderId: orderId, targets: selectKeys) {
[weak self] success, error in [weak self] success, error in
YHHUD.hide() YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
if success { if success {
let vc = YHImproveSchemeViewController() let vc = YHImproveSchemeViewController()
vc.orderId = orderId
vc.isPass = self.isPass vc.isPass = self.isPass
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
return return
...@@ -278,15 +292,16 @@ class YHMyNewSchemeViewController: YHBaseViewController { ...@@ -278,15 +292,16 @@ class YHMyNewSchemeViewController: YHBaseViewController {
let vc = YHInformationPerfectListVC() let vc = YHInformationPerfectListVC()
vc.orderId = orderId vc.orderId = orderId
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
return
} }
YHHUD.flash(message: error?.errorMsg ?? "修改失败") YHHUD.flash(message: error?.errorMsg ?? "修改失败")
} }
} }
func getIndustryDetail(id: Int, industryOther: String) -> String { func getIndustryDetail() -> String {
let target = "\(id)" let target = viewModel.schemeModel.industry_positioning
if target == "15" { if target == "15" {
return "其他(\(industryOther))" return "其他(\(viewModel.schemeModel.industry_positioning_other))"
} }
for(_, item) in YHConstantArrayData.arrSkill.enumerated() { for(_, item) in YHConstantArrayData.arrSkill.enumerated() {
if target == item["value"] { if target == item["value"] {
...@@ -335,6 +350,7 @@ extension YHMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSour ...@@ -335,6 +350,7 @@ extension YHMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSour
if item.type == .industryLocation { if item.type == .industryLocation {
let cell = tableView.dequeueReusableCell(withIdentifier: YHIndustryLocationCell.cellReuseIdentifier, for: indexPath) as! YHIndustryLocationCell let cell = tableView.dequeueReusableCell(withIdentifier: YHIndustryLocationCell.cellReuseIdentifier, for: indexPath) as! YHIndustryLocationCell
cell.industry = self.getIndustryDetail()
targetCell = cell targetCell = cell
} }
...@@ -389,6 +405,7 @@ extension YHMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSour ...@@ -389,6 +405,7 @@ extension YHMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSour
return return
} }
let vc = YHImproveSchemeViewController() let vc = YHImproveSchemeViewController()
vc.orderId = orderId
vc.isPass = self.isPass vc.isPass = self.isPass
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
} }
...@@ -407,6 +424,7 @@ extension YHMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSour ...@@ -407,6 +424,7 @@ extension YHMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSour
if item.type == .improveTarget { if item.type == .improveTarget {
let cell = tableView.dequeueReusableCell(withIdentifier: YHImproveTargetCell.cellReuseIdentifier, for: indexPath) as! YHImproveTargetCell let cell = tableView.dequeueReusableCell(withIdentifier: YHImproveTargetCell.cellReuseIdentifier, for: indexPath) as! YHImproveTargetCell
cell.unpassArr = unpassArr
cell.submitClick = { cell.submitClick = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -15,9 +15,9 @@ class YHSchemeModel: NSObject { ...@@ -15,9 +15,9 @@ class YHSchemeModel: NSObject {
class YHComprehensiveEevaluationModel: SmartCodable { class YHComprehensiveEevaluationModel: SmartCodable {
var standard_name: String = "" var standardName: String = ""
var standard_key: String = "" var standardKey: String = ""
var is_pass: Bool = false var isPass: Bool = false
var is_select: Bool = false var is_select: Bool = false
required init() { required init() {
...@@ -29,7 +29,8 @@ class YHMySchemeDetailModel: SmartCodable { ...@@ -29,7 +29,8 @@ class YHMySchemeDetailModel: SmartCodable {
var comprehensive_evaluation: [YHComprehensiveEevaluationModel] = [] var comprehensive_evaluation: [YHComprehensiveEevaluationModel] = []
var comprehensive_evaluation_selected: [String] = [] var comprehensive_evaluation_selected: [String] = []
var industry_positioning: Int = 0 var industry_positioning: String = ""
var industry_positioning_other: String = ""
var plan_skip_status: Bool = false var plan_skip_status: Bool = false
var supplement_skip_status: Bool = false var supplement_skip_status: Bool = false
var username: String = "" var username: String = ""
......
...@@ -24,7 +24,7 @@ class YHHKRequiredItemListCell: UITableViewCell { ...@@ -24,7 +24,7 @@ class YHHKRequiredItemListCell: UITableViewCell {
var lastItemView: YHHKRequiredItemView? = nil var lastItemView: YHHKRequiredItemView? = nil
for (index, model) in passArr.enumerated() { for (index, model) in passArr.enumerated() {
let itemView = YHHKRequiredItemView(frame: .zero) let itemView = YHHKRequiredItemView(frame: .zero)
itemView.text = model.standard_name itemView.text = model.standardName
itemView.backgroundColor = index%2 == 0 ? .white : .init(hex: 0xFBF7F3) itemView.backgroundColor = index%2 == 0 ? .white : .init(hex: 0xFBF7F3)
listView.addSubview(itemView) listView.addSubview(itemView)
itemView.snp.makeConstraints { make in itemView.snp.makeConstraints { make in
......
...@@ -14,7 +14,6 @@ class YHImproveHKView: UIView { ...@@ -14,7 +14,6 @@ class YHImproveHKView: UIView {
didSet { didSet {
titleLabel.text = "港府要求:\(item.hk_require)" titleLabel.text = "港府要求:\(item.hk_require)"
tipsLabel.text = item.improve_content tipsLabel.text = item.improve_content
numLabel.text = "\(item.sort_num)"
showTemplateBtn = item.templates.count > 0 showTemplateBtn = item.templates.count > 0
} }
} }
......
...@@ -25,7 +25,7 @@ class YHImproveRequireItemView: UIView { ...@@ -25,7 +25,7 @@ class YHImproveRequireItemView: UIView {
var item: YHComprehensiveEevaluationModel = YHComprehensiveEevaluationModel() { var item: YHComprehensiveEevaluationModel = YHComprehensiveEevaluationModel() {
didSet { didSet {
let a: ASAttributedString = .init(string:"港府要求:" , .font(UIFont.PFSC_M(ofSize: 14)), .foreground(UIColor.mainTextColor)) let a: ASAttributedString = .init(string:"港府要求:" , .font(UIFont.PFSC_M(ofSize: 14)), .foreground(UIColor.mainTextColor))
let b: ASAttributedString = .init(string: item.standard_name , .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor.mainTextColor)) let b: ASAttributedString = .init(string: item.standardName , .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor.mainTextColor))
titleLabel.attributed.text = a + b titleLabel.attributed.text = a + b
isSelect = item.is_select isSelect = item.is_select
} }
......
...@@ -11,13 +11,9 @@ import UIKit ...@@ -11,13 +11,9 @@ import UIKit
class YHImproveSchemeTemplateListCell: UITableViewCell { class YHImproveSchemeTemplateListCell: UITableViewCell {
static let cellReuseIdentifier = "YHImproveSchemeTemplateListCell" static let cellReuseIdentifier = "YHImproveSchemeTemplateListCell"
var model = YHSchemeTemplatesModel() { var model = YHSchemeTemplatesModel()
didSet {
titleLabel.text = model.name
}
}
lazy var previewFileTool:YHFilePreviewTool = { lazy var previewFileTool:YHFilePreviewTool = {
let tool = YHFilePreviewTool(targetVC: UIViewController.current) let tool = YHFilePreviewTool(targetVC: UIViewController.current)
return tool return tool
...@@ -83,7 +79,7 @@ class YHImproveSchemeTemplateListCell: UITableViewCell { ...@@ -83,7 +79,7 @@ class YHImproveSchemeTemplateListCell: UITableViewCell {
make.left.equalTo(0) make.left.equalTo(0)
make.top.equalTo(16) make.top.equalTo(16)
make.bottom.equalTo(-16) make.bottom.equalTo(-16)
make.right.equalTo(rightBtn.snp.left).offset(-40) make.right.equalTo(rightBtn.snp.left).offset(-15)
} }
rightBtn.snp.makeConstraints { make in rightBtn.snp.makeConstraints { make in
...@@ -92,6 +88,5 @@ class YHImproveSchemeTemplateListCell: UITableViewCell { ...@@ -92,6 +88,5 @@ class YHImproveSchemeTemplateListCell: UITableViewCell {
make.right.equalTo(-20) make.right.equalTo(-20)
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
} }
} }
} }
...@@ -15,8 +15,24 @@ class YHImproveSchemeTemplateListView: UIView { ...@@ -15,8 +15,24 @@ class YHImproveSchemeTemplateListView: UIView {
return v return v
} }
let bottomFixHeight = 102.0
var items: [YHSchemeTemplatesModel] = [] { var items: [YHSchemeTemplatesModel] = [] {
didSet { didSet {
var totalHeight = bottomFixHeight+52.0
for item in items {
let height = getHeight(text: item.name)+32.0
totalHeight += height
}
totalHeight = floorl(totalHeight)
if totalHeight >= 628.0 {
totalHeight = 628.0
}
whiteView.snp.updateConstraints { make in
make.height.equalTo(totalHeight)
}
self.setNeedsLayout()
self.layoutIfNeeded()
tableView.reloadData() tableView.reloadData()
} }
} }
...@@ -137,6 +153,8 @@ extension YHImproveSchemeTemplateListView : UITableViewDelegate, UITableViewData ...@@ -137,6 +153,8 @@ extension YHImproveSchemeTemplateListView : UITableViewDelegate, UITableViewData
if 0 <= indexPath.row && indexPath.row < items.count { if 0 <= indexPath.row && indexPath.row < items.count {
let item = items[indexPath.row] let item = items[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: YHImproveSchemeTemplateListCell.cellReuseIdentifier, for: indexPath) as! YHImproveSchemeTemplateListCell let cell = tableView.dequeueReusableCell(withIdentifier: YHImproveSchemeTemplateListCell.cellReuseIdentifier, for: indexPath) as! YHImproveSchemeTemplateListCell
cell.titleLabel.text = "\(indexPath.row+1)\(item.name)"
cell.model = item
return cell return cell
} }
...@@ -167,7 +185,14 @@ extension YHImproveSchemeTemplateListView : UITableViewDelegate, UITableViewData ...@@ -167,7 +185,14 @@ extension YHImproveSchemeTemplateListView : UITableViewDelegate, UITableViewData
} }
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.1 return bottomFixHeight
} }
func getHeight(text:String) -> CGFloat {
let size = CGSize.init(width:KScreenWidth-115 , height: CGFloat(MAXFLOAT))
let dic = [NSAttributedString.Key.font: UIFont.PFSC_R(ofSize: 14)]
let strSize = text.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size
return CGSizeMake(strSize.width, strSize.height).height
}
} }
...@@ -17,7 +17,7 @@ class YHImproveTargetCell: UITableViewCell { ...@@ -17,7 +17,7 @@ class YHImproveTargetCell: UITableViewCell {
var unpassArr: [YHComprehensiveEevaluationModel] = [] { var unpassArr: [YHComprehensiveEevaluationModel] = [] {
didSet { didSet {
updateRequireArrUI()
} }
} }
...@@ -41,6 +41,8 @@ class YHImproveTargetCell: UITableViewCell { ...@@ -41,6 +41,8 @@ class YHImproveTargetCell: UITableViewCell {
} }
lastView = view lastView = view
} }
self.setNeedsLayout()
self.layoutIfNeeded()
} }
lazy var whiteContentView: UIView = { lazy var whiteContentView: UIView = {
......
...@@ -19,6 +19,7 @@ class YHImproveTargetListCell: UITableViewCell { ...@@ -19,6 +19,7 @@ class YHImproveTargetListCell: UITableViewCell {
for (i, item) in arr.enumerated() { for (i, item) in arr.enumerated() {
let itemView = YHImproveHKView(frame: .zero) let itemView = YHImproveHKView(frame: .zero)
itemView.item = item itemView.item = item
itemView.numLabel.text = "\(i+1)"
listView.addSubview(itemView) listView.addSubview(itemView)
itemView.snp.makeConstraints { make in itemView.snp.makeConstraints { make in
make.left.equalTo(0) make.left.equalTo(0)
......
...@@ -12,6 +12,12 @@ class YHIndustryLocationCell: UITableViewCell { ...@@ -12,6 +12,12 @@ class YHIndustryLocationCell: UITableViewCell {
static let cellReuseIdentifier = "YHIndustryLocationCell" static let cellReuseIdentifier = "YHIndustryLocationCell"
var industry: String = "" {
didSet {
tips2Label.text = industry
}
}
lazy var whiteContentView: UIView = { lazy var whiteContentView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .white view.backgroundColor = .white
......
...@@ -107,7 +107,11 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -107,7 +107,11 @@ class YHEducationDetailVC: YHBaseViewController {
let title0 = YHFormTitleItem(type: .mainApplicantEducation) let title0 = YHFormTitleItem(type: .mainApplicantEducation)
let item00 = YHFormDetailItem(type: .universityFullName) let item00 = YHFormDetailItem(type: .universityFullName)
item00.tips = "请选择学校".local if detailInfo.degree.contains("学士学位") {
item00.tips = "请输入学校全称".local
} else {
item00.tips = "请选择学校".local
}
item00.value = detailInfo.college item00.value = detailInfo.college
let item01 = YHFormDetailItem(type: .educationStyle) let item01 = YHFormDetailItem(type: .educationStyle)
...@@ -124,7 +128,7 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -124,7 +128,7 @@ class YHEducationDetailVC: YHBaseViewController {
item03.value = detailInfo.graduateTime item03.value = detailInfo.graduateTime
let item04 = YHFormDetailItem(type: .educationMajor) let item04 = YHFormDetailItem(type: .educationMajor)
item04.tips = "请输入专业".local item04.tips = "请选择专业".local
item04.value = detailInfo.major item04.value = detailInfo.major
let item05 = YHFormDetailItem(type: .educationDegree) let item05 = YHFormDetailItem(type: .educationDegree)
...@@ -239,6 +243,12 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -239,6 +243,12 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} else { } else {
detailInfo.major = "" detailInfo.major = ""
} }
} else if detailItem.type == .universityFullName {
if let text = text, !text.isEmpty {
detailInfo.college = text
} else {
detailInfo.college = ""
}
} }
if isEditEnd { if isEditEnd {
loadInfo() loadInfo()
...@@ -416,7 +426,14 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -416,7 +426,14 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .educationDegree { // 学位 } else if detailItem.type == .educationDegree { // 学位
YHSheetPickerView.show(type:.educationDegree, selectTitle:detailInfo.degree) { if detailItem.type == .universityFullName { // 学校全称
if detailInfo.degree.contains("学士学位") {
// 此时学位是输入
return
}
}
YHSheetPickerView.show(type:.degree, selectTitle:detailInfo.degree) {
[weak self] item in [weak self] item in
guard let self = self else { return } guard let self = self else { return }
detailInfo.degree = item.title detailInfo.degree = item.title
...@@ -467,6 +484,24 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -467,6 +484,24 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
saveInfoSilent() saveInfoSilent()
} }
self.present(vc, animated: true) self.present(vc, animated: true)
} else if detailItem.type == .educationMajor { // 专业
let vc = YHMajorSearchViewController()
vc.orderId = self.orderId
vc.searchMajorName = detailInfo.major
vc.selectBlock = {
[weak self] text in
guard let self = self else { return }
if let text = text, !text.isEmpty {
detailInfo.major = text
} else {
detailInfo.major = ""
}
loadInfo()
saveInfoSilent()
}
self.navigationController?.pushViewController(vc)
} }
} }
} }
...@@ -514,6 +549,19 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -514,6 +549,19 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
return .cerConfirm return .cerConfirm
} }
// 学位选择:学士学位,
// 学习全称:直接输入学校名称,不需要进入搜索页面
//
// 学位选择:硕士学位/博士学位,
// 学习全称:需要进入名校库搜索页面,模糊搜索名校,若搜不到直接输入
if detailItem.type == .universityFullName { // 学校全称
if detailInfo.degree.contains("学士学位") {
return .inputText
}
return .selectSheet
}
if detailItem.type == .educationCity { if detailItem.type == .educationCity {
if detailInfo.isSchoolInAboard() { if detailInfo.isSchoolInAboard() {
return .inputText return .inputText
...@@ -522,10 +570,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -522,10 +570,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} }
if detailItem.type == .educationMajor if detailItem.type == .educationMajor
{
return .inputText
}
if detailItem.type == .universityFullName
|| detailItem.type == .educationStyle || detailItem.type == .educationStyle
|| detailItem.type == .educationTime || detailItem.type == .educationTime
|| detailItem.type == .graduateTime || detailItem.type == .graduateTime
......
//
// YHMajorSearchViewController.swift
// galaxy
//
// Created by Dufet on 2024/11/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMajorSearchViewController: YHBaseViewController {
var orderId:Int = 0
var searchMajorName:String?
var selectBlock:((String?)->Void)?
var majors:[YHMajorInfo] = []
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
lazy var searchBar: YHCollegeSearchBar = {
let bar = YHCollegeSearchBar.createBar()
bar.placeHolder = "请输入专业"
return bar
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.plain)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .white
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHMajorNameCell.self, forCellReuseIdentifier: YHMajorNameCell.cellReuseIdentifier)
tableView.backgroundView = emptyDataTipsView
return tableView
}()
lazy var emptyDataTipsView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("无搜索结果", kEmptySearchBgName)
view.topMargin = 130
view.isHidden = true
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
createUI()
if searchMajorName != nil {
searchMajor()
}
}
func createUI() {
self.view.backgroundColor = .white
self.gk_navTitle = "学校名称".local
view.addSubview(tableView)
view.addSubview(searchBar)
if let searchMajorName = searchMajorName {
searchBar.textField.text = searchMajorName
}
searchBar.textChange = {
[weak self] text in
guard let self = self else { return }
searchMajorName = text
self.searchMajor()
}
searchBar.confirmBlock = {
[weak self] in
guard let self = self else { return }
if let selectBlock = selectBlock {
selectBlock(searchBar.textField.text)
self.navigationController?.popViewController(animated: true)
}
}
searchBar.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.height.equalTo(YHCollegeSearchBar.height)
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar+16)
}
tableView.snp.makeConstraints { make in
make.top.equalTo(searchBar.snp.bottom).offset(8)
make.left.right.bottom.equalToSuperview()
}
}
func searchMajor() {
let param:[String:Any] = ["order_id": orderId,
"name":searchMajorName ?? "",
"page":1,
"page_size":15,
]
self.educationRequest.searchMajorInfoList(params: param) {
[weak self] success, error in
guard let self = self else { return }
if success {
if let list = self.educationRequest.majorList {
majors = list
} else {
majors = []
}
emptyDataTipsView.isHidden = majors.count > 0
}
self.tableView.reloadData()
}
}
}
extension YHMajorSearchViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return majors.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMajorNameCell.cellReuseIdentifier, for: indexPath) as! YHMajorNameCell
if indexPath.row < majors.count {
let college:YHMajorInfo = majors[indexPath.row]
var name = ""
if !isEmptyString(college.ch_name) {
name += college.ch_name
}
if !isEmptyString(college.en_name) && !isEmptyString(college.en_name) {
name += "/"
}
if !isEmptyString(college.en_name) {
name += college.en_name
}
cell.titleLabel.text = name
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let selectBlock = selectBlock {
if indexPath.row < majors.count {
let major:YHMajorInfo = majors[indexPath.row]
selectBlock(major.getMajorName())
self.navigationController?.popViewController(animated: true)
}
}
}
}
...@@ -205,5 +205,24 @@ class YHCollegeInfo: SmartCodable { ...@@ -205,5 +205,24 @@ class YHCollegeInfo: SmartCodable {
} }
} }
class YHMajorInfo: SmartCodable {
var id: Int = 0
var ch_name: String = ""
var en_name: String = ""
func getMajorName() -> String {
if !ch_name.isEmpty {
return ch_name
}
return en_name
}
required init() {
}
}
...@@ -17,7 +17,9 @@ class YHEducationRequestViewModel { ...@@ -17,7 +17,9 @@ class YHEducationRequestViewModel {
var qualificationDetailInfo: YHQualificationDetailInfo? var qualificationDetailInfo: YHQualificationDetailInfo?
// 搜索学校数组 // 搜索学校数组
var collegeList: [YHCollegeInfo]? var collegeList: [YHCollegeInfo]?
// 搜索专业数组
var majorList: [YHMajorInfo]?
// 请求学历和专业证书信息列表 // 请求学历和专业证书信息列表
func requestEducationInfoList(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func requestEducationInfoList(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
...@@ -294,4 +296,35 @@ class YHEducationRequestViewModel { ...@@ -294,4 +296,35 @@ class YHEducationRequestViewModel {
} }
} }
// 搜索专业
func searchMajorInfoList(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.searchMajorNameApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let dic = json.data?.peel as? [Any], let results = [YHMajorInfo].deserialize(from: dic) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false, error)
return
}
majorList = results
callBackBlock(true, nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
YHHUD.hide()
callBackBlock(false, err)
}
}
} }
//
// YHMajorNameCell.swift
// galaxy
//
// Created by Dufet on 2024/11/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMajorNameCell: UITableViewCell {
static let cellReuseIdentifier = "YHMajorNameCell"
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_B(ofSize: 14)
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
contentView.backgroundColor = .white
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(21)
make.right.equalToSuperview().offset(-21)
make.top.equalToSuperview().offset(8)
make.bottom.equalToSuperview().offset(-8)
}
}
}
...@@ -15,11 +15,15 @@ class YHIncomeRecordViewController: YHBaseViewController { ...@@ -15,11 +15,15 @@ class YHIncomeRecordViewController: YHBaseViewController {
case incomeSummary(_ isEditing: Bool = false, _ isEditEnable: Bool = false) case incomeSummary(_ isEditing: Bool = false, _ isEditEnable: Bool = false)
case incomeItem(_ isEditState: Bool = false, _ company: String, _ money: String, _ timeStr: String, _ incomeId: Int) case incomeItem(_ isEditState: Bool = false, _ company: String, _ money: String, _ timeStr: String, _ incomeId: Int)
case totalIncome(_ money: ASAttributedString) case totalIncome(_ money: ASAttributedString)
case consentForHKTravel(_ title: String, _ detail: ASAttributedString, _ question: String, _ isSelectSureBtn: Bool = true) case consentForHKTravel(_ title: String, _ detail: ASAttributedString, _ question: String)
} }
private lazy var datas: [[TableRow]] = [] private lazy var datas: [[TableRow]] = []
/// 是否超过
private var isOver100OK = true
private var over100IndexPath: IndexPath?
private lazy var viewModel = YHIncomeRecordViewModel() private lazy var viewModel = YHIncomeRecordViewModel()
private var incomeModel = YHIncomeRecordCompleteModel() private var incomeModel = YHIncomeRecordCompleteModel()
...@@ -113,6 +117,9 @@ extension YHIncomeRecordViewController { ...@@ -113,6 +117,9 @@ extension YHIncomeRecordViewController {
} }
@objc private func clickSubmitButton() { @objc private func clickSubmitButton() {
guard checkInput() else {
return
}
updateIncome(.submit) updateIncome(.submit)
} }
...@@ -158,7 +165,7 @@ extension YHIncomeRecordViewController { ...@@ -158,7 +165,7 @@ extension YHIncomeRecordViewController {
private func setupData() { private func setupData() {
let detail: ASAttributedString = .init(string: "备注:全年收入是指应课税(应纳所得税)的就业或业务收入,包括工资薪金、津贴、股票期权及从其拥有的公司所得的利润。由个人投资所产生的收入不会计算在内。", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor(hexString: "#8993A2") ?? .gray)) let detail: ASAttributedString = .init(string: "备注:全年收入是指应课税(应纳所得税)的就业或业务收入,包括工资薪金、津贴、股票期权及从其拥有的公司所得的利润。由个人投资所产生的收入不会计算在内。", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor(hexString: "#8993A2") ?? .gray))
let firstSection: [TableRow] = [.consentForHKTravel("收入情况", detail, "您在前一年,全年收入是否达港币100万元或以上", incomeModel.income_over_100 == YHIncomeOver100.true.rawValue)] let firstSection: [TableRow] = [.consentForHKTravel("收入情况", detail, "您在前一年,全年收入是否达港币100万元或以上")]
guard incomeModel.income_over_100 == YHIncomeOver100.true.rawValue else { guard incomeModel.income_over_100 == YHIncomeOver100.true.rawValue else {
datas = [firstSection] datas = [firstSection]
tableView.reloadData() tableView.reloadData()
...@@ -167,14 +174,15 @@ extension YHIncomeRecordViewController { ...@@ -167,14 +174,15 @@ extension YHIncomeRecordViewController {
let hkdFormatter = currencyFormat("") let hkdFormatter = currencyFormat("")
var money: Double = 0 var money: Double = 0
var secondSection: [TableRow] = [.incomeSummary(false, false)] var secondSection: [TableRow] = [.incomeSummary(false, false)]
let rate = self.incomeModel.rate > 0 ? self.incomeModel.rate : 0.92
incomeModel.list.forEach { companyModel in incomeModel.list.forEach { companyModel in
money += companyModel.income_money money += companyModel.income_money
let moneyStr = "约" + (hkdFormatter.string(from: NSNumber(value: companyModel.income_money)) ?? "0") + "港币" let moneyStr = "约" + (hkdFormatter.string(from: NSNumber(value: companyModel.income_money / rate)) ?? "0") + "港币"
let timeStr: String = companyModel.fill_status ? "已填写" : "有\(companyModel.unfilled_count)项未填写" let timeStr: String = companyModel.fill_status ? "已填写" : "有\(companyModel.unfilled_count)项未填写"
let incomeItem: TableRow = .incomeItem(false, companyModel.company_name, moneyStr, timeStr, companyModel.income_id) let incomeItem: TableRow = .incomeItem(false, companyModel.company_name, moneyStr, timeStr, companyModel.income_id)
secondSection.append(incomeItem) secondSection.append(incomeItem)
} }
let totalNum = hkdFormatter.string(from: NSNumber(value: money)) ?? "0" let totalNum = hkdFormatter.string(from: NSNumber(value: money / rate)) ?? "0"
let totalMoney: ASAttributedString = .init(string: "约 ", .font(.PFSC_R(ofSize: 14))) + .init(string: totalNum, .font(UIFont(name: "DINAlternate-Bold", size: 20) ?? UIFont.systemFont(ofSize: 20))) + .init(string: " 港币", .font(.PFSC_R(ofSize: 14))) let totalMoney: ASAttributedString = .init(string: "约 ", .font(.PFSC_R(ofSize: 14))) + .init(string: totalNum, .font(UIFont(name: "DINAlternate-Bold", size: 20) ?? UIFont.systemFont(ofSize: 20))) + .init(string: " 港币", .font(.PFSC_R(ofSize: 14)))
secondSection.append(.totalIncome(totalMoney)) secondSection.append(.totalIncome(totalMoney))
datas = [firstSection, secondSection] datas = [firstSection, secondSection]
...@@ -236,17 +244,37 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour ...@@ -236,17 +244,37 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour
} }
return cell return cell
} }
case let .consentForHKTravel(title, detail, question, isSelectSureBtn): case let .consentForHKTravel(title, detail, question):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHInfoConsentForHKTravelCell.cellReuseIdentifier) as? YHInfoConsentForHKTravelCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHInfoConsentForHKTravelCell.cellReuseIdentifier) as? YHInfoConsentForHKTravelCell {
cell.setupCellInfo(title: title, detail: detail, question: question) over100IndexPath = indexPath
cell.setupCellInfo(title: title, detail: detail, question: question, needShowFailButton: !isOver100OK)
cell.didSelectSureButton = { [weak self] selected in cell.didSelectSureButton = { [weak self] selected in
guard let self = self else { guard let self = self else {
return return
} }
self.incomeModel.income_over_100 = selected ? YHIncomeOver100.true.rawValue : YHIncomeOver100.false.rawValue switch selected {
case .true:
self.incomeModel.income_over_100 = YHIncomeOver100.true.rawValue
isOver100OK = true
case .false:
self.incomeModel.income_over_100 = YHIncomeOver100.false.rawValue
isOver100OK = true
case .unknown:
self.incomeModel.income_over_100 = YHIncomeOver100.unknown.rawValue
isOver100OK = false
}
self.setupData() self.setupData()
} }
cell.selectedSureButton = isSelectSureBtn let over100Type = YHIncomeOver100(rawValue: incomeModel.income_over_100) ?? .unknown
switch over100Type {
case .true:
cell.selectedSureButton = .true
case .false:
cell.selectedSureButton = .false
case .unknown:
cell.selectedSureButton = .unknown
}
return cell return cell
} }
...@@ -287,6 +315,18 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour ...@@ -287,6 +315,18 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour
} }
extension YHIncomeRecordViewController { extension YHIncomeRecordViewController {
private func checkInput() -> Bool {
if incomeModel.income_over_100 == YHIncomeOver100.unknown.rawValue {
isOver100OK = false
if let over100IndexPath = over100IndexPath, tableView.numberOfSections > over100IndexPath.section, tableView.numberOfRows(inSection: over100IndexPath.section) > over100IndexPath.row {
tableView.reloadRows(at: [over100IndexPath], with: .none)
}
return false
}
isOver100OK = true
return true
}
private func requestData(isNeedLoading: Bool = false) { private func requestData(isNeedLoading: Bool = false) {
if isNeedLoading { if isNeedLoading {
YHHUD.show(.progress(message: "加载中...")) YHHUD.show(.progress(message: "加载中..."))
...@@ -314,10 +354,9 @@ extension YHIncomeRecordViewController { ...@@ -314,10 +354,9 @@ extension YHIncomeRecordViewController {
} }
private func updateIncome(_ type: YHIncomeRecordUpdateType) { private func updateIncome(_ type: YHIncomeRecordUpdateType) {
let incomeOver100: YHIncomeOver100 = YHIncomeOver100(rawValue: incomeModel.income_over_100) ?? .true
let msg = type == .save ? "保存中..." : "提交中..." let msg = type == .save ? "保存中..." : "提交中..."
YHHUD.show(.progress(message: msg)) YHHUD.show(.progress(message: msg))
viewModel.incomeUpdate(orderId: orderId, incomeOver100: incomeOver100, type: type) { [weak self] success, error in viewModel.incomeUpdate(orderId: orderId, incomeOver100: incomeModel.income_over_100, type: type) { [weak self] success, error in
guard let self = self else { guard let self = self else {
return return
} }
...@@ -327,6 +366,8 @@ extension YHIncomeRecordViewController { ...@@ -327,6 +366,8 @@ extension YHIncomeRecordViewController {
YHHUD.flash(message: msg) YHHUD.flash(message: msg)
if type == .submit { if type == .submit {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} else {
self.requestData(isNeedLoading: true)
} }
} else if let errorMsg = error?.errorMsg, errorMsg.count > 0 { } else if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg) YHHUD.flash(message: errorMsg)
......
...@@ -15,6 +15,13 @@ enum YHIncomeRecordHasAllFile: Int { ...@@ -15,6 +15,13 @@ enum YHIncomeRecordHasAllFile: Int {
} }
enum YHIncomeOver100: Int { enum YHIncomeOver100: Int {
case unknown = 0
case `true` = 1
case `false` = 2
}
enum YHCheckboxSelectType: Int {
case unknown = 0
case `true` = 1 case `true` = 1
case `false` = 2 case `false` = 2
} }
......
...@@ -10,13 +10,13 @@ import UIKit ...@@ -10,13 +10,13 @@ import UIKit
class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell { class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHIncomeDocumentationConfirmationCell" static let cellReuseIdentifier = "YHIncomeDocumentationConfirmationCell"
var didSelectSureButton: ((Bool) -> Void)? var didSelectSureButton: ((YHIncomeRecordHasAllFile) -> Void)?
private var documentationViews: [YHIncomeDocumentationView] = [] private var documentationViews: [YHIncomeDocumentationView] = []
private var lastDocuments: [String] = []
var selectedSureButton: Bool = true { var selectedSureButton: YHIncomeRecordHasAllFile = .unknown {
didSet { didSet {
updateButtonState(sureButton, selectedSureButton) updateButtonsState(selectedSureButton)
updateButtonState(cancelButton, !selectedSureButton)
} }
} }
...@@ -77,6 +77,14 @@ class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell { ...@@ -77,6 +77,14 @@ class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell {
return view return view
}() }()
private lazy var infoFailLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = .failColor
label.text = "请选择"
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI() setupUI()
...@@ -86,55 +94,92 @@ class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell { ...@@ -86,55 +94,92 @@ class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, question: String, documents: [String]) { func setupCellInfo(title: String, question: String, documents: [String], needShowFailButton: Bool) {
infoTitleLabel.text = title infoTitleLabel.text = title
infoQuestionLabel.text = question infoQuestionLabel.text = question
documentationViews.forEach { if lastDocuments != documents || documentationViews.count != documents.count {
$0.removeFromSuperview() lastDocuments = documents
} documentationViews.forEach {
documentationViews.removeAll() $0.removeFromSuperview()
let count = documents.count
documents.enumerated().forEach { [weak self] index, title in
guard let self = self else {
return
} }
let documentationView = YHIncomeDocumentationView() documentationViews.removeAll()
documentationView.setupInfo(title) let count = documents.count
documents.enumerated().forEach { [weak self] index, title in
self.documentationViews.append(documentationView) guard let self = self else {
self.containerView.addSubview(documentationView) return
documentationView.snp.makeConstraints { make in
if index == 0 {
make.top.equalToSuperview().offset(16)
} else {
make.top.equalTo(self.documentationViews[index - 1].snp.bottom).offset(12)
} }
make.left.equalToSuperview().offset(16) let documentationView = YHIncomeDocumentationView()
make.right.lessThanOrEqualToSuperview().offset(-8) documentationView.setupInfo(title)
if index == count - 1 {
make.bottom.equalToSuperview().offset(-16) self.documentationViews.append(documentationView)
self.containerView.addSubview(documentationView)
documentationView.snp.makeConstraints { make in
if index == 0 {
make.top.equalToSuperview().offset(16)
} else {
make.top.equalTo(self.documentationViews[index - 1].snp.bottom).offset(12)
}
make.left.equalToSuperview().offset(16)
make.right.lessThanOrEqualToSuperview().offset(-8)
if index == count - 1 {
make.bottom.equalToSuperview().offset(-16)
}
} }
} }
} }
updateFailLabel(needShowFailButton)
} }
} }
extension YHIncomeDocumentationConfirmationCell { extension YHIncomeDocumentationConfirmationCell {
private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton {
infoFailLabel.isHidden = false
containerView.snp.remakeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.left)
make.right.equalToSuperview().offset(-18)
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(16)
}
infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(containerView.snp.bottom).offset(6)
make.left.equalTo(containerView)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
} else {
infoFailLabel.isHidden = true
containerView.snp.remakeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.left)
make.right.equalToSuperview().offset(-18)
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(16)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.snp.remakeConstraints { make in
make.left.equalTo(containerView)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
}
}
@objc private func cancelButtonDidClick(_ sender: UIButton) { @objc private func cancelButtonDidClick(_ sender: UIButton) {
guard !sender.isSelected else { guard !sender.isSelected else {
return return
} }
selectedSureButton = false selectedSureButton = .false
didSelectSureButton?(false) didSelectSureButton?(.false)
} }
@objc private func sureButtonDidClick(_ sender: UIButton) { @objc private func sureButtonDidClick(_ sender: UIButton) {
guard !sender.isSelected else { guard !sender.isSelected else {
return return
} }
selectedSureButton = true selectedSureButton = .true
didSelectSureButton?(true) didSelectSureButton?(.true)
} }
private func setupUI() { private func setupUI() {
...@@ -146,6 +191,7 @@ extension YHIncomeDocumentationConfirmationCell { ...@@ -146,6 +191,7 @@ extension YHIncomeDocumentationConfirmationCell {
subContainerView.addSubview(sureButton) subContainerView.addSubview(sureButton)
subContainerView.addSubview(cancelButton) subContainerView.addSubview(cancelButton)
subContainerView.addSubview(containerView) subContainerView.addSubview(containerView)
subContainerView.addSubview(infoFailLabel)
sureButton.setContentCompressionResistancePriority(.required, for: .horizontal) sureButton.setContentCompressionResistancePriority(.required, for: .horizontal)
cancelButton.setContentCompressionResistancePriority(.required, for: .horizontal) cancelButton.setContentCompressionResistancePriority(.required, for: .horizontal)
...@@ -198,15 +244,47 @@ extension YHIncomeDocumentationConfirmationCell { ...@@ -198,15 +244,47 @@ extension YHIncomeDocumentationConfirmationCell {
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(16) make.top.equalTo(infoQuestionLabel.snp.bottom).offset(16)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
selectedSureButton = true infoFailLabel.snp.makeConstraints { make in
make.left.equalTo(containerView)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = true
selectedSureButton = .unknown
} }
private func updateButtonState(_ button: UIButton, _ isSelected: Bool) { private func updateButtonsState(_ state: YHIncomeRecordHasAllFile) {
button.isSelected = isSelected switch state {
button.backgroundColor = isSelected ? UIColor(hexString: "#EBF0F9") : .contentBkgColor case .unknown:
button.layer.borderColor = isSelected ? UIColor.brandMainColor.cgColor : nil sureButton.isSelected = false
button.layer.borderWidth = isSelected ? 1 : 0 sureButton.backgroundColor = .contentBkgColor
sureButton.layer.borderColor = nil
sureButton.layer.borderWidth = 0
cancelButton.isSelected = false
cancelButton.backgroundColor = .contentBkgColor
cancelButton.layer.borderColor = nil
cancelButton.layer.borderWidth = 0
case .true:
sureButton.isSelected = true
sureButton.backgroundColor = UIColor(hexString: "#EBF0F9")
sureButton.layer.borderColor = UIColor.brandMainColor.cgColor
sureButton.layer.borderWidth = 1
cancelButton.isSelected = false
cancelButton.backgroundColor = .contentBkgColor
cancelButton.layer.borderColor = nil
cancelButton.layer.borderWidth = 0
case .false:
cancelButton.isSelected = true
cancelButton.backgroundColor = UIColor(hexString: "#EBF0F9")
cancelButton.layer.borderColor = UIColor.brandMainColor.cgColor
cancelButton.layer.borderWidth = 1
sureButton.isSelected = false
sureButton.backgroundColor = .contentBkgColor
sureButton.layer.borderColor = nil
sureButton.layer.borderWidth = 0
}
} }
} }
...@@ -229,7 +307,6 @@ private class YHIncomeDocumentationView: UIView { ...@@ -229,7 +307,6 @@ private class YHIncomeDocumentationView: UIView {
return view return view
}() }()
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
setupUI() setupUI()
......
...@@ -53,6 +53,14 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell { ...@@ -53,6 +53,14 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell {
return view return view
}() }()
private lazy var infoFailLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = .failColor
label.text = "请选择"
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI() setupUI()
...@@ -62,7 +70,7 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell { ...@@ -62,7 +70,7 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, detail: String?, inputValue: String?, showBottomLine: Bool = true, showStarIcon: Bool = false) { func setupCellInfo(title: String, detail: String?, inputValue: String?, showBottomLine: Bool = true, showStarIcon: Bool = false, needShowFailButton: Bool) {
infoTitleLabel.text = title infoTitleLabel.text = title
bottomLineView.isHidden = !showBottomLine bottomLineView.isHidden = !showBottomLine
inputTextField.text = inputValue inputTextField.text = inputValue
...@@ -82,12 +90,8 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell { ...@@ -82,12 +90,8 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell {
make.width.lessThanOrEqualTo(102) make.width.lessThanOrEqualTo(102)
} }
} }
updateDetailText(detail) infoDetailLabel.text = detail
} if let detail = detail, detail.count > 0 {
func updateDetailText(_ text: String?) {
infoDetailLabel.text = text
if let text = text, text.count > 0 {
infoDetailLabel.snp.remakeConstraints { make in infoDetailLabel.snp.remakeConstraints { make in
make.top.equalTo(inputTextField.snp.bottom).offset(4) make.top.equalTo(inputTextField.snp.bottom).offset(4)
make.bottom.lessThanOrEqualToSuperview().offset(-16) make.bottom.lessThanOrEqualToSuperview().offset(-16)
...@@ -102,6 +106,17 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell { ...@@ -102,6 +106,17 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell {
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
} }
} }
infoFailLabel.isHidden = !needShowFailButton
infoFailLabel.snp.remakeConstraints { make in
if needShowFailButton {
make.top.equalTo(infoDetailLabel.snp.bottom).offset(6)
}
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
} }
} }
...@@ -114,6 +129,7 @@ extension YHIncomeInputMoneyCell { ...@@ -114,6 +129,7 @@ extension YHIncomeInputMoneyCell {
subContainerView.addSubview(inputTextField) subContainerView.addSubview(inputTextField)
subContainerView.addSubview(infoDetailLabel) subContainerView.addSubview(infoDetailLabel)
subContainerView.addSubview(bottomLineView) subContainerView.addSubview(bottomLineView)
subContainerView.addSubview(infoFailLabel)
dotIcon.setContentCompressionResistancePriority(.required, for: .horizontal) dotIcon.setContentCompressionResistancePriority(.required, for: .horizontal)
infoTitleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) infoTitleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
...@@ -145,6 +161,12 @@ extension YHIncomeInputMoneyCell { ...@@ -145,6 +161,12 @@ extension YHIncomeInputMoneyCell {
make.left.equalToSuperview().offset(147) make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
} }
infoFailLabel.isHidden = true
infoFailLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
bottomLineView.snp.makeConstraints { make in bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
......
...@@ -44,6 +44,14 @@ class YHIncomeTypeSelectCell: YHResignDocumentCell { ...@@ -44,6 +44,14 @@ class YHIncomeTypeSelectCell: YHResignDocumentCell {
return view return view
}() }()
private lazy var infoFailLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = .failColor
label.text = "请选择"
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI() setupUI()
...@@ -53,16 +61,49 @@ class YHIncomeTypeSelectCell: YHResignDocumentCell { ...@@ -53,16 +61,49 @@ class YHIncomeTypeSelectCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, detail: String = "请选择", isSelectedOne: Bool = false, showBottomLine: Bool = false) { func setupCellInfo(title: String, detail: String = "请选择", isSelectedOne: Bool = false, showBottomLine: Bool = false, needShowFailButton: Bool) {
infoTitleLabel.text = title infoTitleLabel.text = title
infoDetailLabel.text = detail infoDetailLabel.text = detail
infoDetailLabel.isHidden = isSelectedOne infoDetailLabel.isHidden = isSelectedOne
bottomLineView.isHidden = !showBottomLine bottomLineView.isHidden = !showBottomLine
updateFailLabel(needShowFailButton)
} }
} }
extension YHIncomeTypeSelectCell { extension YHIncomeTypeSelectCell {
private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton {
infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
}
infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(infoDetailLabel.snp.bottom).offset(6)
make.left.equalTo(dotIcon)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = false
} else {
infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16)
make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
}
infoFailLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = true
}
}
private func setupUI() { private func setupUI() {
updateCellCorner(.mid) updateCellCorner(.mid)
subContainerView.addSubview(dotIcon) subContainerView.addSubview(dotIcon)
...@@ -70,6 +111,7 @@ extension YHIncomeTypeSelectCell { ...@@ -70,6 +111,7 @@ extension YHIncomeTypeSelectCell {
subContainerView.addSubview(infoDetailLabel) subContainerView.addSubview(infoDetailLabel)
subContainerView.addSubview(rightArrowIcon) subContainerView.addSubview(rightArrowIcon)
subContainerView.addSubview(bottomLineView) subContainerView.addSubview(bottomLineView)
subContainerView.addSubview(infoFailLabel)
dotIcon.setContentCompressionResistancePriority(.required, for: .horizontal) dotIcon.setContentCompressionResistancePriority(.required, for: .horizontal)
infoTitleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) infoTitleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
...@@ -77,18 +119,18 @@ extension YHIncomeTypeSelectCell { ...@@ -77,18 +119,18 @@ extension YHIncomeTypeSelectCell {
rightArrowIcon.setContentCompressionResistancePriority(.required, for: .horizontal) rightArrowIcon.setContentCompressionResistancePriority(.required, for: .horizontal)
dotIcon.snp.makeConstraints { make in dotIcon.snp.makeConstraints { make in
make.centerY.equalToSuperview() make.centerY.equalTo(infoTitleLabel)
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.width.height.equalTo(6) make.width.height.equalTo(6)
} }
infoTitleLabel.snp.makeConstraints { make in infoTitleLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview() make.top.equalToSuperview().offset(16)
make.left.equalTo(dotIcon.snp.right).offset(2) make.left.equalTo(dotIcon.snp.right).offset(2)
} }
rightArrowIcon.snp.makeConstraints { make in rightArrowIcon.snp.makeConstraints { make in
make.centerY.equalToSuperview() make.centerY.equalTo(infoTitleLabel)
make.right.equalToSuperview().offset(-18) make.right.equalToSuperview().offset(-18)
make.width.height.equalTo(20) make.width.height.equalTo(20)
} }
...@@ -100,6 +142,13 @@ extension YHIncomeTypeSelectCell { ...@@ -100,6 +142,13 @@ extension YHIncomeTypeSelectCell {
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18) make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
} }
infoFailLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = true
bottomLineView.snp.makeConstraints { make in bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
......
...@@ -13,6 +13,7 @@ class YHIncomeTypesCell: YHResignDocumentCell { ...@@ -13,6 +13,7 @@ class YHIncomeTypesCell: YHResignDocumentCell {
var didClickTypeView: ((Int) -> Void)? var didClickTypeView: ((Int) -> Void)?
private var typeViews: [YHIncomeTypeView] = [] private var typeViews: [YHIncomeTypeView] = []
private var lastTypes: [String] = []
private lazy var bottomLineView: UIView = { private lazy var bottomLineView: UIView = {
let view = UIView() let view = UIView()
...@@ -41,6 +42,10 @@ class YHIncomeTypesCell: YHResignDocumentCell { ...@@ -41,6 +42,10 @@ class YHIncomeTypesCell: YHResignDocumentCell {
} }
func setupCellInfo(types: [String]) { func setupCellInfo(types: [String]) {
guard lastTypes != types || types.count != typeViews.count else {
return
}
lastTypes = types
typeViews.forEach { typeViews.forEach {
$0.removeFromSuperview() $0.removeFromSuperview()
} }
......
...@@ -11,12 +11,11 @@ import UIKit ...@@ -11,12 +11,11 @@ import UIKit
class YHInfoConsentForHKTravelCell: YHResignDocumentCell { class YHInfoConsentForHKTravelCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHInfoConsentForHKTravelCell" static let cellReuseIdentifier = "YHInfoConsentForHKTravelCell"
var didSelectSureButton: ((Bool) -> Void)? var didSelectSureButton: ((YHCheckboxSelectType) -> Void)?
var selectedSureButton: Bool = true { var selectedSureButton: YHCheckboxSelectType = .unknown {
didSet { didSet {
updateButtonState(sureButton, selectedSureButton) updateButtonsState(selectedSureButton)
updateButtonState(cancelButton, !selectedSureButton)
} }
} }
...@@ -86,6 +85,14 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell { ...@@ -86,6 +85,14 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell {
return button return button
}() }()
private lazy var infoFailLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = .failColor
label.text = "请选择"
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI() setupUI()
...@@ -95,29 +102,62 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell { ...@@ -95,29 +102,62 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, detail: ASAttributedString, question: String, showBottomLine: Bool = false) { func setupCellInfo(title: String, detail: ASAttributedString, question: String, showBottomLine: Bool = false, needShowFailButton: Bool) {
bottomLineView.isHidden = !showBottomLine bottomLineView.isHidden = !showBottomLine
infoTitleLabel.text = title infoTitleLabel.text = title
infoDetailLabel.attributed.text = detail infoDetailLabel.attributed.text = detail
infoQuestionLabel.text = question infoQuestionLabel.text = question
updateFailLabel(needShowFailButton)
} }
} }
extension YHInfoConsentForHKTravelCell { extension YHInfoConsentForHKTravelCell {
private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton {
infoFailLabel.isHidden = false
infoQuestionLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon.snp.right).offset(2)
make.top.equalTo(infoDetailLabel.snp.bottom).offset(16)
make.height.greaterThanOrEqualTo(40)
make.width.lessThanOrEqualTo(113)
}
infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(6)
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
} else {
infoFailLabel.isHidden = true
infoQuestionLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon.snp.right).offset(2)
make.top.equalTo(infoDetailLabel.snp.bottom).offset(16)
make.height.greaterThanOrEqualTo(40)
make.width.lessThanOrEqualTo(113)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
}
}
@objc private func cancelButtonDidClick(_ sender: UIButton) { @objc private func cancelButtonDidClick(_ sender: UIButton) {
guard !sender.isSelected else { guard !sender.isSelected else {
return return
} }
selectedSureButton = false selectedSureButton = .false
didSelectSureButton?(false) didSelectSureButton?(.false)
} }
@objc private func sureButtonDidClick(_ sender: UIButton) { @objc private func sureButtonDidClick(_ sender: UIButton) {
guard !sender.isSelected else { guard !sender.isSelected else {
return return
} }
selectedSureButton = true selectedSureButton = .true
didSelectSureButton?(true) didSelectSureButton?(.true)
} }
private func setupUI() { private func setupUI() {
...@@ -130,6 +170,7 @@ extension YHInfoConsentForHKTravelCell { ...@@ -130,6 +170,7 @@ extension YHInfoConsentForHKTravelCell {
subContainerView.addSubview(infoQuestionLabel) subContainerView.addSubview(infoQuestionLabel)
subContainerView.addSubview(sureButton) subContainerView.addSubview(sureButton)
subContainerView.addSubview(cancelButton) subContainerView.addSubview(cancelButton)
subContainerView.addSubview(infoFailLabel)
sureButton.setContentCompressionResistancePriority(.required, for: .horizontal) sureButton.setContentCompressionResistancePriority(.required, for: .horizontal)
cancelButton.setContentCompressionResistancePriority(.required, for: .horizontal) cancelButton.setContentCompressionResistancePriority(.required, for: .horizontal)
...@@ -165,6 +206,7 @@ extension YHInfoConsentForHKTravelCell { ...@@ -165,6 +206,7 @@ extension YHInfoConsentForHKTravelCell {
make.top.equalTo(infoDetailLabel.snp.bottom).offset(16) make.top.equalTo(infoDetailLabel.snp.bottom).offset(16)
make.height.greaterThanOrEqualTo(40) make.height.greaterThanOrEqualTo(40)
make.width.lessThanOrEqualTo(113) make.width.lessThanOrEqualTo(113)
make.bottom.equalToSuperview().offset(-16)
} }
cancelButton.snp.makeConstraints { make in cancelButton.snp.makeConstraints { make in
...@@ -187,15 +229,47 @@ extension YHInfoConsentForHKTravelCell { ...@@ -187,15 +229,47 @@ extension YHInfoConsentForHKTravelCell {
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18) make.right.equalToSuperview().offset(-18)
make.height.equalTo(0.5) make.height.equalTo(0.5)
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(22)
} }
selectedSureButton = true infoFailLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = true
selectedSureButton = .unknown
} }
private func updateButtonState(_ button: UIButton, _ isSelected: Bool) { private func updateButtonsState(_ state: YHCheckboxSelectType) {
button.isSelected = isSelected switch state {
button.backgroundColor = isSelected ? UIColor(hexString: "#EBF0F9") : .contentBkgColor case .unknown:
button.layer.borderColor = isSelected ? UIColor.brandMainColor.cgColor : nil sureButton.isSelected = false
button.layer.borderWidth = isSelected ? 1 : 0 sureButton.backgroundColor = .contentBkgColor
sureButton.layer.borderColor = nil
sureButton.layer.borderWidth = 0
cancelButton.isSelected = false
cancelButton.backgroundColor = .contentBkgColor
cancelButton.layer.borderColor = nil
cancelButton.layer.borderWidth = 0
case .true:
sureButton.isSelected = true
sureButton.backgroundColor = UIColor(hexString: "#EBF0F9")
sureButton.layer.borderColor = UIColor.brandMainColor.cgColor
sureButton.layer.borderWidth = 1
cancelButton.isSelected = false
cancelButton.backgroundColor = .contentBkgColor
cancelButton.layer.borderColor = nil
cancelButton.layer.borderWidth = 0
case .false:
cancelButton.isSelected = true
cancelButton.backgroundColor = UIColor(hexString: "#EBF0F9")
cancelButton.layer.borderColor = UIColor.brandMainColor.cgColor
cancelButton.layer.borderWidth = 1
sureButton.isSelected = false
sureButton.backgroundColor = .contentBkgColor
sureButton.layer.borderColor = nil
sureButton.layer.borderWidth = 0
}
} }
} }
...@@ -58,12 +58,12 @@ class YHIncomeRecordViewModel: YHBaseViewModel { ...@@ -58,12 +58,12 @@ class YHIncomeRecordViewModel: YHBaseViewModel {
} }
} }
func updateDetail(incomeId: Int, incomeMoney: Double, corporateTurnover: Double, incomeType: [Int], hasAllFile: YHIncomeRecordHasAllFile, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) { func updateDetail(incomeId: Int, incomeMoney: Double, corporateTurnover: Double, incomeType: [Int], hasAllFile: Int, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["income_id": incomeId, let params: [String: Any] = ["income_id": incomeId,
"income_money": incomeMoney, "income_money": incomeMoney,
"corporate_turnover": corporateTurnover, "corporate_turnover": corporateTurnover,
"income_type": incomeType, "income_type": incomeType,
"has_all_file": hasAllFile.rawValue] "has_all_file": hasAllFile]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.updateDetail let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.updateDetail
_ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in
// 1. json字符串 转 对象 // 1. json字符串 转 对象
...@@ -79,9 +79,9 @@ class YHIncomeRecordViewModel: YHBaseViewModel { ...@@ -79,9 +79,9 @@ class YHIncomeRecordViewModel: YHBaseViewModel {
} }
} }
func incomeUpdate(orderId: Int, incomeOver100: YHIncomeOver100, type: YHIncomeRecordUpdateType, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) { func incomeUpdate(orderId: Int, incomeOver100: Int, type: YHIncomeRecordUpdateType, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["order_id": orderId, let params: [String: Any] = ["order_id": orderId,
"income_over_100": incomeOver100.rawValue, "income_over_100": incomeOver100,
"type": type.rawValue] "type": type.rawValue]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.incomeUpdate let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.incomeUpdate
_ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in
......
...@@ -248,6 +248,8 @@ class YHOtherPickerView: UIView { ...@@ -248,6 +248,8 @@ class YHOtherPickerView: UIView {
return "选择星座" return "选择星座"
case .selectAddress: case .selectAddress:
return "选择国家地区" return "选择国家地区"
case .field:
return "选择经验领域"
default: default:
return "请选择" return "请选择"
} }
...@@ -275,7 +277,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource { ...@@ -275,7 +277,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat {
switch type { switch type {
case .nature,.certificate,.structure,.level,.prove,.idType,.sex,.marry,.constellation: case .nature,.certificate,.structure,.level,.prove,.idType,.sex,.marry,.constellation,.field:
return 50 return 50
default: default:
return 70 return 70
...@@ -285,7 +287,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource { ...@@ -285,7 +287,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
switch type { switch type {
case .nature,.certificate,.structure,.level,.prove,.idType,.travelIdType,.sex,.marry,.constellation,.selectAddress: case .nature,.certificate,.structure,.level,.prove,.idType,.travelIdType,.sex,.marry,.constellation,.selectAddress,.field:
let label = UILabel() let label = UILabel()
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_M(ofSize: 14) label.font = UIFont.PFSC_M(ofSize: 14)
...@@ -450,6 +452,14 @@ extension YHOtherPickerView { ...@@ -450,6 +452,14 @@ extension YHOtherPickerView {
arrData.append(model) arrData.append(model)
} }
title = getTitle(type: type) title = getTitle(type: type)
case .field:
let arr = YHConstantArrayData.arrSelectField
arrData.removeAll()
arr.forEach { item in
let model = YHOtherPickerViewItemData(title: item["title"] ?? "-", subTitle: "", index: item["id"] ?? "-")
arrData.append(model)
}
title = getTitle(type: type)
default: default:
return return
} }
......
...@@ -17,11 +17,14 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController { ...@@ -17,11 +17,14 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController {
var introductionDataSource: [YHWorkExperienceProjectModel]? var introductionDataSource: [YHWorkExperienceProjectModel]?
var fileDataSource: [YHWorkExperienceFileModel]? var fileDataSource: [YHWorkExperienceFileModel]?
var workExperienceID: String? var workExperienceID: String?
var workID: Int = 0
var orderID: Int = 0 var orderID: Int = 0
var positionId: Int = 0
var isMore: Bool = false var isMore: Bool = false
var isShowPrompt: Bool = false var isShowPrompt: Bool = false
var isShowMessageSelect: Bool = true var isShowMessageSelect: Bool = true
var isKeyboardShow: Bool = false var isKeyboardShow: Bool = false
var selectReasonIndex: Int = 5
var selectEditItem = YHWorkExperienceFileModel() var selectEditItem = YHWorkExperienceFileModel()
override func viewDidLoad() { override func viewDidLoad() {
...@@ -36,8 +39,17 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController { ...@@ -36,8 +39,17 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController {
} }
func getData() { func getData() {
self.baseDataSource = self.viewModel.getBaseDataSource(false) viewModel.requestWorkPositionDetail(workID, positionId) {[weak self] success, error in
updateDataSource() guard let self = self else { return }
if success ?? false {
self.selectReasonIndex = self.viewModel.position.provide_certificate_type - 1
updateDataSource()
} else {
self.viewModel.position.work_id = workID
self.viewModel.position.order_id = orderID
updateDataSource()
}
}
} }
func getTextWithType(type: Int) -> ASAttributedString { func getTextWithType(type: Int) -> ASAttributedString {
...@@ -75,7 +87,7 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController { ...@@ -75,7 +87,7 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController {
func updateDataSource() { func updateDataSource() {
bottomView.nextButton.setTitle("提交", for: .normal) bottomView.nextButton.setTitle("提交", for: .normal)
self.baseDataSource = self.viewModel.getBaseDataSource(false)
self.tableView.reloadData() self.tableView.reloadData()
} }
...@@ -85,6 +97,7 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController { ...@@ -85,6 +97,7 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController {
if #available(iOS 11.0, *) { if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never tableView.contentInsetAdjustmentBehavior = .never
} }
tableView.sectionHeaderHeight = 16
tableView.backgroundColor = .clear tableView.backgroundColor = .clear
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.delegate = self tableView.delegate = self
...@@ -105,41 +118,35 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController { ...@@ -105,41 +118,35 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController {
bottom.nextblock = { [weak self] in bottom.nextblock = { [weak self] in
bottom.nextButton.isEnabled = false bottom.nextButton.isEnabled = false
guard let self = self else { return } guard let self = self else { return }
// if self.viewModel.isCanNext(self.stepView.currentIndex) { if self.viewModel.isCanNext() {
// self.viewModel.mainModel.step = self.stepView.currentIndex self.viewModel.saveWorkPosition(callBackBlock: {[weak self] flag, error in
// self.viewModel.saveWorkDetail(1, orderID: self.orderID, callBackBlock: {[weak self] flag, error in guard let self = self else { return }
// guard let self = self else { return } bottom.nextButton.isEnabled = true
// bottom.nextButton.isEnabled = true if let error = error {
// if let error = error { YHHUD.flash(message: error.errorMsg )
// YHHUD.flash(message: error.errorMsg ) } else {
// } else { YHHUD.hideFlashMessage()
// YHHUD.hideFlashMessage() YHHUD.flash(message: "提交成功")
// if self.stepView.currentIndex == 3 { self.navigationController?.popViewController()
// YHHUD.flash(message: "提交成功") }
// self.navigationController?.popViewController() })
// } else { } else {
// self.stepView.currentIndex = self.stepView.currentIndex + 1 bottom.nextButton.isEnabled = true
// self.updateDataSource() self.isShowPrompt = true
// } self.updateDataSource()
// } YHHUD.flash(message: "您还有信息未填写")
// }) }
// } else {
// bottom.nextButton.isEnabled = true
// self.isShowPrompt = true
// self.updateDataSource()
// YHHUD.flash(message: "您还有信息未填写")
// }
} }
bottom.saveBlock = { [weak self] in bottom.saveBlock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
// self.viewModel.saveWorkDetail(0, orderID: self.orderID, callBackBlock: {[weak self] flag, error in self.viewModel.saveWorkPosition(callBackBlock: {[weak self] flag, error in
// guard let self = self else { return } guard let _ = self else { return }
// if let error = error { if let error = error {
// YHHUD.flash(message: error.errorMsg ) YHHUD.flash(message: error.errorMsg )
// } else { } else {
// YHHUD.flash(message: "保存成功") YHHUD.flash(message: "保存成功")
// } }
// }) })
} }
return bottom return bottom
}() }()
...@@ -159,26 +166,6 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController { ...@@ -159,26 +166,6 @@ class YHWorkExperiencePositionViewViewController: YHBaseViewController {
} }
} }
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 { extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITableViewDataSource {
...@@ -190,13 +177,12 @@ extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITab ...@@ -190,13 +177,12 @@ extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITab
if indexPath.row == 0 { if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionListTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionListTableViewCell.self)
cell.country = self.viewModel.mainModel.location.country
cell.dataSource = baseDataSource?[indexPath.row] cell.dataSource = baseDataSource?[indexPath.row]
cell.workExperienceBlock = {[weak self] model in cell.workExperienceBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
self.viewModel.updateModel(model) self.viewModel.updateModel(model)
let id = model.id 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 id != .id1 && id != .id2 && id != .id6 && id != .id10 {
self.updateDataSource() self.updateDataSource()
} }
} }
...@@ -208,7 +194,13 @@ extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITab ...@@ -208,7 +194,13 @@ extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITab
return cell return cell
} else { } else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionReasonTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionReasonTableViewCell.self)
cell.selectItem = [self.selectReasonIndex]
cell.dataSource = getTipsWithType() cell.dataSource = getTipsWithType()
cell.selectBlock = {[weak self] index in
guard let self = self else { return }
self.selectReasonIndex = index.first ?? 5
self.viewModel.position.provide_certificate_type = self.selectReasonIndex + 1
}
cell.backgroundColor = .clear cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear cell.contentView.backgroundColor = .clear
return cell return cell
...@@ -223,7 +215,7 @@ extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITab ...@@ -223,7 +215,7 @@ extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITab
let data = array[i] let data = array[i]
let message = data.message ?? "" let message = data.message ?? ""
let isShow = data.isShowPrompts ?? false let isShow = data.isShowPrompts ?? false
if data.id == .id13 { if data.id == .id7 {
h = h + 72 h = h + 72
} else { } else {
h = h + 52 h = h + 52
...@@ -244,7 +236,7 @@ extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITab ...@@ -244,7 +236,7 @@ extension YHWorkExperiencePositionViewViewController: UITableViewDelegate, UITab
} }
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 7 return 16
} }
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......
...@@ -51,7 +51,6 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -51,7 +51,6 @@ class YHWorkExperienceViewController: YHBaseViewController {
setView() setView()
getData()
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardDidShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardDidShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardDidHideNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardDidHideNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
...@@ -77,10 +76,15 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -77,10 +76,15 @@ class YHWorkExperienceViewController: YHBaseViewController {
} }
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
getData()
}
@objc func handleKeyboardNotification(_ notification: Notification) { @objc func handleKeyboardNotification(_ notification: Notification) {
if notification.userInfo != nil { if notification.userInfo != nil {
if stepView.currentIndex == 4 || stepView.currentIndex == 3 { if stepView.currentIndex == 3 {
guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue else {return } guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue else {return }
let isKeyboardShow = notification.name == UIResponder.keyboardWillShowNotification let isKeyboardShow = notification.name == UIResponder.keyboardWillShowNotification
...@@ -103,6 +107,10 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -103,6 +107,10 @@ class YHWorkExperienceViewController: YHBaseViewController {
func getData() { func getData() {
viewModel.requestWorkExample { success, error in viewModel.requestWorkExample { success, error in
}
viewModel.requestWorkPositionList("\(orderID)", workExperienceID ?? "") {[weak self] success, error in
guard let self = self else { return }
self.updateDataSource()
} }
viewModel.requestWorkDetail("\(orderID)", workExperienceID ?? "") {[weak self] success, error in viewModel.requestWorkDetail("\(orderID)", workExperienceID ?? "") {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
...@@ -117,6 +125,7 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -117,6 +125,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
self.updateDataSource() self.updateDataSource()
} }
} }
updateDataSource() updateDataSource()
} }
...@@ -339,10 +348,10 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -339,10 +348,10 @@ class YHWorkExperienceViewController: YHBaseViewController {
} }
} }
func showDeleteAlert(_ model: YHWorkExperienceProjectModel) { func showDeleteAlert(_ model: YHWorkExperiencePositionModel) {
YHCommonAlertView.show("", "确定要删除该项目介绍吗?", "取消", "确认") {[weak self] in YHCommonAlertView.show("", "确定要删除该职位信息吗?", "取消", "确认") {[weak self] in
guard let self = self else { return } guard let self = self else { return }
self.viewModel?.requestDeleteWorkExperienceProject("\(model.id ?? 0)", callBackBlock: {[weak self] success, error in self.viewModel?.requestDeleteWorkPosition(model, callBackBlock: {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.getData() self.getData()
}) })
...@@ -696,7 +705,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -696,7 +705,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} else { } else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHWorkExperiencePositionTableViewCell.self)
cell.showPrompt = isShowPrompt cell.showPrompt = isShowPrompt
// cell.dataSource = dataSource cell.dataSource = self.viewModel.positionList
if isMore { if isMore {
cell.more() cell.more()
} else { } else {
...@@ -704,19 +713,15 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -704,19 +713,15 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} }
cell.clickBlock = {[weak self] model in cell.clickBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
// let firstModel = self.dataSource?.first let vc = YHWorkExperiencePositionViewViewController()
// let vc = YHWorkExperienceViewController() vc.workID = model.work_id
// vc.workExperienceID = "\(model.id ?? 0)" vc.orderID = model.order_id
// vc.orderID = self.orderId vc.positionId = model.position_id
// vc.isShowMessageSelect = true self.navigationController?.pushViewController(vc, animated: true)
// if firstModel?.id == model.id {
// vc.isShowMessageSelect = false
// }
// self.navigationController?.pushViewController(vc, animated: true)
} }
cell.deleteBlock = {[weak self] model in cell.deleteBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
// self.showDeleteAlert(model) self.showDeleteAlert(model)
} }
cell.isMoreBlock = {[weak self] isMore in cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return } guard let self = self else { return }
...@@ -733,6 +738,8 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -733,6 +738,8 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
// self.navigationController?.pushViewController(vc, animated: true) // self.navigationController?.pushViewController(vc, animated: true)
// } // }
let vc = YHWorkExperiencePositionViewViewController() let vc = YHWorkExperiencePositionViewViewController()
vc.workID = workExperienceID?.intValue() ?? 0
vc.orderID = orderID
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
cell.backgroundColor = .clear cell.backgroundColor = .clear
...@@ -763,31 +770,30 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -763,31 +770,30 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} }
return CGFloat(h + 52 + 14 + 386) return CGFloat(h + 52 + 14 + 386)
} else { } else {
// let number = dataSource?.count ?? 0 let number = viewModel.positionList.count
var height = 23 + 154 var height = 23 + 154
// if let data = dataSource { for item in viewModel.positionList {
// for item in data { if item.position_name == "" {
// if item.company_name == "" { height = height + 52
// height = height + 52 } else {
// } else { let text = item.position_name // 要显示的文本内容
// let text = item.company_name // 要显示的文本内容 let font = UIFont.PFSC_B(ofSize: 14) // 字体大小
// let font = UIFont.PFSC_B(ofSize: 14) // 字体大小 let maxWidth = 143.0 // 最大宽度限制
// let maxWidth = 143.0 // 最大宽度限制
// // 创建NSAttributedString对象并设置属性
// // 创建NSAttributedString对象并设置属性 let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any]
// let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any] _ = NSMutableAttributedString(string: text, attributes: attributes)
// _ = NSMutableAttributedString(string: text ?? "", attributes: attributes)
// // 根据指定的最大宽度和字体大小计算文本的高度
// // 根据指定的最大宽度和字体大小计算文本的高度 let size = (text as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size
// let size = (text! as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size if size.height > 20 {
// if size.height > 20 { height = height + 96
// height = height + 96 } else {
// } else { height = height + 76
// height = height + 76 }
// } }
// } }
// }
// }
return CGFloat(height) return CGFloat(height)
} }
} }
......
...@@ -15,6 +15,7 @@ class YHWorkExperienceDetailModel: SmartCodable { ...@@ -15,6 +15,7 @@ class YHWorkExperienceDetailModel: SmartCodable {
var company_name: String = "" var company_name: String = ""
var professional_level: Int = 0 var professional_level: Int = 0
var work_certificate: String = "" var work_certificate: String = ""
var has_finish_basic_question: Int = 0
var is_famous_enterprise: Int = 0 var is_famous_enterprise: Int = 0
var duty: String = "" var duty: String = ""
......
...@@ -19,7 +19,8 @@ enum YHWorkExperienceSelectType: Int { ...@@ -19,7 +19,8 @@ enum YHWorkExperienceSelectType: Int {
case structure = 7 case structure = 7
case level = 8 case level = 8
case prove = 9 case prove = 9
case company = 10 case company = 10
case field = 11
} }
enum YHWorkExperienceID: Int { enum YHWorkExperienceID: Int {
......
...@@ -21,8 +21,9 @@ class YHWorkExperiencePositionModel: SmartCodable { ...@@ -21,8 +21,9 @@ class YHWorkExperiencePositionModel: SmartCodable {
var experience_sub_scope: String = "" var experience_sub_scope: String = ""
var is_international_work_experience: Int = 0 var is_international_work_experience: Int = 0
var provide_certificate_type: Int = 0 var provide_certificate_type: Int = 0
var work_country: String? var work_country: String = ""
var work_city: String? var work_city: String = ""
var missing_item_num: Int = 0
required init() { required init() {
} }
} }
...@@ -248,6 +248,12 @@ class YHWorkExperienceItemView: UIView { ...@@ -248,6 +248,12 @@ class YHWorkExperienceItemView: UIView {
case .prove: case .prove:
break break
case .company: case .company:
if dataSource.message == "0" {
messageTextField.text = "未选择"
} else {
messageTextField.text = "已选择"
}
case .field:
break break
} }
} }
...@@ -506,6 +512,15 @@ class YHWorkExperienceItemView: UIView { ...@@ -506,6 +512,15 @@ class YHWorkExperienceItemView: UIView {
YHWorkExperienceCompanySelectView.show { array in YHWorkExperienceCompanySelectView.show { array in
} }
case .field:
YHOtherPickerView.show(type: .field, selectTitle: self.dataSource?.message ?? "") {[weak self] data in
guard let self = self else { return }
self.dataSource?.message = data.title
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHWorkExperienceModel())
}
}
} }
} }
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import UIKit import UIKit
class YHWorkExperiencePositionItemView: UIView { class YHWorkExperiencePositionItemView: UIView {
typealias ItemBlock = (_ model: YHWorkItemListModel) -> () typealias ItemBlock = (_ model: YHWorkExperiencePositionModel) -> ()
var clickBlock: ItemBlock? var clickBlock: ItemBlock?
var deleteBlock: ItemBlock? var deleteBlock: ItemBlock?
var titleLabel: UILabel! var titleLabel: UILabel!
...@@ -21,19 +21,21 @@ class YHWorkExperiencePositionItemView: UIView { ...@@ -21,19 +21,21 @@ class YHWorkExperiencePositionItemView: UIView {
var showPrompt: Bool = false { var showPrompt: Bool = false {
didSet { didSet {
if showPrompt { if showPrompt {
if dataSource?.vacant_num != 0 { subTitleLabel.isHidden = false
subTitleLabel.text = "有" + "\(dataSource?.vacant_num ?? 0)" + "项未填写" if dataSource?.missing_item_num != 0 {
subTitleLabel.text = "有" + "\(dataSource?.missing_item_num ?? 0)" + "项未填写"
subTitleLabel.textColor = UIColor.failColor subTitleLabel.textColor = UIColor.failColor
} else { } else {
subTitleLabel.textColor = UIColor.labelTextColor2 subTitleLabel.textColor = UIColor.labelTextColor2
} }
} else { } else {
subTitleLabel.isHidden = true
subTitleLabel.textColor = UIColor.labelTextColor2 subTitleLabel.textColor = UIColor.labelTextColor2
} }
} }
} }
var dataSource: YHWorkItemListModel? { var dataSource: YHWorkExperiencePositionModel? {
didSet { didSet {
updateAllViews() updateAllViews()
} }
...@@ -64,6 +66,20 @@ class YHWorkExperiencePositionItemView: UIView { ...@@ -64,6 +66,20 @@ class YHWorkExperiencePositionItemView: UIView {
make.width.equalTo(143) make.width.equalTo(143)
} }
subTitleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 14)
label.textAlignment = .left
label.textColor = UIColor.labelTextColor2
return label
}()
addSubview(subTitleLabel)
subTitleLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.height.equalTo(20)
make.bottom.equalTo(-16)
}
explainLabel = { explainLabel = {
let label = UILabel() let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
...@@ -125,27 +141,27 @@ class YHWorkExperiencePositionItemView: UIView { ...@@ -125,27 +141,27 @@ class YHWorkExperiencePositionItemView: UIView {
func updateAllViews() { func updateAllViews() {
guard let dataSource = dataSource else { return } guard let dataSource = dataSource else { return }
titleLabel.text = dataSource.company_name titleLabel.text = dataSource.position_name
if dataSource.vacant_num != 0 { if dataSource.missing_item_num != 0 {
explainLabel.text = "有" + "\(dataSource.vacant_num ?? 0)" + "项未填写" explainLabel.text = "有" + "\(dataSource.missing_item_num ?? 0)" + "项未填写"
} else { } else {
explainLabel.text = (dataSource.entry_time ?? "") + " ~ " + (dataSource.departure_time ?? "") explainLabel.text = (dataSource.entry_time ?? "") + " ~ " + (dataSource.departure_time ?? "")
} }
if dataSource.company_name?.count == 0 { if dataSource.position_name.count == 0 {
titleLabel.text = "工作经验\(tag - 4000 + 1)" titleLabel.text = "职位\(tag - 4000 + 1)"
} }
} }
@objc func centerClick() { @objc func centerClick() {
if let block = clickBlock { if let block = clickBlock {
block(self.dataSource ?? YHWorkItemListModel()) block(self.dataSource ?? YHWorkExperiencePositionModel())
} }
} }
@objc func deleteClick() { @objc func deleteClick() {
if let block = deleteBlock { if let block = deleteBlock {
block(self.dataSource ?? YHWorkItemListModel()) block(self.dataSource ?? YHWorkExperiencePositionModel())
} }
} }
......
...@@ -107,7 +107,7 @@ class YHWorkExperiencePositionListTableViewCell: UITableViewCell { ...@@ -107,7 +107,7 @@ class YHWorkExperiencePositionListTableViewCell: UITableViewCell {
let message = data?.message ?? "" let message = data?.message ?? ""
var h = 51 var h = 51
if data?.id == .id13 { if data?.id == .id7 {
h = 71 h = 71
} }
if isShow && message.count == 0 { if isShow && message.count == 0 {
...@@ -122,12 +122,6 @@ class YHWorkExperiencePositionListTableViewCell: UITableViewCell { ...@@ -122,12 +122,6 @@ class YHWorkExperiencePositionListTableViewCell: UITableViewCell {
block(model) block(model)
} }
} }
itemView.companyBlock = {[weak self] company in
guard let self = self else { return }
if let block = self.companyBlock {
block(company)
}
}
mainItemView.addSubview(itemView) mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in itemView.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
......
...@@ -134,6 +134,13 @@ class YHWorkExperiencePositionReasonTableViewCell: UITableViewCell { ...@@ -134,6 +134,13 @@ class YHWorkExperiencePositionReasonTableViewCell: UITableViewCell {
view.layer.borderColor = UIColor.brandMainColor.cgColor view.layer.borderColor = UIColor.brandMainColor.cgColor
view.addTarget(self, action: #selector(agreeClick(sender:)), for: .touchUpInside) view.addTarget(self, action: #selector(agreeClick(sender:)), for: .touchUpInside)
view.tag = 20000 + i view.tag = 20000 + i
if selectItem.contains(i) {
view.layer.borderWidth = 1
view.backgroundColor = UIColor(hex: 0xebf0f9)
} else {
view.layer.borderWidth = 0
view.backgroundColor = UIColor.contentBkgColor
}
return view return view
}() }()
mainItemView.addSubview(bgviewButton) mainItemView.addSubview(bgviewButton)
...@@ -192,21 +199,25 @@ class YHWorkExperiencePositionReasonTableViewCell: UITableViewCell { ...@@ -192,21 +199,25 @@ class YHWorkExperiencePositionReasonTableViewCell: UITableViewCell {
} }
@objc func agreeClick(sender: UIButton) { @objc func agreeClick(sender: UIButton) {
selectItem.removeAll()
selectItem.append(sender.tag - 20000)
sender.isSelected = !sender.isSelected sender.isSelected = !sender.isSelected
if sender.isSelected { for i in 0..<(dataSource?.count ?? 0) {
sender.layer.borderWidth = 1 if i == sender.tag - 20000 {
sender.backgroundColor = UIColor(hex: 0xebf0f9) let view = mainItemView.viewWithTag(i + 20000)
selectItem.append(sender.tag - 20000) view?.layer.borderWidth = 1
let view = mainItemView.viewWithTag(sender.tag - 20000 + 10000) as! UIImageView view?.backgroundColor = UIColor(hex: 0xebf0f9)
view.image = UIImage(named: "login_privacy_agree") let subview = mainItemView.viewWithTag(i + 10000) as! UIImageView
} else { subview.image = UIImage(named: "login_privacy_agree")
sender.layer.borderWidth = 0 } else {
sender.backgroundColor = UIColor.contentBkgColor let view = mainItemView.viewWithTag(i + 20000)
selectItem.removeAll(where: {$0 == sender.tag - 20000}) view?.layer.borderWidth = 0
let view = mainItemView.viewWithTag(sender.tag - 20000 + 10000) as! UIImageView view?.backgroundColor = UIColor.contentBkgColor
view.image = UIImage(named: "login_privacy_disagree_glay") let subview = mainItemView.viewWithTag(i + 10000) as! UIImageView
subview.image = UIImage(named: "login_privacy_disagree_glay")
}
} }
if let block = selectBlock { if let block = selectBlock {
block(selectItem) block(selectItem)
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import UIKit import UIKit
class YHWorkExperiencePositionTableViewCell: UITableViewCell { class YHWorkExperiencePositionTableViewCell: UITableViewCell {
typealias ExperienceListBlock = (_ model: YHWorkItemListModel) -> () typealias ExperienceListBlock = (_ model: YHWorkExperiencePositionModel) -> ()
typealias IsMoreBlock = (_ isMore: Bool) -> () typealias IsMoreBlock = (_ isMore: Bool) -> ()
typealias NewWorkBlock = () -> () typealias NewWorkBlock = () -> ()
var clickBlock: ExperienceListBlock? var clickBlock: ExperienceListBlock?
...@@ -24,7 +24,7 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell { ...@@ -24,7 +24,7 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell {
var mainItemView: UIView! var mainItemView: UIView!
var bottomView: YHWorkItemAddView! var bottomView: YHWorkItemAddView!
var showPrompt: Bool = false var showPrompt: Bool = false
var dataSource: [YHWorkItemListModel]?{ var dataSource: [YHWorkExperiencePositionModel]?{
didSet { didSet {
updateAllViews() updateAllViews()
} }
...@@ -144,7 +144,7 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell { ...@@ -144,7 +144,7 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell {
bottomView = { bottomView = {
let view = YHWorkItemAddView() let view = YHWorkItemAddView()
view.addBtn.setTitle("新增工作经验".local, for: .normal) view.addBtn.setTitle("新增职位".local, for: .normal)
view.clickBlock = {[weak self] in view.clickBlock = {[weak self] in
guard let self = self else { return } guard let self = self else { return }
if let block = self.newWorkBlock { if let block = self.newWorkBlock {
...@@ -215,19 +215,19 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell { ...@@ -215,19 +215,19 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell {
itemView.dataSource = dataSource[i] itemView.dataSource = dataSource[i]
itemView.showPrompt = showPrompt itemView.showPrompt = showPrompt
var h = 0 var h = 0
if model.company_name == "" { if model.position_name == "" {
h = 51 h = 51
} else { } else {
let text = model.company_name // 要显示的文本内容 let text = model.position_name // 要显示的文本内容
let font = UIFont.PFSC_B(ofSize: 14) // 字体大小 let font = UIFont.PFSC_B(ofSize: 14) // 字体大小
let maxWidth = 143.0 // 最大宽度限制 let maxWidth = 143.0 // 最大宽度限制
// 创建NSAttributedString对象并设置属性 // 创建NSAttributedString对象并设置属性
let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any] let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any]
_ = NSMutableAttributedString(string: text ?? "", attributes: attributes) _ = NSMutableAttributedString(string: text, attributes: attributes)
// 根据指定的最大宽度和字体大小计算文本的高度 // 根据指定的最大宽度和字体大小计算文本的高度
let size = (text! as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size let size = (text as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size
if size.height > 20 { if size.height > 20 {
h = 95 h = 95
} else { } else {
...@@ -249,7 +249,7 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell { ...@@ -249,7 +249,7 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell {
moreButton.isHidden = false moreButton.isHidden = false
cannalButton.isHidden = true cannalButton.isHidden = true
for i in 0..<(dataSource?.count ?? 0) { for i in 0..<(dataSource?.count ?? 0) {
let view = mainItemView.viewWithTag(4000 + i) as! YHWorkItemView let view = mainItemView.viewWithTag(4000 + i) as! YHWorkExperiencePositionItemView
view.isShowDelete(i, isShow: false) view.isShowDelete(i, isShow: false)
} }
if let block = isMoreBlock { if let block = isMoreBlock {
...@@ -261,7 +261,7 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell { ...@@ -261,7 +261,7 @@ class YHWorkExperiencePositionTableViewCell: UITableViewCell {
moreButton.isHidden = true moreButton.isHidden = true
cannalButton.isHidden = false cannalButton.isHidden = false
for i in 0..<(dataSource?.count ?? 0) { for i in 0..<(dataSource?.count ?? 0) {
let view = mainItemView.viewWithTag(4000 + i) as! YHWorkItemView let view = mainItemView.viewWithTag(4000 + i) as! YHWorkExperiencePositionItemView
view.isShowDelete(i, isShow: true) view.isShowDelete(i, isShow: true)
} }
if let block = isMoreBlock { if let block = isMoreBlock {
......
...@@ -14,13 +14,14 @@ class YHWorkExperienceViewModel: YHBaseViewModel { ...@@ -14,13 +14,14 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
var exampleModels: [YHWorkExampleModel]? var exampleModels: [YHWorkExampleModel]?
var projectModels: [YHWorkExperienceProjectModel]? var projectModels: [YHWorkExperienceProjectModel]?
var fileList: [YHWorkExperienceFileModel] = [] var fileList: [YHWorkExperienceFileModel] = []
var positionList: [YHWorkExperiencePositionModel] = []
override init() { override init() {
super.init() super.init()
} }
func getBaseDataSource(_ isShowPrompt: Bool) -> [YHSectionWorkExperienceModel] { func getBaseDataSource(_ isShowPrompt: Bool) -> [YHSectionWorkExperienceModel] {
let item = YHWorkExperienceModel(id: .id1, isNeed: true, title: "用人单位", isUserKeyBoard: true, prompts: "请输入", message: mainModel.company_name, isShowPrompts: isShowPrompt, alertMessage:"请输入") 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: false, prompts: "请选择", message: mainModel.industry, type: .company, isShowPrompts: isShowPrompt, alertMessage:"请选择") let item1 = YHWorkExperienceModel(id: .id2, isNeed: true, title: "公司基本情况", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.has_finish_basic_question)", type: .company, isShowPrompts: isShowPrompt, alertMessage:"请选择")
let item2 = YHWorkExperienceModel(id: .id3, isNeed: true, title: "职位水平类别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.professional_level)", type: .level, isShowPrompts: isShowPrompt, alertMessage:"请选择") let item2 = YHWorkExperienceModel(id: .id3, isNeed: true, title: "职位水平类别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.professional_level)", type: .level, isShowPrompts: isShowPrompt, alertMessage:"请选择")
var section = YHSectionWorkExperienceModel() var section = YHSectionWorkExperienceModel()
section = YHSectionWorkExperienceModel(title: "企业信息", models: [item, item1, item2]) section = YHSectionWorkExperienceModel(title: "企业信息", models: [item, item1, item2])
...@@ -212,9 +213,9 @@ class YHWorkExperienceViewModel: YHBaseViewModel { ...@@ -212,9 +213,9 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
} }
} }
func requestDeleteWorkExperienceProject(_ orderId: String, callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) { func requestDeleteWorkPosition(_ model: YHWorkExperiencePositionModel, callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
let params: [String : Any] = ["id": orderId] let params: [String : Any] = ["position_id": model.position_id, "work_id": model.work_id]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.projectDel let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.deleteWorkPosition
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象 //1. json字符串 转 对象
guard let self = self else { return } guard let self = self else { return }
...@@ -326,4 +327,27 @@ class YHWorkExperienceViewModel: YHBaseViewModel { ...@@ -326,4 +327,27 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
return true return true
} }
} }
func requestWorkPositionList(_ orderId: String, _ workId: String, callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
let param: [String: Any] = ["work_id": workId, "order_id": orderId]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.workPositionList
let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [Any], let result = [YHWorkExperiencePositionModel].deserialize(from: dic) else {
callBackBlock(false,nil)
return
}
self.positionList = result
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
} }
...@@ -41,6 +41,8 @@ enum YHOtherPickerViewType: Int { ...@@ -41,6 +41,8 @@ enum YHOtherPickerViewType: Int {
case constellation case constellation
//选择国家地区 //选择国家地区
case selectAddress case selectAddress
//选择经验领域
case field
} }
...@@ -473,6 +475,25 @@ class YHConstantArrayData { ...@@ -473,6 +475,25 @@ class YHConstantArrayData {
"title" : "海外地区", "title" : "海外地区",
] ]
] ]
static let arrSelectField = [
[
"id": "0",
"title" : "创新及科技",
],
[
"id" : "1",
"title" : "金融",
],
[
"id" : "2",
"title" : "国际贸易(包括跨境海运及空运,以及供应链管理)",
],
[
"id": "3",
"title" : "其他",
]
]
//通过 id 获取 title //通过 id 获取 title
static func getShowNameBy(indexStr:String,type : YHOtherPickerViewType) -> String { static func getShowNameBy(indexStr:String,type : YHOtherPickerViewType) -> String {
if indexStr.isEmpty { if indexStr.isEmpty {
...@@ -500,6 +521,8 @@ class YHConstantArrayData { ...@@ -500,6 +521,8 @@ class YHConstantArrayData {
arrData = YHConstantArrayData.arrDegreeConstellation arrData = YHConstantArrayData.arrDegreeConstellation
case .selectAddress: case .selectAddress:
arrData = YHConstantArrayData.arrSelectAddress arrData = YHConstantArrayData.arrSelectAddress
case .field:
arrData = YHConstantArrayData.arrSelectField
default: default:
arrData = [[:]] arrData = [[:]]
} }
......
...@@ -184,7 +184,8 @@ class YHAllApiName { ...@@ -184,7 +184,8 @@ class YHAllApiName {
static let saveAllEduAndQuaInfoApi = "infoflow/submitEducert" static let saveAllEduAndQuaInfoApi = "infoflow/submitEducert"
// 搜索大学名称 // 搜索大学名称
static let searchCollegeNameApi = "infoflow/getSchools" static let searchCollegeNameApi = "infoflow/getSchools"
// 搜索大学名称
static let searchMajorNameApi = "infoflow/getStemByName"
} }
struct Qualification { struct Qualification {
...@@ -251,6 +252,11 @@ class YHAllApiName { ...@@ -251,6 +252,11 @@ class YHAllApiName {
static let ocrFileContent = "infoflow/work/getOcrFileContent" static let ocrFileContent = "infoflow/work/getOcrFileContent"
//已上传文件列表 //已上传文件列表
static let fileList = "infoflow/work/file-list" static let fileList = "infoflow/work/file-list"
//职位列表
static let workPositionList = "infoflow/work/v1/workPositionList"
static let workPositionDetail = "infoflow/work/v1/workPositionDetail"
static let saveWorkPosition = "infoflow/work/v1/SaveWorkPosition"
static let deleteWorkPosition = "infoflow/work/v1/deleteWorkPosition"
} }
//登录 //登录
...@@ -377,9 +383,9 @@ class YHAllApiName { ...@@ -377,9 +383,9 @@ class YHAllApiName {
struct Assessment { struct Assessment {
//方案计划 //方案计划
static let applyPlanApi = "infoflow/assessment/apply_plan" static let applyPlanApi = "infoflow/assessment/apply_plan"
static let applyPlanNewApi = "infoflow/assessment/apply_plan" static let applyPlanNewApi = "infoflow/assessment/apply_plan_detail"
static let submitTargetsApi = "infoflow/assessment/save_apply_plan_target" static let submitTargetsApi = "infoflow/assessment/save_apply_plan_target"
static let modifyInfoApi = "infoflow/assessment/save_apply_plan_target" static let modifyInfoApi = "infoflow/assessment/update-info"
static let improveDetailApi = "infoflow/assessment/improve_plan_detail" static let improveDetailApi = "infoflow/assessment/improve_plan_detail"
} }
......
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