Commit 718bfad9 authored by Alex朱枝文's avatar Alex朱枝文

收入记录工作经验提交校验

parent a438dd2d
...@@ -81,37 +81,14 @@ class YHIncomeRecordFromCell: YHResignDocumentCell { ...@@ -81,37 +81,14 @@ class YHIncomeRecordFromCell: YHResignDocumentCell {
extension YHIncomeRecordFromCell { extension YHIncomeRecordFromCell {
private func updateFailLabel(_ needShowFailButton: Bool) { private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton { if needShowFailButton {
let isRightArrowIconHidden = rightArrowIcon.isHidden
infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(147)
if isRightArrowIconHidden {
make.right.lessThanOrEqualToSuperview().offset(-18)
} else {
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
}
}
infoFailLabel.snp.remakeConstraints { make in infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(infoDetailLabel.snp.bottom).offset(6) make.top.equalTo(infoTitleLabel.snp.bottom).offset(6)
make.left.equalTo(dotIcon) make.left.equalTo(dotIcon)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
infoFailLabel.isHidden = false infoFailLabel.isHidden = false
} else { } else {
let isRightArrowIconHidden = rightArrowIcon.isHidden
infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16)
make.left.equalToSuperview().offset(147)
if isRightArrowIconHidden {
make.right.lessThanOrEqualToSuperview().offset(-18)
} else {
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
}
}
infoFailLabel.snp.remakeConstraints { make in infoFailLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon) make.left.equalTo(dotIcon)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
...@@ -153,8 +130,9 @@ extension YHIncomeRecordFromCell { ...@@ -153,8 +130,9 @@ extension YHIncomeRecordFromCell {
} }
infoDetailLabel.snp.makeConstraints { make in infoDetailLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.greaterThanOrEqualToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16) make.bottom.lessThanOrEqualToSuperview().offset(-16)
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(147) make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18) make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
} }
......
...@@ -32,13 +32,45 @@ class YHGCIncomeRecordWorkExperienceViewController: YHBaseViewController { ...@@ -32,13 +32,45 @@ class YHGCIncomeRecordWorkExperienceViewController: YHBaseViewController {
private var isSaving = false private var isSaving = false
var submitSuccess: (() -> Void)? var submitSuccess: (() -> Void)?
// 校验字段
/// 是否选定公司
private var isCompanyOK = true
private var companyIndexPath: IndexPath?
/// 是否选定收入类型 /// 是否选定收入类型
private var isIncomeTypeOK = true private var isIncomeTypeOK = true
private var incomeTypeIndexPath: IndexPath? private var incomeTypeIndexPath: IndexPath?
/// 是否收入金额已填写 /// 是否收入金额已填写
private var isIncomeMoneyOK = true private var isIncomeMoneyOK = true
private var incomMoneyIndexPath: IndexPath? private var incomMoneyIndexPath: IndexPath?
/// 是否选定派薪国家
private var isCountryOK = true
private var countryIndexPath: IndexPath?
/// 是否选定派薪城市
private var isCityOK = true
private var cityIndexPath: IndexPath?
/// 是否选定职位
private var isPositionOK = true
private var positionIndexPath: IndexPath?
/// 是否选定入职年月
private var isEntryTimeOK = true
private var entryTimeIndexPath: IndexPath?
/// 是否选定离职年月
private var isEndTimeOK = true
private var endTimeIndexPath: IndexPath?
/// 是否选定工作证明
private var isWorkCertificateOK = true
private var workCertificateIndexPath: IndexPath?
/// 是否选定职业界别
private var isWorkTypeOK = true
private var workTypeIndexPath: IndexPath?
/// 是否选定具体职业界别
private var isFinalWorkTypeOK = true
private var finalWorkTypeIndexPath: IndexPath?
private lazy var viewModel = YHGCIncomeRecordWorkExperienceViewModel() private lazy var viewModel = YHGCIncomeRecordWorkExperienceViewModel()
private lazy var submitButton: UIButton = { private lazy var submitButton: UIButton = {
...@@ -367,7 +399,8 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -367,7 +399,8 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
} }
case let .incomeFrom(title, placeholder): case let .incomeFrom(title, placeholder):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeRecordFromCell.cellReuseIdentifier) as? YHIncomeRecordFromCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeRecordFromCell.cellReuseIdentifier) as? YHIncomeRecordFromCell {
cell.setupCellInfo(title: title, detail: viewModel.position.company_name, showBottomLine: true, showRightArrow: true, placeholder: placeholder) companyIndexPath = indexPath
cell.setupCellInfo(title: title, detail: viewModel.position.company_name, showBottomLine: true, showRightArrow: true, placeholder: placeholder, needShowFailButton: !isCompanyOK)
return cell return cell
} }
case let .incomeTypeSelect(title, detail, isSelectedOne): case let .incomeTypeSelect(title, detail, isSelectedOne):
...@@ -465,36 +498,55 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -465,36 +498,55 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
case let .infoSelect(title, placeholder): case let .infoSelect(title, placeholder):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeInfoSelectCell.cellReuseIdentifier) as? YHIncomeInfoSelectCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeInfoSelectCell.cellReuseIdentifier) as? YHIncomeInfoSelectCell {
var detail = "" var detail = ""
var needShowFailButton = false
var cellType: YHResignRoundCellType = .mid
switch title { switch title {
case "派薪国家/地区": case "派薪国家/地区":
countryIndexPath = indexPath
needShowFailButton = !isCountryOK
detail = viewModel.position.location.country detail = viewModel.position.location.country
case "派薪城市": case "派薪城市":
cityIndexPath = indexPath
needShowFailButton = !isCityOK
let city = viewModel.position.location.area.reduce("") { partialResult, item in let city = viewModel.position.location.area.reduce("") { partialResult, item in
partialResult.count > 0 ? partialResult + "/" + item : partialResult + item partialResult.count > 0 ? partialResult + "/" + item : partialResult + item
} }
detail = city detail = city
case "入职年月": case "入职年月":
entryTimeIndexPath = indexPath
needShowFailButton = !isEntryTimeOK
detail = viewModel.position.entry_time detail = viewModel.position.entry_time
case "职业界别": case "职业界别":
workTypeIndexPath = indexPath
needShowFailButton = !isWorkTypeOK
detail = viewModel.position.company_type detail = viewModel.position.company_type
if !detail.contains("其他") {
cellType = .bottom
}
default: default:
break break
} }
cell.setupCellInfo(title: title, detail: detail, placeholder: placeholder, needShowFailButton: false) cell.setupCellInfo(title: title, detail: detail, placeholder: placeholder, needShowFailButton: needShowFailButton, cellType: cellType)
return cell return cell
} }
case let .infoTillNowSelect(title, placeholder): case let .infoTillNowSelect(title, placeholder):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeDateTillNowCell.cellReuseIdentifier) as? YHIncomeDateTillNowCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeDateTillNowCell.cellReuseIdentifier) as? YHIncomeDateTillNowCell {
endTimeIndexPath = indexPath
let needShowFailButton = !isEndTimeOK
let detail = viewModel.position.departure_time let detail = viewModel.position.departure_time
cell.setupCellInfo(title: title, detail: detail, placeholder: placeholder, needShowFailButton: false) cell.setupCellInfo(title: title, detail: detail, placeholder: placeholder, needShowFailButton: needShowFailButton)
cell.tillNowButtonEvent = { [weak self] tillNow in cell.tillNowButtonEvent = { [weak self] tillNow in
guard let self = self else { guard let self = self else {
return return
} }
if tillNow { if tillNow {
self.viewModel.position.departure_time = "至今" self.viewModel.position.departure_time = "至今"
self.isEndTimeOK = true
self.tableView.reloadRows(at: [indexPath], with: .automatic)
} else { } else {
self.viewModel.position.departure_time = "" self.viewModel.position.departure_time = ""
self.isEndTimeOK = false
self.tableView.reloadRows(at: [indexPath], with: .automatic)
} }
} }
return cell return cell
...@@ -502,17 +554,26 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -502,17 +554,26 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
case let .infoEdit(title, placeholder): case let .infoEdit(title, placeholder):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeInfoEditCell.cellReuseIdentifier) as? YHIncomeInfoEditCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeInfoEditCell.cellReuseIdentifier) as? YHIncomeInfoEditCell {
var detail = "" var detail = ""
var needShowFailButton = false
var cellType: YHResignRoundCellType = .mid
switch title { switch title {
case "派薪城市": case "派薪城市":
cityIndexPath = indexPath
needShowFailButton = !isCityOK
detail = viewModel.position.location.foreign detail = viewModel.position.location.foreign
case "职位": case "职位":
positionIndexPath = indexPath
needShowFailButton = !isPositionOK
detail = viewModel.position.position detail = viewModel.position.position
case "具体职业界别": case "具体职业界别":
finalWorkTypeIndexPath = indexPath
needShowFailButton = !isFinalWorkTypeOK
detail = viewModel.position.company_type_other detail = viewModel.position.company_type_other
cellType = .bottom
default: default:
break break
} }
cell.setupCellInfo(title: title, detail: detail, placeholder: placeholder, needShowFailButton: false) cell.setupCellInfo(title: title, detail: detail, placeholder: placeholder, needShowFailButton: needShowFailButton, cellType: cellType)
cell.didEndEditing = { [weak self] textField in cell.didEndEditing = { [weak self] textField in
guard let self = self else { guard let self = self else {
return return
...@@ -521,19 +582,24 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -521,19 +582,24 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
case "派薪城市": case "派薪城市":
self.viewModel.position.location.area = [] self.viewModel.position.location.area = []
self.viewModel.position.location.foreign = textField.text ?? "" self.viewModel.position.location.foreign = textField.text ?? ""
self.isCityOK = (textField.text?.count ?? 0) > 0
case "职位": case "职位":
self.viewModel.position.position = textField.text ?? "" self.viewModel.position.position = textField.text ?? ""
self.isPositionOK = (textField.text?.count ?? 0) > 0
case "具体职业界别": case "具体职业界别":
self.viewModel.position.company_type_other = textField.text ?? "" self.viewModel.position.company_type_other = textField.text ?? ""
self.isFinalWorkTypeOK = (textField.text?.count ?? 0) > 0
default: default:
break break
} }
self.tableView.reloadRows(at: [indexPath], with: .automatic)
} }
return cell return cell
} }
case let .infoCheckbox(title): case let .infoCheckbox(title):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHInfoQuestionSelectionCell.cellReuseIdentifier) as? YHInfoQuestionSelectionCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHInfoQuestionSelectionCell.cellReuseIdentifier) as? YHInfoQuestionSelectionCell {
cell.setupCellInfo(question: title, showBottomLine: true, needShowFailButton: false) workCertificateIndexPath = indexPath
cell.setupCellInfo(question: title, showBottomLine: true, needShowFailButton: !isWorkCertificateOK)
cell.didSelectSureButton = { [weak self] selected in cell.didSelectSureButton = { [weak self] selected in
guard let self = self else { guard let self = self else {
return return
...@@ -541,11 +607,15 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -541,11 +607,15 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
switch selected { switch selected {
case .true: case .true:
self.viewModel.position.has_work_certificate = YHCheckboxSelectType.true.rawValue self.viewModel.position.has_work_certificate = YHCheckboxSelectType.true.rawValue
self.isWorkCertificateOK = true
case .false: case .false:
self.viewModel.position.has_work_certificate = YHCheckboxSelectType.false.rawValue self.viewModel.position.has_work_certificate = YHCheckboxSelectType.false.rawValue
self.isWorkCertificateOK = true
case .unknown: case .unknown:
self.viewModel.position.has_work_certificate = YHCheckboxSelectType.unknown.rawValue self.viewModel.position.has_work_certificate = YHCheckboxSelectType.unknown.rawValue
self.isWorkCertificateOK = false
} }
self.tableView.reloadRows(at: [indexPath], with: .automatic)
} }
let selectType = YHCheckboxSelectType(rawValue: viewModel.position.has_work_certificate) ?? .unknown let selectType = YHCheckboxSelectType(rawValue: viewModel.position.has_work_certificate) ?? .unknown
switch selectType { switch selectType {
...@@ -595,6 +665,8 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -595,6 +665,8 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
} }
self.viewModel.position.company_name = company.company_name ?? "" self.viewModel.position.company_name = company.company_name ?? ""
self.tableView.reloadRows(at: [indexPath], with: .automatic) self.tableView.reloadRows(at: [indexPath], with: .automatic)
self.isCompanyOK = (company.company_name?.count ?? 0) > 0
self.tableView.reloadRows(at: [indexPath], with: .automatic)
} }
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
} else if case let .infoSelect(title, _) = tableRow { } else if case let .infoSelect(title, _) = tableRow {
...@@ -608,6 +680,7 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -608,6 +680,7 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
let oldContry = self.viewModel.position.location.country let oldContry = self.viewModel.position.location.country
self.viewModel.position.location.country = country self.viewModel.position.location.country = country
self.viewModel.position.location_aboard = country.contains("中国") ? 0 : 1 self.viewModel.position.location_aboard = country.contains("中国") ? 0 : 1
self.isCountryOK = country.count > 0
if country != oldContry { if country != oldContry {
self.viewModel.position.location.area = [] self.viewModel.position.location.area = []
self.viewModel.position.location.foreign = "" self.viewModel.position.location.foreign = ""
...@@ -636,6 +709,7 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -636,6 +709,7 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
} }
self.viewModel.position.location.area = [province, city] self.viewModel.position.location.area = [province, city]
self.viewModel.position.location.foreign = "" self.viewModel.position.location.foreign = ""
self.isCityOK = true
self.tableView.reloadRows(at: [indexPath], with: .automatic) self.tableView.reloadRows(at: [indexPath], with: .automatic)
} }
present(addressPicker, animated: true, completion: nil) present(addressPicker, animated: true, completion: nil)
...@@ -657,12 +731,15 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -657,12 +731,15 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
guard let endDate = format.date(from: self.viewModel.position.departure_time) else { guard let endDate = format.date(from: self.viewModel.position.departure_time) else {
self.viewModel.position.entry_time = date self.viewModel.position.entry_time = date
self.tableView.reloadRows(at: [indexPath], with: .automatic) self.tableView.reloadRows(at: [indexPath], with: .automatic)
self.isEntryTimeOK = true
self.tableView.reloadRows(at: [indexPath], with: .automatic)
return return
} }
let endTimeInterval = endDate.timeIntervalSince1970 let endTimeInterval = endDate.timeIntervalSince1970
if selectTimeInterval > endTimeInterval { if selectTimeInterval > endTimeInterval {
YHHUD.flash(message: "入职年月不能晚于离职年月") YHHUD.flash(message: "入职年月不能晚于离职年月")
} else { } else {
self.isEntryTimeOK = true
self.viewModel.position.entry_time = date self.viewModel.position.entry_time = date
self.tableView.reloadRows(at: [indexPath], with: .automatic) self.tableView.reloadRows(at: [indexPath], with: .automatic)
} }
...@@ -674,6 +751,8 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -674,6 +751,8 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
guard let self = self else { return } guard let self = self else { return }
let companyType = self.viewModel.position.company_type let companyType = self.viewModel.position.company_type
self.viewModel.position.company_type = data.title self.viewModel.position.company_type = data.title
self.isWorkTypeOK = true
if (data.title == "其他" || companyType == "其他") && companyType != data.title { if (data.title == "其他" || companyType == "其他") && companyType != data.title {
self.getEnterpriseInfo(needUpdateDataSource: true) self.getEnterpriseInfo(needUpdateDataSource: true)
} else { } else {
...@@ -698,10 +777,12 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT ...@@ -698,10 +777,12 @@ extension YHGCIncomeRecordWorkExperienceViewController: UITableViewDelegate, UIT
if selectTimeInterval < startTimeInterval { if selectTimeInterval < startTimeInterval {
YHHUD.flash(message: "离职年月不能早于入职年月") YHHUD.flash(message: "离职年月不能早于入职年月")
} else { } else {
self.isEndTimeOK = true
self.viewModel.position.departure_time = date self.viewModel.position.departure_time = date
self.tableView.reloadRows(at: [indexPath], with: .automatic) self.tableView.reloadRows(at: [indexPath], with: .automatic)
} }
} else { } else {
self.isEndTimeOK = true
self.viewModel.position.departure_time = date self.viewModel.position.departure_time = date
self.tableView.reloadRows(at: [indexPath], with: .automatic) self.tableView.reloadRows(at: [indexPath], with: .automatic)
} }
...@@ -716,6 +797,14 @@ extension YHGCIncomeRecordWorkExperienceViewController { ...@@ -716,6 +797,14 @@ extension YHGCIncomeRecordWorkExperienceViewController {
var retValue = true var retValue = true
var updateRows: [IndexPath] = [] var updateRows: [IndexPath] = []
if viewModel.position.company_name.count == 0 {
isCompanyOK = false
if let companyIndexPath = companyIndexPath, tableView.numberOfSections > companyIndexPath.section, tableView.numberOfRows(inSection: companyIndexPath.section) > companyIndexPath.row {
updateRows.append(companyIndexPath)
}
retValue = false
}
if viewModel.position.type_of_income.count == 0 { if viewModel.position.type_of_income.count == 0 {
isIncomeTypeOK = false isIncomeTypeOK = false
if let incomeTypeIndexPath = incomeTypeIndexPath, tableView.numberOfSections > incomeTypeIndexPath.section, tableView.numberOfRows(inSection: incomeTypeIndexPath.section) > incomeTypeIndexPath.row { if let incomeTypeIndexPath = incomeTypeIndexPath, tableView.numberOfSections > incomeTypeIndexPath.section, tableView.numberOfRows(inSection: incomeTypeIndexPath.section) > incomeTypeIndexPath.row {
...@@ -730,10 +819,92 @@ extension YHGCIncomeRecordWorkExperienceViewController { ...@@ -730,10 +819,92 @@ extension YHGCIncomeRecordWorkExperienceViewController {
} }
retValue = false retValue = false
} }
if viewModel.position.location.country.count == 0 {
isCountryOK = false
if let countryIndexPath = countryIndexPath, tableView.numberOfSections > countryIndexPath.section, tableView.numberOfRows(inSection: countryIndexPath.section) > countryIndexPath.row {
updateRows.append(countryIndexPath)
}
retValue = false
}
if viewModel.position.location.country.contains("中国") {
if viewModel.position.location.area.count == 0 {
isCityOK = false
if let cityIndexPath = cityIndexPath, tableView.numberOfSections > cityIndexPath.section, tableView.numberOfRows(inSection: cityIndexPath.section) > cityIndexPath.row {
updateRows.append(cityIndexPath)
}
retValue = false
}
} else {
if viewModel.position.location.foreign.count == 0 {
isCityOK = false
if let cityIndexPath = cityIndexPath, tableView.numberOfSections > cityIndexPath.section, tableView.numberOfRows(inSection: cityIndexPath.section) > cityIndexPath.row {
updateRows.append(cityIndexPath)
}
retValue = false
}
}
if viewModel.position.position.count == 0 {
isPositionOK = false
if let positionIndexPath = positionIndexPath, tableView.numberOfSections > positionIndexPath.section, tableView.numberOfRows(inSection: positionIndexPath.section) > positionIndexPath.row {
updateRows.append(positionIndexPath)
}
retValue = false
}
if viewModel.position.entry_time.count == 0 {
isEntryTimeOK = false
if let entryTimeIndexPath = entryTimeIndexPath, tableView.numberOfSections > entryTimeIndexPath.section, tableView.numberOfRows(inSection: entryTimeIndexPath.section) > entryTimeIndexPath.row {
updateRows.append(entryTimeIndexPath)
}
retValue = false
}
if viewModel.position.departure_time.count == 0 {
isEndTimeOK = false
if let endTimeIndexPath = endTimeIndexPath, tableView.numberOfSections > endTimeIndexPath.section, tableView.numberOfRows(inSection: endTimeIndexPath.section) > endTimeIndexPath.row {
updateRows.append(endTimeIndexPath)
}
retValue = false
}
if viewModel.position.has_work_certificate == YHCheckboxSelectType.unknown.rawValue {
isWorkCertificateOK = false
if let workCertificateIndexPath = workCertificateIndexPath, tableView.numberOfSections > workCertificateIndexPath.section, tableView.numberOfRows(inSection: workCertificateIndexPath.section) > workCertificateIndexPath.row {
updateRows.append(workCertificateIndexPath)
}
retValue = false
}
if viewModel.position.company_type.count == 0 {
isWorkTypeOK = false
if let workTypeIndexPath = workTypeIndexPath, tableView.numberOfSections > workTypeIndexPath.section, tableView.numberOfRows(inSection: workTypeIndexPath.section) > workTypeIndexPath.row {
updateRows.append(workTypeIndexPath)
}
retValue = false
}
if viewModel.position.company_type.contains("其他"), viewModel.position.company_type_other.count == 0 {
isFinalWorkTypeOK = false
if let finalWorkTypeIndexPath = finalWorkTypeIndexPath, tableView.numberOfSections > finalWorkTypeIndexPath.section, tableView.numberOfRows(inSection: finalWorkTypeIndexPath.section) > finalWorkTypeIndexPath.row {
updateRows.append(finalWorkTypeIndexPath)
}
retValue = false
}
if updateRows.count > 0 { if updateRows.count > 0 {
tableView.reloadRows(at: updateRows, with: .none) tableView.reloadRows(at: updateRows, with: .none)
isIncomeTypeOK = true // isCompanyOK = true
isIncomeMoneyOK = true // isIncomeTypeOK = true
// isIncomeMoneyOK = true
// isCountryOK = true
// isCityOK = true
// isPositionOK = true
// isEntryTimeOK = true
// isEndTimeOK = true
// isWorkCertificateOK = true
// isWorkTypeOK = true
// isFinalWorkTypeOK = true
} }
return retValue return retValue
} }
......
...@@ -93,25 +93,16 @@ extension YHIncomeDateTillNowCell { ...@@ -93,25 +93,16 @@ extension YHIncomeDateTillNowCell {
private func updateFailLabel(_ needShowFailButton: Bool) { private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton { if needShowFailButton {
infoFailLabel.isHidden = false infoFailLabel.isHidden = false
infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(tillNowButton.snp.left).offset(-18)
}
infoFailLabel.snp.remakeConstraints { make in infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(infoDetailLabel.snp.bottom).offset(6) make.top.equalTo(infoTitleLabel.snp.bottom).offset(6)
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
} else { } else {
infoFailLabel.isHidden = true infoFailLabel.isHidden = true
infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16)
make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(tillNowButton.snp.left).offset(-18)
}
infoFailLabel.snp.remakeConstraints { make in infoFailLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
...@@ -137,8 +128,9 @@ extension YHIncomeDateTillNowCell { ...@@ -137,8 +128,9 @@ extension YHIncomeDateTillNowCell {
} }
infoDetailLabel.snp.remakeConstraints { make in infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.greaterThanOrEqualToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16) make.bottom.lessThanOrEqualToSuperview().offset(-16)
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(147) make.left.equalToSuperview().offset(147)
} }
...@@ -152,8 +144,9 @@ extension YHIncomeDateTillNowCell { ...@@ -152,8 +144,9 @@ extension YHIncomeDateTillNowCell {
make.height.equalTo(30) make.height.equalTo(30)
} }
infoDetailLabel.snp.remakeConstraints { make in infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.greaterThanOrEqualToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16) make.bottom.lessThanOrEqualToSuperview().offset(-16)
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(147) make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(tillNowButton.snp.left).offset(-18) make.right.lessThanOrEqualTo(tillNowButton.snp.left).offset(-18)
} }
...@@ -213,8 +206,9 @@ extension YHIncomeDateTillNowCell { ...@@ -213,8 +206,9 @@ extension YHIncomeDateTillNowCell {
} }
infoDetailLabel.snp.makeConstraints { make in infoDetailLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.greaterThanOrEqualToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16) make.bottom.lessThanOrEqualToSuperview().offset(-16)
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(147) make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(tillNowButton.snp.left).offset(-18) make.right.lessThanOrEqualTo(tillNowButton.snp.left).offset(-18)
} }
......
...@@ -24,7 +24,6 @@ class YHIncomeInfoEditCell: YHResignDocumentCell { ...@@ -24,7 +24,6 @@ class YHIncomeInfoEditCell: YHResignDocumentCell {
let label = UILabel() let label = UILabel()
label.font = .PFSC_R(ofSize: 14) label.font = .PFSC_R(ofSize: 14)
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.text = "收入来源公司"
return label return label
}() }()
...@@ -61,7 +60,7 @@ class YHIncomeInfoEditCell: YHResignDocumentCell { ...@@ -61,7 +60,7 @@ class YHIncomeInfoEditCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, detail: String?, placeholder: String = "请输入", showBottomLine: Bool = true, needShowFailButton: Bool) { func setupCellInfo(title: String, detail: String?, placeholder: String = "请输入", showBottomLine: Bool = true, needShowFailButton: Bool, cellType: YHResignRoundCellType = .mid) {
infoTitleLabel.text = title infoTitleLabel.text = title
inputTextField.text = detail inputTextField.text = detail
inputTextField.attributedPlaceholder = NSAttributedString( inputTextField.attributedPlaceholder = NSAttributedString(
...@@ -73,6 +72,7 @@ class YHIncomeInfoEditCell: YHResignDocumentCell { ...@@ -73,6 +72,7 @@ class YHIncomeInfoEditCell: YHResignDocumentCell {
) )
bottomLineView.isHidden = !showBottomLine bottomLineView.isHidden = !showBottomLine
updateFailLabel(needShowFailButton) updateFailLabel(needShowFailButton)
updateCellCorner(cellType)
} }
} }
...@@ -80,25 +80,16 @@ extension YHIncomeInfoEditCell { ...@@ -80,25 +80,16 @@ extension YHIncomeInfoEditCell {
private func updateFailLabel(_ needShowFailButton: Bool) { private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton { if needShowFailButton {
infoFailLabel.isHidden = false infoFailLabel.isHidden = false
inputTextField.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualToSuperview().offset(-18)
}
infoFailLabel.snp.remakeConstraints { make in infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(inputTextField.snp.bottom).offset(6) make.top.equalTo(infoTitleLabel.snp.bottom).offset(6)
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
} else { } else {
infoFailLabel.isHidden = true infoFailLabel.isHidden = true
inputTextField.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16)
make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualToSuperview().offset(-18)
}
infoFailLabel.snp.remakeConstraints { make in infoFailLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
...@@ -126,14 +117,17 @@ extension YHIncomeInfoEditCell { ...@@ -126,14 +117,17 @@ extension YHIncomeInfoEditCell {
} }
infoTitleLabel.snp.makeConstraints { make in infoTitleLabel.snp.makeConstraints { make in
make.top.greaterThanOrEqualToSuperview().offset(16)
make.bottom.lessThanOrEqualToSuperview().offset(-16)
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
make.left.equalTo(dotIcon.snp.right).offset(2) make.left.equalTo(dotIcon.snp.right).offset(2)
} }
inputTextField.snp.makeConstraints { make in inputTextField.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.greaterThanOrEqualToSuperview()
make.bottom.equalToSuperview().offset(-16) make.bottom.lessThanOrEqualToSuperview()
make.left.equalToSuperview().offset(147) make.left.equalToSuperview().offset(147)
make.centerY.equalToSuperview()
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
} }
......
...@@ -63,12 +63,13 @@ class YHIncomeInfoSelectCell: YHResignDocumentCell { ...@@ -63,12 +63,13 @@ class YHIncomeInfoSelectCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, detail: String?, placeholder: String = "请选择", showBottomLine: Bool = true, needShowFailButton: Bool) { func setupCellInfo(title: String, detail: String?, placeholder: String = "请选择", showBottomLine: Bool = true, needShowFailButton: Bool, cellType: YHResignRoundCellType = .mid) {
infoTitleLabel.text = title infoTitleLabel.text = title
updateContentState(detail: detail, placeholder: placeholder) updateContentState(detail: detail, placeholder: placeholder)
bottomLineView.isHidden = !showBottomLine bottomLineView.isHidden = !showBottomLine
infoFailLabel.text = placeholder infoFailLabel.text = placeholder
updateFailLabel(needShowFailButton) updateFailLabel(needShowFailButton)
updateCellCorner(cellType)
} }
} }
...@@ -76,25 +77,16 @@ extension YHIncomeInfoSelectCell { ...@@ -76,25 +77,16 @@ extension YHIncomeInfoSelectCell {
private func updateFailLabel(_ needShowFailButton: Bool) { private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton { if needShowFailButton {
infoFailLabel.isHidden = false infoFailLabel.isHidden = false
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 infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(infoDetailLabel.snp.bottom).offset(6) make.top.equalTo(infoTitleLabel.snp.bottom).offset(6)
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
} else { } else {
infoFailLabel.isHidden = true infoFailLabel.isHidden = true
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 infoFailLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
...@@ -148,8 +140,9 @@ extension YHIncomeInfoSelectCell { ...@@ -148,8 +140,9 @@ extension YHIncomeInfoSelectCell {
} }
infoDetailLabel.snp.makeConstraints { make in infoDetailLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.greaterThanOrEqualToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16) make.bottom.lessThanOrEqualToSuperview().offset(-16)
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(147) make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18) make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
} }
......
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