Commit 46fc2660 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 36d3a15d cc4b6479
...@@ -127,17 +127,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -127,17 +127,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let item2 = YHItemModel(id: .id23, isNeed: false, title: "婚前姓氏", isUserKeyBoard: true, prompts: "如有则填写,仅支持输入字母", message: mainModel.surname, isShowPrompts: isShowPrompt) let item2 = YHItemModel(id: .id23, isNeed: false, title: "婚前姓氏", isUserKeyBoard: true, prompts: "如有则填写,仅支持输入字母", message: mainModel.surname, isShowPrompts: isShowPrompt)
let item3 = YHItemModel(id: .id24, isNeed: true, title: "出生日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.birthday, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择出生日期") let item3 = YHItemModel(id: .id24, isNeed: true, title: "出生日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.birthday, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择出生日期")
let item4 = YHItemModel(id: .id25, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.birth_place_aboard)", leftButtonString: "国内", rightButtonString: "国外", isShowPrompts: isShowPrompt, alertMessage:"请选择出生国家/地区") let item4 = YHItemModel(id: .id25, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.birth_place_aboard)", leftButtonString: "国内", rightButtonString: "国外", isShowPrompts: isShowPrompt, alertMessage:"请选择出生国家/地区")
var string = "" let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.birth_place.details, isShowPrompts: isShowPrompt, alertMessage:"请输入出生城市;")
let array = mainModel.birth_place.area
for item in array {
if string.count != 0 {
string = string + "/" + item
} else {
string = string + item
}
}
let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请输入", message: string, isShowPrompts: isShowPrompt, alertMessage:"请输入出生城市;")
let item55 = YHItemModel(id: .id34, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.birth_place.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入出生城市") let item55 = YHItemModel(id: .id34, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.birth_place.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入出生城市")
let item6 = YHItemModel(id: .id27, isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.sex )", type: .sex, alertMessage:"请选择性别") let item6 = YHItemModel(id: .id27, isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.sex )", type: .sex, alertMessage:"请选择性别")
let item7 = YHItemModel(id: .id28, isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.married )", type: .marry, isShowPrompts: isShowPrompt, alertMessage:"请选择婚姻状况") let item7 = YHItemModel(id: .id28, isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.married )", type: .marry, isShowPrompts: isShowPrompt, alertMessage:"请选择婚姻状况")
......
...@@ -107,11 +107,7 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -107,11 +107,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
self.stepView.currentIndex = self.viewModel.mainModel.step self.stepView.currentIndex = self.viewModel.mainModel.step
self.stepView.maxIndex = self.viewModel.mainModel.step self.stepView.maxIndex = self.viewModel.mainModel.step
self.updateDataSource() self.updateDataSource()
if self.viewModel.mainModel.is_project_introduction == 1 { self.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "简历/工作总结"]
self.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "项目介绍", "简历/工作总结"]
} else {
self.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "简历/工作总结"]
}
self.viewModel.requestWorkInfoProject("\(self.viewModel.mainModel.id )") {[weak self] success, error in self.viewModel.requestWorkInfoProject("\(self.viewModel.mainModel.id )") {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.introductionDataSource = success self.introductionDataSource = success
...@@ -126,7 +122,7 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -126,7 +122,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
if self.stepView.currentIndex == 0 { if self.stepView.currentIndex == 0 {
self.baseDataSource = self.viewModel.getBaseDataSource(isShowPrompt) self.baseDataSource = self.viewModel.getBaseDataSource(isShowPrompt)
} }
if (self.viewModel.mainModel.is_project_introduction == 1 && self.stepView.currentIndex == 4) || (self.viewModel.mainModel.is_project_introduction != 1 && self.stepView.currentIndex == 3) { if self.stepView.currentIndex == 3 {
bottomView.nextButton.setTitle("提交", for: .normal) bottomView.nextButton.setTitle("提交", for: .normal)
} else { } else {
bottomView.nextButton.setTitle("下一步", for: .normal) bottomView.nextButton.setTitle("下一步", for: .normal)
...@@ -192,7 +188,7 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -192,7 +188,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
YHHUD.flash(message: error.errorMsg ) YHHUD.flash(message: error.errorMsg )
} else { } else {
YHHUD.hideFlashMessage() YHHUD.hideFlashMessage()
if self.stepView.currentIndex == 4 || (self.stepView.currentIndex == 3 && self.viewModel.mainModel.is_project_introduction == 0) { if self.stepView.currentIndex == 3 {
YHHUD.flash(message: "提交成功") YHHUD.flash(message: "提交成功")
self.navigationController?.popViewController() self.navigationController?.popViewController()
} else { } else {
...@@ -289,7 +285,7 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -289,7 +285,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
YHHUD.flash(message: error.errorMsg ) YHHUD.flash(message: error.errorMsg )
} else { } else {
YHHUD.hideFlashMessage() YHHUD.hideFlashMessage()
if self.stepView.currentIndex == 4 || (self.stepView.currentIndex == 3 && self.viewModel.mainModel.is_project_introduction == 0) { if self.stepView.currentIndex == 3 {
YHHUD.flash(message: "提交成功") YHHUD.flash(message: "提交成功")
self.navigationController?.popViewController() self.navigationController?.popViewController()
} else { } else {
...@@ -476,7 +472,6 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -476,7 +472,6 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} else if stepView.currentIndex == 2 { } else if stepView.currentIndex == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkHighlightsTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHWorkHighlightsTableViewCell.self)
cell.dataSource = viewModel.mainModel.highlights cell.dataSource = viewModel.mainModel.highlights
cell.detailSwitch.isOn = viewModel.mainModel.is_project_introduction == 1
cell.exampleBlock = {[weak self] in cell.exampleBlock = {[weak self] in
guard let self = self else { return } guard let self = self else { return }
let mainVc = YHWorkExampleViewController() let mainVc = YHWorkExampleViewController()
...@@ -494,14 +489,6 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -494,14 +489,6 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
cell.messageBlock = {[weak self] message in cell.messageBlock = {[weak self] message in
self?.viewModel.updateHighlights(message) self?.viewModel.updateHighlights(message)
} }
cell.switchBlock = {[weak self] isOn in
self?.viewModel.updateIsProjectIntroduction(isOn: isOn)
if isOn {
self?.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "项目介绍", "简历/工作总结"]
} else {
self?.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "简历/工作总结"]
}
}
cell.photoBlock = {[weak self] in cell.photoBlock = {[weak self] in
guard let self = self else { return } guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in YHImagePickerView.show() {[weak self] image in
...@@ -518,177 +505,6 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -518,177 +505,6 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} }
return cell return cell
} else if stepView.currentIndex == 3 { } else if stepView.currentIndex == 3 {
if self.viewModel.mainModel.is_project_introduction == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkIntroductionTableViewCell.self)
cell.dataSource = introductionDataSource
if isMore {
cell.more()
} else {
cell.cannal()
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
let vc = YHWorkIntroductionViewController()
vc.dataSource = model
vc.workModel = self.viewModel.mainModel
vc.saveBlock = {[weak self] in
guard let self = self else { return }
self.getData()
}
self.navigationController?.pushViewController(vc, animated: true)
}
cell.deleteBlock = {[weak self] model in
guard let self = self else { return }
self.showDeleteAlert(model)
}
cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return }
self.isMore = isMore
}
cell.addIntroductionBlock = {[weak self] in
guard let self = self else { return }
let vc = YHWorkIntroductionViewController()
vc.workModel = self.viewModel.mainModel
vc.saveBlock = {[weak self] in
guard let self = self else { return }
self.getData()
}
self.navigationController?.pushViewController(vc, animated: true)
}
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkFileSyncTableViewCell.self)
cell.dataSource = fileDataSource
cell.addIntroductionBlock = { [weak self] in
guard let self = self else { return }
let count = self.viewModel.mainModel.file.count
if count >= 99 {
YHHUD.flash(message: "最多上传99个图片或文件")
return
}
var maxCount = 99 - count
if maxCount > 9 {
maxCount = 9
}
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectImageCount = maxCount
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
uploadFile(fileUrl)
}
sheetView.uploadImageBlock = {
[weak self] imgArr in
guard let self = self else { return }
let group = DispatchGroup()
var successArr:[String] = []
var failArr:[YHSelectImageItem] = []
YHHUD.show(.progress(message: "上传中..."))
for item in imgArr {
if let image = item.data {
group.enter()
uploadImage(image, imageName:item.name) {
success, url in
if success {
successArr.append(url)
} else {
failArr.append(item)
}
group.leave()
}
}
}
// 等待所有任务完成
group.notify(queue: .main) {
YHHUD.hide()
// 所有任务完成,回到主线程继续执行
if imgArr.count == successArr.count {
YHHUD.flash(message: "上传成功")
for item in successArr {
let timestamp = Date().timeIntervalSince1970
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy.MM.dd HH:mm:ss"
let currentDate = Date()
let formattedDate = dateFormatter.string(from: currentDate)
let model = YHWorkExperienceFileModel()
model.fileUrl = item
model.fileName = "\(UInt64(timestamp))" + ".jpg"
model.uploadedAt = formattedDate
self.fileDataSource?.append(model)
self.viewModel.mainModel.file = self.fileDataSource ?? []
}
self.tableView.reloadData()
} else {
YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
}
}
}
sheetView.show()
}
cell.experienceListBlock = {[weak self] model, type in
guard let self = self else { return }
if type == .delete {
let items = [YHCertificateEditItem(type:.rename, title:"重命名"),
YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.delete, title:"删除"),
YHCertificateEditItem(type:.cancel, title:"取消")]
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
guard let self = self else { return }
if editType == .rename {
self.selectEditItem = model
var name = getFileNameWithoutSuffix(model.fileName)
if name.count > 30 {
name = name[safe: ..<30]!
}
renameInputView.textField.text = name
renameInputView.textField.becomeFirstResponder()
}
if editType == .preview {
if model.fileUrl.isEmpty == false {
self.viewModel.getPublicImageUrl(model.fileUrl) { success, error in
if let success = success {
self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName: model.fileName)
}
}
}
}
if editType == .delete {
self.showDeleteAlert(model)
}
}.show()
} else {
if model.fileUrl.isEmpty == false {
self.viewModel.getPublicImageUrl(model.fileUrl) { success, error in
if let success = success {
self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName:model.fileName)
}
}
}
}
}
cell.selectIntroductionBlock = { [weak self] in
guard let self = self else { return }
YHSelectFileSheetView.show(orderID: self.orderID) { [weak self] models in
guard let self = self else { return }
for item in models {
self.fileDataSource?.append(item)
self.viewModel.mainModel.file = self.fileDataSource ?? []
}
self.tableView.reloadData()
if models.count != 0 {
YHHUD.flash(message: "同步成功")
}
}
}
return cell
}
} else if stepView.currentIndex == 4 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkFileSyncTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHWorkFileSyncTableViewCell.self)
cell.dataSource = fileDataSource cell.dataSource = fileDataSource
cell.addIntroductionBlock = { [weak self] in cell.addIntroductionBlock = { [weak self] in
...@@ -845,14 +661,6 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -845,14 +661,6 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
if stepView.currentIndex == 1 || stepView.currentIndex == 2 { if stepView.currentIndex == 1 || stepView.currentIndex == 2 {
return KScreenHeight - k_Height_NavigationtBarAndStatuBar - YHStepView.height - k_Height_safeAreaInsetsBottom() - 64 return KScreenHeight - k_Height_NavigationtBarAndStatuBar - YHStepView.height - k_Height_safeAreaInsetsBottom() - 64
} else if stepView.currentIndex == 3 { } else if stepView.currentIndex == 3 {
if self.viewModel.mainModel.is_project_introduction == 1 {
let number = introductionDataSource?.count ?? 0
return CGFloat(76 * number + 150)
} else {
let count = fileDataSource?.count ?? 0
return CGFloat(69 * count + 171)
}
} else if stepView.currentIndex == 4 {
let count = fileDataSource?.count ?? 0 let count = fileDataSource?.count ?? 0
return CGFloat(69 * count + 171) return CGFloat(69 * count + 171)
} else { } else {
......
...@@ -56,7 +56,6 @@ class YHWorkExperienceDetailModel: SmartCodable { ...@@ -56,7 +56,6 @@ class YHWorkExperienceDetailModel: SmartCodable {
var company_website: String = "" var company_website: String = ""
var company_introduce: String = "" var company_introduce: String = ""
var business_remark: String = "" var business_remark: String = ""
var is_project_introduction: Int = 0
var customer_center_id: Int = 0 var customer_center_id: Int = 0
var projects: [String] = [] var projects: [String] = []
......
...@@ -11,19 +11,15 @@ import UIKit ...@@ -11,19 +11,15 @@ import UIKit
class YHWorkHighlightsTableViewCell: UITableViewCell { class YHWorkHighlightsTableViewCell: UITableViewCell {
typealias ExampleBlock = () -> () typealias ExampleBlock = () -> ()
typealias MessageBlock = (_ message: String) -> () typealias MessageBlock = (_ message: String) -> ()
typealias SwitchBlock = (_ isOn: Bool) -> ()
var exampleBlock: ExampleBlock? var exampleBlock: ExampleBlock?
var photoBlock: ExampleBlock? var photoBlock: ExampleBlock?
var messageBlock: MessageBlock? var messageBlock: MessageBlock?
var switchBlock: SwitchBlock?
var centerView: UIView! var centerView: UIView!
var titleLabel: UILabel! var titleLabel: UILabel!
var subTitleLabel: UILabel! var subTitleLabel: UILabel!
var lineView: UIView! var lineView: UIView!
var messageTextField: UITextView! var messageTextField: UITextView!
var promptsLabel: UILabel! var promptsLabel: UILabel!
var detailLabel: UILabel!
var detailSwitch: UISwitch!
var bottomView: YHWorkActionView! var bottomView: YHWorkActionView!
var dataSource: String?{ var dataSource: String?{
didSet { didSet {
...@@ -143,35 +139,6 @@ class YHWorkHighlightsTableViewCell: UITableViewCell { ...@@ -143,35 +139,6 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
make.top.equalTo(116) make.top.equalTo(116)
} }
detailLabel = {
let label = UILabel()
label.text = "项目详细介绍"
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_R(ofSize: 14)
return label
}()
centerView.addSubview(detailLabel)
detailLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.bottom.equalTo(-62)
make.height.equalTo(20)
make.width.equalTo(100)
}
detailSwitch = {
let switchView = UISwitch()
switchView.onTintColor = UIColor.brandMainColor
switchView.addTarget(self, action: #selector(switchViewChange), for: .valueChanged)
return switchView
}()
centerView.addSubview(detailSwitch)
detailSwitch.snp.makeConstraints { make in
make.right.equalTo(-18)
make.centerY.equalTo(detailLabel.snp.centerY)
make.height.equalTo(24)
make.width.equalTo(45)
}
bottomView = { bottomView = {
let view = YHWorkActionView() let view = YHWorkActionView()
view.exampleBlock = {[weak self] in view.exampleBlock = {[weak self] in
...@@ -193,7 +160,6 @@ class YHWorkHighlightsTableViewCell: UITableViewCell { ...@@ -193,7 +160,6 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
make.left.right.bottom.equalToSuperview() make.left.right.bottom.equalToSuperview()
make.height.equalTo(44) make.height.equalTo(44)
} }
detailSwitch.transform = CGAffineTransform(scaleX: 0.77, y: 0.77)
} }
...@@ -205,20 +171,6 @@ class YHWorkHighlightsTableViewCell: UITableViewCell { ...@@ -205,20 +171,6 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
promptsLabel.isHidden = false promptsLabel.isHidden = false
} }
} }
@objc func switchViewChange() {
if let block = switchBlock {
block(detailSwitch.isOn)
}
}
func setSwitchState(_ isOn: Int) {
if isOn == 1 {
detailSwitch.isOn = true
} else {
detailSwitch.isOn = false
}
}
} }
extension YHWorkHighlightsTableViewCell: UITextViewDelegate { extension YHWorkHighlightsTableViewCell: UITextViewDelegate {
......
...@@ -195,14 +195,6 @@ class YHWorkExperienceViewModel: YHBaseViewModel { ...@@ -195,14 +195,6 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
mainModel.highlights = value mainModel.highlights = value
} }
func updateIsProjectIntroduction(isOn: Bool) {
if isOn {
mainModel.is_project_introduction = 1
} else {
mainModel.is_project_introduction = 0
}
}
func updateNotNeedUploadFile(value: Int) { func updateNotNeedUploadFile(value: Int) {
mainModel.not_need_upload_file = value mainModel.not_need_upload_file = value
} }
...@@ -297,7 +289,6 @@ class YHWorkExperienceViewModel: YHBaseViewModel { ...@@ -297,7 +289,6 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
"international_work_experience": mainModel.international_work_experience, "international_work_experience": mainModel.international_work_experience,
"is_executives": mainModel.is_executives, "is_executives": mainModel.is_executives,
"is_famous_enterprise": mainModel.is_famous_enterprise, "is_famous_enterprise": mainModel.is_famous_enterprise,
"is_project_introduction": mainModel.is_project_introduction,
"is_show": mainModel.is_show, "is_show": mainModel.is_show,
"is_synthetic": mainModel.is_synthetic, "is_synthetic": mainModel.is_synthetic,
"location": location, "location": location,
......
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