Commit ad3a56cb authored by David黄金龙's avatar David黄金龙

Merge commit '578d4e5b' into davidhuang

* commit '578d4e5b':
  // 学历/专业资格
  登录注册验证码逻辑 接口
  参考用例模版UI接口
  // 学历信息
parents 8092d597 578d4e5b
......@@ -108,6 +108,13 @@
04E86E532B8485E300A35F4B /* YHWorkFileSyncTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E522B8485E300A35F4B /* YHWorkFileSyncTableViewCell.swift */; };
04E86E552B8486FF00A35F4B /* YHWorkFileItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E542B8486FF00A35F4B /* YHWorkFileItemView.swift */; };
04E86E572B848D5A00A35F4B /* YHWorkIntroductionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E562B848D5A00A35F4B /* YHWorkIntroductionViewController.swift */; };
04E86E592B84AD6200A35F4B /* YHWorkExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E582B84AD6200A35F4B /* YHWorkExampleViewController.swift */; };
04E86E5B2B84BF2000A35F4B /* YHWorkExampleTypeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E5A2B84BF2000A35F4B /* YHWorkExampleTypeView.swift */; };
04E86E5D2B84CC9700A35F4B /* YHWorkExampleMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E5C2B84CC9700A35F4B /* YHWorkExampleMessageView.swift */; };
04E86E5F2B84D07000A35F4B /* YHWorkExampleMessageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E5E2B84D07000A35F4B /* YHWorkExampleMessageTableViewCell.swift */; };
04E86E612B85CAEA00A35F4B /* YHWorkExampleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E602B85CAEA00A35F4B /* YHWorkExampleModel.swift */; };
04E86E632B85EE9A00A35F4B /* YHWorkIntroductionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E622B85EE9A00A35F4B /* YHWorkIntroductionViewModel.swift */; };
04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
A50AB89B2B81E96E00C227DE /* YHOtherInfoFillModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB89A2B81E96E00C227DE /* YHOtherInfoFillModel.swift */; };
A50AB89D2B81F1FB00C227DE /* YHOtherInfoFillViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB89C2B81F1FB00C227DE /* YHOtherInfoFillViewModel.swift */; };
......@@ -378,6 +385,13 @@
04E86E522B8485E300A35F4B /* YHWorkFileSyncTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkFileSyncTableViewCell.swift; sourceTree = "<group>"; };
04E86E542B8486FF00A35F4B /* YHWorkFileItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkFileItemView.swift; sourceTree = "<group>"; };
04E86E562B848D5A00A35F4B /* YHWorkIntroductionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkIntroductionViewController.swift; sourceTree = "<group>"; };
04E86E582B84AD6200A35F4B /* YHWorkExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExampleViewController.swift; sourceTree = "<group>"; };
04E86E5A2B84BF2000A35F4B /* YHWorkExampleTypeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExampleTypeView.swift; sourceTree = "<group>"; };
04E86E5C2B84CC9700A35F4B /* YHWorkExampleMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExampleMessageView.swift; sourceTree = "<group>"; };
04E86E5E2B84D07000A35F4B /* YHWorkExampleMessageTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExampleMessageTableViewCell.swift; sourceTree = "<group>"; };
04E86E602B85CAEA00A35F4B /* YHWorkExampleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkExampleModel.swift; sourceTree = "<group>"; };
04E86E622B85EE9A00A35F4B /* YHWorkIntroductionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWorkIntroductionViewModel.swift; sourceTree = "<group>"; };
04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginManager.swift; sourceTree = "<group>"; };
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; };
987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A50AB89A2B81E96E00C227DE /* YHOtherInfoFillModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoFillModel.swift; sourceTree = "<group>"; };
......@@ -823,6 +837,7 @@
children = (
04E86E242B81EA1000A35F4B /* YHWorkItemListViewModel.swift */,
04E86E372B83306800A35F4B /* YHWorkExperienceViewModel.swift */,
04E86E622B85EE9A00A35F4B /* YHWorkIntroductionViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
......@@ -832,6 +847,7 @@
children = (
04E86E262B81EA1000A35F4B /* YHWorkItemListModel.swift */,
04E86E392B83321600A35F4B /* YHWorkExperienceModel.swift */,
04E86E602B85CAEA00A35F4B /* YHWorkExampleModel.swift */,
);
path = Model;
sourceTree = "<group>";
......@@ -842,6 +858,7 @@
04E86E282B81EA1000A35F4B /* YHWorkExperienceListViewController.swift */,
04E86E332B83268F00A35F4B /* YHWorkExperienceViewController.swift */,
04E86E562B848D5A00A35F4B /* YHWorkIntroductionViewController.swift */,
04E86E582B84AD6200A35F4B /* YHWorkExampleViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -856,6 +873,7 @@
04E86E4C2B84756A00A35F4B /* YHWorkIntroductionTableViewCell.swift */,
04E86E502B847D1B00A35F4B /* YHWorkMessageSelectTableViewCell.swift */,
04E86E522B8485E300A35F4B /* YHWorkFileSyncTableViewCell.swift */,
04E86E5E2B84D07000A35F4B /* YHWorkExampleMessageTableViewCell.swift */,
04E86E542B8486FF00A35F4B /* YHWorkFileItemView.swift */,
04E86E4E2B8479B700A35F4B /* YHWorkIntroductionItemView.swift */,
04E86E482B8445F400A35F4B /* YHWorkActionView.swift */,
......@@ -863,6 +881,8 @@
04E86E2C2B81EA1000A35F4B /* YHWorkItemAddView.swift */,
04E86E3B2B833DB900A35F4B /* YHWorkExperienceItemView.swift */,
04E86E3D2B834FC100A35F4B /* YHWorkExperienceTextItemView.swift */,
04E86E5A2B84BF2000A35F4B /* YHWorkExampleTypeView.swift */,
04E86E5C2B84CC9700A35F4B /* YHWorkExampleMessageView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -877,6 +897,14 @@
path = M;
sourceTree = "<group>";
};
04E86E642B86EB4E00A35F4B /* Server */ = {
isa = PBXGroup;
children = (
04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */,
);
path = Server;
sourceTree = "<group>";
};
4758815B24BAF3CAA24EC6A8 /* Pods */ = {
isa = PBXGroup;
children = (
......@@ -1144,6 +1172,7 @@
A5ACE8D82B4564F7002C94D2 /* Login(登录) */ = {
isa = PBXGroup;
children = (
04E86E642B86EB4E00A35F4B /* Server */,
0468D4382B579E9B00CFB916 /* VM */,
0468D4372B57756300CFB916 /* M */,
A5ACE8DA2B4564F7002C94D2 /* C */,
......@@ -1693,6 +1722,7 @@
A5ACE9542B4564F7002C94D2 /* YHNavigationController.swift in Sources */,
A5FD63DF2B6639AD00D1D9DA /* YHScoreDataModel.swift in Sources */,
A5ACE95E2B4571BF002C94D2 /* YHHomeViewController.swift in Sources */,
04E86E632B85EE9A00A35F4B /* YHWorkIntroductionViewModel.swift in Sources */,
A5FD63BD2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift in Sources */,
041B52932B5E6CBA007EBCEB /* YHFormItemTitleCell.swift in Sources */,
04E86E382B83306800A35F4B /* YHWorkExperienceViewModel.swift in Sources */,
......@@ -1707,6 +1737,7 @@
A5ACE9292B4564F7002C94D2 /* YHSmsCodeInputView.swift in Sources */,
A5ACE9452B4564F7002C94D2 /* YHHUDContainerView.swift in Sources */,
A5ACE93A2B4564F7002C94D2 /* NSAttributedString+Extension.swift in Sources */,
04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */,
042F888B2B8477C6008B60BD /* YHEducationInfo.swift in Sources */,
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */,
042FBBBF2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift in Sources */,
......@@ -1795,6 +1826,7 @@
A5C5B3102B57677300A7C5D1 /* YHGestureTableView.swift in Sources */,
A5167B272B692CF20084C08F /* YHPersonInfoIdentificationCardView.swift in Sources */,
A5ACE9312B4564F7002C94D2 /* YHPersonalCenterCell.swift in Sources */,
04E86E5D2B84CC9700A35F4B /* YHWorkExampleMessageView.swift in Sources */,
A5ACE9532B4564F7002C94D2 /* YHBaseViewController.swift in Sources */,
042FBBC32B63DA4C00F9DE23 /* YHParentInfoVC.swift in Sources */,
A5ACE9392B4564F7002C94D2 /* UIDevice+Extension.swift in Sources */,
......@@ -1826,8 +1858,10 @@
04E86E312B81EA1000A35F4B /* YHWorkItemView.swift in Sources */,
0468D4492B6258A900CFB916 /* YHItemView.swift in Sources */,
041B528F2B5E620E007EBCEB /* YHFormItemInputTextCell.swift in Sources */,
04E86E612B85CAEA00A35F4B /* YHWorkExampleModel.swift in Sources */,
A5FD63C72B638CA000D1D9DA /* YHSubmintAllInfoSuccessTipView.swift in Sources */,
04E86E572B848D5A00A35F4B /* YHWorkIntroductionViewController.swift in Sources */,
04E86E5F2B84D07000A35F4B /* YHWorkExampleMessageTableViewCell.swift in Sources */,
041B528F2B5E620E007EBCEB /* YHFormItemInputTextCell.swift in Sources */,
A5ACE9402B4564F7002C94D2 /* String+Extension.swift in Sources */,
A5ACE9482B4564F7002C94D2 /* YHHUDWariningView.swift in Sources */,
......@@ -1848,6 +1882,7 @@
0468D42B2B55019900CFB916 /* YHAnalytics.swift in Sources */,
A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */,
04E86E4F2B8479B700A35F4B /* YHWorkIntroductionItemView.swift in Sources */,
04E86E5B2B84BF2000A35F4B /* YHWorkExampleTypeView.swift in Sources */,
042FBBBD2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift in Sources */,
A5FD63C32B63438A00D1D9DA /* YHContactMainItemStatusModel.swift in Sources */,
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift in Sources */,
......@@ -1865,6 +1900,7 @@
A5C5B3292B57CCBE00A7C5D1 /* YHDavidCell4.swift in Sources */,
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */,
A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */,
04E86E592B84AD6200A35F4B /* YHWorkExampleViewController.swift in Sources */,
042FBBBB2B62806D00F9DE23 /* YHCertificateInfoController.swift in Sources */,
042FBBC72B64CFBF00F9DE23 /* YHChildPrimaryInfoVC.swift in Sources */,
A5234E2A2B6E349600A33433 /* YHBasicInfoFillBottomView.swift in Sources */,
......
......@@ -335,7 +335,7 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource
} else if indexPath.row == 3 {
//学历/专业资格
let vc = YHEducationalQualificationVC()
vc.orderId = orderId
// vc.orderId = orderId
vc.orderId = 133971
navigationController?.pushViewController(vc)
......
......@@ -14,7 +14,7 @@ class YHFamilyRequestViewModel {
//请求所有家庭成员信息
func getFamilyInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.familyInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
YHHUD.show(.progress(message: "数据加载中..."))
......@@ -82,7 +82,7 @@ if let brother = dic["brother"], brother is [[String: Any]] {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.familyInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
......@@ -109,7 +109,7 @@ if let brother = dic["brother"], brother is [[String: Any]] {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.familyMemberDeleteApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyMemberDeleteApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in
YHHUD.hide()
......
......@@ -21,7 +21,11 @@
print(selectType.title)
}
// 【扩展新类型】
1)先增加一个YHFormPickerViewType类型
2)再扩展其关联类型 YHFormPickerViewSubType
3)补充新增类型后的方法 YHFormPickerView的getSubType方法 YHFormPickerViewSubType的title和index方法
4)填充数据源 详情见 属性 dataDict 懒加载方法
*/
......@@ -209,7 +213,7 @@ class YHFormPickerView: UIView {
[YHFormPickerViewItem(type: .degreeLocation(.domestic)),
YHFormPickerViewItem(type: .degreeLocation(.forgin))],
// 专业证书
.professionCertificate:
[YHFormPickerViewItem(type: .professionCertificate(.CFA)),
YHFormPickerViewItem(type: .professionCertificate(.CFP)),
......
//
// YHWorkExampleViewController.swift
// galaxy
//
// Created by EDY on 2024/2/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHWorkExampleType: Int {
case wduty = 0
case highlight = 1
case introduction = 2
}
class YHWorkExampleViewController: YHBaseViewController {
var closeButton: UIButton!
var titleLabel: UILabel!
var lineView: UIView!
var typeView: YHWorkExampleTypeView!
var messageView: YHWorkExampleMessageView!
var dataSource: [YHWorkExampleModel]?
var type: YHWorkExampleType = .wduty
override func viewDidLoad() {
super.viewDidLoad()
setView()
gk_navBackgroundColor = .clear
gk_navShadowColor = .clear
gk_navigationBar.isHidden = true
getData()
}
func setView() {
view.backgroundColor = .white
closeButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "work_example_close"), for: .normal)
button.addTarget(self, action: #selector(close), for: .touchUpInside)
return button
}()
view.addSubview(closeButton)
closeButton.snp.makeConstraints { make in
make.right.equalTo(-21)
make.top.equalTo(16)
make.width.height.equalTo(24)
}
titleLabel = {
let label = UILabel()
label.text = "参考示例"
label.font = kBoldFont(size: 17)
label.textColor = UIColor(hex:0x222222)
label.textAlignment = .center
return label
}()
view.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(24)
make.right.equalTo(-24)
make.top.equalTo(16)
make.height.equalTo(24)
}
lineView = {
let line = UIView()
line.backgroundColor = UIColor(hex: 0xf0f0f0)
return line
}()
view.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.top.equalTo(52)
make.height.equalTo(1)
}
typeView = {
let view = YHWorkExampleTypeView()
view.dataSource = self.getData()
view.isHidden = false
view.exampleBlock = {[weak self] index in
guard let self = self else { return }
view.isHidden = true
self.messageView.isHidden = false
self.messageView.titleLabel.text = self.getExampleTitle(index: index)
self.messageView.dataSource = self.getExampleArray(index: index)
}
return view
}()
view.addSubview(typeView)
typeView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(53)
make.height.equalTo(KScreenHeight - 150)
}
messageView = {
let view = YHWorkExampleMessageView()
view.backBlock = {[weak self] in
guard let self = self else { return }
view.isHidden = true
self.typeView.isHidden = false
}
view.isHidden = true
return view
}()
view.addSubview(messageView)
messageView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(53)
make.height.equalTo(KScreenHeight - 150)
}
}
func getData() -> [String] {
var array: [String] = []
guard let dataSource = dataSource else { return []}
for item in dataSource {
array.append(item.industry ?? "")
}
return array
}
func getExampleArray(index: Int) -> [String] {
if type == .wduty {
return dataSource?[index].wduty_list ?? []
} else if type == .highlight{
return dataSource?[index].highlights_list ?? []
}
return dataSource?[index].template ?? []
}
func getExampleTitle(index: Int) -> String {
return dataSource?[index].industry ?? ""
}
@objc func getCode() {
}
@objc func close() {
self.dismiss(animated: true)
}
}
......@@ -14,6 +14,7 @@ class YHWorkExperienceListViewController: YHBaseViewController {
var tableView: UITableView!
var dataSource: [YHWorkItemListModel]?
var viewModel: YHWorkItemListViewModel?
var isMore: Bool = false
override func viewDidLoad() {
super.viewDidLoad()
......@@ -25,8 +26,11 @@ class YHWorkExperienceListViewController: YHBaseViewController {
}
func getData() {
dataSource = viewModel?.getBaseDataSource()
updateDataSource()
viewModel?.requestWorkList("133969", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.dataSource = success
self.tableView.reloadData()
})
}
func updateDataSource() {
......@@ -99,6 +103,27 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExperienceListTableViewCell.self)
cell.dataSource = dataSource
if isMore {
cell.more()
} else {
cell.cannal()
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
let vc = YHWorkExperienceViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
cell.deleteBlock = {[weak self] model in
guard let self = self else { return }
self.viewModel?.requestDeleteWorkExperience("\(model.id ?? 0)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.getData()
})
}
cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return }
self.isMore = isMore
}
return cell
}
......
......@@ -27,6 +27,9 @@ class YHWorkExperienceViewController: YHBaseViewController {
}
func getData() {
viewModel.requestWorkExample { success, error in
}
updateDataSource()
}
......@@ -117,9 +120,25 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if stepView.currentIndex == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkResponsibilitiesTableViewCell.self)
cell.exampleBlock = {[weak self] in
let mainVc = YHWorkExampleViewController()
mainVc.dataSource = self?.viewModel.exampleModels
mainVc.type = .wduty
let vc = UINavigationController(rootVC: mainVc)
vc.modalPresentationStyle = .pageSheet
self?.navigationController?.present(vc, animated: true)
}
return cell
} else if stepView.currentIndex == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkHighlightsTableViewCell.self)
cell.exampleBlock = {[weak self] in
let mainVc = YHWorkExampleViewController()
mainVc.dataSource = self?.viewModel.exampleModels
mainVc.type = .highlight
let vc = UINavigationController(rootVC: mainVc)
vc.modalPresentationStyle = .pageSheet
self?.navigationController?.present(vc, animated: true)
}
return cell
} else if stepView.currentIndex == 3 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkIntroductionTableViewCell.self)
......
......@@ -18,15 +18,21 @@ class YHWorkIntroductionViewController: YHBaseViewController {
var bottomView: UIView!
var bottomButton: UIButton!
var viewModel: YHWorkIntroductionViewModel?
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "工作经验信息填写"
viewModel = YHWorkIntroductionViewModel()
setView()
getData()
// Do any additional setup after loading the view.
}
func getData() {
viewModel?.requestIntroducetionExample(callBackBlock: { success, error in
})
}
func setView() {
......@@ -171,6 +177,15 @@ class YHWorkIntroductionViewController: YHBaseViewController {
}
actionView = {
let view = YHWorkActionView()
view.exampleBlock = {[weak self] in
guard let self = self else { return }
let mainVc = YHWorkExampleViewController()
mainVc.dataSource = self.viewModel?.introducetionExampleModels
mainVc.type = .introduction
let vc = UINavigationController(rootVC: mainVc)
vc.modalPresentationStyle = .pageSheet
self.navigationController?.present(vc, animated: true)
}
return view
}()
view.addSubview(actionView)
......
//
// YHWorkExampleModel.swift
// galaxy
//
// Created by EDY on 2024/2/21.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
struct YHWorkExampleModel: SmartCodable {
var type: Int?
var industry: String?
var wduty_list: [String]?
var highlights_list: [String]?
var template: [String]?
}
......@@ -7,17 +7,23 @@
//
import UIKit
import SmartCodable
struct YHWorkItemListModel {
var title: String?
var subTitle: String?
var message: String?
var isShowDelete: Bool?
struct YHWorkModel: SmartCodable {
var count: Int?
var list: [YHWorkItemListModel]?
}
struct YHWorkItemListModel: SmartCodable {
var id: Int?
var order_id: Int?
var company_name: String?
var position: String?
var entry_time: String?
var departure_time: Bool?
var vacant_num: Int?
init(title: String? = nil, subTitle: String? = nil, message: String? = nil, isShowDelete: Bool? = nil) {
self.title = title
self.subTitle = subTitle
self.message = message
self.isShowDelete = isShowDelete
}
}
......@@ -9,6 +9,8 @@
import UIKit
class YHWorkActionView: UIView {
typealias ExampleBlock = () -> ()
var exampleBlock: ExampleBlock?
var photoButton: UIButton!
var wxButton: UIButton!
var exampleButton: UIButton!
......@@ -82,6 +84,8 @@ class YHWorkActionView: UIView {
}
@objc func exampleClick() {
if let block = exampleBlock {
block()
}
}
}
//
// YHWorkExampleMessageTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/2/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkExampleMessageTableViewCell: UITableViewCell {
typealias IndexBlock = (_ index: Int) -> ()
var indexBlock: IndexBlock?
var centerView: UIView!
var titleLabel: UILabel!
var useButton: UIButton!
var lineView: UIView!
var messageLabel: UILabel!
var dataSource: String?{
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
backgroundColor = .white
centerView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xf8f9fb)
view.layer.cornerRadius = 8
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.top.equalTo(6)
make.bottom.equalTo(-6)
}
titleLabel = {
let label = UILabel()
label.font = kFont(size: 14)
label.text = "工作职责范例1"
label.textColor = UIColor(hex:0x222222)
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(16)
make.height.equalTo(20)
make.right.equalTo(-120)
}
useButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x2f7ef6).withAlphaComponent(0.08)
button.titleLabel?.font = kBoldFont(size: 12)
button.contentHorizontalAlignment = .center
button.setTitle("使用此模板", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.layer.cornerRadius = 3
// button.addTarget(self, action: #selector(submit), for: .touchUpInside)
return button
}()
centerView.addSubview(useButton)
useButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.top.equalTo(12)
make.height.equalTo(27)
make.width.equalTo(80)
}
lineView = {
let line = UIView()
line.backgroundColor = UIColor(hex: 0xf0f0f0)
return line
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(47)
make.height.equalTo(1)
}
messageLabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = kFont(size: 14)
label.textColor = UIColor(hex:0x222222)
return label
}()
centerView.addSubview(messageLabel)
messageLabel.snp.makeConstraints { make in
make.right.equalTo(-16)
make.top.equalTo(59)
make.left.equalTo(16)
}
}
func updateAllViews() {
messageLabel.text = dataSource
}
}
//
// YHWorkExampleMessageView.swift
// galaxy
//
// Created by EDY on 2024/2/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkExampleMessageView: UIView {
typealias ExampleBlock = (_ message: String) -> ()
typealias BackBlock = () -> ()
var exampleBlock: ExampleBlock?
var backBlock: BackBlock?
var backButton: UIButton!
var titleLabel: UILabel!
var tableView: UITableView!
var dataSource: [String]?{
didSet {
updateView()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
backButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "work_example_back"), for: .normal)
button.addTarget(self, action: #selector(back), for: .touchUpInside)
return button
}()
addSubview(backButton)
backButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(20)
make.height.width.equalTo(16)
}
titleLabel = {
let label = UILabel()
label.font = kBoldFont(size: 16)
label.text = "业务支援及人力资源"
label.textAlignment = .left
label.textColor = UIColor(hex:0x222222)
return label
}()
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(backButton.snp.right).offset(6)
make.centerY.equalTo(backButton.snp.centerY)
make.right.equalTo(-16)
make.height.equalTo(23)
}
tableView = {
let tableView = UITableView(frame:.zero, style:.plain)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHWorkExampleMessageTableViewCell.self)
return tableView
}()
addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(50)
make.left.right.bottom.equalToSuperview()
}
}
func updateView() {
tableView.reloadData()
}
@objc func exampleClick() {
if let block = exampleBlock {
block("")
}
}
@objc func back() {
if let block = backBlock {
block()
}
}
}
extension YHWorkExampleMessageView: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataSource?.count ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHWorkExampleMessageTableViewCell.self)
cell.titleLabel.text = "范例\(indexPath.row + 1)"
cell.dataSource = dataSource?[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let text = dataSource?[indexPath.row] // 要显示的文本内容
let font = UIFont.systemFont(ofSize: 14) // 字体大小
let maxWidth = KScreenWidth - 74 // 最大宽度限制
// 创建NSAttributedString对象并设置属性
let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any]
_ = NSMutableAttributedString(string: text ?? "", attributes: attributes)
// 根据指定的最大宽度和字体大小计算文本的高度
let size = (text! as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size
// if size.height < 311 {
// return CGFloat(size.height + 87)
// } else {
// return CGFloat(385)
// }
return CGFloat(size.height + 87)
}
}
//
// YHWorkExampleTypeView.swift
// galaxy
//
// Created by EDY on 2024/2/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkExampleTypeView: UIView {
typealias ExampleBlock = (_ index: Int) -> ()
var exampleBlock: ExampleBlock?
var titleLabel: UILabel!
var dataSource: [String]?{
didSet {
updateView()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
titleLabel = {
let label = UILabel()
label.font = kBoldFont(size: 14)
label.text = "请选择您的行业:"
label.textAlignment = .left
label.textColor = UIColor(hex:0x222222)
return label
}()
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.top.equalTo(16)
make.height.equalTo(23)
}
}
func updateView() {
guard let dataSource = dataSource else { return }
var x = 0
var y = 0
for i in 0..<dataSource.count {
let string = dataSource[i]
let font = UIFont.systemFont(ofSize: 13) // 设置字体样式及大小
let maxWidth = KScreenWidth - 42 // label最大宽度限制
// 创建NSAttributedString对象并指定字体属性
let attributedText = NSMutableAttributedString(string: string)
attributedText.addAttribute(.font, value: font, range: NSRange(location: 0, length: string.count))
// 获取文本所需的高度和宽度
var boundingBox = CGRect()
boundingBox = NSString(string: string).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: [.usesLineFragmentOrigin], attributes: [.font : font], context: nil)
let width = boundingBox.size.width
if CGFloat(x) + width + 24 > maxWidth {
x = 0
y = y + 1
}
let button = UIButton(type: .custom)
button.setTitle(dataSource[i], for: .normal)
button.setTitleColor(UIColor(hex: 0x222222), for: .normal)
button.setBackgroundColor(color: UIColor(hex: 0xf8f9fb), forState: .normal)
button.titleLabel?.font = kFont(size: 13)
button.layer.cornerRadius = 16
button.tag = 3000 + i
button.addTarget(self, action: #selector(exampleClick(sender:)), for: .touchUpInside)
addSubview(button)
button.snp.makeConstraints { make in
make.left.equalTo(21 + x)
make.top.equalTo(56 + y * 44)
make.height.equalTo(32)
make.width.equalTo(width + 24)
}
x = x + Int(width) + 36
}
}
@objc func exampleClick(sender: UIButton) {
let tag = sender.tag - 3000
if let block = exampleBlock {
block(tag)
}
}
}
......@@ -9,9 +9,11 @@
import UIKit
class YHWorkExperienceListTableViewCell: UITableViewCell {
typealias ExperienceListBlock = (_ model: YHItemModel) -> ()
var experienceListBlock: ExperienceListBlock?
typealias ExperienceListBlock = (_ model: YHWorkItemListModel) -> ()
typealias IsMoreBlock = (_ isMore: Bool) -> ()
var clickBlock: ExperienceListBlock?
var deleteBlock: ExperienceListBlock?
var isMoreBlock: IsMoreBlock?
var centerView: UIView!
var titleLabel: UILabel!
var subTitleLabel: UILabel!
......@@ -162,13 +164,7 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
make.right.equalTo(-18)
}
let itemView = YHWorkItemView()
itemView.dataSource = YHWorkItemListModel(title: "工作经历1", subTitle: "", message: "有16项未填写", isShowDelete: false)
itemView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.experienceListBlock {
block(model)
}
}
itemView.dataSource = YHWorkItemListModel()
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
......@@ -190,13 +186,21 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
make.right.equalTo(-18)
}
let itemView = YHWorkItemView()
itemView.dataSource = dataSource[i]
itemView.block = {[weak self] model in
itemView.clickBlock = {[weak self] model in
guard let self = self else { return }
if let block = self.clickBlock {
block(model)
}
}
itemView.deleteBlock = {[weak self] model in
guard let self = self else { return }
if let block = self.experienceListBlock {
if let block = self.deleteBlock {
block(model)
}
}
itemView.tag = 4000 + i
itemView.dataSource = dataSource[i]
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
......@@ -208,10 +212,26 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
}
@objc func cannal() {
moreButton.isHidden = false
cannalButton.isHidden = true
for i in 0..<(dataSource?.count ?? 0) {
let view = mainItemView.viewWithTag(4000 + i) as! YHWorkItemView
view.isShowDelete(i, isShow: false)
}
if let block = isMoreBlock {
block(false)
}
}
@objc func more() {
moreButton.isHidden = true
cannalButton.isHidden = false
for i in 0..<(dataSource?.count ?? 0) {
let view = mainItemView.viewWithTag(4000 + i) as! YHWorkItemView
view.isShowDelete(i, isShow: true)
}
if let block = isMoreBlock {
block(true)
}
}
}
......@@ -67,7 +67,7 @@ class YHWorkFileItemView: UIView {
func updateAllViews() {
guard let dataSource = dataSource else { return }
titleLabel.text = dataSource.title
// titleLabel.text = dataSource.title
}
......
......@@ -9,7 +9,8 @@
import UIKit
class YHWorkHighlightsTableViewCell: UITableViewCell {
typealias ExampleBlock = () -> ()
var exampleBlock: ExampleBlock?
var centerView: UIView!
var titleLabel: UILabel!
var subTitleLabel: UILabel!
......@@ -168,6 +169,12 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
bottomView = {
let view = YHWorkActionView()
view.exampleBlock = {[weak self] in
guard let self = self else { return }
if let block = self.exampleBlock {
block()
}
}
return view
}()
centerView.addSubview(bottomView)
......
......@@ -102,18 +102,17 @@ class YHWorkIntroductionItemView: UIView {
make.width.equalTo(28)
make.centerY.equalTo(titleLabel.snp.centerY)
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
titleLabel.text = dataSource.title
subTitleLabel.text = dataSource.subTitle
if dataSource.isShowDelete ?? false {
deleteButton.isHidden = false
} else {
deleteButton.isHidden = true
}
// titleLabel.text = dataSource.title
// subTitleLabel.text = dataSource.subTitle
// if dataSource.isShowDelete ?? false {
// deleteButton.isHidden = false
// } else {
// deleteButton.isHidden = true
// }
}
......
......@@ -10,8 +10,9 @@ import UIKit
class YHWorkItemView: UIView {
typealias ItemBlock = (_ model: YHItemModel) -> ()
var block: ItemBlock?
typealias ItemBlock = (_ model: YHWorkItemListModel) -> ()
var clickBlock: ItemBlock?
var deleteBlock: ItemBlock?
var titleLabel: UILabel!
var subTitleLabel: UILabel!
var explainLabel: UILabel!
......@@ -87,7 +88,7 @@ class YHWorkItemView: UIView {
addSubview(nextStepImageView)
nextStepImageView.snp.makeConstraints { make in
make.right.equalToSuperview()
make.centerY.equalToSuperview()
make.centerY.equalTo(titleLabel.snp.centerY)
make.height.width.equalTo(20)
}
......@@ -107,16 +108,17 @@ class YHWorkItemView: UIView {
button.titleLabel?.font = kFont(size: 14)
button.contentHorizontalAlignment = .center
button.setTitle("删除", for: .normal)
button.contentHorizontalAlignment = .right
button.setTitleColor( UIColor(hex:0xf81d22), for: .normal)
button.addTarget(self, action: #selector(centerClick), for: .touchUpInside)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
addSubview(deleteButton)
deleteButton.snp.makeConstraints { make in
make.right.equalTo(-24)
make.right.equalToSuperview()
make.height.equalTo(20)
make.width.equalTo(28)
make.width.equalTo(35)
make.centerY.equalTo(titleLabel.snp.centerY)
}
......@@ -124,20 +126,39 @@ class YHWorkItemView: UIView {
func updateAllViews() {
guard let dataSource = dataSource else { return }
titleLabel.text = dataSource.title
subTitleLabel.text = dataSource.subTitle
explainLabel.text = dataSource.message
if dataSource.isShowDelete ?? false {
deleteButton.isHidden = false
explainLabel.isHidden = true
titleLabel.text = dataSource.company_name
subTitleLabel.text = dataSource.position
if dataSource.vacant_num != 0 {
explainLabel.text = "有" + "\(dataSource.vacant_num ?? 0)" + "项未填写"
} else {
deleteButton.isHidden = true
explainLabel.isHidden = false
explainLabel.text = (dataSource.entry_time ?? "") + "-" + (dataSource.entry_time ?? "")
}
}
@objc func centerClick() {
if let block = clickBlock {
block(self.dataSource ?? YHWorkItemListModel())
}
}
@objc func deleteClick() {
if let block = deleteBlock {
block(self.dataSource ?? YHWorkItemListModel())
}
}
func isShowDelete(_ index: Int, isShow: Bool) {
if isShow {
explainLabel.isHidden = true
nextStepImageView.isHidden = true
if index != 0 {
deleteButton.isHidden = false
}
} else {
explainLabel.isHidden = false
nextStepImageView.isHidden = false
deleteButton.isHidden = true
}
}
}
......@@ -9,6 +9,8 @@
import UIKit
class YHWorkResponsibilitiesTableViewCell: UITableViewCell {
typealias ExampleBlock = () -> ()
var exampleBlock: ExampleBlock?
var centerView: UIView!
var titleLabel: UILabel!
var subTitleLabel: UILabel!
......@@ -136,6 +138,12 @@ class YHWorkResponsibilitiesTableViewCell: UITableViewCell {
bottomView = {
let view = YHWorkActionView()
view.exampleBlock = {[weak self] in
guard let self = self else { return }
if let block = self.exampleBlock {
block()
}
}
return view
}()
centerView.addSubview(bottomView)
......
......@@ -10,6 +10,7 @@ import UIKit
class YHWorkExperienceViewModel: YHBaseViewModel {
var mainModel: YHMainInformationModel = YHMainInformationModel()
var exampleModels: [YHWorkExampleModel]?
override init() {
super.init()
......@@ -126,4 +127,27 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
mainModel.birth_place?.foreign = item.message
}
}
func requestWorkExample(callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/workInfo/example"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
let dic = model.data?.peel
guard let result = [YHWorkExampleModel].deserialize(array: dic as? [Any]) else {
callBackBlock(false,nil)
return
}
self.exampleModels = result as? [YHWorkExampleModel]
callBackBlock(true, nil)
} failBlock: { err in
callBackBlock(false,err)
}
}
}
//
// YHWorkIntroductionViewModel.swift
// galaxy
//
// Created by EDY on 2024/2/21.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWorkIntroductionViewModel: YHBaseViewModel {
var introducetionExampleModels: [YHWorkExampleModel]?
override init() {
super.init()
}
func requestIntroducetionExample(callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/workInfo/item-example"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
let dic = model.data?.peel
guard let result = [YHWorkExampleModel].deserialize(array: dic as? [Any]) else {
callBackBlock(false,nil)
return
}
self.introducetionExampleModels = result as? [YHWorkExampleModel]
callBackBlock(true, nil)
} failBlock: { err in
callBackBlock(false,err)
}
}
}
......@@ -10,15 +10,50 @@ import UIKit
class YHWorkItemListViewModel: YHBaseViewModel {
var mainModel: YHMainInformationModel = YHMainInformationModel()
var mainModel: [YHWorkItemListModel]?
override init() {
super.init()
}
func getBaseDataSource() -> [YHWorkItemListModel] {
let item = YHWorkItemListModel(title: "华为有限公司", subTitle: "后端开发工程师", message: "2019.07-至今", isShowDelete: false)
return [item]
func requestWorkList(_ orderId: String, callBackBlock:@escaping (_ success: [YHWorkItemListModel]?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/workInfo/list?order_id=\(orderId)"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock([],error)
return
}
let dic = model.data?.peel
guard let result = YHWorkModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock([],nil)
return
}
self.mainModel = result.list
callBackBlock(self.mainModel, nil)
} failBlock: { err in
callBackBlock([],err)
}
}
func requestDeleteWorkExperience(_ orderId: String, callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
let params: [String : Any] = ["id": orderId]
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/workInfo/del"
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
callBackBlock(true, nil)
} failBlock: { err in
callBackBlock(false, err)
}
}
}
......@@ -7,11 +7,17 @@
//
import UIKit
import SwifterSwift
import Toast_Swift
class YHEducationDetailVC: YHBaseViewController {
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
var familyMemberInfo: YHFamilyMemberGroupInfo?
//【WARNING!】新添加 传orderId 已有信息传detailId
// 订单ID
var orderId: Int = 0
// 学历ID
var detailId: Int = 0
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
var detailInfo: YHEducationDetailInfo = YHEducationDetailInfo()
var isChildsEditMode: YHFormTitleItemEditType = .none
var isBrothersEditMode: YHFormTitleItemEditType = .none
......@@ -44,7 +50,7 @@ class YHEducationDetailVC: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navTitle = "学历X".local
self.gk_navTitle = "学历".local
view.backgroundColor = UIColor(hexString:"#F8F8F8")
createUI()
}
......@@ -58,6 +64,12 @@ class YHEducationDetailVC: YHBaseViewController {
view.addSubview(tableView);
view.addSubview(bottomView)
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
saveDetailInfo()
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
......@@ -72,6 +84,11 @@ class YHEducationDetailVC: YHBaseViewController {
}
loadInfo()
if self.detailId != 0 { // 有学历ID则该学历已存在
getDetailInfo()
} else { // 该学历是新添加的
detailInfo.orderId = orderId
}
}
func loadInfo() {
......@@ -81,23 +98,51 @@ class YHEducationDetailVC: YHBaseViewController {
let title0 = YHFormTitleItem(type: .mainApplicantEducation)
let item00 = YHFormDetailItem(type: .universityFullName)
item00.placeHolder = "请输入学校全称,例:清华,需填全称“清华大学".local
item00.value = detailInfo.college
let item01 = YHFormDetailItem(type: .educationStyle)
item01.placeHolder = "请选择授课形式".local
item01.value = detailInfo.type
let item02 = YHFormDetailItem(type: .educationTime)
item02.placeHolder = "请选择年月".local
item02.value = detailInfo.admissionTime
let item03 = YHFormDetailItem(type: .graduateTime)
item03.placeHolder = "请选择年月".local
item03.value = detailInfo.graduateTime
let item04 = YHFormDetailItem(type: .educationMajor)
item04.placeHolder = "请输入专业".local
item04.value = detailInfo.professional
let item05 = YHFormDetailItem(type: .educationDegree)
item05.placeHolder = "请选择学位".local
item05.value = detailInfo.background
let item06 = YHFormDetailItem(type: .degreeType)
item06.placeHolder = "请输入学位类型,如管理学".local
item06.value = detailInfo.degreeType
let item07 = YHFormDetailItem(type: .educationCountry)
item07.placeHolder = "请输入国家及地区".local
item07.value = detailInfo.schoolAddress?.country
let item08 = YHFormDetailItem(type: .educationCity)
item08.placeHolder = "请选择城市".local
if detailInfo.isSchoolInAboard() {
item08.value = detailInfo.schoolAddress?.foreign
item08.placeHolder = "请输入城市".local
item08.tips = "请输入城市".local
} else {
item08.value = detailInfo.schoolAddress?.area.joined(separator: ",")
item08.placeHolder = "请选择出生城市".local
item08.tips = "请选择出生城市".local
}
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02, item03, item04, item05, item06, item07, item08]
items.append(arr0)
self.tableView.reloadData()
......@@ -126,8 +171,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormTitleItem { // 是标题
let formItem = item as! YHFormTitleItem
// 配偶父母子女兄妹title
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.titleLabel.text = formItem.getTitle()
cell.subTitleLabel.text = formItem.getSubTitle()
......@@ -143,6 +186,26 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
// 只有国外城市才需输入,国内城市使用的是选择器
if detailItem.type == .educationCity {
if let text = text, !text.isEmpty {
detailInfo.schoolAddress?.foreign = text
} else {
detailInfo.schoolAddress?.foreign = ""
}
} else if detailItem.type == .educationMajor {
detailInfo.professional = text
}
if isEditEnd {
loadInfo()
saveDetailInfo()
}
}
return cell
} else if cellType == .selectSheet {
......@@ -150,7 +213,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = ""
cell.detail = detailItem.value
return cell
}
}
......@@ -190,11 +253,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHProfessionalQualificationVC()
self.navigationController?.pushViewController(vc)
return
/*
let arr = items[indexPath.section]
let item:YHFormItemProtocol = arr[indexPath.row]
......@@ -204,11 +262,16 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .educationStyle { // 授课形式
if detailItem.type == .universityFullName { // 选择大学名称
} else if detailItem.type == .educationStyle { // 授课形式
YHFormPickerView.show(type: .edution, selectType: .education(.fullTime)) {
[weak self] selectType in
guard let self = self else { return }
detailInfo.type = selectType.title
loadInfo()
saveDetailInfo()
}
} else if detailItem.type == .educationTime || detailItem.type == .graduateTime { // 入学及毕业年月
......@@ -216,36 +279,56 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
YHDatePickView.show(type: .yyyymm) {
[weak self] date in
guard let self = self else { return }
if detailItem.type == .educationTime {
detailInfo.admissionTime = date
} else if detailItem.type == .graduateTime {
detailInfo.graduateTime = date
}
loadInfo()
saveDetailInfo()
}
} else if detailItem.type == .educationDegree { // 学位
YHFormPickerView.show(type: .degree, selectType: .degree(.bachelor)) {
[weak self] selectType in
guard let self = self else { return }
detailInfo.background = selectType.title
loadInfo()
saveDetailInfo()
}
} else if detailItem.type == .degreeType { // 学位类型
} else if detailItem.type == .educationCountry { // 上课国家/地区
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] country in
guard let self = self else { return }
detailInfo.schoolAddress?.country = country
loadInfo()
saveDetailInfo()
}
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .educationCity { // 上课城市
if detailInfo.isSchoolInAboard() { return }
let vc = YHAddressViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
detailInfo.schoolAddress?.area = [string1, string2, string3, string4]
loadInfo()
saveDetailInfo()
}
self.present(vc, animated: true)
}
}
*/
}
func createDefaultCell(_ indexPath: IndexPath) -> UITableViewCell {
......@@ -275,23 +358,79 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .universityFullName
|| detailItem.type == .degreeType
|| detailItem.type == .educationMajor {
if detailItem.type == .educationCity {
if detailInfo.isSchoolInAboard() {
return .inputText
}
return .selectSheet
}
if detailItem.type == .educationMajor
{
return .inputText
}
if detailItem.type == .educationStyle
if detailItem.type == .universityFullName
|| detailItem.type == .educationStyle
|| detailItem.type == .educationTime
|| detailItem.type == .graduateTime
|| detailItem.type == .educationDegree
|| detailItem.type == .degreeType
|| detailItem.type == .educationCountry
|| detailItem.type == .educationCity {
{
return .selectSheet
}
}
return .defaultType
}
}
extension YHEducationDetailVC {
func getDetailInfo() {
self.educationRequest.getEducationDetailInfo(params: ["id": self.detailId]) {
[weak self] success, error in
guard let self = self else { return }
if success {
if let educationDetailInfo = self.educationRequest.educationDetailInfo {
detailInfo = educationDetailInfo
}
loadInfo()
}
}
}
func saveDetailInfo() {
// detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理
let dict:[String : Any] = ["verify": 0,
"id": detailInfo.id,
"order_id": detailInfo.orderId,
"admission_time": detailInfo.admissionTime ?? "",
"background": detailInfo.background ?? "",
"college": detailInfo.college ?? "",
"degree_type": detailInfo.degreeType ?? "",
"graduate_time": detailInfo.graduateTime ?? "",
"professional": detailInfo.professional ?? "",
"school_address_aboard": "",
"type": detailInfo.type ?? "",
"school_address": ["country": detailInfo.schoolAddress?.country ?? "",
"area": detailInfo.schoolAddress?.area ?? "",
"foreign": detailInfo.schoolAddress?.foreign ?? ""],
]
self.educationRequest.saveEducationInfo(params: dict) {
[weak self] success, error in
guard let self = self else { return }
if success {
self.view.makeToast("保存成功", duration: 1.0, position:ToastPosition.center)
} else {
self.view.makeToast("保存失败", duration: 1.0, position:ToastPosition.center)
}
DispatchQueue.main.asyncAfter(deadline:.now()+1.0) {
self.view.hideToast()
}
}
}
}
......@@ -7,17 +7,21 @@
//
import UIKit
import Toast_Swift
class YHEducationalQualificationVC: YHBaseViewController {
var orderId:Int?
var orderId:Int = 0
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
var familyMemberInfo: YHFamilyMemberGroupInfo?
var isChildsEditMode: YHFormTitleItemEditType = .none
var isBrothersEditMode: YHFormTitleItemEditType = .none
// 学历编辑模式
var isDegreeEditMode: YHFormTitleItemEditType = .none
// 专业编辑模式
var isQualificationEditMode: YHFormTitleItemEditType = .none
var educationInfo: YHEducationListInfo?
var items:[[YHFormItemProtocol]] = []
// 是否显示未填写错误提示
var isNeedShowError = false
lazy var tableView: UITableView = {
......@@ -55,6 +59,7 @@ class YHEducationalQualificationVC: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
requestEducationInfo()
}
func createUI() {
......@@ -62,6 +67,19 @@ class YHEducationalQualificationVC: YHBaseViewController {
view.addSubview(tableView);
view.addSubview(bottomView)
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
saveInfo()
self.navigationController?.popViewController(animated: true)
}
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
submitInfo()
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
......@@ -76,7 +94,6 @@ class YHEducationalQualificationVC: YHBaseViewController {
}
loadInfo()
requestEducationInfo()
}
func loadInfo() {
......@@ -93,6 +110,16 @@ class YHEducationalQualificationVC: YHBaseViewController {
let item = YHFormDetailItem(type: .educationInfo)
arr0.append(item)
}
// 多学历可编辑删除状态
if eduList.count <= 0 {
isDegreeEditMode = .none
} else {
if isDegreeEditMode == .none {
isDegreeEditMode = .canEdit
}
}
} else {
isDegreeEditMode = .none
}
// 新增学历信息
arr0.append(YHFormAddItem(type: .addEducation))
......@@ -106,7 +133,18 @@ class YHEducationalQualificationVC: YHBaseViewController {
let item = YHFormDetailItem(type: .certificateInfo)
arr1.append(item)
}
// 多专业可编辑删除状态
if quaList.count <= 0 {
isQualificationEditMode = .none
} else {
if isQualificationEditMode == .none {
isQualificationEditMode = .canEdit
}
}
} else {
isQualificationEditMode = .none
}
// 新增学历信息
arr1.append(YHFormAddItem(type: .addCertificateInfo))
items.append(arr1)
......@@ -126,6 +164,8 @@ class YHEducationalQualificationVC: YHBaseViewController {
arr2.append(questionInfo)
}
items.append(arr2)
self.tableView.reloadData()
}
}
......@@ -159,17 +199,34 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
// 决定右边按钮显示样式
cell.showEditType(type: .none)
// if formItem.type == .child {
// cell.showEditType(type: isChildsEditMode)
//
// } else if formItem.type == .brother {
// cell.showEditType(type: isBrothersEditMode)
// }
if formItem.type == .mainApplicantEducation { // 学历
cell.showEditType(type: isDegreeEditMode)
// 右边按钮点击事件处理
cell.rightClickBlock = { [weak self] type in
} else if formItem.type == .mainApplicantProfessionalQualification { // 专业
cell.showEditType(type: isQualificationEditMode)
}
// 右边按钮点击事件处理
cell.rightClickBlock = {
[weak self] type in
guard let self = self else { return }
if formItem.type == .mainApplicantEducation { // 学历
if self.isDegreeEditMode == .canCancel {
self.isDegreeEditMode = .canEdit
} else if self.isDegreeEditMode == .canEdit {
self.isDegreeEditMode = .canCancel
}
}
if formItem.type == .mainApplicantProfessionalQualification { // 专业
if self.isQualificationEditMode == .canCancel {
self.isQualificationEditMode = .canEdit
} else if self.isQualificationEditMode == .canEdit {
self.isQualificationEditMode = .canCancel
}
}
loadInfo()
}
return cell
}
......@@ -186,6 +243,24 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
} else {
cell.title = ""
}
cell.clickBlock = {
[weak self] in
guard let self = self else { return }
if detailItem.type == .addEducation { // 学历
let vc = YHEducationDetailVC()
vc.orderId = self.orderId
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .addCertificateInfo { // 证书
let vc = YHProfessionalQualificationVC()
vc.orderId = String(self.orderId)
self.navigationController?.pushViewController(vc)
}
return
}
return cell
}
......@@ -207,17 +282,32 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
let answers = [YHFormChoiceItem(title: "是".local, isSelect: select0),YHFormChoiceItem(title: "否".local, isSelect: select1)]
cell.answerArr = answers
cell.answerBlock = {
[weak self] (arr, selectIndex) in
guard let self = self else { return }
let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? 1 : 2)
if detailItem.key == "qualification" {
self.educationInfo?.qualification = option
} else if detailItem.key == "graduate" {
self.educationInfo?.graduate = option
}
loadInfo()
}
return cell
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .educationInfo {
if let eduList = educationInfo?.eduList {
if let eduList = educationInfo?.eduList, eduList.count > 0 {
// 第一行是标题
let eduInfo:YHEducationInfo = eduList[indexPath.row-1]
if eduInfo.vacantNum > 0 {
if eduInfo.vacantNum > 0 { // 有未填项
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
if let college = eduInfo.college, !college.isEmpty {
cell.title = eduInfo.college
......@@ -225,9 +315,17 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
cell.title = "学历标题".local
}
cell.detailLabel.text = String(format: "有%d项未填", eduInfo.vacantNum)
cell.isShowDeleteBtn = (isDegreeEditMode == .canCancel)
cell.detailLabel.textColor = (isNeedShowError && eduInfo.vacantNum > 0 ? .failColor : .labelTextColor2)
cell.deleteBlock = {
[weak self] in
guard let self = self else { return }
isDegreeEditMode = .none
deleteEducationInfo(id:eduInfo.id)
}
return cell
} else {
} else { // 数据已填满
let cell = tableView.dequeueReusableCell(withIdentifier: YHEducationInfoCell.cellReuseIdentifier, for: indexPath) as! YHEducationInfoCell
cell.titleLabel.text = eduInfo.college
......@@ -239,12 +337,19 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
if let admissionTime = eduInfo.admissionTime, let graduateTime = eduInfo.graduateTime {
cell.timeLabel.text = String("\(admissionTime)-\(graduateTime)")
}
cell.isShowDeleteBtn = (isDegreeEditMode == .canCancel)
cell.deleteBlock = {
[weak self] in
guard let self = self else { return }
isDegreeEditMode = .none
deleteEducationInfo(id:eduInfo.id)
}
return cell
}
}
}
if detailItem.type == .certificateInfo {
if let quaList = educationInfo?.quaList {
if let quaList = educationInfo?.quaList, quaList.count > 0 {
// 第一行是标题
let quaInfo:YHQualificationInfo = quaList[indexPath.row-1]
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
......@@ -257,6 +362,14 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
} else {
cell.detailLabel.text = "已填完".local
}
cell.detailLabel.textColor = (isNeedShowError && quaInfo.vacantNum > 0 ? .failColor : .labelTextColor2)
cell.isShowDeleteBtn = (isQualificationEditMode == .canCancel)
cell.deleteBlock = {
[weak self] in
guard let self = self else { return }
isQualificationEditMode = .none
deleteQualificationInfo(id:quaInfo.id)
}
return cell
}
}
......@@ -308,15 +421,6 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
}
if item is YHFormAddItem {
let detailItem = item as! YHFormAddItem
if detailItem.type == .addEducation {
let vc = YHEducationDetailVC()
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .addCertificateInfo {
let vc = YHProfessionalQualificationVC()
self.navigationController?.pushViewController(vc)
}
return
}
......@@ -324,18 +428,23 @@ extension YHEducationalQualificationVC : UITableViewDelegate, UITableViewDataSou
let detailItem = item as! YHFormDetailItem
if detailItem.type == .educationInfo { // 学历
let vc = YHEducationDetailVC()
if let eduList = educationInfo?.eduList, indexPath.row-1 < eduList.count {
let eduInfo = eduList[indexPath.row-1]
vc.detailId = eduInfo.id
}
self.navigationController?.pushViewController(vc)
return
}
if detailItem.type == .certificateInfo { // 证书
let vc = YHProfessionalQualificationVC()
if let quaList = educationInfo?.quaList, indexPath.row-1 < quaList.count {
let quaInfo = quaList[indexPath.row-1]
vc.detailId = String(quaInfo.id)
}
self.navigationController?.pushViewController(vc)
return
}
}
let vc = YHEducationDetailVC()
self.navigationController?.pushViewController(vc)
}
func createDefaultCell(_ indexPath: IndexPath) -> UITableViewCell {
......@@ -364,7 +473,7 @@ extension YHEducationalQualificationVC {
// 请求家庭成员信息
func requestEducationInfo() {
self.educationRequest.requestEducationInfo(params: ["order_id": self.orderId!]) {
self.educationRequest.requestEducationInfo(params: ["order_id": self.orderId]) {
[weak self] success, error in
guard let self = self else { return }
if success {
......@@ -373,6 +482,93 @@ extension YHEducationalQualificationVC {
}
}
}
// 删除学历信息
func deleteEducationInfo(id:Int) {
self.educationRequest.deleteEducationInfo(id: id) {
[weak self] success, error in
guard let self = self else { return }
if success {
requestEducationInfo()
}
}
}
// 删除证书信息
func deleteQualificationInfo(id:Int) {
self.educationRequest.deleteQualificationInfo(id: id) {
[weak self] success, error in
guard let self = self else { return }
if success {
requestEducationInfo()
}
}
}
// 保存
func saveInfo() {
let params = ["go_next": 0,
"graduate": educationInfo?.graduate ?? 0,
"order_id": self.orderId,
"qualification": educationInfo?.qualification ?? 0]
self.educationRequest.saveAllEducationInfo(params: params) {
[weak self] success, error in
guard let self = self else { return }
if success {
requestEducationInfo()
}
}
}
func submitInfo() {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
if !isChecked {
ToastManager.shared.isTapToDismissEnabled = false
self.view.makeToast("资料还未填完", duration: 1.0, position:ToastPosition.center)
DispatchQueue.main.asyncAfter(deadline:.now()+1.0) {
self.view.hideToast()
}
return
}
saveInfo()
}
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let educationInfo = educationInfo else { return false }
// 检查所有学历信息是否有未填项
if let eduList = educationInfo.eduList, eduList.count > 0 {
for eduInfo in eduList {
if eduInfo.vacantNum > 0 {
return false
}
}
}
// 检查所有证书信息是否有未填项
if let quaList = educationInfo.quaList, quaList.count > 0 {
for quaInfo in quaList {
if quaInfo.vacantNum > 0 {
return false
}
}
}
// 检查所有问题是否有未答项
if educationInfo.qualification == 0 || educationInfo.graduate == 0 {
return false
}
return true
}
}
......@@ -7,11 +7,18 @@
//
import UIKit
import Toast_Swift
class YHProfessionalQualificationVC: YHBaseViewController {
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
var familyMemberInfo: YHFamilyMemberGroupInfo?
//【WARNING!】新添加 传orderId 已有信息传detailId
// 订单ID
var orderId: String = ""
// 专业ID
var detailId: String = ""
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
// 专业详情信息
var detailInfo = YHQualificationDetailInfo()
var isChildsEditMode: YHFormTitleItemEditType = .none
var isBrothersEditMode: YHFormTitleItemEditType = .none
......@@ -44,7 +51,7 @@ class YHProfessionalQualificationVC: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navTitle = "学历X".local
self.gk_navTitle = "专业资格及会员资格".local
view.backgroundColor = UIColor(hexString:"#F8F8F8")
createUI()
}
......@@ -57,6 +64,11 @@ class YHProfessionalQualificationVC: YHBaseViewController {
view.addSubview(tableView);
view.addSubview(bottomView)
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
saveDetailInfo()
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
......@@ -72,6 +84,11 @@ class YHProfessionalQualificationVC: YHBaseViewController {
}
loadInfo()
if !self.detailId.isEmpty { // 有专业ID则该专业已存在
reqeustDetailInfo()
} else { // 该专业是新添加的
detailInfo.orderId = orderId
}
}
func loadInfo() {
......@@ -81,14 +98,27 @@ class YHProfessionalQualificationVC: YHBaseViewController {
let title0 = YHFormTitleItem(type: .mainApplicantEducation)
let item00 = YHFormDetailItem(type: .qualificationCertificateName)
item00.placeHolder = "请选择资格证书名称".local
item00.value = detailInfo.qualification
let item01 = YHFormDetailItem(type: .conferAgencyFullName)
item01.placeHolder = "请输入颁授机构全称".local
item01.value = detailInfo.college
let item02 = YHFormDetailItem(type: .conferTime)
item02.placeHolder = "请选择颁授年份".local
item02.value = detailInfo.promulgation
let item03 = YHFormDetailItem(type: .conferCountry)
item03.placeHolder = "请选择颁授国家/地区".local
item03.value = detailInfo.collegeAddress.country
let item04 = YHFormDetailItem(type: .conferCity)
item04.placeHolder = "请选择颁授城市".local
if detailInfo.isCollegeInAboard() {
item04.value = detailInfo.collegeAddress.foreign
} else {
item04.value = detailInfo.collegeAddress.area.joined(separator: ",")
}
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02, item03, item04]
items.append(arr0)
......@@ -136,14 +166,34 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
// 只有国外城市才需输入,国内城市使用的是选择器
if detailItem.type == .conferCity {
if let text = text, !text.isEmpty {
detailInfo.collegeAddress.foreign = text
} else {
detailInfo.collegeAddress.foreign = ""
}
}
if isEditEnd {
loadInfo()
// saveDetailInfo()
}
}
return cell
} else if cellType == .selectSheet {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = ""
cell.detail = detailItem.value
return cell
}
}
......@@ -186,8 +236,6 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
let arr = items[indexPath.section]
let item:YHFormItemProtocol = arr[indexPath.row]
// 标题
if item is YHFormTitleItem {
return
......@@ -200,7 +248,9 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
[weak self] selectType in
guard let self = self else { return }
detailInfo.qualification = selectType.title
loadInfo()
saveDetailInfo()
}
} else if detailItem.type == .conferTime { // 授权年份
......@@ -208,7 +258,9 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
YHDatePickView.show(type: .yyyy) {
[weak self] date in
guard let self = self else { return }
detailInfo.promulgation = date
loadInfo()
saveDetailInfo()
}
} else if detailItem.type == .conferCountry { // 授权国家/地区
......@@ -217,15 +269,23 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
vc.backLocationStringController = {
[weak self] country in
guard let self = self else { return }
detailInfo.collegeAddress.country = country
loadInfo()
saveDetailInfo()
}
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .conferCity { // 授权城市
if detailInfo.isCollegeInAboard() { return }
let vc = YHAddressViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
detailInfo.collegeAddress.area = [string1, string2, string3, string4]
loadInfo()
saveDetailInfo()
}
self.present(vc, animated: true)
}
......@@ -272,7 +332,56 @@ extension YHProfessionalQualificationVC : UITableViewDelegate, UITableViewDataSo
}
return .defaultType
}
}
extension YHProfessionalQualificationVC {
func reqeustDetailInfo() {
self.educationRequest.getQualificationDetailInfo(id:self.detailId) {
[weak self] success, error in
guard let self = self else { return }
if success {
if let qualificationDetailInfo = self.educationRequest.qualificationDetailInfo {
detailInfo = qualificationDetailInfo
}
loadInfo()
}
}
}
func saveDetailInfo() {
var dict:[String : Any] = [:]
if detailId.isEmpty { // 新增数据
dict = ["verify" : 0,
"college":detailInfo.college,
"college_address_aboard":"",
"id":"",
"order_id" : detailInfo.orderId,
"promulgation" : detailInfo.promulgation,
"qualification" : detailInfo.qualification,
"college_address":["area":[],
"country":"",
"details":"",
"foreign":""]]
} else { // 已有数据
dict = detailInfo.toDictionary() ?? [:]
dict["verify"] = 0
}
print(dict)
self.educationRequest.saveQualificationInfo(params: dict) {
[weak self] success, error in
guard let self = self else { return }
if success {
YHHUD.flash(message: "保存成功")
} else {
YHHUD.flash(message: "保存失败")
}
}
}
}
......@@ -9,7 +9,7 @@
import UIKit
import SmartCodable
class YHEducationListInfo:SmartCodable {
class YHEducationListInfo: SmartCodable {
var eduList: [YHEducationInfo]?
var eduCount: Int = 0
var quaList: [YHQualificationInfo]?
......@@ -34,8 +34,8 @@ class YHEducationListInfo:SmartCodable {
}
class YHEducationInfo: SmartCodable {
var id: Int = -1
var orderId: Int = -1
var id: Int = 0
var orderId: Int = 0
var college: String?
var background: String?
var professional: String?
......@@ -60,8 +60,8 @@ class YHEducationInfo: SmartCodable {
}
class YHQualificationInfo: SmartCodable {
var id: Int = -1
var orderId: Int = -1
var id: Int = 0
var orderId: Int = 0
var qualification: String?
var vacantNum: Int = 0
......@@ -76,3 +76,155 @@ class YHQualificationInfo: SmartCodable {
}
}
class YHEducationDetailInfo: SmartCodable {
var id: Int = 0
var orderId: Int = 0
var college: String?
var isTop: Int = 0
var type: String?
var admissionTime: String?
var graduateTime: String?
var background: String?
var professional: String?
var degreeType: String?
var remark: String?
var average: String?
var schoolAddress: YHCollegeAddress?
var schoolAddressAboard: Int = 0
var oldId: Int = 0
var createdAt: String?
var updatedAt: String?
var deletedAt: SmartAny?
var isShow: Int = 0
var operatorName: SmartAny?
var operatorEnglishName: SmartAny?
var operatorId: Int = 0
var matchListing: Int = 0
var createFromAppid: Int = 0
var updateFromAppid: Int = 0
var customerCenterId: Int = 0
enum CodingKeys: String, CodingKey {
case id = "id"
case orderId = "order_id"
case college = "college"
case isTop = "is_top"
case type = "type"
case admissionTime = "admission_time"
case graduateTime = "graduate_time"
case background = "background"
case professional = "professional"
case degreeType = "degree_type"
case remark = "remark"
case average = "average"
case schoolAddress = "school_address"
case schoolAddressAboard = "school_address_aboard"
case oldId = "old_id"
case createdAt = "created_at"
case updatedAt = "updated_at"
case deletedAt = "deleted_at"
case isShow = "is_show"
case operatorName = "operator_name"
case operatorEnglishName = "operator_english_name"
case operatorId = "operator_id"
case matchListing = "match_listing"
case createFromAppid = "create_from_appid"
case updateFromAppid = "update_from_appid"
case customerCenterId = "customer_center_id"
}
required init() {
}
// 学校是否在国外 默认是在国内
func isSchoolInAboard() -> Bool {
guard let schoolAddress = schoolAddress else { return false }
if schoolAddress.country.isEmpty { return false }
if schoolAddress.country.contains("中国") {
return false
}
return true
}
}
class YHCollegeAddress: Codable {
var area: [String] = []
var country: String = ""
var details: String = ""
var foreign: String = ""
enum CodingKeys: String, CodingKey {
case area = "area"
case country = "country"
case details = "details"
case foreign = "foreign"
}
required init() {
}
}
class YHQualificationDetailInfo: SmartCodable {
var id: String = ""
var orderId: String = ""
var college: String = ""
var collegeAddress: YHCollegeAddress = YHCollegeAddress()
var collegeAddressAboard: Int = 0
var promulgation: String = ""
var qualification: String = ""
var remark: String = ""
var oldId: Int = 0
var createdAt: String = ""
var updatedAt: String = ""
var deletedAt: String = ""
var operatorName: String = ""
var operatorEnglishName: String = ""
var operatorId: Int = 0
var matchListing: Int = 0
var createFromAppid: Int = 0
var updateFromAppid: Int = 0
var customerCenterId: Int = 0
enum CodingKeys: String, CodingKey {
case id = "id"
case orderId = "order_id"
case college = "college"
case collegeAddress = "college_address"
case collegeAddressAboard = "college_address_aboard"
case promulgation = "promulgation"
case qualification = "qualification"
case remark = "remark"
case oldId = "old_id"
case createdAt = "created_at"
case updatedAt = "updated_at"
case deletedAt = "deleted_at"
case operatorName = "operator_name"
case operatorEnglishName = "operator_english_name"
case operatorId = "operator_id"
case matchListing = "match_listing"
case createFromAppid = "create_from_appid"
case updateFromAppid = "update_from_appid"
case customerCenterId = "customer_center_id"
}
// 学校是否在国外 默认是在国内
func isCollegeInAboard() -> Bool {
if collegeAddress.country.isEmpty { return false }
if collegeAddress.country.contains("中国") {
return false
}
return true
}
required init() {
}
}
......@@ -9,14 +9,19 @@
import UIKit
class YHEducationRequestViewModel {
// 学历和专业信息
var educationInfo: YHEducationListInfo?
// 学历详情信息
var educationDetailInfo: YHEducationDetailInfo?
// 专业详情信息
var qualificationDetailInfo: YHQualificationDetailInfo?
// 添加家庭成员
// 请求学历和专业证书信息
func requestEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.educationInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.getEducationAndQulificationInfoApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
......@@ -41,4 +46,208 @@ class YHEducationRequestViewModel {
callBackBlock(false,err)
}
}
// 获取学历详情
func getEducationDetailInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.getEducationDetailInfoApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
let dic = model.data?.peel as? [AnyHashable : Any]
guard let resultModel = YHEducationDetailInfo.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
educationDetailInfo = resultModel
callBackBlock(true,nil)
} failBlock: { err in
callBackBlock(false,err)
}
}
// 保存学历
func saveEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.saveEducationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
if model.code == NetWorkCode.success.rawValue {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
// 删除学历
func deleteEducationInfo(id:Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.deleteEducationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:["id" : id]) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
if model.code == NetWorkCode.success.rawValue {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
// 删除专业
func deleteQualificationInfo(id:Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Qualification.deleteQualificationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:["id" : id]) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
if model.code == NetWorkCode.success.rawValue {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
// 保存所有
func saveAllEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.saveAllEduAndQuaInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
if model.code == NetWorkCode.success.rawValue {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
// 获取专业详情
func getQualificationDetailInfo(id:String, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Qualification.getQualificationDetailInfoApi
let _ = YHNetRequest.getRequest(url: strUrl, params:["id" : id]) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
let dic = model.data?.peel as? [AnyHashable : Any]
guard let resultModel = YHQualificationDetailInfo.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
qualificationDetailInfo = resultModel
callBackBlock(true,nil)
} failBlock: { err in
callBackBlock(false,err)
}
}
// 保存专业信息
func saveQualificationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Qualification.saveQualificationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
printLog("model 是 ==> \(model)")
if model.code == NetWorkCode.success.rawValue {
callBackBlock(true,nil)
} else {
callBackBlock(false, nil)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
......@@ -12,6 +12,14 @@ class YHEducationInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHEducationInfoCell"
let horizonalGap = 18.0
var deleteBlock:(()->Void)?
var isShowDeleteBtn:Bool = false {
didSet {
deleteButton.isHidden = !isShowDeleteBtn
timeLabel.isHidden = isShowDeleteBtn
arrowImgView.isHidden = isShowDeleteBtn
}
}
lazy var titleLabel: UILabel = {
let label = UILabel()
......@@ -38,6 +46,17 @@ class YHEducationInfoCell: UITableViewCell {
return label
}()
private lazy var deleteButton: UIButton = {
let btn = UIButton()
btn.setTitle("删除".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(.failColor, for: .normal)
btn.addTarget(self, action: #selector(didClickDeleteBtn(btn:)), for: .touchUpInside)
btn.isHidden = true
return btn
}()
private lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView
......@@ -66,6 +85,13 @@ class YHEducationInfoCell: UITableViewCell {
setupUI()
}
@objc func didClickDeleteBtn(btn:UIButton) {
if let deleteBlock = deleteBlock {
deleteBlock()
}
}
func setupUI() {
self.selectionStyle = .none
......@@ -74,6 +100,7 @@ class YHEducationInfoCell: UITableViewCell {
contentView.addSubview(timeLabel)
contentView.addSubview(arrowImgView)
contentView.addSubview(bottomLine)
contentView.addSubview(deleteButton)
titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
......@@ -88,6 +115,12 @@ class YHEducationInfoCell: UITableViewCell {
make.centerY.equalTo(titleLabel)
}
deleteButton.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(64, 40))
make.centerY.equalTo(titleLabel)
make.right.equalToSuperview()
}
arrowImgView.snp.makeConstraints { make in
make.width.height.equalTo(20.0)
make.centerY.equalTo(titleLabel)
......
......@@ -19,15 +19,18 @@ class YHCodeSueecssViewController: YHBaseViewController {
var getCodeLabel: UILabel!
var getCodeButton: UIButton!
var smscodeView: YHSmsCodeInputView!
var phoneNumber: String?
var viewModel: YHLoginViewModel?
override func viewDidLoad() {
super.viewDidLoad()
viewModel = YHLoginViewModel()
gk_navBackgroundColor = .clear
gk_navShadowColor = .clear
gk_navigationBar.isHidden = true
setView()
// Do any additional setup after loading the view.
startClicked()
startTime()
}
func setView() {
......@@ -74,7 +77,7 @@ class YHCodeSueecssViewController: YHBaseViewController {
loginSubTitleLabel = {
let label = UILabel()
label.text = "已发送至 +86 188****2882"
label.text = "已发送至 \(phoneNumber ?? "")"
label.font = kFont(size: 13)
label.textColor = UIColor(hex:0xc0c0c0)
return label
......@@ -90,7 +93,14 @@ class YHCodeSueecssViewController: YHBaseViewController {
smscodeView = {
let view = YHSmsCodeInputView(config: YHSmsCodeViewConfig())
view.complete = { [weak self] code in
self?.dismiss(animated: true)
guard let self = self else { return }
self.viewModel?.login(self.phoneNumber ?? "", code: code, callBackBlock: {[weak self] success in
guard let self = self else { return }
YHLoginManager.shared.userModel = success
if success?.token?.count != 0 {
self.dismiss(animated: true)
}
})
}
return view
}()
......@@ -146,7 +156,7 @@ class YHCodeSueecssViewController: YHBaseViewController {
}
@objc func startClicked() {
func startTime() {
getCodeLabel.isHidden = false
getCodeButton.isHidden = true
let sourceTimer = DispatchSource.makeTimerSource()
......@@ -171,6 +181,14 @@ class YHCodeSueecssViewController: YHBaseViewController {
sourceTimer.resume()
}
@objc func startClicked() {
viewModel?.getLoginCode(phoneNumber ?? "", callBackBlock: {[weak self] success in
guard let self = self else { return }
self.startTime()
})
}
@objc func close() {
self.navigationController?.popViewController()
}
......
......@@ -18,11 +18,12 @@ class YHPhoneLoginViewController: YHBaseViewController {
var phoneMessageView: YHPhoneMessageView!
var getCodeButton: UIButton!
var privacyView: YHLoginPrivacyView!
var viewModel: YHLoginViewModel?
override func viewDidLoad() {
super.viewDidLoad()
viewModel = YHLoginViewModel()
setView()
gk_navBackgroundColor = .clear
gk_navShadowColor = .clear
gk_navigationBar.isHidden = true
......@@ -113,6 +114,16 @@ class YHPhoneLoginViewController: YHBaseViewController {
view.layer.cornerRadius = 6
view.layer.borderWidth = 1
view.layer.borderColor = UIColor(hex:0xebeef4).cgColor
view.phoneBlock = {[weak self] count in
guard let self = self else { return }
if count == 0 {
self.getCodeButton.backgroundColor = UIColor(hex:0x2274ee).withAlphaComponent(0.4)
self.getCodeButton.isEnabled = false
} else {
self.getCodeButton.backgroundColor = UIColor(hex:0x2274ee)
self.getCodeButton.isEnabled = true
}
}
return view
}()
view.addSubview(phoneMessageView)
......@@ -125,13 +136,14 @@ class YHPhoneLoginViewController: YHBaseViewController {
getCodeButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x2274ee).withAlphaComponent(0.8)
button.backgroundColor = UIColor(hex:0x2274ee).withAlphaComponent(0.4)
button.titleLabel?.font = kBoldFont(size: 16)
button.contentHorizontalAlignment = .center
button.setTitle("获取验证码", for: .normal)
button.setTitleColor( UIColor(hex:0x979797), for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = 6
button.addTarget(self, action: #selector(getCode), for: .touchUpInside)
button.isEnabled = false
return button
}()
view.addSubview(getCodeButton)
......@@ -157,10 +169,18 @@ class YHPhoneLoginViewController: YHBaseViewController {
}
@objc func getCode() {
let phoneNumer = phoneMessageView.phoneTextField.text ?? ""
guard phoneNumer.isMobile() == true else {
YHHUD.flash(message: "请输入正确的手机号")
return
}
if privacyView.isAgree {
viewModel?.getLoginCode(phoneNumer, callBackBlock: {[weak self] success in
guard let self = self else { return }
let vc = YHCodeSueecssViewController()
vc.phoneNumber = self.phoneMessageView.phoneTextField.text
self.navigationController?.pushViewController(vc)
})
} else {
let view = YHPrivacyAlertView(frame: view.bounds)
view.urlBlock = { [weak self] url in
......
......@@ -10,22 +10,15 @@ import UIKit
import SmartCodable
struct YHUserModel: SmartCodable {
var userid: Int?
var yhId: String?
var nickname: String?
var mobile: String?
var headpic: String?
var sex: Int?
var token: String?
var brand: String?
var os: String?
var ip: String?
var imei: String?
var channel: String?
init(userid: Int? = nil, nickname: String? = nil, mobile: String? = nil, headpic: String? = nil, sex: Int? = nil, token: String? = nil) {
self.userid = userid
self.nickname = nickname
self.mobile = mobile
self.headpic = headpic
self.sex = sex
self.token = token
}
init() {
}
var token: String? // 暂无token
}
//
// YHLoginManager.swift
// galaxy
//
// Created by EDY on 2024/2/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHLoginManager: NSObject {
static let shared = YHLoginManager()
var userModel: YHUserModel?
private override init() {}
func isLogin() -> Bool {
if userModel?.token?.count != 0 {
return true
}
return false
}
}
......@@ -9,8 +9,10 @@
import UIKit
class YHPhoneMessageView: UIView {
typealias PhoneBlock = (_ count: Int) -> ()
typealias Block = () -> ()
var block: Block?
var phoneBlock: PhoneBlock?
var messageButton: UIButton!
var pointImageView: UIImageView!
var phoneTextField: UITextField!
......@@ -59,6 +61,7 @@ class YHPhoneMessageView: UIView {
text.textAlignment = .left
text.keyboardType = .phonePad
text.clearButtonMode = .always
text.addTarget(self, action: #selector(textFeildChange), for: .allEvents)
return text
}()
addSubview(phoneTextField)
......@@ -74,4 +77,10 @@ class YHPhoneMessageView: UIView {
block()
}
}
@objc func textFeildChange() {
if let block = phoneBlock {
block(phoneTextField.text?.count ?? 0)
}
}
}
......@@ -19,9 +19,11 @@ class YHLoginViewModel: YHBaseViewModel {
//接口
extension YHLoginViewModel {
//发送验证码
func getLoginCode(callBackBlock: @escaping (_ success: Bool)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "/user/login-code"
let _ = YHNetRequest.postRequest(url: strUrl) {[weak self] json, code in
func getLoginCode(_ phone: String, callBackBlock: @escaping (_ success: Bool)->()) {
let params: [String : Any] = ["type": "Phone",
"value": phone]
let strUrl = "http://192.168.35.135:18087/" + "user/verify-code"
let _ = YHNetRequest.postRequest(url: strUrl, params: params) {[weak self] json, code in
guard let self = self else { return }
//1. json字符串 转 对象
if code == 200 {
......@@ -32,26 +34,30 @@ extension YHLoginViewModel {
}
}
func login(callBackBlock: @escaping (_ success: Bool)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "/user/userlogin"
let _ = YHNetRequest.postRequest(url: strUrl) {[weak self] json, code in
func login(_ phone: String, code: String,callBackBlock: @escaping (_ success: YHUserModel?)->()) {
let params: [String : Any] = ["mobile": phone,
"sms_code": code,
"channel": "app",
"client": "super_app"]
let strUrl = "http://192.168.25.12:18083/" + "auth/login"
let _ = YHNetRequest.postRequest(url: strUrl, params: params) {[weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false)
callBackBlock(nil)
return
}
// printLog("model 是 ==> \(model)")
let dic = model.data?.peel
guard let resultModel = YHUserModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(nil)
return
}
self.userModel = resultModel
callBackBlock(true)
callBackBlock(resultModel)
} failBlock: { err in
callBackBlock(false)
callBackBlock(nil)
}
}
}
......@@ -128,38 +128,6 @@ extension String {
}
}
// MARK: - 计算文字的宽高
extension String {
/// 计算文字的宽高
///
/// - Parameters:
/// - font: 字体大小
/// - lineSpacing: 行高
/// - constraintRect: 大小范围
/// - Returns: 宽高
public func bs_sizeWithConstrained(_ font: UIFont,
lineSpacing: CGFloat? = nil,
constraintRect: CGSize = CGSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude)) -> CGSize {
var attributes: [NSAttributedString.Key : Any] = [NSAttributedString.Key.font: font]
if let lineSpacing = lineSpacing {
//格式调整
let style = NSMutableParagraphStyle()
/**调行间距*/
style.lineSpacing = lineSpacing
style.alignment = .left
attributes[.paragraphStyle] = style
}
let boundingBox = self.boundingRect(
with: constraintRect,
options: NSStringDrawingOptions.usesLineFragmentOrigin,
attributes: attributes,
context: nil)
return boundingBox.size
}
}
// MARK: - 正则获取http
extension String {
......
......@@ -32,19 +32,37 @@ class YHAllApiName {
//保存其他资料信息
static let updateOtherInfoApi = "frontend/order/updateOrderOtherInformation"
}
struct Family {
// 获取家庭成员信息 添加家庭成员也用这个
static let familyInfoApi = "frontend/order/information/family"
// 删除家庭成员信息
static let familyMemberDeleteApi = "frontend/order/information/family/delete"
}
struct Education {
// 获取学历及证书相关信息
static let educationInfoApi = "frontend/education/list"
static let getEducationAndQulificationInfoApi = "frontend/education/list"
// 获取学历详情信息
static let getEducationDetailInfoApi = "frontend/education/detail"
// 保存学历信息
static let saveEducationInfoApi = "frontend/education/save"
// 删除学历
static let deleteEducationInfoApi = "frontend/education/del"
// 保存所有信息
static let saveAllEduAndQuaInfoApi = "frontend/education/save_all"
}
struct Qualification {
// 获取学历详情信息
static let getQualificationDetailInfoApi = "frontend/qualification/detail"
// 删除专业
static let deleteQualificationInfoApi = "frontend/qualification/del"
// 保存专业
static let saveQualificationInfoApi = "frontend/qualification/save"
}
//Users
......
......@@ -95,7 +95,7 @@ class YHNetRequest: NSObject {
requestHeader.add(name:"sign",value:sign)
requestHeader.add(name: "token", value: "eyJpdiI6Ik5aeEVDclZTK0FISEFBZUgxN2VkdGc9PSIsInZhbHVlIjoiRFRJOHlObzVrZlp4T2tVYW1MSE1ZK0Z3dXlyK3p4QlczNmxsTXdkdW5GQVY4Q2VqZlNNUDdrdVpsb0JcLytpYmJheUp2MWZTUE5pOWgrVWRLdEtIUkx4R1wvS3F6SmRSQ0dWeFVXanFINGkyRWNMTXB4TVlcLzhjXC9NSzVoMFwvZ1ZOaVIwb0VqWlo1VERPSHY2RWJhME1RdWtkXC8yanBQdm9lMWM4WXJVK1BnMDd6SncwVVlWMDNnbSswSnM3eVwveFRRck03M3pOaDFSc3g0UmlYMTJQdmZpSkhUWHVMa21RV2xRbXBkalVTTUFicmFaN2NVNXl1ZTJOeEJoKzhrMnZtdzdvM1U5Qmh4WXNiSEFERUpiZHNWNkxoM2ZkVVRUdFlMMU1MQnIyaWNxNSt4S1NocDVEbnNqeHphUCtVVk1qTlVnMk1ydVNPamJ0c2tDQ1wvWFk1SkxtSWtDMU9oT3ZqaFpuNU5aVUVicHpYVU56VnlqK01Cb20welJMbkQrcTFWOHFUbzlPK0RGdDRcLzJ1T094MjNjYTVZZmJcL2txRE93cEFUYzlKWWdVWE9cLzFnYnVwTFZ4VUtqMFQ5QlgzZitDQjhyNURpU3p0bktqblBicUxPekNBcWRWM0g0WklSOEc0T0RPVkNBMGZQdEtWV3ZqN3IrcHZDYm9UNjREdnA3U1RZY1Z1dFE3K1RRM2F2eGY0QXc2dGlha0RBUDVpVHdFWE53dzl2eVczVk9VNTJSa1Fzb1J4ZGd0c0RCdktPQ1FWOUQ5Y0krckQ3bFc4NkNJMHliSXlnNGtYU1ZCUHRZWTdCKzA5d1wvdldzWTlpeUdYaEg4eGhITHpRSUthMWpSVlZvZVhwZ3BvamxCTHFSUXJmQ1hQNThYbUNNanZnVGs0b3RDTUFmYkdsYTEzeEtnTXJpZVU0QnJHWDJoUk9sUklzaFFhUkJiNWk0Z2E0cUUwejU4RmF2RnE4Z2U0eEo3VmZ2SmFMTlVacFBvSFlZUmM2N3liVTdhTk5NWU9YS0xtalk3QUN3NWV2UTlPeE5hMmk0aHU4MSt0YjNJQytFczRMa2l6XC9jV0Jxc01QYU0yYXdTXC92RXBxTFNVOVd6SlwvRm9KM21jUHlcL2diRlMyU3REeEl0K1RxSjRuck8xaXlOaWY4NXVzMVBibXpVSEZJWkVZQnFUd2k5TUVJcDUwUEFjTmljTzYyaWFYaFkzZUtkR294d29LUzBUTFF1Y0xxbWtMNFF4ZlZkN2k4YktEUnRGekU3OEdaN2J3TUR4T2FpVHRKaGlqRWNcL2c5dlwvOUVEVmdLNUhBSk1wSGV5UXVoOFJydlczc09HU1EyeXI4SFZZQmJJQWx1cGFIaXhmK1VJNmdoNmwrOElMZXFxSHZtazQreW84RFBlOXFnVDI2bm1tZWl0K01OcU1DSGJEQXdnWW9Hc0ptWFVJbXVXdEpyT2FKUHprTzJ1MkxFSEViZGV4cFpuOWRXK3dUdVR4bmJHZ1VRRGJycFRBME5lWUtaT0JCYjViSWVvcVJ3RXllb2tQZ1VkUWFqVWo0UHQzMUQwWVMwZ05rTTU0Nk1QQUdxTm9rZFNISVYrTG5DWlArNkt5RkZxajdZN1luakRKQVdUaVpnOUhCUExYMEVKRXRRT3QyZTI4cU9TdlBrbWxVZkFLSWZFbXNha3lCZUhFRVpyTmxQOERjbVwvMytCc0JpNnZcL1Nvek9yR2pUWGF2XC9VMzN4OEY5T3VsdUNGRFNWbHZZMnBzNHhMeEdIR21majBOOUJNbEhlK1J4S3dFTnlJamdTeFQyTWlTTlhCUWxnSDF6VmNhWHIzVGpoREY5clB2XC9uZHZjSm1iTHZ1bjFIUUFRait6dUJlUk1WQ1FhdXFoN002YlQ5MVwvQVMzYzJJQ0RFR1czdEtqMFBTQT09IiwibWFjIjoiOGVlZjBmNTVmMzEwNjhkZjVmYTlkYzAwYzllMjJmNjUyZmRmN2U1ODFiZTIzNzRjMDVjMTNiOTNhOWRhMmVkYSJ9")
requestHeader.add(name: "token", value: "eyJpdiI6Iko1OGFleVJ5SVBEaDh6U0J4R0dqa1E9PSIsInZhbHVlIjoic3ZQWVBiNEVvTmpxaEFcL2pKc3NkKzlhaXZ0Qk1nallPcUdnbkVISUJZT0tNTHAyTmtzY3lUMVh3VURnUnpSTWRsZXNHVVNhR2RPeU05NnprdTlhUXMyWENyTWVFU3B4SGlxenBcL1ZnWEk2Vnl3bjRuT1NhcDVCV2k2bXl4Y3F4RXRsaXBTdWVKUUQwTjFadUx2UURvK2RZS3VsWEJpb2xETUc4RzZWdnh0ZzJVVGhzVGdoYjdOT2ZDMFpld2plU2pCVDl3elgxVEpjYmJQQnZlYnRoMTJheUlicVVURWx4XC81elVCS21nSzF4SkhhN2VNTE12ZUVMNThpWElPY3d0MVNlQkRUSW9Rd3V0ZTYwSytPaDhYSElHdDJvWSs4cWpkRkRMU3pKaUdvNW1DTmJiK3Zvdmk4REk2VWpzTCs3cERSUXFkc3hOREJaNVdGU1lEOXN2b1JQSWNZYWVCQjZBaHJCUEV0UmhLMWFrWFN3ZGx4ZGR3Q3FHVm83QjgxMEFHWDQ3aVdnMVVNYnpjS2JuTkpHdnFYK0FoNksyWkFSZGJNcXFTenhXdWpubTZsQXhmZ0g0ekc5REVkQW1xbEVTYktiTmRaMTN6blF4NkFZQzNxMlp0bDlDcGpsdGFpWFNtRmVVa1FYSEtjZUJKbUhWZ2VZanh6VEpWRHpWK0RPZlJKN0UxOHJHcmpFZ1d3XC94WlplOWZHSlNBVnRJKzNFTzNtMk9uXC8xb1hzS3pjalJmYktCa1hqdFJjSVwvMWNWUnlqYU14R01Lbko5TjZHNGlxZnUyOEpnamw5ZEFQK3M1MVZJYjI5RWhON3Q5YlVyMWZYbUNtMmpjTDFVemtjUVVRQmwzSEp6TFZZRytja3A5Q2hSS2xycDF2RXZUbUdzTWVHNHNjVG81UUZqeUV2ck9QdHczS3hHYkpPR09vQ0ZkK0kwVEZoaVFUajF4XC9vSFBJUllNbFlqWUFYYzRRMGJabGxBV2RmTUtOSmNRcVZpM0lNVVpNWWdhNEJLWXlkVG82c3pcLzFsSkNyQmhkNFZ6WTcwbEloSkFndCtEUDNwVkF1MG9GUGQ1allBT3Q4Q0hsSFkrK2lveWxaVHE4UFNDR0JvTERoc1BYdnp0UFVSYWlxQjFCbVdkdGl5YWFnZVRpK1YzUzVBa1I4cU91V0pkSnBcL0o0K1pqbzJQZVRuR0wzXC9cLzVna0JiWVhlRXFwRXljN3N0NURhdkZFV001TU9QdFBXQjM0bXplSnl3T1RjMFBqbCtkSytIZ0tyME5vdEpSMnd0Z3pvRHpSWUkydEFCb2plYlpPQW9WaVRMcmxyYkxPZnd6RllkR2VoQTBEZVZjNjRTcWVlS1AxT0wybXVuQWJZQzhOVW44K3RJT000endabjEyR3d5OHhhbzNyT0hpdEd2VWRiallmc1ZuQkhaWmF2ODhVclpNb2lGUDB6Z3dqMVdVczh3RGQ4WnZ1a1o2Qzh5XC8yS1pmRjJ2TkhWXC9QTkFuY0NGR0FIc1BJcThadk1ZTFFxeXJKZ05XT2t4SzFQa1RnaTg2WXBhMnNzM0k4bk90aEQ1aFwvXC9lY1dpVFFzYUVoNGVhdWhsNEQwczJGTWtncTA0aDQ5SDlDTGtOREVYNVJQNU9HaURnZ01wR2JWaWkyWVVlK2FcL3JNZVB4d2dcLzR6MjNPYTJrcW83T2cyVVFONWVnMTRXczB3azVteHVzMGVYUEhVVEt4SmpROCtLZGwrRW5HbVpxV3F4cHZOZ2x6M1ZoNFFHRmxnZGs4alEwaU9cL09WSDZpSkRsYitzdzNWT1IrZk5VN0R1QkZDUGw4WGhVZnhjQ1lmNmJhU0VCYVp2VUNiUVlcL1VvbTY0bzAzdEFzbVJLQUhUWW1UT2RcL1Bqbmh5XC9keDRGRThzNlY2aFFVbEpqMnc9PSIsIm1hYyI6IjFjMDE1NmZiNDc4ZWE2ZWUwZDI0N2I3MTc3N2QxMmZjNzE4OTExNGYwNDIwMzgzNTA1YWQyOGMyNzIwYjllMDUifQ==")
headers = requestHeader
}
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "work_example_back@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "work_example_back@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "work_example_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "work_example_close@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