Commit 7fb37bd8 authored by pete谢兆麟's avatar pete谢兆麟

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

parents c950383b 705c2e0c
...@@ -118,6 +118,8 @@ ...@@ -118,6 +118,8 @@
042B20DA2CEB337100655093 /* YHImproveSchemeTemplateListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20D92CEB337100655093 /* YHImproveSchemeTemplateListCell.swift */; }; 042B20DA2CEB337100655093 /* YHImproveSchemeTemplateListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20D92CEB337100655093 /* YHImproveSchemeTemplateListCell.swift */; };
042B20DC2CEB69CB00655093 /* YHSchemeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20DB2CEB69CB00655093 /* YHSchemeModel.swift */; }; 042B20DC2CEB69CB00655093 /* YHSchemeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20DB2CEB69CB00655093 /* YHSchemeModel.swift */; };
042B20DF2CEB6A8F00655093 /* YHSchemeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20DE2CEB6A8F00655093 /* YHSchemeViewModel.swift */; }; 042B20DF2CEB6A8F00655093 /* YHSchemeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20DE2CEB6A8F00655093 /* YHSchemeViewModel.swift */; };
042B20E12CEC91CD00655093 /* YHMajorSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20E02CEC91CD00655093 /* YHMajorSearchViewController.swift */; };
042B20E32CEC92C400655093 /* YHMajorNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042B20E22CEC92C400655093 /* YHMajorNameCell.swift */; };
0430E63B2C6DA106000511E2 /* CGFloat+Extention.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */; }; 0430E63B2C6DA106000511E2 /* CGFloat+Extention.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */; };
0430E6422C72E120000511E2 /* YHAddAdoptersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6412C72E120000511E2 /* YHAddAdoptersViewController.swift */; }; 0430E6422C72E120000511E2 /* YHAddAdoptersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6412C72E120000511E2 /* YHAddAdoptersViewController.swift */; };
0430E6442C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */; }; 0430E6442C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */; };
...@@ -1145,6 +1147,8 @@ ...@@ -1145,6 +1147,8 @@
042B20D92CEB337100655093 /* YHImproveSchemeTemplateListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImproveSchemeTemplateListCell.swift; sourceTree = "<group>"; }; 042B20D92CEB337100655093 /* YHImproveSchemeTemplateListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImproveSchemeTemplateListCell.swift; sourceTree = "<group>"; };
042B20DB2CEB69CB00655093 /* YHSchemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeModel.swift; sourceTree = "<group>"; }; 042B20DB2CEB69CB00655093 /* YHSchemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeModel.swift; sourceTree = "<group>"; };
042B20DE2CEB6A8F00655093 /* YHSchemeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeViewModel.swift; sourceTree = "<group>"; }; 042B20DE2CEB6A8F00655093 /* YHSchemeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeViewModel.swift; sourceTree = "<group>"; };
042B20E02CEC91CD00655093 /* YHMajorSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMajorSearchViewController.swift; sourceTree = "<group>"; };
042B20E22CEC92C400655093 /* YHMajorNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMajorNameCell.swift; sourceTree = "<group>"; };
0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGFloat+Extention.swift"; sourceTree = "<group>"; }; 0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGFloat+Extention.swift"; sourceTree = "<group>"; };
0430E6412C72E120000511E2 /* YHAddAdoptersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAddAdoptersViewController.swift; sourceTree = "<group>"; }; 0430E6412C72E120000511E2 /* YHAddAdoptersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAddAdoptersViewController.swift; sourceTree = "<group>"; };
0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterMainTableViewCell.swift; sourceTree = "<group>"; }; 0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterMainTableViewCell.swift; sourceTree = "<group>"; };
...@@ -3145,6 +3149,7 @@ ...@@ -3145,6 +3149,7 @@
045EEE102B9F171A0022A143 /* YHEducationDetailVC.swift */, 045EEE102B9F171A0022A143 /* YHEducationDetailVC.swift */,
045EEE112B9F171A0022A143 /* YHEducationInfoListVC.swift */, 045EEE112B9F171A0022A143 /* YHEducationInfoListVC.swift */,
045EEE122B9F171A0022A143 /* YHCollegeSearchViewController.swift */, 045EEE122B9F171A0022A143 /* YHCollegeSearchViewController.swift */,
042B20E02CEC91CD00655093 /* YHMajorSearchViewController.swift */,
045EEE132B9F171A0022A143 /* YHQualificationDetailVC.swift */, 045EEE132B9F171A0022A143 /* YHQualificationDetailVC.swift */,
); );
path = C; path = C;
...@@ -3154,6 +3159,7 @@ ...@@ -3154,6 +3159,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
045EEE152B9F171A0022A143 /* YHCollegeNameCell.swift */, 045EEE152B9F171A0022A143 /* YHCollegeNameCell.swift */,
042B20E22CEC92C400655093 /* YHMajorNameCell.swift */,
045EEE162B9F171A0022A143 /* YHEducationInfoCell.swift */, 045EEE162B9F171A0022A143 /* YHEducationInfoCell.swift */,
047F3DD82CE601D1001B2A6D /* YHEducationCertificateConfirmCell.swift */, 047F3DD82CE601D1001B2A6D /* YHEducationCertificateConfirmCell.swift */,
047F3DDA2CE6DE91001B2A6D /* YHEducationMarkView.swift */, 047F3DDA2CE6DE91001B2A6D /* YHEducationMarkView.swift */,
...@@ -6111,6 +6117,7 @@ ...@@ -6111,6 +6117,7 @@
04256E1D2C75C74200A37BA4 /* YHAppointHKResultModel.swift in Sources */, 04256E1D2C75C74200A37BA4 /* YHAppointHKResultModel.swift in Sources */,
047F3DE62CE83A0F001B2A6D /* YHHKRequiredItemView.swift in Sources */, 047F3DE62CE83A0F001B2A6D /* YHHKRequiredItemView.swift in Sources */,
04CE1ADB2C2AD91F001CB80A /* YHActivityTitleItemView.swift in Sources */, 04CE1ADB2C2AD91F001CB80A /* YHActivityTitleItemView.swift in Sources */,
042B20E32CEC92C400655093 /* YHMajorNameCell.swift in Sources */,
A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */, A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */,
04CA2C2F2CBA5C9E00F36DE7 /* YHLookResignGuideLineView.swift in Sources */, 04CA2C2F2CBA5C9E00F36DE7 /* YHLookResignGuideLineView.swift in Sources */,
045792172CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift in Sources */, 045792172CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift in Sources */,
...@@ -6384,6 +6391,7 @@ ...@@ -6384,6 +6391,7 @@
A517A4E52BB6C4BB000DEECD /* YHDocumentFileItemView.swift in Sources */, A517A4E52BB6C4BB000DEECD /* YHDocumentFileItemView.swift in Sources */,
045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */, 045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */,
0419A0A42C49184300A5FCFA /* YHInvitationNumberItemView.swift in Sources */, 0419A0A42C49184300A5FCFA /* YHInvitationNumberItemView.swift in Sources */,
042B20E12CEC91CD00655093 /* YHMajorSearchViewController.swift in Sources */,
045EEEDD2B9F171A0022A143 /* YHCollegeNameCell.swift in Sources */, 045EEEDD2B9F171A0022A143 /* YHCollegeNameCell.swift in Sources */,
04F2432D2C94645000DF2C74 /* YHResignDocumentStatusCell.swift in Sources */, 04F2432D2C94645000DF2C74 /* YHResignDocumentStatusCell.swift in Sources */,
04256DFA2C742A1500A37BA4 /* YHFamilyGroupModel.swift in Sources */, 04256DFA2C742A1500A37BA4 /* YHFamilyGroupModel.swift in Sources */,
......
...@@ -513,10 +513,10 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource ...@@ -513,10 +513,10 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource
} }
else if tapIndex == 5 { else if tapIndex == 5 {
//收入记录 //收入记录
// let vc = YHOtherInfoFillViewController() if let orderId = orderId {
// vc.orderId = orderId let ctl = YHIncomeRecordViewController(orderId: orderId)
// navigationController?.pushViewController(vc) navigationController?.pushViewController(ctl)
YHHUD.flash(message: "这里完善 收入记录 跳转逻辑") }
} }
else if tapIndex == 6 { else if tapIndex == 6 {
......
...@@ -115,7 +115,17 @@ extension YHOrderSearchViewController: UITableViewDelegate, UITableViewDataSourc ...@@ -115,7 +115,17 @@ extension YHOrderSearchViewController: UITableViewDelegate, UITableViewDataSourc
cell.cellBlock = {[weak self] model in cell.cellBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
if self.mobile == model.mobile { if self.mobile == model.mobile {
self.navigationController?.popToRootViewController(animated: true) if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") as? Int {
if orderID == model.id {
self.navigationController?.popToRootViewController(animated: true)
} else {
let vc = YHServiceCenterViewController()
vc.model = model
self.navigationController?.pushViewController(vc)
}
} else {
self.navigationController?.popToRootViewController(animated: true)
}
} else { } else {
let vc = YHServiceCenterViewController() let vc = YHServiceCenterViewController()
vc.model = model vc.model = model
......
...@@ -12,11 +12,11 @@ enum HKPlanDocQuestionType { ...@@ -12,11 +12,11 @@ enum HKPlanDocQuestionType {
case unknow case unknow
case planDocQuestion1 //1、主要事业成就 case planDocQuestion1 //1、主要事业成就
case planDocQuestion2 //2、专业技能成就 case planDocQuestion2 //2、专业技能成就
case planDocQuestion3 //3、学业成就 case planDocQuestion3 //3、专业资格|奖项
case planDocQuestion4 //4、未来发展计划 case planDocQuestion4 //4、专业技能|成就
case planDocQuestion5 //5、专业资格及奖项 case planDocQuestion5 //5、对香港潜在贡献
case planDocQuestion6 //6、其他材料 case planDocQuestion6 //6、计划计划
case planOther //7、备注 case planOther //7、其他重要资料
} }
class YHHKPlanDocModel { class YHHKPlanDocModel {
...@@ -24,6 +24,8 @@ class YHHKPlanDocModel { ...@@ -24,6 +24,8 @@ class YHHKPlanDocModel {
var content : String = "" var content : String = ""
var type : HKPlanDocQuestionType = .unknow var type : HKPlanDocQuestionType = .unknow
var other : String = ""
//本地使用 //本地使用
var canEditFlag : Bool = true var canEditFlag : Bool = true
var isFirstData : Bool = false var isFirstData : Bool = false
......
...@@ -23,6 +23,8 @@ class YHMyDocumentProspectusModel: SmartCodable { ...@@ -23,6 +23,8 @@ class YHMyDocumentProspectusModel: SmartCodable {
var career_achievement: String = "" var career_achievement: String = ""
var professional_skills: String = "" var professional_skills: String = ""
var academic_achievement: String = "" var academic_achievement: String = ""
var visa_contribution : String = ""
var talent_list: String = ""
var plan_detail: String = "" var plan_detail: String = ""
var created_at: String = "" var created_at: String = ""
var updated_at: String = "" var updated_at: String = ""
......
...@@ -37,6 +37,35 @@ class YHHKPlanItemView: UIView { ...@@ -37,6 +37,35 @@ class YHHKPlanItemView: UIView {
}() }()
private lazy var subHoldView : UIView = {
let view = UIView()
view.backgroundColor = .contentBkgColor
view.clipsToBounds = true
view.layer.cornerRadius = kCornerRadius3
return view
}()
private lazy var subHoldView2 : UIView = {
let view = UIView()
view.backgroundColor = .contentBkgColor
view.clipsToBounds = true
view.layer.cornerRadius = kCornerRadius3
return view
}()
private lazy var skillLabel : UILabel = {
let view = UILabel()
view.text = "所属专业名称(如有):资深数据科学家"
view.font = UIFont.PFSC_R(ofSize: 14)
view.textColor = .init(hex: 0x6D788A)
return view
}()
private lazy var myTextView : UITextView = { private lazy var myTextView : UITextView = {
let view = UITextView() let view = UITextView()
view.textColor = UIColor.mainTextColor view.textColor = UIColor.mainTextColor
...@@ -53,7 +82,7 @@ class YHHKPlanItemView: UIView { ...@@ -53,7 +82,7 @@ class YHHKPlanItemView: UIView {
private lazy var nameLable : UILabel = { private lazy var nameLable : UILabel = {
let lable0 = UILabel(text: "1、主要事业成就") let lable0 = UILabel(text: "1、主要事业成就")
lable0.textColor = UIColor.mainTextColor lable0.textColor = UIColor.mainTextColor
lable0.font = UIFont.PFSC_M(ofSize: 17) lable0.font = UIFont.PFSC_M(ofSize: 14)
return lable0 return lable0
}() }()
...@@ -134,16 +163,30 @@ private extension YHHKPlanItemView { ...@@ -134,16 +163,30 @@ private extension YHHKPlanItemView {
make.height.width.equalTo(16) make.height.width.equalTo(16)
} }
iconImageV.isHidden = true
let tap : UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapButton(gestureRecognizer:))) let tap : UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapButton(gestureRecognizer:)))
iconImageV.isUserInteractionEnabled = true iconImageV.isUserInteractionEnabled = true
iconImageV.addGestureRecognizer(tap) iconImageV.addGestureRecognizer(tap)
let subHoldView : UIView = UIView() //add
subHoldView.backgroundColor = UIColor.contentBkgColor holdView.addSubview(subHoldView2)
subHoldView.layer.cornerRadius = kCornerRadius6 subHoldView2.snp.makeConstraints { make in
subHoldView.clipsToBounds = true make.top.equalTo(nameLable.snp.bottom).offset(12)
make.left.right.equalToSuperview()
}
subHoldView2.addSubview(skillLabel)
skillLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(12)
make.left.equalTo(12)
make.right.equalTo(-12)
make.bottom.equalToSuperview().offset(-12)
}
subHoldView2.isHidden = true
holdView.addSubview(subHoldView) holdView.addSubview(subHoldView)
subHoldView.snp.makeConstraints { make in subHoldView.snp.makeConstraints { make in
make.top.equalTo(nameLable.snp.bottom).offset(12) make.top.equalTo(nameLable.snp.bottom).offset(12)
...@@ -202,6 +245,17 @@ private extension YHHKPlanItemView { ...@@ -202,6 +245,17 @@ private extension YHHKPlanItemView {
func updateUI() { func updateUI() {
guard let model = dataMode else { return } guard let model = dataMode else { return }
if model.type == .planDocQuestion4 {
iconImageV.isHidden = true
}
else if model.type == .planOther {
iconImageV.isHidden = true
}
else {
iconImageV.isHidden = false
}
nameLable.text = model.title nameLable.text = model.title
myTextView.text = model.content myTextView.text = model.content
if model.canEditFlag { if model.canEditFlag {
...@@ -219,11 +273,8 @@ private extension YHHKPlanItemView { ...@@ -219,11 +273,8 @@ private extension YHHKPlanItemView {
if model.type == .planOther { if model.type == .planOther {
maxNumbler = 100 maxNumbler = 100
tipsTxt = "在此补充其他信息,非必填" tipsTxt = "在此补充其他信息,非必填"
iconImageV.isHidden = true
} else { } else {
maxNumbler = 100 maxNumbler = 100
iconImageV.isHidden = false
} }
tipsLable.text = tipsTxt tipsLable.text = tipsTxt
...@@ -260,6 +311,40 @@ private extension YHHKPlanItemView { ...@@ -260,6 +311,40 @@ private extension YHHKPlanItemView {
} }
} }
//布局
if model.other.isEmpty {
subHoldView2.isHidden = true
subHoldView.snp.removeConstraints()
subHoldView.snp.remakeConstraints() { make in
make.top.equalTo(nameLable.snp.bottom).offset(12)
make.left.equalTo(0)
make.right.equalTo(0)
make.bottom.equalTo(line.snp.top).offset(-18)
}
} else {
subHoldView2.isHidden = false
skillLabel.text = model.other
subHoldView.snp.removeConstraints()
subHoldView2.snp.removeConstraints()
subHoldView2.snp.remakeConstraints() { make in
make.top.equalTo(nameLable.snp.bottom).offset(12)
make.left.right.equalToSuperview()
}
subHoldView.snp.remakeConstraints() { make in
make.top.equalTo(subHoldView2.snp.bottom).offset(12)
make.left.equalTo(0)
make.right.equalTo(0)
make.bottom.equalTo(line.snp.top).offset(-18)
}
}
} }
func calcTextLength(string : String) -> Int { func calcTextLength(string : String) -> Int {
......
...@@ -330,7 +330,7 @@ class YHMyDocumentsDetailViewModel: YHBaseViewModel { ...@@ -330,7 +330,7 @@ class YHMyDocumentsDetailViewModel: YHBaseViewModel {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.signCallBack let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.signCallBack
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象 //1. json字符串 转 对象
guard let self = self else { return } guard self != nil else { return }
if json.code == 200 { if json.code == 200 {
callBackBlock(true, nil) callBackBlock(true, nil)
} else { } else {
...@@ -365,59 +365,62 @@ private extension YHMyDocumentsDetailViewModel { ...@@ -365,59 +365,62 @@ private extension YHMyDocumentsDetailViewModel {
arrHKPlanData.append(tModel) arrHKPlanData.append(tModel)
} }
//2、专业技能成就 //2、学业成就
do { do {
let tModel = YHHKPlanDocModel() let tModel = YHHKPlanDocModel()
tModel.title = "2、专业技能成就" tModel.title = "2、学业成就"
tModel.content = model.professional_skills.defaultStringIfEmpty(detaultValue: "") tModel.content = model.academic_achievement.defaultStringIfEmpty(detaultValue: "")
tModel.type = .planDocQuestion2 tModel.type = .planDocQuestion2
arrHKPlanData.append(tModel) arrHKPlanData.append(tModel)
} }
//3、学业成就 //3、专业资格
do { do {
let tModel = YHHKPlanDocModel() let tModel = YHHKPlanDocModel()
tModel.title = "3、学业成就" tModel.title = "3、专业资格"
tModel.content = model.academic_achievement.defaultStringIfEmpty(detaultValue: "") tModel.content = model.qualifications_and_awards.defaultStringIfEmpty(detaultValue: "")
tModel.type = .planDocQuestion3 tModel.type = .planDocQuestion3
arrHKPlanData.append(tModel) arrHKPlanData.append(tModel)
} }
//4、未来发展计划 //4、专业技能或人才清单内相关专业的成就
do { do {
let tModel = YHHKPlanDocModel() let tModel = YHHKPlanDocModel()
tModel.title = "4、未来发展计划" tModel.title = "4、专业技能或人才清单内相关专业的成就"
tModel.content = model.plan_detail.defaultStringIfEmpty(detaultValue: "") tModel.content = model.professional_skills.defaultStringIfEmpty(detaultValue: "")
tModel.type = .planDocQuestion4 tModel.type = .planDocQuestion4
tModel.other = model.talent_list.defaultStringIfEmpty(detaultValue: "")
arrHKPlanData.append(tModel) arrHKPlanData.append(tModel)
} }
//5、专业资格及奖项 //5、对香港的潜在贡献
do { do {
let tModel = YHHKPlanDocModel() let tModel = YHHKPlanDocModel()
tModel.title = "5、专业资格及奖项" tModel.title = "5、对香港的潜在贡献"
tModel.content = model.qualifications_and_awards.defaultStringIfEmpty(detaultValue: "") tModel.content = model.visa_contribution.defaultStringIfEmpty(detaultValue: "")
tModel.type = .planDocQuestion5 tModel.type = .planDocQuestion5
arrHKPlanData.append(tModel) arrHKPlanData.append(tModel)
} }
//6、其他材料 //6、未来在香港发展事业的计划
do { do {
let tModel = YHHKPlanDocModel() let tModel = YHHKPlanDocModel()
tModel.title = "6、其他材料" tModel.title = "6、未来在香港发展事业的计划"
tModel.content = model.other.defaultStringIfEmpty(detaultValue: "") tModel.content = model.plan_detail.defaultStringIfEmpty(detaultValue: "")
tModel.type = .planDocQuestion6 tModel.type = .planDocQuestion6
arrHKPlanData.append(tModel) arrHKPlanData.append(tModel)
} }
//6、备注
//7、认为对评核你的申请非常重要的其他资料
do { do {
let tModel = YHHKPlanDocModel() let tModel = YHHKPlanDocModel()
tModel.title = "7、备注" tModel.title = "7、认为对评核你的申请非常重要的其他资料"
tModel.content = model.remark.defaultStringIfEmpty(detaultValue: "") tModel.content = model.other.defaultStringIfEmpty(detaultValue: "")
tModel.type = .planOther tModel.type = .planOther
tModel.isLastData = true tModel.isLastData = true
......
...@@ -56,6 +56,7 @@ class YHImproveSchemeViewController: YHBaseViewController { ...@@ -56,6 +56,7 @@ class YHImproveSchemeViewController: YHBaseViewController {
make.width.equalTo(14) make.width.equalTo(14)
make.height.equalTo(24) make.height.equalTo(24)
make.centerY.equalTo(greetLabel) make.centerY.equalTo(greetLabel)
make.right.lessThanOrEqualTo(-24)
} }
tipsLabel.snp.makeConstraints { make in tipsLabel.snp.makeConstraints { make in
...@@ -72,6 +73,7 @@ class YHImproveSchemeViewController: YHBaseViewController { ...@@ -72,6 +73,7 @@ class YHImproveSchemeViewController: YHBaseViewController {
label.font = UIFont.PFSC_B(ofSize: 24) label.font = UIFont.PFSC_B(ofSize: 24)
label.textColor = .init(hex: 0xFFDEC8) label.textColor = .init(hex: 0xFFDEC8)
label.text = "尊敬的先生" label.text = "尊敬的先生"
// label.lineBreakMode = .byTruncatingMiddle
return label return label
}() }()
...@@ -186,7 +188,12 @@ class YHImproveSchemeViewController: YHBaseViewController { ...@@ -186,7 +188,12 @@ class YHImproveSchemeViewController: YHBaseViewController {
items.removeAll() items.removeAll()
items.append(contentsOf: viewModel.improveDetailModel.improvePlanItem) items.append(contentsOf: viewModel.improveDetailModel.improvePlanItem)
tableView.reloadData() tableView.reloadData()
greetLabel.text = "尊敬的\(viewModel.improveDetailModel.username)\(viewModel.improveDetailModel.sex)"
var name = viewModel.improveDetailModel.username
if name.count > 5 {
name = String(name.prefix(5)) + "..."
}
greetLabel.text = "尊敬的\(name)\(viewModel.improveDetailModel.sex)"
} }
} }
......
...@@ -103,7 +103,8 @@ class YHMyNewSchemeViewController: YHBaseViewController { ...@@ -103,7 +103,8 @@ class YHMyNewSchemeViewController: YHBaseViewController {
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.top.equalTo(27) make.top.equalTo(27)
make.height.equalTo(34) make.height.equalTo(34)
make.centerX.equalToSuperview() make.left.equalTo(subTitleLabel)
make.right.equalTo(subTitleLabel)
} }
subTitleLabel.snp.makeConstraints { make in subTitleLabel.snp.makeConstraints { make in
...@@ -120,6 +121,8 @@ class YHMyNewSchemeViewController: YHBaseViewController { ...@@ -120,6 +121,8 @@ class YHMyNewSchemeViewController: YHBaseViewController {
label.font = UIFont.PFSC_B(ofSize: 24) label.font = UIFont.PFSC_B(ofSize: 24)
label.textColor = .white label.textColor = .white
label.text = "尊敬的先生" label.text = "尊敬的先生"
label.textAlignment = .center
label.lineBreakMode = .byTruncatingMiddle
return label return label
}() }()
...@@ -219,6 +222,7 @@ class YHMyNewSchemeViewController: YHBaseViewController { ...@@ -219,6 +222,7 @@ class YHMyNewSchemeViewController: YHBaseViewController {
} }
isPass = passArr.count >= 6 isPass = passArr.count >= 6
if isPass { if isPass {
let item1 = YHSchemeItem(type: .evaluate) let item1 = YHSchemeItem(type: .evaluate)
let item2 = YHSchemeItem(type: .hkRequireList) let item2 = YHSchemeItem(type: .hkRequireList)
...@@ -264,6 +268,11 @@ class YHMyNewSchemeViewController: YHBaseViewController { ...@@ -264,6 +268,11 @@ class YHMyNewSchemeViewController: YHBaseViewController {
return $0.standardKey return $0.standardKey
} }
if selectKeys.count <= 0 {
YHHUD.flash(message: "请选择必填项")
return
}
YHHUD.show(.progress(message: "提交中...")) YHHUD.show(.progress(message: "提交中..."))
viewModel.postSelectImproveTargets(orderId: orderId, targets: selectKeys) { viewModel.postSelectImproveTargets(orderId: orderId, targets: selectKeys) {
[weak self] success, error in [weak self] success, error in
...@@ -298,10 +307,10 @@ class YHMyNewSchemeViewController: YHBaseViewController { ...@@ -298,10 +307,10 @@ class YHMyNewSchemeViewController: YHBaseViewController {
} }
} }
func getIndustryDetail(id: Int, industryOther: String) -> String { func getIndustryDetail() -> String {
let target = "\(id)" let target = viewModel.schemeModel.industry_positioning
if target == "15" { if target == "15" {
return "其他(\(industryOther))" return "其他(\(viewModel.schemeModel.industry_positioning_other))"
} }
for(_, item) in YHConstantArrayData.arrSkill.enumerated() { for(_, item) in YHConstantArrayData.arrSkill.enumerated() {
if target == item["value"] { if target == item["value"] {
...@@ -350,6 +359,7 @@ extension YHMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSour ...@@ -350,6 +359,7 @@ extension YHMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSour
if item.type == .industryLocation { if item.type == .industryLocation {
let cell = tableView.dequeueReusableCell(withIdentifier: YHIndustryLocationCell.cellReuseIdentifier, for: indexPath) as! YHIndustryLocationCell let cell = tableView.dequeueReusableCell(withIdentifier: YHIndustryLocationCell.cellReuseIdentifier, for: indexPath) as! YHIndustryLocationCell
cell.industry = self.getIndustryDetail()
targetCell = cell targetCell = cell
} }
......
...@@ -43,10 +43,16 @@ class YHDocumentListCell: UITableViewCell { ...@@ -43,10 +43,16 @@ class YHDocumentListCell: UITableViewCell {
lazy var tips1Label: UILabel = { lazy var tips1Label: UILabel = {
let label = UILabel() let label = UILabel()
label.numberOfLines = 0 label.numberOfLines = 0
let aa: ASAttributedString = .init("您的文书清单,包括推荐信、赴港计划书。文书编写后会发送至APP【我的文书】,与您一起沟通定稿,预计", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("3周-4周", .font(UIFont.PFSC_M(ofSize: 14)),.foreground(UIColor.init(hex: 0xD48638))) let paragraphStyle = NSMutableParagraphStyle()
let cc: ASAttributedString = .init("左右完成,需要咱们共同配合完成噢", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor)) paragraphStyle.lineSpacing = 4
label.attributed.text = aa+bb+cc
let a = NSMutableAttributedString(string: "您的文书清单,包括推荐信、赴港计划书。文书编写后会发送至APP【我的文书】,与您一起沟通定稿,预计", attributes: [NSAttributedString.Key.foregroundColor : UIColor.mainTextColor, NSAttributedString.Key.font: UIFont.PFSC_R(ofSize: 14), NSAttributedString.Key.paragraphStyle: paragraphStyle])
let b = NSMutableAttributedString(string: "3周-4周", attributes: [NSAttributedString.Key.foregroundColor : UIColor.init(hex: 0xD48638), NSAttributedString.Key.font: UIFont.PFSC_M(ofSize: 14), NSAttributedString.Key.paragraphStyle: paragraphStyle])
let c = NSMutableAttributedString(string: "左右完成,需要咱们共同配合完成噢", attributes: [NSAttributedString.Key.foregroundColor : UIColor.mainTextColor, NSAttributedString.Key.font: UIFont.PFSC_R(ofSize: 14), NSAttributedString.Key.paragraphStyle: paragraphStyle])
a.append(b)
a.append(c)
label.attributedText = a
return label return label
}() }()
......
...@@ -42,9 +42,13 @@ class YHImproveSchemeCell: UITableViewCell { ...@@ -42,9 +42,13 @@ class YHImproveSchemeCell: UITableViewCell {
lazy var tips1Label: UILabel = { lazy var tips1Label: UILabel = {
let label = UILabel() let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = UIColor.mainTextColor
label.numberOfLines = 0 label.numberOfLines = 0
let aa: ASAttributedString = .init("已根据港府甄选条件,为您规划后续提升方案,您可根据实际情况进行提升~", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor.mainTextColor)) let paragraphStyle = NSMutableParagraphStyle()
label.attributed.text = aa paragraphStyle.lineSpacing = 4
let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle]
label.attributedText = NSAttributedString(string: "已根据港府甄选条件,为您规划后续提升方案,您可根据实际情况进行提升~", attributes: attributes)
return label return label
}() }()
......
...@@ -45,8 +45,11 @@ class YHImproveSchemeTemplateListCell: UITableViewCell { ...@@ -45,8 +45,11 @@ class YHImproveSchemeTemplateListCell: UITableViewCell {
}() }()
@objc func didBtnClicked() { @objc func didBtnClicked() {
if !model.url.isEmpty { if !model.url.isEmpty {
self.previewFileTool.openXLSXRemoteFile(urlString:model.url, fileName:"预览") let viewModel = YHBaseViewModel()
viewModel.getRealUsefulUrl(model.url) { success in
self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName:"预览")
}
} }
} }
......
...@@ -12,6 +12,12 @@ class YHIndustryLocationCell: UITableViewCell { ...@@ -12,6 +12,12 @@ class YHIndustryLocationCell: UITableViewCell {
static let cellReuseIdentifier = "YHIndustryLocationCell" static let cellReuseIdentifier = "YHIndustryLocationCell"
var industry: String = "" {
didSet {
tips2Label.text = industry
}
}
lazy var whiteContentView: UIView = { lazy var whiteContentView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .white view.backgroundColor = .white
...@@ -42,7 +48,10 @@ class YHIndustryLocationCell: UITableViewCell { ...@@ -42,7 +48,10 @@ class YHIndustryLocationCell: UITableViewCell {
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = .mainTextColor label.textColor = .mainTextColor
label.numberOfLines = 0 label.numberOfLines = 0
label.text = "根据您目前给来的材料,初步建议您申请的行业:" let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 4
let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle]
label.attributedText = NSAttributedString(string: "根据您目前给来的材料,初步建议您申请的行业:", attributes: attributes)
return label return label
}() }()
...@@ -59,8 +68,11 @@ class YHIndustryLocationCell: UITableViewCell { ...@@ -59,8 +68,11 @@ class YHIndustryLocationCell: UITableViewCell {
let label = UILabel() let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = .init(hex: 0x8993A2) label.textColor = .init(hex: 0x8993A2)
label.numberOfLines = 0 label.numberOfLines = 0
label.text = "后续会根据您文书准备的补充情况来最终确定,如有修改会再告知您。" let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 4
let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle]
label.attributedText = NSAttributedString(string: "后续会根据您文书准备的补充情况来最终确定,如有修改会再告知您。", attributes: attributes)
return label return label
}() }()
......
...@@ -43,10 +43,16 @@ class YHMaterialListCell: UITableViewCell { ...@@ -43,10 +43,16 @@ class YHMaterialListCell: UITableViewCell {
lazy var tips1Label: UILabel = { lazy var tips1Label: UILabel = {
let label = UILabel() let label = UILabel()
label.numberOfLines = 0 label.numberOfLines = 0
let aa: ASAttributedString = .init("这是您的资料清单,请您前往查看。请您在", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("1-2周内", .font(UIFont.PFSC_M(ofSize: 14)),.foreground(UIColor.init(hex: 0xD48638))) let paragraphStyle = NSMutableParagraphStyle()
let cc: ASAttributedString = .init("上传基础类证件哦,需要重新办理的可以晚些提供。需要注意的点如下:", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor)) paragraphStyle.lineSpacing = 4
label.attributed.text = aa+bb+cc
let a = NSMutableAttributedString(string: "这是您的资料清单,请您前往查看。请您在", attributes: [NSAttributedString.Key.foregroundColor : UIColor.mainTextColor, NSAttributedString.Key.font: UIFont.PFSC_R(ofSize: 14), NSAttributedString.Key.paragraphStyle: paragraphStyle])
let b = NSMutableAttributedString(string: "1-2周内", attributes: [NSAttributedString.Key.foregroundColor : UIColor.init(hex: 0xD48638), NSAttributedString.Key.font: UIFont.PFSC_M(ofSize: 14), NSAttributedString.Key.paragraphStyle: paragraphStyle])
let c = NSMutableAttributedString(string: "上传基础类证件哦,需要重新办理的可以晚些提供。需要注意的点如下:", attributes: [NSAttributedString.Key.foregroundColor : UIColor.mainTextColor, NSAttributedString.Key.font: UIFont.PFSC_R(ofSize: 14), NSAttributedString.Key.paragraphStyle: paragraphStyle])
a.append(b)
a.append(c)
label.attributedText = a
return label return label
}() }()
...@@ -55,7 +61,11 @@ class YHMaterialListCell: UITableViewCell { ...@@ -55,7 +61,11 @@ class YHMaterialListCell: UITableViewCell {
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = .init(hex: 0x8993A2) label.textColor = .init(hex: 0x8993A2)
label.numberOfLines = 0 label.numberOfLines = 0
label.text = "(1)港澳通如未办理,请优先安排办理;\n(2)如为国内学校,需准备由教育部学信网出具的学位认证报告;\n(3)如为海外学校,需准备官方成绩单和第三方机构学位认证文件;\n(4)赴港同意书,在获批后1个月内,由您获批时在职公司盖章出具即可(目前不需要提供)。" let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 4
let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle]
label.attributedText = NSAttributedString(string: "(1)港澳通如未办理,请优先安排办理;\n(2)如为国内学校,需准备由教育部学信网出具的学位认证报告;\n(3)如为海外学校,需准备官方成绩单和第三方机构学位认证文件;\n(4)赴港同意书,在获批后1个月内,由您获批时在职公司盖章出具即可(目前不需要提供)。", attributes: attributes)
return label return label
}() }()
......
...@@ -21,7 +21,6 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -21,7 +21,6 @@ class YHEducationDetailVC: YHBaseViewController {
var isNeedShowError = false var isNeedShowError = false
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel() let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
var detailInfo: YHEducationDetailInfo = YHEducationDetailInfo() var detailInfo: YHEducationDetailInfo = YHEducationDetailInfo()
var isCerConfirm: Bool? = nil
var items:[[YHFormItemProtocol]] = [] var items:[[YHFormItemProtocol]] = []
...@@ -107,28 +106,40 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -107,28 +106,40 @@ class YHEducationDetailVC: YHBaseViewController {
let title0 = YHFormTitleItem(type: .mainApplicantEducation) let title0 = YHFormTitleItem(type: .mainApplicantEducation)
let item00 = YHFormDetailItem(type: .universityFullName) let item00 = YHFormDetailItem(type: .universityFullName)
item00.tips = "请选择学校".local if detailInfo.degree.contains("学士学位") {
item00.tips = "请输入学校全称".local
item00.placeHolder = "请输入学校全称,例:清华,需填全称“清华大学”".local
} else {
item00.tips = "请选择学校".local
item00.placeHolder = "请选择学校"
}
item00.value = detailInfo.college item00.value = detailInfo.college
let item01 = YHFormDetailItem(type: .educationStyle) let item01 = YHFormDetailItem(type: .educationStyle)
item01.tips = "请选择授课形式".local item01.tips = "请选择授课形式".local
item01.placeHolder = "请选择授课形式"
item01.value = detailInfo.teachingFormat item01.value = detailInfo.teachingFormat
let item02 = YHFormDetailItem(type: .educationTime) let item02 = YHFormDetailItem(type: .educationTime)
item02.tips = "请选择年月".local item02.tips = "请选择年月".local
item02.placeHolder = "请选择年月".local
item02.value = detailInfo.admissionTime item02.value = detailInfo.admissionTime
let item03 = YHFormDetailItem(type: .graduateTime) let item03 = YHFormDetailItem(type: .graduateTime)
item03.tips = "请选择年月".local item03.tips = "请选择年月".local
item03.placeHolder = "请选择年月".local
item03.value = detailInfo.graduateTime item03.value = detailInfo.graduateTime
let item04 = YHFormDetailItem(type: .educationMajor) let item04 = YHFormDetailItem(type: .educationMajor)
item04.tips = "请输入专业".local item04.tips = "请选择专业".local
item04.placeHolder = "请选择专业".local
item04.value = detailInfo.major item04.value = detailInfo.major
let item05 = YHFormDetailItem(type: .educationDegree) let item05 = YHFormDetailItem(type: .educationDegree)
item05.tips = "请选择学位".local item05.tips = "请选择学位".local
item05.placeHolder = "请选择学位".local
item05.value = detailInfo.degree item05.value = detailInfo.degree
let item06 = YHFormDetailItem(type: .degreeType) let item06 = YHFormDetailItem(type: .degreeType)
...@@ -136,7 +147,8 @@ class YHEducationDetailVC: YHBaseViewController { ...@@ -136,7 +147,8 @@ class YHEducationDetailVC: YHBaseViewController {
item06.value = detailInfo.degreeType item06.value = detailInfo.degreeType
let item07 = YHFormDetailItem(type: .educationCountry) let item07 = YHFormDetailItem(type: .educationCountry)
item07.tips = "请输入国家及地区".local item07.tips = "请选择国家及地区".local
item07.placeHolder = "请选择国家及地区".local
item07.value = detailInfo.schoolAddress.country item07.value = detailInfo.schoolAddress.country
let item08 = YHFormDetailItem(type: .educationCity) let item08 = YHFormDetailItem(type: .educationCity)
...@@ -239,6 +251,12 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -239,6 +251,12 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} else { } else {
detailInfo.major = "" detailInfo.major = ""
} }
} else if detailItem.type == .universityFullName {
if let text = text, !text.isEmpty {
detailInfo.college = text
} else {
detailInfo.college = ""
}
} }
if isEditEnd { if isEditEnd {
loadInfo() loadInfo()
...@@ -267,13 +285,19 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -267,13 +285,19 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} else if cellType == .cerConfirm { } else if cellType == .cerConfirm {
let cell = tableView.dequeueReusableCell(withIdentifier: YHEducationCertificateConfirmCell.cellReuseIdentifier, for: indexPath) as! YHEducationCertificateConfirmCell let cell = tableView.dequeueReusableCell(withIdentifier: YHEducationCertificateConfirmCell.cellReuseIdentifier, for: indexPath) as! YHEducationCertificateConfirmCell
cell.isCheck = isNeedShowError
var isSelectTrue = false var isSelectTrue = false
var isSelectFalse = false var isSelectFalse = false
if let isCerConfirm = isCerConfirm { let isCerConfirm = detailInfo.certConfirm
isSelectTrue = isCerConfirm if isCerConfirm == 1 {
isSelectFalse = !isCerConfirm isSelectTrue = true
isSelectFalse = false
} else if isCerConfirm == 2 {
isSelectFalse = true
isSelectTrue = false
} }
let answers = [YHFormChoiceItem(title: "是".local, isSelect: isSelectTrue), let answers = [YHFormChoiceItem(title: "是".local, isSelect: isSelectTrue),
YHFormChoiceItem(title: "否".local, isSelect: isSelectFalse)] YHFormChoiceItem(title: "否".local, isSelect: isSelectFalse)]
...@@ -284,7 +308,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -284,7 +308,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
let selectItem:YHFormChoiceItem = arr[selectIndex] let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? true : false) let option = (selectItem.title == "是".local ? true : false)
self.isCerConfirm = option detailInfo.certConfirm = option ? 1 : 2
self.tableView.reloadData() self.tableView.reloadData()
} }
return cell return cell
...@@ -331,7 +355,11 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -331,7 +355,11 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
let detailItem = item as! YHFormDetailItem let detailItem = item as! YHFormDetailItem
if detailItem.type == .universityFullName { // 选择大学名称 if detailItem.type == .universityFullName { // 选择大学名称
if detailInfo.degree.contains("学士学位") {
// 此时学位是输入
return
}
let vc = YHCollegeSearchViewController() let vc = YHCollegeSearchViewController()
vc.orderId = self.orderId vc.orderId = self.orderId
vc.searchCollegeName = detailInfo.college vc.searchCollegeName = detailInfo.college
...@@ -416,7 +444,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -416,7 +444,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .educationDegree { // 学位 } else if detailItem.type == .educationDegree { // 学位
YHSheetPickerView.show(type:.educationDegree, selectTitle:detailInfo.degree) { YHSheetPickerView.show(type:.degree, selectTitle:detailInfo.degree) {
[weak self] item in [weak self] item in
guard let self = self else { return } guard let self = self else { return }
detailInfo.degree = item.title detailInfo.degree = item.title
...@@ -467,6 +495,24 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -467,6 +495,24 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
saveInfoSilent() saveInfoSilent()
} }
self.present(vc, animated: true) self.present(vc, animated: true)
} else if detailItem.type == .educationMajor { // 专业
let vc = YHMajorSearchViewController()
vc.orderId = self.orderId
vc.searchMajorName = detailInfo.major
vc.selectBlock = {
[weak self] text in
guard let self = self else { return }
if let text = text, !text.isEmpty {
detailInfo.major = text
} else {
detailInfo.major = ""
}
loadInfo()
saveInfoSilent()
}
self.navigationController?.pushViewController(vc)
} }
} }
} }
...@@ -514,6 +560,19 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -514,6 +560,19 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
return .cerConfirm return .cerConfirm
} }
// 学位选择:学士学位,
// 学习全称:直接输入学校名称,不需要进入搜索页面
//
// 学位选择:硕士学位/博士学位,
// 学习全称:需要进入名校库搜索页面,模糊搜索名校,若搜不到直接输入
if detailItem.type == .universityFullName { // 学校全称
if detailInfo.degree.contains("学士学位") {
return .inputText
}
return .selectSheet
}
if detailItem.type == .educationCity { if detailItem.type == .educationCity {
if detailInfo.isSchoolInAboard() { if detailInfo.isSchoolInAboard() {
return .inputText return .inputText
...@@ -522,10 +581,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -522,10 +581,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} }
if detailItem.type == .educationMajor if detailItem.type == .educationMajor
{
return .inputText
}
if detailItem.type == .universityFullName
|| detailItem.type == .educationStyle || detailItem.type == .educationStyle
|| detailItem.type == .educationTime || detailItem.type == .educationTime
|| detailItem.type == .graduateTime || detailItem.type == .graduateTime
...@@ -582,6 +637,10 @@ extension YHEducationDetailVC { ...@@ -582,6 +637,10 @@ extension YHEducationDetailVC {
return false return false
} }
if detailInfo.certConfirm == 0 { // 证件提供确认
return false
}
// if detailInfo.isSchoolInAboard(), detailInfo.schoolAddress.foreign.isEmpty { // if detailInfo.isSchoolInAboard(), detailInfo.schoolAddress.foreign.isEmpty {
// return false // return false
// } // }
......
//
// YHMajorSearchViewController.swift
// galaxy
//
// Created by Dufet on 2024/11/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMajorSearchViewController: YHBaseViewController {
var orderId:Int = 0
var searchMajorName:String?
var selectBlock:((String?)->Void)?
var majors:[YHMajorInfo] = []
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
lazy var searchBar: YHCollegeSearchBar = {
let bar = YHCollegeSearchBar.createBar()
bar.placeHolder = "请输入专业"
return bar
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.plain)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .white
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHMajorNameCell.self, forCellReuseIdentifier: YHMajorNameCell.cellReuseIdentifier)
tableView.backgroundView = emptyDataTipsView
return tableView
}()
lazy var emptyDataTipsView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("无搜索结果", kEmptySearchBgName)
view.topMargin = 130
view.isHidden = true
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
createUI()
if searchMajorName != nil {
searchMajor()
}
}
func createUI() {
self.view.backgroundColor = .white
self.gk_navTitle = "学校名称".local
view.addSubview(tableView)
view.addSubview(searchBar)
if let searchMajorName = searchMajorName {
searchBar.textField.text = searchMajorName
}
searchBar.textChange = {
[weak self] text in
guard let self = self else { return }
searchMajorName = text
self.searchMajor()
}
searchBar.confirmBlock = {
[weak self] in
guard let self = self else { return }
if let selectBlock = selectBlock {
selectBlock(searchBar.textField.text)
self.navigationController?.popViewController(animated: true)
}
}
searchBar.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.height.equalTo(YHCollegeSearchBar.height)
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar+16)
}
tableView.snp.makeConstraints { make in
make.top.equalTo(searchBar.snp.bottom).offset(8)
make.left.right.bottom.equalToSuperview()
}
}
func searchMajor() {
let param:[String:Any] = ["order_id": orderId,
"name":searchMajorName ?? "",
"page":1,
"page_size":15,
]
self.educationRequest.searchMajorInfoList(params: param) {
[weak self] success, error in
guard let self = self else { return }
if success {
if let list = self.educationRequest.majorList {
majors = list
} else {
majors = []
}
emptyDataTipsView.isHidden = majors.count > 0
}
self.tableView.reloadData()
}
}
}
extension YHMajorSearchViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return majors.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMajorNameCell.cellReuseIdentifier, for: indexPath) as! YHMajorNameCell
if indexPath.row < majors.count {
let college:YHMajorInfo = majors[indexPath.row]
var name = ""
if !isEmptyString(college.ch_name) {
name += college.ch_name
}
if !isEmptyString(college.en_name) && !isEmptyString(college.en_name) {
name += "/"
}
if !isEmptyString(college.en_name) {
name += college.en_name
}
cell.titleLabel.text = name
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let selectBlock = selectBlock {
if indexPath.row < majors.count {
let major:YHMajorInfo = majors[indexPath.row]
selectBlock(major.getMajorName())
self.navigationController?.popViewController(animated: true)
}
}
}
}
...@@ -89,8 +89,13 @@ class YHEducationDetailInfo: SmartCodable { ...@@ -89,8 +89,13 @@ class YHEducationDetailInfo: SmartCodable {
var degreeType: String = "" var degreeType: String = ""
var schoolAddress: YHCollegeAddress = YHCollegeAddress() var schoolAddress: YHCollegeAddress = YHCollegeAddress()
var isAboardSchool: Bool = false var isAboardSchool: Bool = false
var majorOther: String = ""
var hasBachelorDegree: Int = 0
// 证件提供确认 0 未选择 1 是 2 否
var certConfirm: Int = 0
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id = "id" case id = "id"
case college = "college" case college = "college"
case teachingFormat = "teaching_format" case teachingFormat = "teaching_format"
...@@ -101,6 +106,9 @@ class YHEducationDetailInfo: SmartCodable { ...@@ -101,6 +106,9 @@ class YHEducationDetailInfo: SmartCodable {
case degreeType = "degree_type" case degreeType = "degree_type"
case schoolAddress = "school_address" case schoolAddress = "school_address"
case isAboardSchool = "is_aboard_school" case isAboardSchool = "is_aboard_school"
case majorOther = "major_other"
case hasBachelorDegree = "has_bachelor_degree"
case certConfirm = "cert_confirm"
} }
required init() { required init() {
...@@ -205,5 +213,24 @@ class YHCollegeInfo: SmartCodable { ...@@ -205,5 +213,24 @@ class YHCollegeInfo: SmartCodable {
} }
} }
class YHMajorInfo: SmartCodable {
var id: Int = 0
var ch_name: String = ""
var en_name: String = ""
func getMajorName() -> String {
if !ch_name.isEmpty {
return ch_name
}
return en_name
}
required init() {
}
}
...@@ -17,7 +17,9 @@ class YHEducationRequestViewModel { ...@@ -17,7 +17,9 @@ class YHEducationRequestViewModel {
var qualificationDetailInfo: YHQualificationDetailInfo? var qualificationDetailInfo: YHQualificationDetailInfo?
// 搜索学校数组 // 搜索学校数组
var collegeList: [YHCollegeInfo]? var collegeList: [YHCollegeInfo]?
// 搜索专业数组
var majorList: [YHMajorInfo]?
// 请求学历和专业证书信息列表 // 请求学历和专业证书信息列表
func requestEducationInfoList(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func requestEducationInfoList(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
...@@ -294,4 +296,35 @@ class YHEducationRequestViewModel { ...@@ -294,4 +296,35 @@ class YHEducationRequestViewModel {
} }
} }
// 搜索专业
func searchMajorInfoList(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.searchMajorNameApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let dic = json.data?.peel as? [Any], let results = [YHMajorInfo].deserialize(from: dic) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false, error)
return
}
majorList = results
callBackBlock(true, nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
YHHUD.hide()
callBackBlock(false, err)
}
}
} }
...@@ -23,7 +23,7 @@ class YHEducationCertificateConfirmCell: UITableViewCell { ...@@ -23,7 +23,7 @@ class YHEducationCertificateConfirmCell: UITableViewCell {
private let answerBaseTag = 9527 private let answerBaseTag = 9527
// 是否必须字段 // 是否必须字段
var isMust:Bool = false var isCheck:Bool = false
var answerBlock:(([YHFormChoiceItem], Int)->Void)? var answerBlock:(([YHFormChoiceItem], Int)->Void)?
// 必须传2个item的arr // 必须传2个item的arr
...@@ -55,9 +55,15 @@ class YHEducationCertificateConfirmCell: UITableViewCell { ...@@ -55,9 +55,15 @@ class YHEducationCertificateConfirmCell: UITableViewCell {
} }
} else { // 没有选择 } else { // 没有选择
let tips: ASAttributedString = .init("请选择", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.failColor)) if isCheck {
tipsLabel.attributed.text = tips let tips: ASAttributedString = .init("请选择", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.failColor))
isNeedShowTips(true) tipsLabel.attributed.text = tips
isNeedShowTips(true)
} else {
tipsLabel.attributed.text = ""
isNeedShowTips(false)
}
} }
} else { } else {
......
//
// YHMajorNameCell.swift
// galaxy
//
// Created by Dufet on 2024/11/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMajorNameCell: UITableViewCell {
static let cellReuseIdentifier = "YHMajorNameCell"
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_B(ofSize: 14)
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
contentView.backgroundColor = .white
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(21)
make.right.equalToSuperview().offset(-21)
make.top.equalToSuperview().offset(8)
make.bottom.equalToSuperview().offset(-8)
}
}
}
...@@ -15,11 +15,15 @@ class YHIncomeRecordViewController: YHBaseViewController { ...@@ -15,11 +15,15 @@ class YHIncomeRecordViewController: YHBaseViewController {
case incomeSummary(_ isEditing: Bool = false, _ isEditEnable: Bool = false) case incomeSummary(_ isEditing: Bool = false, _ isEditEnable: Bool = false)
case incomeItem(_ isEditState: Bool = false, _ company: String, _ money: String, _ timeStr: String, _ incomeId: Int) case incomeItem(_ isEditState: Bool = false, _ company: String, _ money: String, _ timeStr: String, _ incomeId: Int)
case totalIncome(_ money: ASAttributedString) case totalIncome(_ money: ASAttributedString)
case consentForHKTravel(_ title: String, _ detail: ASAttributedString, _ question: String, _ isSelectSureBtn: Bool = true) case consentForHKTravel(_ title: String, _ detail: ASAttributedString, _ question: String)
} }
private lazy var datas: [[TableRow]] = [] private lazy var datas: [[TableRow]] = []
/// 是否超过
private var isOver100OK = true
private var over100IndexPath: IndexPath?
private lazy var viewModel = YHIncomeRecordViewModel() private lazy var viewModel = YHIncomeRecordViewModel()
private var incomeModel = YHIncomeRecordCompleteModel() private var incomeModel = YHIncomeRecordCompleteModel()
...@@ -113,6 +117,9 @@ extension YHIncomeRecordViewController { ...@@ -113,6 +117,9 @@ extension YHIncomeRecordViewController {
} }
@objc private func clickSubmitButton() { @objc private func clickSubmitButton() {
guard checkInput() else {
return
}
updateIncome(.submit) updateIncome(.submit)
} }
...@@ -158,7 +165,7 @@ extension YHIncomeRecordViewController { ...@@ -158,7 +165,7 @@ extension YHIncomeRecordViewController {
private func setupData() { private func setupData() {
let detail: ASAttributedString = .init(string: "备注:全年收入是指应课税(应纳所得税)的就业或业务收入,包括工资薪金、津贴、股票期权及从其拥有的公司所得的利润。由个人投资所产生的收入不会计算在内。", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor(hexString: "#8993A2") ?? .gray)) let detail: ASAttributedString = .init(string: "备注:全年收入是指应课税(应纳所得税)的就业或业务收入,包括工资薪金、津贴、股票期权及从其拥有的公司所得的利润。由个人投资所产生的收入不会计算在内。", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor(hexString: "#8993A2") ?? .gray))
let firstSection: [TableRow] = [.consentForHKTravel("收入情况", detail, "您在前一年,全年收入是否达港币100万元或以上", incomeModel.income_over_100 == YHIncomeOver100.true.rawValue)] let firstSection: [TableRow] = [.consentForHKTravel("收入情况", detail, "您在前一年,全年收入是否达港币100万元或以上")]
guard incomeModel.income_over_100 == YHIncomeOver100.true.rawValue else { guard incomeModel.income_over_100 == YHIncomeOver100.true.rawValue else {
datas = [firstSection] datas = [firstSection]
tableView.reloadData() tableView.reloadData()
...@@ -167,14 +174,15 @@ extension YHIncomeRecordViewController { ...@@ -167,14 +174,15 @@ extension YHIncomeRecordViewController {
let hkdFormatter = currencyFormat("") let hkdFormatter = currencyFormat("")
var money: Double = 0 var money: Double = 0
var secondSection: [TableRow] = [.incomeSummary(false, false)] var secondSection: [TableRow] = [.incomeSummary(false, false)]
let rate = self.incomeModel.rate > 0 ? self.incomeModel.rate : 0.92
incomeModel.list.forEach { companyModel in incomeModel.list.forEach { companyModel in
money += companyModel.income_money money += companyModel.income_money
let moneyStr = "约" + (hkdFormatter.string(from: NSNumber(value: companyModel.income_money)) ?? "0") + "港币" let moneyStr = "约" + (hkdFormatter.string(from: NSNumber(value: companyModel.income_money / rate)) ?? "0") + "港币"
let timeStr: String = companyModel.fill_status ? "已填写" : "有\(companyModel.unfilled_count)项未填写" let timeStr: String = companyModel.fill_status ? "已填写" : "有\(companyModel.unfilled_count)项未填写"
let incomeItem: TableRow = .incomeItem(false, companyModel.company_name, moneyStr, timeStr, companyModel.income_id) let incomeItem: TableRow = .incomeItem(false, companyModel.company_name, moneyStr, timeStr, companyModel.income_id)
secondSection.append(incomeItem) secondSection.append(incomeItem)
} }
let totalNum = hkdFormatter.string(from: NSNumber(value: money)) ?? "0" let totalNum = hkdFormatter.string(from: NSNumber(value: money / rate)) ?? "0"
let totalMoney: ASAttributedString = .init(string: "约 ", .font(.PFSC_R(ofSize: 14))) + .init(string: totalNum, .font(UIFont(name: "DINAlternate-Bold", size: 20) ?? UIFont.systemFont(ofSize: 20))) + .init(string: " 港币", .font(.PFSC_R(ofSize: 14))) let totalMoney: ASAttributedString = .init(string: "约 ", .font(.PFSC_R(ofSize: 14))) + .init(string: totalNum, .font(UIFont(name: "DINAlternate-Bold", size: 20) ?? UIFont.systemFont(ofSize: 20))) + .init(string: " 港币", .font(.PFSC_R(ofSize: 14)))
secondSection.append(.totalIncome(totalMoney)) secondSection.append(.totalIncome(totalMoney))
datas = [firstSection, secondSection] datas = [firstSection, secondSection]
...@@ -236,17 +244,37 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour ...@@ -236,17 +244,37 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour
} }
return cell return cell
} }
case let .consentForHKTravel(title, detail, question, isSelectSureBtn): case let .consentForHKTravel(title, detail, question):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHInfoConsentForHKTravelCell.cellReuseIdentifier) as? YHInfoConsentForHKTravelCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHInfoConsentForHKTravelCell.cellReuseIdentifier) as? YHInfoConsentForHKTravelCell {
cell.setupCellInfo(title: title, detail: detail, question: question) over100IndexPath = indexPath
cell.setupCellInfo(title: title, detail: detail, question: question, needShowFailButton: !isOver100OK)
cell.didSelectSureButton = { [weak self] selected in cell.didSelectSureButton = { [weak self] selected in
guard let self = self else { guard let self = self else {
return return
} }
self.incomeModel.income_over_100 = selected ? YHIncomeOver100.true.rawValue : YHIncomeOver100.false.rawValue switch selected {
case .true:
self.incomeModel.income_over_100 = YHIncomeOver100.true.rawValue
isOver100OK = true
case .false:
self.incomeModel.income_over_100 = YHIncomeOver100.false.rawValue
isOver100OK = true
case .unknown:
self.incomeModel.income_over_100 = YHIncomeOver100.unknown.rawValue
isOver100OK = false
}
self.setupData() self.setupData()
} }
cell.selectedSureButton = isSelectSureBtn let over100Type = YHIncomeOver100(rawValue: incomeModel.income_over_100) ?? .unknown
switch over100Type {
case .true:
cell.selectedSureButton = .true
case .false:
cell.selectedSureButton = .false
case .unknown:
cell.selectedSureButton = .unknown
}
return cell return cell
} }
...@@ -287,6 +315,18 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour ...@@ -287,6 +315,18 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour
} }
extension YHIncomeRecordViewController { extension YHIncomeRecordViewController {
private func checkInput() -> Bool {
if incomeModel.income_over_100 == YHIncomeOver100.unknown.rawValue {
isOver100OK = false
if let over100IndexPath = over100IndexPath, tableView.numberOfSections > over100IndexPath.section, tableView.numberOfRows(inSection: over100IndexPath.section) > over100IndexPath.row {
tableView.reloadRows(at: [over100IndexPath], with: .none)
}
return false
}
isOver100OK = true
return true
}
private func requestData(isNeedLoading: Bool = false) { private func requestData(isNeedLoading: Bool = false) {
if isNeedLoading { if isNeedLoading {
YHHUD.show(.progress(message: "加载中...")) YHHUD.show(.progress(message: "加载中..."))
...@@ -306,6 +346,7 @@ extension YHIncomeRecordViewController { ...@@ -306,6 +346,7 @@ extension YHIncomeRecordViewController {
} }
self.datas = [] self.datas = []
self.tableView.reloadData() self.tableView.reloadData()
self.navigationController?.popViewController(animated: true)
return return
} }
self.incomeModel = incomeModel self.incomeModel = incomeModel
...@@ -314,10 +355,9 @@ extension YHIncomeRecordViewController { ...@@ -314,10 +355,9 @@ extension YHIncomeRecordViewController {
} }
private func updateIncome(_ type: YHIncomeRecordUpdateType) { private func updateIncome(_ type: YHIncomeRecordUpdateType) {
let incomeOver100: YHIncomeOver100 = YHIncomeOver100(rawValue: incomeModel.income_over_100) ?? .true
let msg = type == .save ? "保存中..." : "提交中..." let msg = type == .save ? "保存中..." : "提交中..."
YHHUD.show(.progress(message: msg)) YHHUD.show(.progress(message: msg))
viewModel.incomeUpdate(orderId: orderId, incomeOver100: incomeOver100, type: type) { [weak self] success, error in viewModel.incomeUpdate(orderId: orderId, incomeOver100: incomeModel.income_over_100, type: type) { [weak self] success, error in
guard let self = self else { guard let self = self else {
return return
} }
...@@ -327,6 +367,8 @@ extension YHIncomeRecordViewController { ...@@ -327,6 +367,8 @@ extension YHIncomeRecordViewController {
YHHUD.flash(message: msg) YHHUD.flash(message: msg)
if type == .submit { if type == .submit {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} else {
self.requestData(isNeedLoading: true)
} }
} else if let errorMsg = error?.errorMsg, errorMsg.count > 0 { } else if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg) YHHUD.flash(message: errorMsg)
......
...@@ -17,17 +17,30 @@ class YHIncomeRecordWorkExperienceViewController: YHBaseViewController { ...@@ -17,17 +17,30 @@ class YHIncomeRecordWorkExperienceViewController: YHBaseViewController {
case incomeTypes(_ types: [YHIncomeType]) case incomeTypes(_ types: [YHIncomeType])
case inputMoney(_ title: String, _ detail: String?, _ inputStr: String?, _ showBottomLine: Bool, _ showStar: Bool, _ isIncomeMoney: Bool) case inputMoney(_ title: String, _ detail: String?, _ inputStr: String?, _ showBottomLine: Bool, _ showStar: Bool, _ isIncomeMoney: Bool)
case inputRemark(_ detail: String) case inputRemark(_ detail: String)
case documentComfirm(_ title: String, _ question: String, _ isSelectedSure: Bool, _ docs: [String]) case documentComfirm(_ title: String, _ question: String, _ docs: [String])
} }
private lazy var datas: [[TableRow]] = [] private lazy var datas: [[TableRow]] = []
private var selectedTypes: [YHIncomeType] = [] private var selectedTypes: [YHIncomeType] = []
private let currencyRate = 0.92 private let currencyRate = 0.92
private var isSaving = false private var isSaving = false
var submitSuccess: (() -> Void)? var submitSuccess: (() -> Void)?
// 校验字段控制
/// 是否选定收入类型
private var isIncomeTypeOK = true
private var incomeTypeIndexPath: IndexPath?
/// 是否选定文件
private var isHasAllFileOK = true
private var hasAllFileIndexPath: IndexPath?
/// 是否收入金额已填写
private var isIncomeMoneyOK = true
private var incomMoneyIndexPath: IndexPath?
private lazy var viewModel = YHIncomeRecordViewModel() private lazy var viewModel = YHIncomeRecordViewModel()
private var companyModel = YHIncomeCompanyDetailModel() private var companyModel = YHIncomeCompanyDetailModel()
...@@ -76,17 +89,17 @@ class YHIncomeRecordWorkExperienceViewController: YHBaseViewController { ...@@ -76,17 +89,17 @@ class YHIncomeRecordWorkExperienceViewController: YHBaseViewController {
view.keyboardDismissMode = .onDrag view.keyboardDismissMode = .onDrag
return view return view
}() }()
private let incomeId: Int private let incomeId: Int
init(incomeId: Int) { init(incomeId: Int) {
self.incomeId = incomeId self.incomeId = incomeId
super.init(nibName: nil, bundle: nil) super.init(nibName: nil, bundle: nil)
} }
@MainActor required init?(coder: NSCoder) { @MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setupUI() setupUI()
...@@ -102,7 +115,7 @@ class YHIncomeRecordWorkExperienceViewController: YHBaseViewController { ...@@ -102,7 +115,7 @@ class YHIncomeRecordWorkExperienceViewController: YHBaseViewController {
super.viewWillDisappear(animated) super.viewWillDisappear(animated)
IQKeyboardManager.shared.enable = false IQKeyboardManager.shared.enable = false
} }
override func backItemClick(_ sender: Any) { override func backItemClick(_ sender: Any) {
guard !isSaving else { guard !isSaving else {
return return
...@@ -112,7 +125,7 @@ class YHIncomeRecordWorkExperienceViewController: YHBaseViewController { ...@@ -112,7 +125,7 @@ class YHIncomeRecordWorkExperienceViewController: YHBaseViewController {
self?.isSaving = false self?.isSaving = false
} }
} }
/// 是否可以返回,包括点击返回和手势返回,默认YES /// 是否可以返回,包括点击返回和手势返回,默认YES
override func navigationShouldPop() -> Bool { override func navigationShouldPop() -> Bool {
guard !isSaving else { guard !isSaving else {
...@@ -175,16 +188,16 @@ extension YHIncomeRecordWorkExperienceViewController { ...@@ -175,16 +188,16 @@ extension YHIncomeRecordWorkExperienceViewController {
let rmbFmt = currencyFormat("¥") let rmbFmt = currencyFormat("¥")
let rate = companyModel.rate > 0 ? companyModel.rate : 0.92 let rate = companyModel.rate > 0 ? companyModel.rate : 0.92
if selectedTypes.contains(.incomeOfMainland) || selectedTypes.contains(.incomeOfHKCompanies) || selectedTypes.contains(.incomeOfMacauCompanies) || selectedTypes.contains(.incomeOfOtherOverseasCompanies) { if selectedTypes.contains(.incomeOfMainland) || selectedTypes.contains(.incomeOfHKCompanies) || selectedTypes.contains(.incomeOfMacauCompanies) || selectedTypes.contains(.incomeOfOtherOverseasCompanies) {
firstSection.append(.inputMoney("公司营业额(近一年)", "约\(hkdFmt.string(from: NSNumber(value: companyModel.corporate_turnover / rate)) ?? "0")港币", (rmbFmt.string(from: NSNumber(value: companyModel.corporate_turnover)) ?? "0"), true, false, false)) firstSection.append(.inputMoney("公司营业额(近一年)", "约\(hkdFmt.string(from: NSNumber(value: companyModel.corporate_turnover / rate)) ?? "0")港币", rmbFmt.string(from: NSNumber(value: companyModel.corporate_turnover)) ?? "0", true, false, false))
} }
firstSection.append(.inputMoney("收入金额", "约\(hkdFmt.string(from: NSNumber(value: companyModel.income_money / rate)) ?? "0")港币", (rmbFmt.string(from: NSNumber(value: companyModel.income_money)) ?? "0"), false, true, true)) firstSection.append(.inputMoney("收入金额", "约\(hkdFmt.string(from: NSNumber(value: companyModel.income_money / rate)) ?? "0")港币", rmbFmt.string(from: NSNumber(value: companyModel.income_money)) ?? "0", false, true, true))
firstSection.append(.inputRemark("注:按1港币≈\(rate)人民币计算,实际金额按递交时入境处给出的汇率为准")) firstSection.append(.inputRemark("注:按1港币≈\(rate)人民币计算,实际金额按递交时入境处给出的汇率为准"))
let set = Set(selectedTypes.map { $0.docsArray() }.flatMap{ $0 }) let set = Set(selectedTypes.map { $0.docsArray() }.flatMap { $0 })
var arr = Array(set) var arr = Array(set)
if set.count == 0 { if set.count == 0 {
arr = YHIncomeType.defaultDocs() arr = YHIncomeType.defaultDocs()
} }
let secondSection: [TableRow] = [.documentComfirm("证件提供确认", "您是否可以提供以下所有证明文件", companyModel.has_all_file == YHIncomeRecordHasAllFile.true.rawValue, arr)] let secondSection: [TableRow] = [.documentComfirm("证件提供确认", "您是否可以提供以下所有证明文件", arr)]
datas = [firstSection, secondSection] datas = [firstSection, secondSection]
tableView.reloadData() tableView.reloadData()
} }
...@@ -206,9 +219,13 @@ extension YHIncomeRecordWorkExperienceViewController { ...@@ -206,9 +219,13 @@ extension YHIncomeRecordWorkExperienceViewController {
private func updateSelectTypes() { private func updateSelectTypes() {
companyModel.income_type = selectedTypes.map { $0.rawValue } companyModel.income_type = selectedTypes.map { $0.rawValue }
if companyModel.income_type.count > 0 {
isIncomeTypeOK = true
}
var incomeTypesIndexPath: IndexPath? var incomeTypesIndexPath: IndexPath?
var incomeTypeSelectIndexPath: IndexPath? var incomeTypeSelectIndexPath: IndexPath?
var docIndexPath: IndexPath? var docIndexPath: IndexPath?
var incomeCompanyIndexPath: IndexPath?
datas = datas.enumerated().map { section, sectionArr in datas = datas.enumerated().map { section, sectionArr in
sectionArr.enumerated().map { row, tableRow in sectionArr.enumerated().map { row, tableRow in
switch tableRow { switch tableRow {
...@@ -218,14 +235,19 @@ extension YHIncomeRecordWorkExperienceViewController { ...@@ -218,14 +235,19 @@ extension YHIncomeRecordWorkExperienceViewController {
case let .incomeTypeSelect(title, detail, _): case let .incomeTypeSelect(title, detail, _):
incomeTypeSelectIndexPath = IndexPath(row: row, section: section) incomeTypeSelectIndexPath = IndexPath(row: row, section: section)
return .incomeTypeSelect(title, detail, selectedTypes.count > 0) return .incomeTypeSelect(title, detail, selectedTypes.count > 0)
case let .documentComfirm(title, question, isSelectSure, docs): case let .documentComfirm(title, question, _):
docIndexPath = IndexPath(row: row, section: section) docIndexPath = IndexPath(row: row, section: section)
let set = Set(selectedTypes.map { $0.docsArray() }.flatMap{ $0 }) let set = Set(selectedTypes.map { $0.docsArray() }.flatMap { $0 })
if set.count > 0 { if set.count > 0 {
return .documentComfirm(title, question, isSelectSure, Array(set)) return .documentComfirm(title, question, Array(set))
} else { } else {
return .documentComfirm(title, question, isSelectSure, YHIncomeType.defaultDocs()) return .documentComfirm(title, question, YHIncomeType.defaultDocs())
}
case let .inputMoney(_, _, _, _, _, isIncomeMoney):
if !isIncomeMoney {
incomeCompanyIndexPath = IndexPath(row: row, section: section)
} }
return tableRow
default: default:
return tableRow return tableRow
} }
...@@ -248,6 +270,41 @@ extension YHIncomeRecordWorkExperienceViewController { ...@@ -248,6 +270,41 @@ extension YHIncomeRecordWorkExperienceViewController {
sectionArr.remove(at: incomeTypesIndexPath.row) sectionArr.remove(at: incomeTypesIndexPath.row)
datas[incomeTypesIndexPath.section] = sectionArr datas[incomeTypesIndexPath.section] = sectionArr
} }
if selectedTypes.contains(.incomeOfMainland) || selectedTypes.contains(.incomeOfHKCompanies) || selectedTypes.contains(.incomeOfMacauCompanies) || selectedTypes.contains(.incomeOfOtherOverseasCompanies) {
if incomeCompanyIndexPath == nil {
var sectionArr = datas[incomeTypeSelectIndexPath.section]
if let incomeIndex = sectionArr.firstIndex(where: { tableRow in
if case let .inputMoney(_, _, _, _, _, isIncomeMoney) = tableRow, isIncomeMoney == true {
return true
} else {
return false
}
}) {
let newIndex = incomeIndex //> 1 ? incomeIndex - 1 : 0
let hkdFmt = currencyFormat("")
let rmbFmt = currencyFormat("¥")
let rate = companyModel.rate > 0 ? companyModel.rate : 0.92
sectionArr.insert(.inputMoney("公司营业额(近一年)", "约\(hkdFmt.string(from: NSNumber(value: companyModel.corporate_turnover / rate)) ?? "0")港币", rmbFmt.string(from: NSNumber(value: companyModel.corporate_turnover)) ?? "0", true, false, false), at: newIndex)
datas[incomeTypeSelectIndexPath.section] = sectionArr
}
}
} else {
if incomeCompanyIndexPath != nil {
var sectionArr = datas[incomeTypeSelectIndexPath.section]
if let companyIndex = sectionArr.firstIndex(where: { tableRow in
if case let .inputMoney(_, _, _, _, _, isIncomeMoney) = tableRow, isIncomeMoney == false {
return true
} else {
return false
}
}) {
sectionArr.remove(at: companyIndex)
datas[incomeTypeSelectIndexPath.section] = sectionArr
}
}
}
if let secondSection = docIndexPath?.section { if let secondSection = docIndexPath?.section {
tableView.performBatchUpdates { [weak tableView] in tableView.performBatchUpdates { [weak tableView] in
tableView?.reloadSections(IndexSet(arrayLiteral: incomeTypeSelectIndexPath.section, secondSection), with: .automatic) tableView?.reloadSections(IndexSet(arrayLiteral: incomeTypeSelectIndexPath.section, secondSection), with: .automatic)
...@@ -257,9 +314,8 @@ extension YHIncomeRecordWorkExperienceViewController { ...@@ -257,9 +314,8 @@ extension YHIncomeRecordWorkExperienceViewController {
tableView?.reloadSections(IndexSet(integer: incomeTypeSelectIndexPath.section), with: .automatic) tableView?.reloadSections(IndexSet(integer: incomeTypeSelectIndexPath.section), with: .automatic)
} }
} }
} }
private func currencyFormat(_ currencySymbol: String) -> NumberFormatter { private func currencyFormat(_ currencySymbol: String) -> NumberFormatter {
let formatter = NumberFormatter() let formatter = NumberFormatter()
formatter.numberStyle = .currency formatter.numberStyle = .currency
...@@ -304,7 +360,8 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab ...@@ -304,7 +360,8 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab
} }
case let .incomeTypeSelect(title, detail, isSelectedOne): case let .incomeTypeSelect(title, detail, isSelectedOne):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeTypeSelectCell.cellReuseIdentifier) as? YHIncomeTypeSelectCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeTypeSelectCell.cellReuseIdentifier) as? YHIncomeTypeSelectCell {
cell.setupCellInfo(title: title, detail: detail, isSelectedOne: isSelectedOne, showBottomLine: !isSelectedOne) cell.setupCellInfo(title: title, detail: detail, isSelectedOne: isSelectedOne, showBottomLine: !isSelectedOne, needShowFailButton: !isIncomeTypeOK)
incomeTypeIndexPath = indexPath
return cell return cell
} }
case let .incomeTypes(types): case let .incomeTypes(types):
...@@ -321,7 +378,12 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab ...@@ -321,7 +378,12 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab
} }
case let .inputMoney(title, detail, inputStr, showBottomLine, showStar, isIncomeMoney): case let .inputMoney(title, detail, inputStr, showBottomLine, showStar, isIncomeMoney):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeInputMoneyCell.cellReuseIdentifier) as? YHIncomeInputMoneyCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeInputMoneyCell.cellReuseIdentifier) as? YHIncomeInputMoneyCell {
cell.setupCellInfo(title: title, detail: detail, inputValue: inputStr, showBottomLine: showBottomLine, showStarIcon: showStar) var needShowFailButton = false
if isIncomeMoney {
incomMoneyIndexPath = indexPath
needShowFailButton = !isIncomeMoneyOK
}
cell.setupCellInfo(title: title, detail: detail, inputValue: inputStr, showBottomLine: showBottomLine, showStarIcon: showStar, needShowFailButton: needShowFailButton)
cell.didBeginEditing = { textField in cell.didBeginEditing = { textField in
var text = textField.text ?? "" var text = textField.text ?? ""
text = text.replacingOccurrences(of: "¥", with: "") text = text.replacingOccurrences(of: "¥", with: "")
...@@ -332,7 +394,22 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab ...@@ -332,7 +394,22 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab
guard let self = self else { guard let self = self else {
return return
} }
guard let text = textField.text else { guard let text = textField.text, text.count > 0 else {
if self.datas.count > indexPath.section {
let sectionArr = self.datas[indexPath.section]
if sectionArr.count > indexPath.row {
let currentRow = sectionArr[indexPath.row]
if case let .inputMoney(title, _, _, showBottomLine, showStar, isIncomeMoney) = currentRow {
self.datas[indexPath.section][indexPath.row] = .inputMoney(title, nil, nil, showBottomLine, showStar, isIncomeMoney)
self.tableView.reloadRows(at: [indexPath], with: .automatic)
if isIncomeMoney {
self.companyModel.income_money = 0
} else {
self.companyModel.corporate_turnover = 0
}
}
}
}
return return
} }
// 转换为数字 // 转换为数字
...@@ -340,11 +417,12 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab ...@@ -340,11 +417,12 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab
// 格式化为带货币符号和千分位 // 格式化为带货币符号和千分位
let detail = number / self.currencyRate let detail = number / self.currencyRate
if isIncomeMoney { if isIncomeMoney {
self.isIncomeMoneyOK = true
self.companyModel.income_money = number self.companyModel.income_money = number
} else { } else {
self.companyModel.corporate_turnover = number self.companyModel.corporate_turnover = number
} }
let rmbFormatter = self.currencyFormat("¥") let rmbFormatter = self.currencyFormat("¥")
let hkdFormatter = self.currencyFormat("") let hkdFormatter = self.currencyFormat("")
if let formattedString = rmbFormatter.string(from: NSNumber(value: number)) { if let formattedString = rmbFormatter.string(from: NSNumber(value: number)) {
...@@ -369,20 +447,18 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab ...@@ -369,20 +447,18 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab
cell.setupCellInfo(detail) cell.setupCellInfo(detail)
return cell return cell
} }
case let .documentComfirm(title, question, isSelectedSure, docs): case let .documentComfirm(title, question, docs):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeDocumentationConfirmationCell.cellReuseIdentifier) as? YHIncomeDocumentationConfirmationCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeDocumentationConfirmationCell.cellReuseIdentifier) as? YHIncomeDocumentationConfirmationCell {
cell.setupCellInfo(title: title, question: question, documents: docs) hasAllFileIndexPath = indexPath
cell.selectedSureButton = isSelectedSure cell.setupCellInfo(title: title, question: question, documents: docs, needShowFailButton: !isHasAllFileOK)
cell.selectedSureButton = YHIncomeRecordHasAllFile(rawValue: companyModel.has_all_file) ?? .unknown
cell.didSelectSureButton = { [weak self] flag in cell.didSelectSureButton = { [weak self] flag in
guard let self = self else { guard let self = self else {
return return
} }
if flag { self.companyModel.has_all_file = flag.rawValue
self.companyModel.has_all_file = YHIncomeRecordHasAllFile.true.rawValue self.isHasAllFileOK = flag != .unknown
} else { self.tableView.reloadRows(at: [indexPath], with: .none)
self.companyModel.has_all_file = YHIncomeRecordHasAllFile.false.rawValue
}
} }
return cell return cell
} }
...@@ -420,7 +496,35 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab ...@@ -420,7 +496,35 @@ extension YHIncomeRecordWorkExperienceViewController: UITableViewDelegate, UITab
} }
extension YHIncomeRecordWorkExperienceViewController { extension YHIncomeRecordWorkExperienceViewController {
private func checkInput() -> Bool {
if companyModel.has_all_file == YHIncomeRecordHasAllFile.unknown.rawValue {
isHasAllFileOK = false
if let hasAllFileIndexPath = hasAllFileIndexPath, tableView.numberOfSections > hasAllFileIndexPath.section, tableView.numberOfRows(inSection: hasAllFileIndexPath.section) > hasAllFileIndexPath.row {
tableView.reloadRows(at: [hasAllFileIndexPath], with: .none)
}
return false
}
isHasAllFileOK = true
if companyModel.income_type.count == 0 {
isIncomeTypeOK = false
if let incomeTypeIndexPath = incomeTypeIndexPath, tableView.numberOfSections > incomeTypeIndexPath.section, tableView.numberOfRows(inSection: incomeTypeIndexPath.section) > incomeTypeIndexPath.row {
tableView.reloadRows(at: [incomeTypeIndexPath], with: .none)
}
return false
}
isIncomeTypeOK = true
if companyModel.income_money == 0 {
isIncomeMoneyOK = false
if let incomMoneyIndexPath = incomMoneyIndexPath, tableView.numberOfSections > incomMoneyIndexPath.section, tableView.numberOfRows(inSection: incomMoneyIndexPath.section) > incomMoneyIndexPath.row {
tableView.reloadRows(at: [incomMoneyIndexPath], with: .none)
}
return false
}
isIncomeMoneyOK = true
return true
}
private func requestData(isNeedLoading: Bool = false) { private func requestData(isNeedLoading: Bool = false) {
if isNeedLoading { if isNeedLoading {
YHHUD.show(.progress(message: "加载中...")) YHHUD.show(.progress(message: "加载中..."))
...@@ -429,7 +533,7 @@ extension YHIncomeRecordWorkExperienceViewController { ...@@ -429,7 +533,7 @@ extension YHIncomeRecordWorkExperienceViewController {
guard let self = self else { guard let self = self else {
return return
} }
if isNeedLoading { if isNeedLoading {
YHHUD.hide() YHHUD.hide()
} }
...@@ -446,12 +550,16 @@ extension YHIncomeRecordWorkExperienceViewController { ...@@ -446,12 +550,16 @@ extension YHIncomeRecordWorkExperienceViewController {
self.setupData() self.setupData()
} }
} }
private func submitIncome(_ type: YHIncomeRecordUpdateType, complete: @escaping (Bool) -> Void) { private func submitIncome(_ type: YHIncomeRecordUpdateType, complete: @escaping (Bool) -> Void) {
let msg = type == .save ? "保存中..." : "提交中..." let msg = type == .save ? "保存中..." : "提交中..."
if type == .submit {
if checkInput() == false {
return
}
}
YHHUD.show(.progress(message: msg)) YHHUD.show(.progress(message: msg))
let hasFile: YHIncomeRecordHasAllFile = companyModel.has_all_file == YHIncomeRecordHasAllFile.true.rawValue ? .true : .false viewModel.updateDetail(incomeId: incomeId, incomeMoney: companyModel.income_money, corporateTurnover: companyModel.corporate_turnover, incomeType: companyModel.income_type, hasAllFile: companyModel.has_all_file) { [weak self] success, error in
viewModel.updateDetail(incomeId: incomeId, incomeMoney: companyModel.income_money, corporateTurnover: companyModel.corporate_turnover, incomeType: companyModel.income_type, hasAllFile: hasFile) { [weak self] success, error in
guard let self = self else { guard let self = self else {
complete(false) complete(false)
return return
......
...@@ -31,8 +31,13 @@ class YHIncomeTypeSelectViewController: YHBaseViewController { ...@@ -31,8 +31,13 @@ class YHIncomeTypeSelectViewController: YHBaseViewController {
}() }()
private lazy var tableView: UITableView = { private lazy var tableView: UITableView = {
let view = UITableView(frame: .zero, style: .plain) let view = UITableView(frame: .zero, style: .grouped)
view.backgroundColor = .clear view.estimatedSectionHeaderHeight = 0.01
view.estimatedSectionFooterHeight = 12
view.sectionHeaderHeight = 0.01
view.sectionFooterHeight = 12
view.backgroundColor = .white
view.contentInsetAdjustmentBehavior = .never
view.separatorStyle = .none view.separatorStyle = .none
view.rowHeight = UITableView.automaticDimension view.rowHeight = UITableView.automaticDimension
view.estimatedRowHeight = 52.0 view.estimatedRowHeight = 52.0
...@@ -145,6 +150,7 @@ class YHIncomeTypeSelectViewController: YHBaseViewController { ...@@ -145,6 +150,7 @@ class YHIncomeTypeSelectViewController: YHBaseViewController {
make.top.equalTo(topLineView.snp.bottom).offset(12) make.top.equalTo(topLineView.snp.bottom).offset(12)
make.bottom.equalTo(bottomView.snp.top) make.bottom.equalTo(bottomView.snp.top)
} }
tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: CGFloat.leastNonzeroMagnitude))
tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 20)) tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 20))
preferredContentSize = CGSize(width: KScreenWidth, height: KScreenHeight - k_Height_NavigationtBarAndStatuBar - 44) preferredContentSize = CGSize(width: KScreenWidth, height: KScreenHeight - k_Height_NavigationtBarAndStatuBar - 44)
} }
......
...@@ -15,6 +15,13 @@ enum YHIncomeRecordHasAllFile: Int { ...@@ -15,6 +15,13 @@ enum YHIncomeRecordHasAllFile: Int {
} }
enum YHIncomeOver100: Int { enum YHIncomeOver100: Int {
case unknown = 0
case `true` = 1
case `false` = 2
}
enum YHCheckboxSelectType: Int {
case unknown = 0
case `true` = 1 case `true` = 1
case `false` = 2 case `false` = 2
} }
......
...@@ -10,13 +10,13 @@ import UIKit ...@@ -10,13 +10,13 @@ import UIKit
class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell { class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHIncomeDocumentationConfirmationCell" static let cellReuseIdentifier = "YHIncomeDocumentationConfirmationCell"
var didSelectSureButton: ((Bool) -> Void)? var didSelectSureButton: ((YHIncomeRecordHasAllFile) -> Void)?
private var documentationViews: [YHIncomeDocumentationView] = [] private var documentationViews: [YHIncomeDocumentationView] = []
private var lastDocuments: [String] = []
var selectedSureButton: Bool = true { var selectedSureButton: YHIncomeRecordHasAllFile = .unknown {
didSet { didSet {
updateButtonState(sureButton, selectedSureButton) updateButtonsState(selectedSureButton)
updateButtonState(cancelButton, !selectedSureButton)
} }
} }
...@@ -77,6 +77,14 @@ class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell { ...@@ -77,6 +77,14 @@ class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell {
return view return view
}() }()
private lazy var infoFailLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = .failColor
label.text = "请选择"
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI() setupUI()
...@@ -86,55 +94,92 @@ class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell { ...@@ -86,55 +94,92 @@ class YHIncomeDocumentationConfirmationCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, question: String, documents: [String]) { func setupCellInfo(title: String, question: String, documents: [String], needShowFailButton: Bool) {
infoTitleLabel.text = title infoTitleLabel.text = title
infoQuestionLabel.text = question infoQuestionLabel.text = question
documentationViews.forEach { if lastDocuments != documents || documentationViews.count != documents.count {
$0.removeFromSuperview() lastDocuments = documents
} documentationViews.forEach {
documentationViews.removeAll() $0.removeFromSuperview()
let count = documents.count
documents.enumerated().forEach { [weak self] index, title in
guard let self = self else {
return
} }
let documentationView = YHIncomeDocumentationView() documentationViews.removeAll()
documentationView.setupInfo(title) let count = documents.count
documents.enumerated().forEach { [weak self] index, title in
self.documentationViews.append(documentationView) guard let self = self else {
self.containerView.addSubview(documentationView) return
documentationView.snp.makeConstraints { make in
if index == 0 {
make.top.equalToSuperview().offset(16)
} else {
make.top.equalTo(self.documentationViews[index - 1].snp.bottom).offset(12)
} }
make.left.equalToSuperview().offset(16) let documentationView = YHIncomeDocumentationView()
make.right.lessThanOrEqualToSuperview().offset(-8) documentationView.setupInfo(title)
if index == count - 1 {
make.bottom.equalToSuperview().offset(-16) self.documentationViews.append(documentationView)
self.containerView.addSubview(documentationView)
documentationView.snp.makeConstraints { make in
if index == 0 {
make.top.equalToSuperview().offset(16)
} else {
make.top.equalTo(self.documentationViews[index - 1].snp.bottom).offset(12)
}
make.left.equalToSuperview().offset(16)
make.right.lessThanOrEqualToSuperview().offset(-8)
if index == count - 1 {
make.bottom.equalToSuperview().offset(-16)
}
} }
} }
} }
updateFailLabel(needShowFailButton)
} }
} }
extension YHIncomeDocumentationConfirmationCell { extension YHIncomeDocumentationConfirmationCell {
private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton {
infoFailLabel.isHidden = false
containerView.snp.remakeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.left)
make.right.equalToSuperview().offset(-18)
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(16)
}
infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(containerView.snp.bottom).offset(6)
make.left.equalTo(containerView)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
} else {
infoFailLabel.isHidden = true
containerView.snp.remakeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.left)
make.right.equalToSuperview().offset(-18)
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(16)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.snp.remakeConstraints { make in
make.left.equalTo(containerView)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
}
}
@objc private func cancelButtonDidClick(_ sender: UIButton) { @objc private func cancelButtonDidClick(_ sender: UIButton) {
guard !sender.isSelected else { guard !sender.isSelected else {
return return
} }
selectedSureButton = false selectedSureButton = .false
didSelectSureButton?(false) didSelectSureButton?(.false)
} }
@objc private func sureButtonDidClick(_ sender: UIButton) { @objc private func sureButtonDidClick(_ sender: UIButton) {
guard !sender.isSelected else { guard !sender.isSelected else {
return return
} }
selectedSureButton = true selectedSureButton = .true
didSelectSureButton?(true) didSelectSureButton?(.true)
} }
private func setupUI() { private func setupUI() {
...@@ -146,6 +191,7 @@ extension YHIncomeDocumentationConfirmationCell { ...@@ -146,6 +191,7 @@ extension YHIncomeDocumentationConfirmationCell {
subContainerView.addSubview(sureButton) subContainerView.addSubview(sureButton)
subContainerView.addSubview(cancelButton) subContainerView.addSubview(cancelButton)
subContainerView.addSubview(containerView) subContainerView.addSubview(containerView)
subContainerView.addSubview(infoFailLabel)
sureButton.setContentCompressionResistancePriority(.required, for: .horizontal) sureButton.setContentCompressionResistancePriority(.required, for: .horizontal)
cancelButton.setContentCompressionResistancePriority(.required, for: .horizontal) cancelButton.setContentCompressionResistancePriority(.required, for: .horizontal)
...@@ -198,15 +244,47 @@ extension YHIncomeDocumentationConfirmationCell { ...@@ -198,15 +244,47 @@ extension YHIncomeDocumentationConfirmationCell {
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(16) make.top.equalTo(infoQuestionLabel.snp.bottom).offset(16)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
selectedSureButton = true infoFailLabel.snp.makeConstraints { make in
make.left.equalTo(containerView)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = true
selectedSureButton = .unknown
} }
private func updateButtonState(_ button: UIButton, _ isSelected: Bool) { private func updateButtonsState(_ state: YHIncomeRecordHasAllFile) {
button.isSelected = isSelected switch state {
button.backgroundColor = isSelected ? UIColor(hexString: "#EBF0F9") : .contentBkgColor case .unknown:
button.layer.borderColor = isSelected ? UIColor.brandMainColor.cgColor : nil sureButton.isSelected = false
button.layer.borderWidth = isSelected ? 1 : 0 sureButton.backgroundColor = .contentBkgColor
sureButton.layer.borderColor = nil
sureButton.layer.borderWidth = 0
cancelButton.isSelected = false
cancelButton.backgroundColor = .contentBkgColor
cancelButton.layer.borderColor = nil
cancelButton.layer.borderWidth = 0
case .true:
sureButton.isSelected = true
sureButton.backgroundColor = UIColor(hexString: "#EBF0F9")
sureButton.layer.borderColor = UIColor.brandMainColor.cgColor
sureButton.layer.borderWidth = 1
cancelButton.isSelected = false
cancelButton.backgroundColor = .contentBkgColor
cancelButton.layer.borderColor = nil
cancelButton.layer.borderWidth = 0
case .false:
cancelButton.isSelected = true
cancelButton.backgroundColor = UIColor(hexString: "#EBF0F9")
cancelButton.layer.borderColor = UIColor.brandMainColor.cgColor
cancelButton.layer.borderWidth = 1
sureButton.isSelected = false
sureButton.backgroundColor = .contentBkgColor
sureButton.layer.borderColor = nil
sureButton.layer.borderWidth = 0
}
} }
} }
...@@ -229,7 +307,6 @@ private class YHIncomeDocumentationView: UIView { ...@@ -229,7 +307,6 @@ private class YHIncomeDocumentationView: UIView {
return view return view
}() }()
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
setupUI() setupUI()
......
...@@ -53,6 +53,14 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell { ...@@ -53,6 +53,14 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell {
return view return view
}() }()
private lazy var infoFailLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = .failColor
label.text = "请选择"
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI() setupUI()
...@@ -62,7 +70,7 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell { ...@@ -62,7 +70,7 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, detail: String?, inputValue: String?, showBottomLine: Bool = true, showStarIcon: Bool = false) { func setupCellInfo(title: String, detail: String?, inputValue: String?, showBottomLine: Bool = true, showStarIcon: Bool = false, needShowFailButton: Bool) {
infoTitleLabel.text = title infoTitleLabel.text = title
bottomLineView.isHidden = !showBottomLine bottomLineView.isHidden = !showBottomLine
inputTextField.text = inputValue inputTextField.text = inputValue
...@@ -82,12 +90,8 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell { ...@@ -82,12 +90,8 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell {
make.width.lessThanOrEqualTo(102) make.width.lessThanOrEqualTo(102)
} }
} }
updateDetailText(detail) infoDetailLabel.text = detail
} if let detail = detail, detail.count > 0 {
func updateDetailText(_ text: String?) {
infoDetailLabel.text = text
if let text = text, text.count > 0 {
infoDetailLabel.snp.remakeConstraints { make in infoDetailLabel.snp.remakeConstraints { make in
make.top.equalTo(inputTextField.snp.bottom).offset(4) make.top.equalTo(inputTextField.snp.bottom).offset(4)
make.bottom.lessThanOrEqualToSuperview().offset(-16) make.bottom.lessThanOrEqualToSuperview().offset(-16)
...@@ -102,6 +106,17 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell { ...@@ -102,6 +106,17 @@ class YHIncomeInputMoneyCell: YHResignDocumentCell {
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
} }
} }
infoFailLabel.isHidden = !needShowFailButton
infoFailLabel.snp.remakeConstraints { make in
if needShowFailButton {
make.top.equalTo(infoDetailLabel.snp.bottom).offset(6)
}
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
} }
} }
...@@ -114,6 +129,7 @@ extension YHIncomeInputMoneyCell { ...@@ -114,6 +129,7 @@ extension YHIncomeInputMoneyCell {
subContainerView.addSubview(inputTextField) subContainerView.addSubview(inputTextField)
subContainerView.addSubview(infoDetailLabel) subContainerView.addSubview(infoDetailLabel)
subContainerView.addSubview(bottomLineView) subContainerView.addSubview(bottomLineView)
subContainerView.addSubview(infoFailLabel)
dotIcon.setContentCompressionResistancePriority(.required, for: .horizontal) dotIcon.setContentCompressionResistancePriority(.required, for: .horizontal)
infoTitleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) infoTitleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
...@@ -145,6 +161,12 @@ extension YHIncomeInputMoneyCell { ...@@ -145,6 +161,12 @@ extension YHIncomeInputMoneyCell {
make.left.equalToSuperview().offset(147) make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualToSuperview().offset(-18) make.right.lessThanOrEqualToSuperview().offset(-18)
} }
infoFailLabel.isHidden = true
infoFailLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
bottomLineView.snp.makeConstraints { make in bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
......
...@@ -44,6 +44,14 @@ class YHIncomeTypeSelectCell: YHResignDocumentCell { ...@@ -44,6 +44,14 @@ class YHIncomeTypeSelectCell: YHResignDocumentCell {
return view return view
}() }()
private lazy var infoFailLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = .failColor
label.text = "请选择"
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI() setupUI()
...@@ -53,16 +61,49 @@ class YHIncomeTypeSelectCell: YHResignDocumentCell { ...@@ -53,16 +61,49 @@ class YHIncomeTypeSelectCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, detail: String = "请选择", isSelectedOne: Bool = false, showBottomLine: Bool = false) { func setupCellInfo(title: String, detail: String = "请选择", isSelectedOne: Bool = false, showBottomLine: Bool = false, needShowFailButton: Bool) {
infoTitleLabel.text = title infoTitleLabel.text = title
infoDetailLabel.text = detail infoDetailLabel.text = detail
infoDetailLabel.isHidden = isSelectedOne infoDetailLabel.isHidden = isSelectedOne
bottomLineView.isHidden = !showBottomLine bottomLineView.isHidden = !showBottomLine
updateFailLabel(needShowFailButton)
} }
} }
extension YHIncomeTypeSelectCell { extension YHIncomeTypeSelectCell {
private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton {
infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
}
infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(infoDetailLabel.snp.bottom).offset(6)
make.left.equalTo(dotIcon)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = false
} else {
infoDetailLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16)
make.left.equalToSuperview().offset(147)
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
}
infoFailLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = true
}
}
private func setupUI() { private func setupUI() {
updateCellCorner(.mid) updateCellCorner(.mid)
subContainerView.addSubview(dotIcon) subContainerView.addSubview(dotIcon)
...@@ -70,6 +111,7 @@ extension YHIncomeTypeSelectCell { ...@@ -70,6 +111,7 @@ extension YHIncomeTypeSelectCell {
subContainerView.addSubview(infoDetailLabel) subContainerView.addSubview(infoDetailLabel)
subContainerView.addSubview(rightArrowIcon) subContainerView.addSubview(rightArrowIcon)
subContainerView.addSubview(bottomLineView) subContainerView.addSubview(bottomLineView)
subContainerView.addSubview(infoFailLabel)
dotIcon.setContentCompressionResistancePriority(.required, for: .horizontal) dotIcon.setContentCompressionResistancePriority(.required, for: .horizontal)
infoTitleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) infoTitleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
...@@ -77,18 +119,18 @@ extension YHIncomeTypeSelectCell { ...@@ -77,18 +119,18 @@ extension YHIncomeTypeSelectCell {
rightArrowIcon.setContentCompressionResistancePriority(.required, for: .horizontal) rightArrowIcon.setContentCompressionResistancePriority(.required, for: .horizontal)
dotIcon.snp.makeConstraints { make in dotIcon.snp.makeConstraints { make in
make.centerY.equalToSuperview() make.centerY.equalTo(infoTitleLabel)
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.width.height.equalTo(6) make.width.height.equalTo(6)
} }
infoTitleLabel.snp.makeConstraints { make in infoTitleLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview() make.top.equalToSuperview().offset(16)
make.left.equalTo(dotIcon.snp.right).offset(2) make.left.equalTo(dotIcon.snp.right).offset(2)
} }
rightArrowIcon.snp.makeConstraints { make in rightArrowIcon.snp.makeConstraints { make in
make.centerY.equalToSuperview() make.centerY.equalTo(infoTitleLabel)
make.right.equalToSuperview().offset(-18) make.right.equalToSuperview().offset(-18)
make.width.height.equalTo(20) make.width.height.equalTo(20)
} }
...@@ -100,6 +142,13 @@ extension YHIncomeTypeSelectCell { ...@@ -100,6 +142,13 @@ extension YHIncomeTypeSelectCell {
make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18) make.right.lessThanOrEqualTo(rightArrowIcon.snp.left).offset(-18)
} }
infoFailLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = true
bottomLineView.snp.makeConstraints { make in bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
......
...@@ -13,6 +13,7 @@ class YHIncomeTypesCell: YHResignDocumentCell { ...@@ -13,6 +13,7 @@ class YHIncomeTypesCell: YHResignDocumentCell {
var didClickTypeView: ((Int) -> Void)? var didClickTypeView: ((Int) -> Void)?
private var typeViews: [YHIncomeTypeView] = [] private var typeViews: [YHIncomeTypeView] = []
private var lastTypes: [String] = []
private lazy var bottomLineView: UIView = { private lazy var bottomLineView: UIView = {
let view = UIView() let view = UIView()
...@@ -41,6 +42,10 @@ class YHIncomeTypesCell: YHResignDocumentCell { ...@@ -41,6 +42,10 @@ class YHIncomeTypesCell: YHResignDocumentCell {
} }
func setupCellInfo(types: [String]) { func setupCellInfo(types: [String]) {
guard lastTypes != types || types.count != typeViews.count else {
return
}
lastTypes = types
typeViews.forEach { typeViews.forEach {
$0.removeFromSuperview() $0.removeFromSuperview()
} }
......
...@@ -11,12 +11,11 @@ import UIKit ...@@ -11,12 +11,11 @@ import UIKit
class YHInfoConsentForHKTravelCell: YHResignDocumentCell { class YHInfoConsentForHKTravelCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHInfoConsentForHKTravelCell" static let cellReuseIdentifier = "YHInfoConsentForHKTravelCell"
var didSelectSureButton: ((Bool) -> Void)? var didSelectSureButton: ((YHCheckboxSelectType) -> Void)?
var selectedSureButton: Bool = true { var selectedSureButton: YHCheckboxSelectType = .unknown {
didSet { didSet {
updateButtonState(sureButton, selectedSureButton) updateButtonsState(selectedSureButton)
updateButtonState(cancelButton, !selectedSureButton)
} }
} }
...@@ -86,6 +85,14 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell { ...@@ -86,6 +85,14 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell {
return button return button
}() }()
private lazy var infoFailLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = .failColor
label.text = "请选择"
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI() setupUI()
...@@ -95,29 +102,62 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell { ...@@ -95,29 +102,62 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String, detail: ASAttributedString, question: String, showBottomLine: Bool = false) { func setupCellInfo(title: String, detail: ASAttributedString, question: String, showBottomLine: Bool = false, needShowFailButton: Bool) {
bottomLineView.isHidden = !showBottomLine bottomLineView.isHidden = !showBottomLine
infoTitleLabel.text = title infoTitleLabel.text = title
infoDetailLabel.attributed.text = detail infoDetailLabel.attributed.text = detail
infoQuestionLabel.text = question infoQuestionLabel.text = question
updateFailLabel(needShowFailButton)
} }
} }
extension YHInfoConsentForHKTravelCell { extension YHInfoConsentForHKTravelCell {
private func updateFailLabel(_ needShowFailButton: Bool) {
if needShowFailButton {
infoFailLabel.isHidden = false
infoQuestionLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon.snp.right).offset(2)
make.top.equalTo(infoDetailLabel.snp.bottom).offset(16)
make.height.greaterThanOrEqualTo(40)
make.width.lessThanOrEqualTo(113)
}
infoFailLabel.snp.remakeConstraints { make in
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(6)
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
} else {
infoFailLabel.isHidden = true
infoQuestionLabel.snp.remakeConstraints { make in
make.left.equalTo(dotIcon.snp.right).offset(2)
make.top.equalTo(infoDetailLabel.snp.bottom).offset(16)
make.height.greaterThanOrEqualTo(40)
make.width.lessThanOrEqualTo(113)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
}
}
@objc private func cancelButtonDidClick(_ sender: UIButton) { @objc private func cancelButtonDidClick(_ sender: UIButton) {
guard !sender.isSelected else { guard !sender.isSelected else {
return return
} }
selectedSureButton = false selectedSureButton = .false
didSelectSureButton?(false) didSelectSureButton?(.false)
} }
@objc private func sureButtonDidClick(_ sender: UIButton) { @objc private func sureButtonDidClick(_ sender: UIButton) {
guard !sender.isSelected else { guard !sender.isSelected else {
return return
} }
selectedSureButton = true selectedSureButton = .true
didSelectSureButton?(true) didSelectSureButton?(.true)
} }
private func setupUI() { private func setupUI() {
...@@ -130,6 +170,7 @@ extension YHInfoConsentForHKTravelCell { ...@@ -130,6 +170,7 @@ extension YHInfoConsentForHKTravelCell {
subContainerView.addSubview(infoQuestionLabel) subContainerView.addSubview(infoQuestionLabel)
subContainerView.addSubview(sureButton) subContainerView.addSubview(sureButton)
subContainerView.addSubview(cancelButton) subContainerView.addSubview(cancelButton)
subContainerView.addSubview(infoFailLabel)
sureButton.setContentCompressionResistancePriority(.required, for: .horizontal) sureButton.setContentCompressionResistancePriority(.required, for: .horizontal)
cancelButton.setContentCompressionResistancePriority(.required, for: .horizontal) cancelButton.setContentCompressionResistancePriority(.required, for: .horizontal)
...@@ -165,6 +206,7 @@ extension YHInfoConsentForHKTravelCell { ...@@ -165,6 +206,7 @@ extension YHInfoConsentForHKTravelCell {
make.top.equalTo(infoDetailLabel.snp.bottom).offset(16) make.top.equalTo(infoDetailLabel.snp.bottom).offset(16)
make.height.greaterThanOrEqualTo(40) make.height.greaterThanOrEqualTo(40)
make.width.lessThanOrEqualTo(113) make.width.lessThanOrEqualTo(113)
make.bottom.equalToSuperview().offset(-16)
} }
cancelButton.snp.makeConstraints { make in cancelButton.snp.makeConstraints { make in
...@@ -187,15 +229,47 @@ extension YHInfoConsentForHKTravelCell { ...@@ -187,15 +229,47 @@ extension YHInfoConsentForHKTravelCell {
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18) make.right.equalToSuperview().offset(-18)
make.height.equalTo(0.5) make.height.equalTo(0.5)
make.top.equalTo(infoQuestionLabel.snp.bottom).offset(22)
} }
selectedSureButton = true infoFailLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
infoFailLabel.isHidden = true
selectedSureButton = .unknown
} }
private func updateButtonState(_ button: UIButton, _ isSelected: Bool) { private func updateButtonsState(_ state: YHCheckboxSelectType) {
button.isSelected = isSelected switch state {
button.backgroundColor = isSelected ? UIColor(hexString: "#EBF0F9") : .contentBkgColor case .unknown:
button.layer.borderColor = isSelected ? UIColor.brandMainColor.cgColor : nil sureButton.isSelected = false
button.layer.borderWidth = isSelected ? 1 : 0 sureButton.backgroundColor = .contentBkgColor
sureButton.layer.borderColor = nil
sureButton.layer.borderWidth = 0
cancelButton.isSelected = false
cancelButton.backgroundColor = .contentBkgColor
cancelButton.layer.borderColor = nil
cancelButton.layer.borderWidth = 0
case .true:
sureButton.isSelected = true
sureButton.backgroundColor = UIColor(hexString: "#EBF0F9")
sureButton.layer.borderColor = UIColor.brandMainColor.cgColor
sureButton.layer.borderWidth = 1
cancelButton.isSelected = false
cancelButton.backgroundColor = .contentBkgColor
cancelButton.layer.borderColor = nil
cancelButton.layer.borderWidth = 0
case .false:
cancelButton.isSelected = true
cancelButton.backgroundColor = UIColor(hexString: "#EBF0F9")
cancelButton.layer.borderColor = UIColor.brandMainColor.cgColor
cancelButton.layer.borderWidth = 1
sureButton.isSelected = false
sureButton.backgroundColor = .contentBkgColor
sureButton.layer.borderColor = nil
sureButton.layer.borderWidth = 0
}
} }
} }
...@@ -58,12 +58,12 @@ class YHIncomeRecordViewModel: YHBaseViewModel { ...@@ -58,12 +58,12 @@ class YHIncomeRecordViewModel: YHBaseViewModel {
} }
} }
func updateDetail(incomeId: Int, incomeMoney: Double, corporateTurnover: Double, incomeType: [Int], hasAllFile: YHIncomeRecordHasAllFile, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) { func updateDetail(incomeId: Int, incomeMoney: Double, corporateTurnover: Double, incomeType: [Int], hasAllFile: Int, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["income_id": incomeId, let params: [String: Any] = ["income_id": incomeId,
"income_money": incomeMoney, "income_money": incomeMoney,
"corporate_turnover": corporateTurnover, "corporate_turnover": corporateTurnover,
"income_type": incomeType, "income_type": incomeType,
"has_all_file": hasAllFile.rawValue] "has_all_file": hasAllFile]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.updateDetail let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.updateDetail
_ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in
// 1. json字符串 转 对象 // 1. json字符串 转 对象
...@@ -79,9 +79,9 @@ class YHIncomeRecordViewModel: YHBaseViewModel { ...@@ -79,9 +79,9 @@ class YHIncomeRecordViewModel: YHBaseViewModel {
} }
} }
func incomeUpdate(orderId: Int, incomeOver100: YHIncomeOver100, type: YHIncomeRecordUpdateType, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) { func incomeUpdate(orderId: Int, incomeOver100: Int, type: YHIncomeRecordUpdateType, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["order_id": orderId, let params: [String: Any] = ["order_id": orderId,
"income_over_100": incomeOver100.rawValue, "income_over_100": incomeOver100,
"type": type.rawValue] "type": type.rawValue]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.incomeUpdate let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.incomeUpdate
_ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in
......
...@@ -34,6 +34,11 @@ class YHOtherInfoFillViewController: YHBaseViewController { ...@@ -34,6 +34,11 @@ class YHOtherInfoFillViewController: YHBaseViewController {
//2.0 //2.0
loadData() loadData()
}
deinit {
NotificationCenter.default.removeObserver(self)
} }
} }
...@@ -74,8 +79,27 @@ extension YHOtherInfoFillViewController { ...@@ -74,8 +79,27 @@ extension YHOtherInfoFillViewController {
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.right.equalTo(-kMargin) make.right.equalTo(-kMargin)
} }
NotificationCenter.default.addObserver(self, selector: #selector(didRevModelChanged(_:)), name: Notification.Name(rawValue: "com.yinhe.myCertificate.wechat.otherInfo_remark_notification"), object: nil)
}
@objc func didRevModelChanged(_ notification: Notification) {
if let model = notification.object as? LanguageDetailModel {
printLog(model)
if let tModel = otherInfoVM.otherInfoFillData,tModel.language_detail_new.count > 0 {
for(index,item) in tModel.language_detail_new_data.enumerated() {
if item.id == model.id {
tModel.language_detail_new_data[index] = model
break
}
}
}
}
} }
private func loadData() { private func loadData() {
guard let orderId = orderId else { return} guard let orderId = orderId else { return}
let param = ["order_id":orderId] let param = ["order_id":orderId]
...@@ -112,25 +136,47 @@ extension YHOtherInfoFillViewController { ...@@ -112,25 +136,47 @@ extension YHOtherInfoFillViewController {
private func submitDataOp(flag : Bool) { private func submitDataOp(flag : Bool) {
//提交 //提交
let model = otherInfoVM.otherInfoFillData let model = otherInfoVM.otherInfoFillData
//处理提交的数据 //for test hjl
var tID = 0 var tID = 0
if let arr = model?.language_detail_new, arr.count > 0 { if let arrr = model?.language_detail_new_data,arrr.count > 0 {
tID = arr[0].id var arrO : [LanguageDetailNew] = []
for(_,item) in arrr.enumerated() {
if item.select {
let fakeData : LanguageDetailNew = LanguageDetailNew()
if let arr = model?.language_detail_new,arr.count > 0 {
for(_,tttt) in arr.enumerated() {
if tttt.first_select == item.id {
tID = tttt.id
}
}
}
fakeData.id = tID
fakeData.first_select = item.id
fakeData.other_instructions = item.other_instructions
arrO.append(fakeData)
var isFirst : Bool = true
for(_,tt) in item.options.enumerated() {
if tt.select {
if isFirst {
fakeData.second_select = String(tt.id)
isFirst = false
} else {
fakeData.second_select = fakeData.second_select + "," + String(tt.id)
}
}
}
}
}
model?.language_detail_new = arrO
} else {
model?.language_detail_new = []
} }
let fakeData : LanguageDetailNew = LanguageDetailNew()
fakeData.id = tID
fakeData.first_select = 3
fakeData.second_select = "1"
fakeData.other_instructions = "DavidTest"
model?.language_detail_new = [fakeData]
model?.is_update = flag model?.is_update = flag
//保存 //保存
if let param = model?.toDictionary() { if let param = model?.toDictionary() {
...@@ -186,6 +232,27 @@ extension YHOtherInfoFillViewController { ...@@ -186,6 +232,27 @@ extension YHOtherInfoFillViewController {
// //
// } // }
if !model.language_detail_new_data.isEmpty {
var mutilFlag : Bool = false
var singleFlag : Bool = false
for(_,item) in model.language_detail_new_data.enumerated() {
mutilFlag = item.select || mutilFlag
if mutilFlag {
for(_,iitem) in item.options.enumerated() {
singleFlag = singleFlag || iitem.select
}
if !singleFlag {
return false
}
}
}
if !mutilFlag {
return false
}
}
//3.专业技能行业 //3.专业技能行业
if model.profession?.optionDes.isEmpty == true { if model.profession?.optionDes.isEmpty == true {
returnValue = false returnValue = false
......
...@@ -54,8 +54,8 @@ class YHOtherLanguageSelecteView: UIView { ...@@ -54,8 +54,8 @@ class YHOtherLanguageSelecteView: UIView {
}() }()
// //
private var arrLanguage : [UIView] = [] private var arrLanguage : [YHOtherMultipleChoiceItemView] = []
private var arrLanguageOptions : [UIView] = [] private var arrLanguageOptions : [YHSingleOptionalItemsView] = []
var dataModel : [LanguageDetailModel] = [] { var dataModel : [LanguageDetailModel] = [] {
...@@ -64,11 +64,11 @@ class YHOtherLanguageSelecteView: UIView { ...@@ -64,11 +64,11 @@ class YHOtherLanguageSelecteView: UIView {
} }
} }
override func layoutSubviews() { // override func layoutSubviews() {
super.layoutSubviews() // super.layoutSubviews()
//
updateUI() // updateUI()
} // }
} }
...@@ -162,6 +162,10 @@ extension YHOtherLanguageSelecteView { ...@@ -162,6 +162,10 @@ extension YHOtherLanguageSelecteView {
make.height.equalTo(YHOtherMultipleChoiceItemView.viewH)//占位置 make.height.equalTo(YHOtherMultipleChoiceItemView.viewH)//占位置
} }
optionView.block = { model in
self.block?(model)
}
arrLanguageOptions.append(optionView) arrLanguageOptions.append(optionView)
optionView.isHidden = true optionView.isHidden = true
} }
...@@ -186,7 +190,11 @@ extension YHOtherLanguageSelecteView { ...@@ -186,7 +190,11 @@ extension YHOtherLanguageSelecteView {
for (index,item) in dataModel.enumerated() { for (index,item) in dataModel.enumerated() {
let multiCheckView = arrLanguage[index] let multiCheckView = arrLanguage[index]
multiCheckView.dataModel = item
let optionView = arrLanguageOptions[index] let optionView = arrLanguageOptions[index]
optionView.dataModel = item
if index == 0 { if index == 0 {
multiCheckView.snp.remakeConstraints { make in multiCheckView.snp.remakeConstraints { make in
make.top.left.right.equalToSuperview() make.top.left.right.equalToSuperview()
......
...@@ -70,6 +70,12 @@ class YHSingleOptionalItemsView: UIView { ...@@ -70,6 +70,12 @@ class YHSingleOptionalItemsView: UIView {
updateUI() updateUI()
} }
} }
private var arrHoldView : [YHOtherSingleChoiceItemView] = []
typealias Block = (LanguageDetailModel?) -> ()
var block: Block?
} }
...@@ -94,43 +100,21 @@ private extension YHSingleOptionalItemsView { ...@@ -94,43 +100,21 @@ private extension YHSingleOptionalItemsView {
make.top.equalTo(textFieldHoldView.snp.bottom).offset(8) make.top.equalTo(textFieldHoldView.snp.bottom).offset(8)
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.height.equalTo(60)//for test hjl make.height.equalTo(20)//for test hjl
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
//for test hjl
let tmpOption = YHOtherSingleChoiceItemView()
optionsHoldView.addSubview(tmpOption)
tmpOption.snp.makeConstraints { make in
make.top.equalToSuperview().offset(kMargin)
make.left.equalToSuperview().offset(kMargin)
make.right.equalToSuperview().offset(-kMargin)
}
let tmpOption1 = YHOtherSingleChoiceItemView()
tmpOption1.isSelected = true
optionsHoldView.addSubview(tmpOption1)
tmpOption1.snp.makeConstraints { make in
make.top.equalTo(tmpOption.snp.bottom).offset(kMargin)
make.left.equalToSuperview().offset(kMargin)
make.right.equalToSuperview().offset(-kMargin)
}
let tmpOption2 = YHOtherSingleChoiceItemView()
optionsHoldView.addSubview(tmpOption2)
tmpOption2.snp.makeConstraints { make in
make.top.equalTo(tmpOption1.snp.bottom).offset(kMargin)
make.left.equalToSuperview().offset(kMargin)
make.right.equalToSuperview().offset(-kMargin)
make.bottom.equalToSuperview().offset(-kMargin)
}
} }
@objc func textFieldChanged(textField:UITextField) { @objc func textFieldChanged(textField:UITextField) {
printLog(textField.text) printLog(textField.text)
guard let model = dataModel else {
return
}
model.other_instructions = textField.text ?? ""
// self.block?(model)
NotificationCenter.default.post(name: Notification.Name(rawValue: "com.yinhe.myCertificate.wechat.otherInfo_remark_notification"), object: model)
} }
func updateUI() { func updateUI() {
...@@ -144,6 +128,8 @@ private extension YHSingleOptionalItemsView { ...@@ -144,6 +128,8 @@ private extension YHSingleOptionalItemsView {
if model.id == 3 { if model.id == 3 {
languageTextField.text = model.other_instructions
textFieldHoldView.isHidden = false textFieldHoldView.isHidden = false
optionsHoldView.snp.remakeConstraints() { make in optionsHoldView.snp.remakeConstraints() { make in
make.top.equalTo(textFieldHoldView.snp.bottom).offset(8) make.top.equalTo(textFieldHoldView.snp.bottom).offset(8)
...@@ -165,11 +151,19 @@ private extension YHSingleOptionalItemsView { ...@@ -165,11 +151,19 @@ private extension YHSingleOptionalItemsView {
var lastView : UIView? var lastView : UIView?
arrHoldView.removeAll()
for(index,item) in model.options.enumerated() { for(index,item) in model.options.enumerated() {
let tmpOption = YHOtherSingleChoiceItemView() let tmpOption = YHOtherSingleChoiceItemView()
tmpOption.dataModel = item tmpOption.dataModel = item
optionsHoldView.addSubview(tmpOption) optionsHoldView.addSubview(tmpOption)
arrHoldView.append(tmpOption)
tmpOption.tag = index
let tap : UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapItem(gestureRecognizer:)))
tmpOption.addGestureRecognizer(tap)
if index == 0 { if index == 0 {
//第一个 //第一个
tmpOption.snp.makeConstraints { make in tmpOption.snp.makeConstraints { make in
...@@ -201,6 +195,33 @@ private extension YHSingleOptionalItemsView { ...@@ -201,6 +195,33 @@ private extension YHSingleOptionalItemsView {
} }
} }
} }
@objc func tapItem(gestureRecognizer:UITapGestureRecognizer) {
guard let model = dataModel else {
return
}
let clickIndex = gestureRecognizer.view?.tag
for (index,item) in model.options.enumerated() {
if clickIndex == index {
if !item.select {
item.select = true
} else {
return
}
} else {
item.select = false
}
}
for (index,item) in arrHoldView.enumerated() {
let data = model.options[index]
item.dataModel = data
}
self.block?(model)
}
} }
......
...@@ -299,6 +299,7 @@ extension YHOtherInfoFillViewModel { ...@@ -299,6 +299,7 @@ extension YHOtherInfoFillViewModel {
for (ii,tt) in arr.enumerated() { for (ii,tt) in arr.enumerated() {
if item.first_select == tt.id { if item.first_select == tt.id {
tt.select = true tt.select = true
tt.other_instructions = item.other_instructions
let arrTTT = item.second_select.split(separator: ",") let arrTTT = item.second_select.split(separator: ",")
......
...@@ -96,20 +96,21 @@ class YHWholeScreenTipsView: UIView { ...@@ -96,20 +96,21 @@ class YHWholeScreenTipsView: UIView {
return "该栏目已对好友隐藏,若需重新开启,请前往信息授权处更新设置" return "该栏目已对好友隐藏,若需重新开启,请前往信息授权处更新设置"
case .nameCardWorkExperience: case .nameCardWorkExperience:
return "该栏目已对好友隐藏,若需重新开启,请前往信息授权处更新设置" return "该栏目已对好友隐藏,若需重新开启,请前往信息授权处更新设置"
case .hkPlanQ1: case .hkPlanQ1:
return "请以不超过100字简介你的主要事业成就,包括你在主要工作项目上曾担当的角色、你工作期间曾服务的知名机构/单位或你对有关工作项目及机构的重大贡献" return "请以不超过100字简介你在主要工作项目上曾担当的角色、你工作期间曾服务的知名机构/单位或你对有关工作项目及机构的重大贡献"
case .hkPlanQ2: case .hkPlanQ2:
return "请以不超过100字简介你的专业技能或人才清单内相关专业的成就,以及有关技能/专业如何对香港经济或社会做出重大贡献" return "请以不超过100字简介你的学业成绩或曾取得的奖项"
case .hkPlanQ3: case .hkPlanQ3:
return "请以不超过100字简介你的学业成就,包括你的学业成绩或曾取得的奖项(如有)" return "请以不超过100字简介你在所属的专业界别内曾获取由国家或国际认可/著名的团体颁授的专业资格,及曾取得的奖项"
case .hkPlanQ4: case .hkPlanQ4:
return "请以不超过100字简介你未来在香港发展事业的计划,包括你与本地商业或学业机构联系及合作的详情(如有)" return ""
case .hkPlanQ5: case .hkPlanQ5:
return "请以不超过100字简介你所属的专业界别内曾获取由国家或国际认可/著名团体颁奖的专业资格,及曾取得的奖项(如有)" return "请以不超过100字简介你的人才清单内相关专业、专业技能或成就(例如你拥有的专利或发明、你在学术研究的领导角色、或你在专业领域获得的国际或地区奖项)如何对香港经济或社会作出重大贡献"
case .hkPlanQ6: case .hkPlanQ6:
return "请以不超过100字简介你认为对评核你的申请非常重要的其他材料" return "请以不超过100字简介你与本地商业或学术机构联系及合作的详情"
case .hkPlanQ7: case .hkPlanQ7:
return "您可以在此输入因为字数限制无法输入的内容" return ""
case .renewTimeTips: case .renewTimeTips:
return "入境处网址18:00之后可能会存在系统更新,为避免预约时间无法递交,请尽量选择18:00之前的时间" return "入境处网址18:00之后可能会存在系统更新,为避免预约时间无法递交,请尽量选择18:00之前的时间"
default: default:
......
...@@ -184,7 +184,8 @@ class YHAllApiName { ...@@ -184,7 +184,8 @@ class YHAllApiName {
static let saveAllEduAndQuaInfoApi = "infoflow/submitEducert" static let saveAllEduAndQuaInfoApi = "infoflow/submitEducert"
// 搜索大学名称 // 搜索大学名称
static let searchCollegeNameApi = "infoflow/getSchools" static let searchCollegeNameApi = "infoflow/getSchools"
// 搜索大学名称
static let searchMajorNameApi = "infoflow/getStemByName"
} }
struct Qualification { struct Qualification {
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "收入记录icon@2x.png", "filename" : "Frame@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "收入记录icon@3x.png", "filename" : "Frame@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Applicant@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Applicant@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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