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

工作经验公司基本情况接口及逻辑

parent 22c42aa0
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
040AE9842CE893CC00310241 /* YHWorkExperiencePositionItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9832CE893CC00310241 /* YHWorkExperiencePositionItemView.swift */; }; 040AE9842CE893CC00310241 /* YHWorkExperiencePositionItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9832CE893CC00310241 /* YHWorkExperiencePositionItemView.swift */; };
040AE9862CEB09ED00310241 /* YHWorkExperienceCompanySelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9852CEB09ED00310241 /* YHWorkExperienceCompanySelectView.swift */; }; 040AE9862CEB09ED00310241 /* YHWorkExperienceCompanySelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9852CEB09ED00310241 /* YHWorkExperienceCompanySelectView.swift */; };
040AE9882CEB6DAC00310241 /* YHWorkExperiencePositionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9872CEB6DAC00310241 /* YHWorkExperiencePositionModel.swift */; }; 040AE9882CEB6DAC00310241 /* YHWorkExperiencePositionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9872CEB6DAC00310241 /* YHWorkExperiencePositionModel.swift */; };
040AE98A2CEC83FA00310241 /* YHWorkExperienceCompanyViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE9892CEC83FA00310241 /* YHWorkExperienceCompanyViewModel.swift */; };
040AE98C2CEC84B400310241 /* YHWorkExperienceCompanyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040AE98B2CEC84B400310241 /* YHWorkExperienceCompanyModel.swift */; };
04129E862CD0C8490072F87B /* YHAliYunLogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */; }; 04129E862CD0C8490072F87B /* YHAliYunLogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */; };
041390692C1081FA0098CB8A /* YHFileListEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */; }; 041390692C1081FA0098CB8A /* YHFileListEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */; };
0414708B2C88627B00B7B688 /* YHButlerServiceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */; }; 0414708B2C88627B00B7B688 /* YHButlerServiceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */; };
...@@ -1046,6 +1048,8 @@ ...@@ -1046,6 +1048,8 @@
040AE9832CE893CC00310241 /* YHWorkExperiencePositionItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperiencePositionItemView.swift; sourceTree = "<group>"; }; 040AE9832CE893CC00310241 /* YHWorkExperiencePositionItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperiencePositionItemView.swift; sourceTree = "<group>"; };
040AE9852CEB09ED00310241 /* YHWorkExperienceCompanySelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperienceCompanySelectView.swift; sourceTree = "<group>"; }; 040AE9852CEB09ED00310241 /* YHWorkExperienceCompanySelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperienceCompanySelectView.swift; sourceTree = "<group>"; };
040AE9872CEB6DAC00310241 /* YHWorkExperiencePositionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperiencePositionModel.swift; sourceTree = "<group>"; }; 040AE9872CEB6DAC00310241 /* YHWorkExperiencePositionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperiencePositionModel.swift; sourceTree = "<group>"; };
040AE9892CEC83FA00310241 /* YHWorkExperienceCompanyViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperienceCompanyViewModel.swift; sourceTree = "<group>"; };
040AE98B2CEC84B400310241 /* YHWorkExperienceCompanyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExperienceCompanyModel.swift; sourceTree = "<group>"; };
04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAliYunLogManager.swift; sourceTree = "<group>"; }; 04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAliYunLogManager.swift; sourceTree = "<group>"; };
041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListEmptyView.swift; sourceTree = "<group>"; }; 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListEmptyView.swift; sourceTree = "<group>"; };
0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceManager.swift; sourceTree = "<group>"; }; 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceManager.swift; sourceTree = "<group>"; };
...@@ -2927,6 +2931,7 @@ ...@@ -2927,6 +2931,7 @@
045EEDC22B9F171A0022A143 /* YHCompanyViewModel.swift */, 045EEDC22B9F171A0022A143 /* YHCompanyViewModel.swift */,
045EEDC32B9F171A0022A143 /* YHWorkItemListViewModel.swift */, 045EEDC32B9F171A0022A143 /* YHWorkItemListViewModel.swift */,
040AE97B2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift */, 040AE97B2CE7410100310241 /* YHWorkExperiencePositionViewModel.swift */,
040AE9892CEC83FA00310241 /* YHWorkExperienceCompanyViewModel.swift */,
); );
path = ViewModel; path = ViewModel;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2941,6 +2946,7 @@ ...@@ -2941,6 +2946,7 @@
045EEDC92B9F171A0022A143 /* YHWorkExperienceProjectModel.swift */, 045EEDC92B9F171A0022A143 /* YHWorkExperienceProjectModel.swift */,
045EEDCA2B9F171A0022A143 /* YHCompanyModel.swift */, 045EEDCA2B9F171A0022A143 /* YHCompanyModel.swift */,
040AE9872CEB6DAC00310241 /* YHWorkExperiencePositionModel.swift */, 040AE9872CEB6DAC00310241 /* YHWorkExperiencePositionModel.swift */,
040AE98B2CEC84B400310241 /* YHWorkExperienceCompanyModel.swift */,
); );
path = Model; path = Model;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -5959,6 +5965,7 @@ ...@@ -5959,6 +5965,7 @@
044D0BF42C21247100C5CF5E /* YHUserInfoSettingViewController.swift in Sources */, 044D0BF42C21247100C5CF5E /* YHUserInfoSettingViewController.swift in Sources */,
040AE9862CEB09ED00310241 /* YHWorkExperienceCompanySelectView.swift in Sources */, 040AE9862CEB09ED00310241 /* YHWorkExperienceCompanySelectView.swift in Sources */,
A567E5942BD7643D00D5D5A0 /* YHHomeListModel.swift in Sources */, A567E5942BD7643D00D5D5A0 /* YHHomeListModel.swift in Sources */,
040AE98A2CEC83FA00310241 /* YHWorkExperienceCompanyViewModel.swift in Sources */,
047F3DDB2CE6DE91001B2A6D /* YHEducationMarkView.swift in Sources */, 047F3DDB2CE6DE91001B2A6D /* YHEducationMarkView.swift in Sources */,
04CE1AD82C2AD91F001CB80A /* YHActivityListViewController.swift in Sources */, 04CE1AD82C2AD91F001CB80A /* YHActivityListViewController.swift in Sources */,
A5ACE94E2B4564F7002C94D2 /* AlignedCollectionViewFlowLayout.swift in Sources */, A5ACE94E2B4564F7002C94D2 /* AlignedCollectionViewFlowLayout.swift in Sources */,
...@@ -6028,6 +6035,7 @@ ...@@ -6028,6 +6035,7 @@
045EEF032B9F171A0022A143 /* YHFormItemDoubleChoiceCell.swift in Sources */, 045EEF032B9F171A0022A143 /* YHFormItemDoubleChoiceCell.swift in Sources */,
044F39482CB80626007CA277 /* YHVisaRenewalTipsCell.swift in Sources */, 044F39482CB80626007CA277 /* YHVisaRenewalTipsCell.swift in Sources */,
0430E6842C76D702000511E2 /* YHAddpterViewModel.swift in Sources */, 0430E6842C76D702000511E2 /* YHAddpterViewModel.swift in Sources */,
040AE98C2CEC84B400310241 /* YHWorkExperienceCompanyModel.swift in Sources */,
045EEEAE2B9F171A0022A143 /* YHWorkHighlightsTableViewCell.swift in Sources */, 045EEEAE2B9F171A0022A143 /* YHWorkHighlightsTableViewCell.swift in Sources */,
A567E59A2BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift in Sources */, A567E59A2BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift in Sources */,
045EEF062B9F171A0022A143 /* YHFormItemQuestionsCell.swift in Sources */, 045EEF062B9F171A0022A143 /* YHFormItemQuestionsCell.swift in Sources */,
......
...@@ -686,6 +686,8 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -686,6 +686,8 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} else { } else {
if indexPath.row == 0 { if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceTableViewCell.self)
cell.orderId = orderID
cell.workId = workExperienceID?.intValue() ?? 0
cell.selectDataSource = getTipsWithType() cell.selectDataSource = getTipsWithType()
cell.selectItem = getSelectCompany() cell.selectItem = getSelectCompany()
cell.dataSource = baseDataSource?[indexPath.row] cell.dataSource = baseDataSource?[indexPath.row]
......
//
// YHWorkExperienceCompanyModel.swift
// galaxy
//
// Created by EDY on 2024/11/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHWorkExperienceCompanyModel: SmartCodable {
var order_id: Int = 0
var work_id: Int = 0
var is_ipo_company: Int = 0
var has_company_equity: Int = 0
var has_sales_reached: Int = 0
var has_ipo_company_equity: Int = 0
var has_ipo_sales_reached: Int = 0
var company_location: String = ""
var has_provide_certificate: Int = 0
required init() {
}
}
...@@ -10,19 +10,21 @@ import UIKit ...@@ -10,19 +10,21 @@ import UIKit
import AttributedString import AttributedString
class YHWorkExperienceCompanySelectView: UIView { class YHWorkExperienceCompanySelectView: UIView {
var backDate: (([YHWorkExperienceFileModel]) -> Void)? private var selectBlock:(()->Void)? //回调
var centerView: UIView! var centerView: UIView!
var titleLabel: UILabel! var titleLabel: UILabel!
var closeButton: UIButton! var closeButton: UIButton!
var sureButton: UIButton! var sureButton: UIButton!
var tableView: UITableView! var tableView: UITableView!
var dataSource: [YHWorkExperienceFileModel] = [] var viewModel = YHWorkExperienceCompanyViewModel()
var viewModel = YHWorkExperienceViewModel() var orderId: Int = 0
var title: String = "" { var workId: Int = 0 {
didSet { didSet {
titleLabel.text = title getData()
} }
} }
var model: YHWorkExperienceCompanyModel = YHWorkExperienceCompanyModel()
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
...@@ -33,6 +35,14 @@ class YHWorkExperienceCompanySelectView: UIView { ...@@ -33,6 +35,14 @@ class YHWorkExperienceCompanySelectView: UIView {
setView() setView()
} }
func getData() {
viewModel.requestWorkQuestionDetail(workId, orderId) {[weak self] success, error in
guard let self = self else { return }
self.model = viewModel.model
self.tableView.reloadData()
}
}
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
...@@ -52,7 +62,7 @@ class YHWorkExperienceCompanySelectView: UIView { ...@@ -52,7 +62,7 @@ class YHWorkExperienceCompanySelectView: UIView {
titleLabel = { titleLabel = {
let label = UILabel() let label = UILabel()
label.text = title label.text = "公司基本情况"
label.font = UIFont.PFSC_M(ofSize: 17) label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.textAlignment = .center label.textAlignment = .center
...@@ -131,9 +141,11 @@ class YHWorkExperienceCompanySelectView: UIView { ...@@ -131,9 +141,11 @@ class YHWorkExperienceCompanySelectView: UIView {
dismiss() dismiss()
} }
static func show(callBack: @escaping (([YHWorkExperienceFileModel]) -> Void)) { static func show(workId: Int, orderId: Int, callBack: @escaping (()->Void)) {
let view = YHWorkExperienceCompanySelectView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight)) let view = YHWorkExperienceCompanySelectView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.backDate = callBack view.orderId = orderId
view.workId = workId
view.selectBlock = callBack
let window = UIApplication.shared.yhKeyWindow() let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view) window?.addSubview(view)
} }
...@@ -143,10 +155,43 @@ class YHWorkExperienceCompanySelectView: UIView { ...@@ -143,10 +155,43 @@ class YHWorkExperienceCompanySelectView: UIView {
} }
@objc func sure() { @objc func sure() {
if let block = backDate { if canNext() {
// block(array) model.order_id = orderId
model.work_id = workId
viewModel.saveWorkQuestion(model: model) {[weak self] success, error in
guard let self = self else { return }
self.selectBlock?()
dismiss()
}
} else {
YHHUD.flash(message: "请完善公司基本情况")
} }
dismiss() }
func canNext() -> Bool {
guard model.is_ipo_company != 0 else { return false}
if model.is_ipo_company == 1 {
guard model.has_ipo_company_equity != 0 else { return false }
if model.has_ipo_company_equity == 1 {
guard model.has_ipo_sales_reached != 0 else { return false }
if model.has_ipo_sales_reached == 1 {
guard model.company_location != "" else { return false }
guard model.has_provide_certificate != 0 else { return false }
} else {
guard model.has_provide_certificate != 0 else { return false }
}
}
} else {
guard model.has_company_equity != 0 else { return false }
if model.has_company_equity == 1 {
guard model.has_sales_reached != 0 else { return false }
if model.has_sales_reached == 1 {
guard model.company_location != "" else { return false }
guard model.has_provide_certificate != 0 else { return false }
}
}
}
return true
} }
} }
...@@ -161,7 +206,10 @@ extension YHWorkExperienceCompanySelectView: UIGestureRecognizerDelegate { ...@@ -161,7 +206,10 @@ extension YHWorkExperienceCompanySelectView: UIGestureRecognizerDelegate {
extension YHWorkExperienceCompanySelectView: UITableViewDelegate, UITableViewDataSource { extension YHWorkExperienceCompanySelectView: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
return 2 if model.company_location.count != 0 || (model.is_ipo_company == 1 && model.has_ipo_company_equity == 1 && model.has_ipo_sales_reached == 2 ) {
return 2
}
return 1
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
...@@ -171,11 +219,21 @@ extension YHWorkExperienceCompanySelectView: UITableViewDelegate, UITableViewDat ...@@ -171,11 +219,21 @@ extension YHWorkExperienceCompanySelectView: UITableViewDelegate, UITableViewDat
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 1 { if indexPath.section == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHCompanyReasonFileCell.self) let cell = tableView.dequeueReusableCell(withClass: YHCompanyReasonFileCell.self)
cell.selectData = [] cell.model = model
cell.selectBlock = { [weak self] model in
guard let self = self else { return }
self.model = model
self.tableView.reloadData()
}
return cell return cell
} }
let cell = tableView.dequeueReusableCell(withClass: YHCompanySelectFileCell.self) let cell = tableView.dequeueReusableCell(withClass: YHCompanySelectFileCell.self)
cell.selectData = [] cell.model = model
cell.selectBlock = { [weak self] model in
guard let self = self else { return }
self.model = model
self.tableView.reloadData()
}
return cell return cell
} }
...@@ -203,14 +261,26 @@ extension YHWorkExperienceCompanySelectView: UITableViewDelegate, UITableViewDat ...@@ -203,14 +261,26 @@ extension YHWorkExperienceCompanySelectView: UITableViewDelegate, UITableViewDat
class YHCompanySelectFileCell: UITableViewCell { class YHCompanySelectFileCell: UITableViewCell {
typealias SelectBlock = (_ selectIndex: [Int]) -> () typealias SelectBlock = (_ select: YHWorkExperienceCompanyModel) -> ()
var selectBlock: SelectBlock? var selectBlock: SelectBlock?
var selectItem: [Int] = [] var selectItem: [Int] = []
var centerView: UIView! var centerView: UIView!
var titleLabel: UILabel! var titleLabel: UILabel!
var subTitleLabel: UILabel! var subTitleLabel: UILabel!
var mainItemView: UIView! var mainItemView: UIView!
var model: YHWorkExperienceCompanyModel = YHWorkExperienceCompanyModel() {
didSet {
var i = 0
for item in dataSource {
if item == model.company_location {
selectData = [i]
return
}
i += 1
}
selectData = []
}
}
var dataSource: [String] = ["内地", "香港", "澳门", "境外"] var dataSource: [String] = ["内地", "香港", "澳门", "境外"]
var selectData: [Int]? { var selectData: [Int]? {
didSet { didSet {
...@@ -270,18 +340,6 @@ class YHCompanySelectFileCell: UITableViewCell { ...@@ -270,18 +340,6 @@ class YHCompanySelectFileCell: UITableViewCell {
make.right.equalTo(-18) make.right.equalTo(-18)
} }
// lineView = {
// let label = UIView()
// label.backgroundColor = UIColor.separatorColor
// return label
// }()
// centerView.addSubview(lineView)
// lineView.snp.makeConstraints { make in
// make.height.equalTo(1)
// make.top.equalTo(52)
// make.left.right.equalToSuperview()
// }
//
mainItemView = { mainItemView = {
let view = UIView() let view = UIView()
view.backgroundColor = .white view.backgroundColor = .white
...@@ -316,7 +374,6 @@ class YHCompanySelectFileCell: UITableViewCell { ...@@ -316,7 +374,6 @@ class YHCompanySelectFileCell: UITableViewCell {
make.top.equalTo(view?.snp.bottom ?? mainItemView.snp.bottom).offset(15) make.top.equalTo(view?.snp.bottom ?? mainItemView.snp.bottom).offset(15)
} }
} }
let titleLabel = { let titleLabel = {
let label = UILabel() let label = UILabel()
// label.attributed.text = dataSource?[i] // label.attributed.text = dataSource?[i]
...@@ -324,7 +381,7 @@ class YHCompanySelectFileCell: UITableViewCell { ...@@ -324,7 +381,7 @@ class YHCompanySelectFileCell: UITableViewCell {
let str = "*" + messageDataSource[j] let str = "*" + messageDataSource[j]
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14), .font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor .foregroundColor: UIColor(hex: 0xd5dad1)
] ]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes) let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1) let starRange = NSRange(location: 0, length: 1)
...@@ -387,7 +444,7 @@ class YHCompanySelectFileCell: UITableViewCell { ...@@ -387,7 +444,7 @@ class YHCompanySelectFileCell: UITableViewCell {
label.text = dataSource[i] label.text = dataSource[i]
label.numberOfLines = 0 label.numberOfLines = 0
label.tag = 1000 + i label.tag = 1000 + i
label.textColor = UIColor.mainTextColor label.textColor = UIColor(hex: 0xd5dad1)
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
label.isUserInteractionEnabled = false label.isUserInteractionEnabled = false
return label return label
...@@ -408,21 +465,46 @@ class YHCompanySelectFileCell: UITableViewCell { ...@@ -408,21 +465,46 @@ class YHCompanySelectFileCell: UITableViewCell {
make.left.equalTo(18) make.left.equalTo(18)
make.right.equalTo(-18) make.right.equalTo(-18)
} }
if (model.has_ipo_company_equity == 1 && model.is_ipo_company == 1 && model.has_ipo_sales_reached == 1) || (model.has_company_equity == 1 && model.is_ipo_company == 2 && model.has_sales_reached == 1) {
let str = "*" + messageDataSource[j]
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
if selectItem.contains(i) {
bgviewButton.layer.borderWidth = 1
bgviewButton.backgroundColor = UIColor(hex: 0xebf0f9)
agreeButton.image = UIImage(named: "login_privacy_agree")
subTitleLabel.textColor = UIColor.mainTextColor
} else {
bgviewButton.layer.borderWidth = 0
bgviewButton.backgroundColor = UIColor.contentBkgColor
agreeButton.image = UIImage(named: "login_privacy_disagree_glay")
subTitleLabel.textColor = UIColor.mainTextColor
}
}
} }
} else { } else {
let rightButton = { let rightButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.08)
button.setTitleColor(UIColor.brandMainColor, for: .selected) button.setTitleColor(UIColor.brandMainColor, for: .selected)
button.setTitleColor(UIColor.mainTextColor, for: .normal) button.setTitleColor(UIColor(hex: 0xd5dad1), for: .normal)
button.setBackgroundColor(color: UIColor.brandMainColor.withAlphaComponent(0.08), forState: .selected)
button.setBackgroundColor(color: UIColor(hex: 0xf5f6f8), forState: .normal)
button.setTitle("否", for: .normal) button.setTitle("否", for: .normal)
button.layer.cornerRadius = 16 button.layer.cornerRadius = 16
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13) button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13)
button.layer.borderColor = UIColor.brandMainColor.cgColor
button.addTarget(self, action: #selector(rightClick(sender:)), for: .touchUpInside) button.addTarget(self, action: #selector(rightClick(sender:)), for: .touchUpInside)
button.tag = 3000 + j button.tag = 3000 + j
return button return button
}() }()
addSubview(rightButton) mainItemView.addSubview(rightButton)
rightButton.snp.makeConstraints { make in rightButton.snp.makeConstraints { make in
make.right.equalTo(-18) make.right.equalTo(-18)
make.centerY.equalTo(titleLabel.snp.centerY) make.centerY.equalTo(titleLabel.snp.centerY)
...@@ -432,60 +514,298 @@ class YHCompanySelectFileCell: UITableViewCell { ...@@ -432,60 +514,298 @@ class YHCompanySelectFileCell: UITableViewCell {
let leftButton = { let leftButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.backgroundColor = UIColor.contentBkgColor button.setBackgroundColor(color: UIColor.brandMainColor.withAlphaComponent(0.08), forState: .selected)
button.setBackgroundColor(color: UIColor(hex: 0xf5f6f8), forState: .normal)
button.setTitleColor(UIColor.brandMainColor, for: .selected) button.setTitleColor(UIColor.brandMainColor, for: .selected)
button.setTitleColor(UIColor.mainTextColor, for: .normal) button.setTitleColor(UIColor(hex: 0xd5dad1), for: .normal)
button.layer.cornerRadius = 16 button.layer.cornerRadius = 16
button.setTitle("是", for: .normal) button.setTitle("是", for: .normal)
button.layer.borderColor = UIColor.brandMainColor.cgColor
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13) button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13)
button.addTarget(self, action: #selector(leftClick(sender:)), for: .touchUpInside) button.addTarget(self, action: #selector(leftClick(sender:)), for: .touchUpInside)
button.tag = 4000 + j button.tag = 4000 + j
return button return button
}() }()
addSubview(leftButton) mainItemView.addSubview(leftButton)
leftButton.snp.makeConstraints { make in leftButton.snp.makeConstraints { make in
make.right.equalTo(rightButton.snp.left).offset(-12) make.right.equalTo(rightButton.snp.left).offset(-12)
make.centerY.equalTo(titleLabel.snp.centerY) make.centerY.equalTo(titleLabel.snp.centerY)
make.height.equalTo(32) make.height.equalTo(32)
make.width.equalTo(74) make.width.equalTo(74)
} }
// 数据源刷新
if j == 0 {
let str = "*" + messageDataSource[j]
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
leftButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
leftButton.setTitleColor(UIColor.mainTextColor, for: .normal)
rightButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
rightButton.setTitleColor(UIColor.mainTextColor, for: .normal)
if model.is_ipo_company == 0 {
leftButton.isSelected = false
rightButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 0
}
if model.is_ipo_company == 1 {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
rightButton.layer.borderWidth = 0
}
if model.is_ipo_company == 2 {
rightButton.isSelected = true
leftButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 1
}
}
if j == 1 {
if model.is_ipo_company == 1 {
let str = "*" + messageDataSource[j]
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
leftButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
leftButton.setTitleColor(UIColor.mainTextColor, for: .normal)
rightButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
rightButton.setTitleColor(UIColor.mainTextColor, for: .normal)
if model.has_ipo_company_equity == 0 {
leftButton.isSelected = false
rightButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 0
}
if model.has_ipo_company_equity == 1 {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
rightButton.layer.borderWidth = 0
}
if model.has_ipo_company_equity == 2 {
rightButton.isSelected = true
leftButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 1
}
}
}
if j == 2 {
if model.is_ipo_company == 2 {
let str = "*" + messageDataSource[j]
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
leftButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
leftButton.setTitleColor(UIColor.mainTextColor, for: .normal)
rightButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
rightButton.setTitleColor(UIColor.mainTextColor, for: .normal)
if model.has_company_equity == 0 {
leftButton.isSelected = false
rightButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 0
}
if model.has_company_equity == 1 {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
rightButton.layer.borderWidth = 0
}
if model.has_company_equity == 2 {
rightButton.isSelected = true
leftButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 1
}
}
}
if j == 3 {
if model.is_ipo_company == 1 && model.has_ipo_company_equity == 1 {
let str = "*" + messageDataSource[j]
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
leftButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
leftButton.setTitleColor(UIColor.mainTextColor, for: .normal)
rightButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
rightButton.setTitleColor(UIColor.mainTextColor, for: .normal)
if model.has_ipo_sales_reached == 0 {
leftButton.isSelected = false
rightButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 0
}
if model.has_ipo_sales_reached == 1 {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
rightButton.layer.borderWidth = 0
}
if model.has_ipo_sales_reached == 2 {
rightButton.isSelected = true
leftButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 1
}
}
if model.is_ipo_company == 2 && model.has_company_equity == 1 {
let str = "*" + messageDataSource[j]
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
leftButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
leftButton.setTitleColor(UIColor.mainTextColor, for: .normal)
rightButton.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
rightButton.setTitleColor(UIColor.mainTextColor, for: .normal)
if model.has_sales_reached == 0 {
leftButton.isSelected = false
rightButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 0
}
if model.has_sales_reached == 1 {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
rightButton.layer.borderWidth = 0
}
if model.has_sales_reached == 2 {
rightButton.isSelected = true
leftButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 1
}
}
}
} }
} }
} }
@objc func agreeClick(sender: UIButton) { @objc func agreeClick(sender: UIButton) {
sender.isSelected = !sender.isSelected if (model.has_ipo_company_equity == 1 && model.is_ipo_company == 1 && model.has_ipo_sales_reached == 1)||(model.has_company_equity == 1 && model.is_ipo_company == 2 && model.has_sales_reached == 1) {
if sender.isSelected { selectItem.removeAll()
sender.layer.borderWidth = 1
sender.backgroundColor = UIColor(hex: 0xebf0f9)
selectItem.append(sender.tag - 20000) selectItem.append(sender.tag - 20000)
let view = mainItemView.viewWithTag(sender.tag - 20000 + 10000) as! UIImageView sender.isSelected = !sender.isSelected
view.image = UIImage(named: "login_privacy_agree") for i in 0..<(dataSource.count) {
} else { if i == sender.tag - 20000 {
sender.layer.borderWidth = 0 let view = mainItemView.viewWithTag(i + 20000)
sender.backgroundColor = UIColor.contentBkgColor view?.layer.borderWidth = 1
selectItem.removeAll(where: {$0 == sender.tag - 20000}) view?.backgroundColor = UIColor(hex: 0xebf0f9)
let view = mainItemView.viewWithTag(sender.tag - 20000 + 10000) as! UIImageView let subview = mainItemView.viewWithTag(i + 10000) as! UIImageView
view.image = UIImage(named: "login_privacy_disagree_glay") subview.image = UIImage(named: "login_privacy_agree")
} } else {
let view = mainItemView.viewWithTag(i + 20000)
if let block = selectBlock { view?.layer.borderWidth = 0
block(selectItem) view?.backgroundColor = UIColor.contentBkgColor
let subview = mainItemView.viewWithTag(i + 10000) as! UIImageView
subview.image = UIImage(named: "login_privacy_disagree_glay")
}
}
var tempModel = YHWorkExperienceCompanyModel()
tempModel = model
tempModel.company_location = dataSource[sender.tag - 20000]
if let block = selectBlock {
block(tempModel)
}
} }
} }
@objc func leftClick(sender: UIButton) { @objc func leftClick(sender: UIButton) {
let number = sender.tag - 4000
var tempModel = YHWorkExperienceCompanyModel()
if number == 0 {
tempModel.is_ipo_company = 1
}
if number == 1 && model.is_ipo_company == 1 {
tempModel.has_ipo_company_equity = 1
tempModel.is_ipo_company = 1
}
if number == 2 && model.is_ipo_company == 2 {
tempModel.has_company_equity = 1
tempModel.is_ipo_company = 2
}
if number == 3 && (model.is_ipo_company == 1 && model.has_ipo_company_equity == 1) {
tempModel.has_ipo_sales_reached = 1
tempModel.is_ipo_company = 1
tempModel.has_ipo_company_equity = 1
}
if number == 3 && (model.is_ipo_company == 2 && model.has_company_equity == 1) {
tempModel.has_sales_reached = 1
tempModel.is_ipo_company = 2
tempModel.has_company_equity = 1
}
tempModel.company_location = ""
tempModel.has_provide_certificate = 0
selectItem.removeAll()
if let block = selectBlock {
block(tempModel)
}
} }
@objc func rightClick(sender: UIButton) { @objc func rightClick(sender: UIButton) {
let number = sender.tag - 3000
var tempModel = YHWorkExperienceCompanyModel()
if number == 0 {
tempModel.is_ipo_company = 2
}
if number == 1 && model.is_ipo_company == 1 {
tempModel.has_ipo_company_equity = 2
tempModel.is_ipo_company = 1 }
if number == 2 && model.is_ipo_company == 2 {
tempModel.has_company_equity = 2
tempModel.is_ipo_company = 2
}
if number == 3 && (model.is_ipo_company == 1 && model.has_ipo_company_equity == 1) {
tempModel.has_ipo_sales_reached = 2
tempModel.is_ipo_company = 1
tempModel.has_ipo_company_equity = 1
}
if number == 3 && (model.is_ipo_company == 2 && model.has_company_equity == 1) {
tempModel.has_sales_reached = 2
tempModel.is_ipo_company = 2
tempModel.has_company_equity = 1
}
tempModel.company_location = ""
tempModel.has_provide_certificate = 0
selectItem.removeAll()
if let block = selectBlock {
block(tempModel)
}
} }
} }
class YHCompanyReasonFileCell: UITableViewCell { class YHCompanyReasonFileCell: UITableViewCell {
typealias SelectBlock = (_ selectIndex: [Int]) -> () typealias SelectBlock = (_ model: YHWorkExperienceCompanyModel) -> ()
var selectBlock: SelectBlock? var selectBlock: SelectBlock?
var selectItem: [Int] = [] var selectItem: [Int] = []
var centerView: UIView! var centerView: UIView!
...@@ -494,8 +814,19 @@ class YHCompanyReasonFileCell: UITableViewCell { ...@@ -494,8 +814,19 @@ class YHCompanyReasonFileCell: UITableViewCell {
var mainItemView: UIView! var mainItemView: UIView!
var dataSource: [String] = ["验资报告", "审计报告", "绝对实益拥有人声明书", "企业所得税月(季)度预缴纳税申报表(A类)(前4个季度/前12个月)", "企业所得税完税证明(表格式)", "企业所得税年度纳税申报表(A类) (近一年度)", "工作证明"] var dataSource: [String] = ["验资报告", "审计报告", "绝对实益拥有人声明书", "企业所得税月(季)度预缴纳税申报表(A类)(前4个季度/前12个月)", "企业所得税完税证明(表格式)", "企业所得税年度纳税申报表(A类) (近一年度)", "工作证明"]
var selectData: [Int]? { var model: YHWorkExperienceCompanyModel? {
didSet { didSet {
if model?.company_location == "内地" {
dataSource = ["验资报告", "审计报告", "绝对实益拥有人声明书", "企业所得税月(季)度预缴纳税申报表(A类)(前4个季度/前12个月)", "企业所得税完税证明(表格式)", "企业所得税年度纳税申报表(A类) (近一年度)", "工作证明"]
} else if model?.company_location == "香港" {
dataSource = ["周年申报表", "审计报告", "利得税申请表", "利得税缴纳通知书", "缴税凭证", "绝对实益拥有人声明书", "工作签证", "工作证明"]
} else if model?.company_location == "澳门" {
dataSource = ["商业登记证明", "审计报告", "所得补充税B组──收益申报书(M1)", "所得补充税—收益评定通知书(M5)", "缴税凭证", "绝对实益拥有人声明书", "工作签证", "工作证明"]
} else if model?.company_location == "境外" {
dataSource = ["财务报表", "合法纳税及完税证明", "公司所有权官方证明文件", "工作签证", "工作证明"]
} else {
dataSource = ["年报(近一年)", "上市证明(证券交易所/百度股市通截图等)", "持股证明文件(周年申报表/工商备案的公司章程/国家企业信用信息公示报告/上市公司定期公告等)"]
}
updateAllViews() updateAllViews()
} }
} }
...@@ -611,9 +942,11 @@ class YHCompanyReasonFileCell: UITableViewCell { ...@@ -611,9 +942,11 @@ class YHCompanyReasonFileCell: UITableViewCell {
let rightButton = { let rightButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.08) button.setBackgroundColor(color: UIColor.brandMainColor.withAlphaComponent(0.08), forState: .selected)
button.setTitleColor(UIColor.brandMainColor, for: .selected) button.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
button.layer.borderColor = UIColor.brandMainColor.cgColor
button.setTitleColor(UIColor.mainTextColor, for: .normal) button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.setTitleColor(UIColor.brandMainColor, for: .selected)
button.setTitle("否", for: .normal) button.setTitle("否", for: .normal)
button.layer.cornerRadius = 16 button.layer.cornerRadius = 16
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13) button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13)
...@@ -621,7 +954,7 @@ class YHCompanyReasonFileCell: UITableViewCell { ...@@ -621,7 +954,7 @@ class YHCompanyReasonFileCell: UITableViewCell {
button.tag = 3000 + j button.tag = 3000 + j
return button return button
}() }()
addSubview(rightButton) mainItemView.addSubview(rightButton)
rightButton.snp.makeConstraints { make in rightButton.snp.makeConstraints { make in
make.right.equalTo(-18) make.right.equalTo(-18)
make.centerY.equalTo(titleLabel.snp.centerY) make.centerY.equalTo(titleLabel.snp.centerY)
...@@ -631,7 +964,9 @@ class YHCompanyReasonFileCell: UITableViewCell { ...@@ -631,7 +964,9 @@ class YHCompanyReasonFileCell: UITableViewCell {
let leftButton = { let leftButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.backgroundColor = UIColor.contentBkgColor button.setBackgroundColor(color: UIColor.brandMainColor.withAlphaComponent(0.08), forState: .selected)
button.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
button.layer.borderColor = UIColor.brandMainColor.cgColor
button.setTitleColor(UIColor.brandMainColor, for: .selected) button.setTitleColor(UIColor.brandMainColor, for: .selected)
button.setTitleColor(UIColor.mainTextColor, for: .normal) button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.layer.cornerRadius = 16 button.layer.cornerRadius = 16
...@@ -641,7 +976,7 @@ class YHCompanyReasonFileCell: UITableViewCell { ...@@ -641,7 +976,7 @@ class YHCompanyReasonFileCell: UITableViewCell {
button.tag = 4000 + j button.tag = 4000 + j
return button return button
}() }()
addSubview(leftButton) mainItemView.addSubview(leftButton)
leftButton.snp.makeConstraints { make in leftButton.snp.makeConstraints { make in
make.right.equalTo(rightButton.snp.left).offset(-12) make.right.equalTo(rightButton.snp.left).offset(-12)
make.centerY.equalTo(titleLabel.snp.centerY) make.centerY.equalTo(titleLabel.snp.centerY)
...@@ -656,6 +991,24 @@ class YHCompanyReasonFileCell: UITableViewCell { ...@@ -656,6 +991,24 @@ class YHCompanyReasonFileCell: UITableViewCell {
return view return view
}() }()
mainItemView.addSubview(bgviewButton) mainItemView.addSubview(bgviewButton)
if model?.has_provide_certificate == 0 {
leftButton.isSelected = false
rightButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 0
}
if model?.has_provide_certificate == 1 {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
rightButton.layer.borderWidth = 0
}
if model?.has_provide_certificate == 2 {
rightButton.isSelected = true
leftButton.isSelected = false
leftButton.layer.borderWidth = 0
rightButton.layer.borderWidth = 1
}
for i in 0..<dataSource.count { for i in 0..<dataSource.count {
let agreeButton = { let agreeButton = {
let button = UIView() let button = UIView()
...@@ -688,7 +1041,7 @@ class YHCompanyReasonFileCell: UITableViewCell { ...@@ -688,7 +1041,7 @@ class YHCompanyReasonFileCell: UITableViewCell {
}() }()
mainItemView.addSubview(subTitleLabel) mainItemView.addSubview(subTitleLabel)
subTitleLabel.snp.makeConstraints { make in subTitleLabel.snp.makeConstraints { make in
make.top.equalTo(agreeButton.snp.top).offset(-3) make.top.equalTo(agreeButton.snp.top).offset(-10)
make.left.equalTo(56) make.left.equalTo(56)
make.right.equalTo(-35) make.right.equalTo(-35)
if i == (dataSource.count) - 1 { if i == (dataSource.count) - 1 {
...@@ -707,31 +1060,18 @@ class YHCompanyReasonFileCell: UITableViewCell { ...@@ -707,31 +1060,18 @@ class YHCompanyReasonFileCell: UITableViewCell {
} }
} }
@objc func agreeClick(sender: UIButton) { @objc func leftClick(sender: UIButton) {
sender.isSelected = !sender.isSelected model?.has_provide_certificate = 1
if sender.isSelected {
sender.layer.borderWidth = 1
sender.backgroundColor = UIColor(hex: 0xebf0f9)
selectItem.append(sender.tag - 20000)
let view = mainItemView.viewWithTag(sender.tag - 20000 + 10000) as! UIImageView
view.image = UIImage(named: "login_privacy_agree")
} else {
sender.layer.borderWidth = 0
sender.backgroundColor = UIColor.contentBkgColor
selectItem.removeAll(where: {$0 == sender.tag - 20000})
let view = mainItemView.viewWithTag(sender.tag - 20000 + 10000) as! UIImageView
view.image = UIImage(named: "login_privacy_disagree_glay")
}
if let block = selectBlock { if let block = selectBlock {
block(selectItem) block(model ?? YHWorkExperienceCompanyModel())
} }
} }
@objc func leftClick(sender: UIButton) {
}
@objc func rightClick(sender: UIButton) { @objc func rightClick(sender: UIButton) {
model?.has_provide_certificate = 2
if let block = selectBlock {
block(model ?? YHWorkExperienceCompanyModel())
}
} }
} }
...@@ -22,6 +22,8 @@ class YHWorkExperienceItemView: UIView { ...@@ -22,6 +22,8 @@ class YHWorkExperienceItemView: UIView {
var showPromptLabel: UILabel! var showPromptLabel: UILabel!
var longTimeButton:UIButton! var longTimeButton:UIButton!
var country: String = "" var country: String = ""
var workId: Int = 0
var orderId: Int = 0
var dataSource: YHWorkExperienceModel? { var dataSource: YHWorkExperienceModel? {
didSet { didSet {
updateAllViews() updateAllViews()
...@@ -249,7 +251,7 @@ class YHWorkExperienceItemView: UIView { ...@@ -249,7 +251,7 @@ class YHWorkExperienceItemView: UIView {
break break
case .company: case .company:
if dataSource.message == "0" { if dataSource.message == "0" {
messageTextField.text = "未选择" messageTextField.text = ""
} else { } else {
messageTextField.text = "已选择" messageTextField.text = "已选择"
} }
...@@ -509,8 +511,13 @@ class YHWorkExperienceItemView: UIView { ...@@ -509,8 +511,13 @@ class YHWorkExperienceItemView: UIView {
} }
} }
case .company: case .company:
YHWorkExperienceCompanySelectView.show { array in YHWorkExperienceCompanySelectView.show(workId: workId, orderId: orderId) { [weak self] in
guard let self = self else { return }
self.dataSource?.message = "1"
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHWorkExperienceModel())
}
} }
case .field: case .field:
YHOtherPickerView.show(type: .field, selectTitle: self.dataSource?.message ?? "") {[weak self] data in YHOtherPickerView.show(type: .field, selectTitle: self.dataSource?.message ?? "") {[weak self] data in
......
...@@ -20,6 +20,8 @@ class YHWorkExperienceTableViewCell: UITableViewCell { ...@@ -20,6 +20,8 @@ class YHWorkExperienceTableViewCell: UITableViewCell {
var titleLabel: UILabel! var titleLabel: UILabel!
var mainItemView: UIView! var mainItemView: UIView!
var selectItem: Int = 5 var selectItem: Int = 5
var workId: Int = 0
var orderId: Int = 0
var dataSource: YHSectionWorkExperienceModel?{ var dataSource: YHSectionWorkExperienceModel?{
didSet { didSet {
updateAllViews() updateAllViews()
...@@ -114,6 +116,8 @@ class YHWorkExperienceTableViewCell: UITableViewCell { ...@@ -114,6 +116,8 @@ class YHWorkExperienceTableViewCell: UITableViewCell {
} }
let itemView = YHWorkExperienceItemView() let itemView = YHWorkExperienceItemView()
itemView.dataSource = data itemView.dataSource = data
itemView.workId = workId
itemView.orderId = orderId
itemView.block = {[weak self] model in itemView.block = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
if let block = self.workExperienceBlock { if let block = self.workExperienceBlock {
......
//
// YHWorkExperienceCompanyViewModel.swift
// galaxy
//
// Created by EDY on 2024/11/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkExperienceCompanyViewModel: YHBaseViewModel {
var model: YHWorkExperienceCompanyModel = YHWorkExperienceCompanyModel()
func requestWorkQuestionDetail(_ workId: Int, _ orderId: Int, callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
let param: [String: Any] = ["work_id": workId, "order_id": orderId]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.workQuestionDetail
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? [String : Any], let result = YHWorkExperienceCompanyModel.deserialize(from: dic) else {
callBackBlock(false,nil)
return
}
self.model = 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)
}
}
func saveWorkQuestion(model: YHWorkExperienceCompanyModel, callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
let params: [String : Any] = ["order_id": model.order_id,
"work_id": model.work_id,
"is_ipo_company":model.is_ipo_company,
"has_company_equity": model.has_company_equity,
"has_sales_reached": model.has_sales_reached,
"has_ipo_company_equity": model.has_ipo_company_equity,
"has_ipo_sales_reached": model.has_ipo_sales_reached,
"company_location": model.company_location,
"has_provide_certificate": model.has_provide_certificate]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.saveWorkQuestion
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
guard let self = self else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [String : Any], let result = YHWorkExperiencePositionModel.deserialize(from: dic) else {
callBackBlock(false,nil)
return
}
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
}
...@@ -157,6 +157,13 @@ class YHWorkExperiencePositionViewModel: YHBaseViewModel { ...@@ -157,6 +157,13 @@ class YHWorkExperiencePositionViewModel: YHBaseViewModel {
} }
func saveWorkPosition(callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) { func saveWorkPosition(callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
var is_location_aboard: Int = 0
let addressCountry = position.work_country
if addressCountry.contains("中国") {
is_location_aboard = 1
} else {
is_location_aboard = 2
}
let params: [String : Any] = ["position_id": position.position_id, let params: [String : Any] = ["position_id": position.position_id,
"order_id": position.order_id, "order_id": position.order_id,
"work_id":position.work_id, "work_id":position.work_id,
...@@ -169,7 +176,8 @@ class YHWorkExperiencePositionViewModel: YHBaseViewModel { ...@@ -169,7 +176,8 @@ class YHWorkExperiencePositionViewModel: YHBaseViewModel {
"work_country": position.work_country, "work_country": position.work_country,
"work_city": position.work_city, "work_city": position.work_city,
"provide_certificate_type": position.provide_certificate_type, "provide_certificate_type": position.provide_certificate_type,
"experience_sub_scope": position.experience_sub_scope] "experience_sub_scope": position.experience_sub_scope,
"is_location_aboard": is_location_aboard]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.saveWorkPosition let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.saveWorkPosition
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -256,6 +256,9 @@ class YHAllApiName { ...@@ -256,6 +256,9 @@ class YHAllApiName {
static let workPositionDetail = "infoflow/work/v1/workPositionDetail" static let workPositionDetail = "infoflow/work/v1/workPositionDetail"
static let saveWorkPosition = "infoflow/work/v1/SaveWorkPosition" static let saveWorkPosition = "infoflow/work/v1/SaveWorkPosition"
static let deleteWorkPosition = "infoflow/work/v1/deleteWorkPosition" static let deleteWorkPosition = "infoflow/work/v1/deleteWorkPosition"
static let workQuestionDetail = "infoflow/work/v1/workQuestionDetail"
static let saveWorkQuestion = "infoflow/work/v1/SaveWorkQuestion"
} }
//登录 //登录
......
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