Commit 27909f43 authored by David黄金龙's avatar David黄金龙

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

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  部分走查问题修改
parents ea6775d2 ea6f567d
...@@ -177,7 +177,6 @@ ...@@ -177,7 +177,6 @@
045EEF152B9F171A0022A143 /* YHHKIDCardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE652B9F171A0022A143 /* YHHKIDCardModel.swift */; }; 045EEF152B9F171A0022A143 /* YHHKIDCardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE652B9F171A0022A143 /* YHHKIDCardModel.swift */; };
045EEF162B9F171A0022A143 /* YHMainApplicantInformationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE672B9F171A0022A143 /* YHMainApplicantInformationViewController.swift */; }; 045EEF162B9F171A0022A143 /* YHMainApplicantInformationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE672B9F171A0022A143 /* YHMainApplicantInformationViewController.swift */; };
045EEF172B9F171A0022A143 /* YHSelectCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE682B9F171A0022A143 /* YHSelectCountryViewController.swift */; }; 045EEF172B9F171A0022A143 /* YHSelectCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE682B9F171A0022A143 /* YHSelectCountryViewController.swift */; };
045EEF182B9F171A0022A143 /* area.plist in Resources */ = {isa = PBXBuildFile; fileRef = 045EEE6B2B9F171A0022A143 /* area.plist */; };
045EEF192B9F171A0022A143 /* YHAddressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE6C2B9F171A0022A143 /* YHAddressModel.swift */; }; 045EEF192B9F171A0022A143 /* YHAddressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE6C2B9F171A0022A143 /* YHAddressModel.swift */; };
045EEF1A2B9F171A0022A143 /* YHAddressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE6D2B9F171A0022A143 /* YHAddressViewController.swift */; }; 045EEF1A2B9F171A0022A143 /* YHAddressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE6D2B9F171A0022A143 /* YHAddressViewController.swift */; };
045EEF1B2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE6E2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift */; }; 045EEF1B2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE6E2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift */; };
...@@ -205,6 +204,7 @@ ...@@ -205,6 +204,7 @@
0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4392B579EAC00CFB916 /* YHLoginViewModel.swift */; }; 0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4392B579EAC00CFB916 /* YHLoginViewModel.swift */; };
047294E82B988A19008E0B84 /* YHNewWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047294E72B988A19008E0B84 /* YHNewWebViewController.swift */; }; 047294E82B988A19008E0B84 /* YHNewWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047294E72B988A19008E0B84 /* YHNewWebViewController.swift */; };
04754A952B96FF3D00F8ADCA /* UITextField+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */; }; 04754A952B96FF3D00F8ADCA /* UITextField+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */; };
047619E92BA9867100F45358 /* YHCountryHotView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047619E82BA9867100F45358 /* YHCountryHotView.swift */; };
0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */; }; 0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */; };
0477E17C2BA4238400436346 /* YHMaterialListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17B2BA4238400436346 /* YHMaterialListViewController.swift */; }; 0477E17C2BA4238400436346 /* YHMaterialListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17B2BA4238400436346 /* YHMaterialListViewController.swift */; };
0477E17E2BA4362A00436346 /* YHCustomNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */; }; 0477E17E2BA4362A00436346 /* YHCustomNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */; };
...@@ -550,7 +550,6 @@ ...@@ -550,7 +550,6 @@
045EEE652B9F171A0022A143 /* YHHKIDCardModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHKIDCardModel.swift; sourceTree = "<group>"; }; 045EEE652B9F171A0022A143 /* YHHKIDCardModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHKIDCardModel.swift; sourceTree = "<group>"; };
045EEE672B9F171A0022A143 /* YHMainApplicantInformationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMainApplicantInformationViewController.swift; sourceTree = "<group>"; }; 045EEE672B9F171A0022A143 /* YHMainApplicantInformationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMainApplicantInformationViewController.swift; sourceTree = "<group>"; };
045EEE682B9F171A0022A143 /* YHSelectCountryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSelectCountryViewController.swift; sourceTree = "<group>"; }; 045EEE682B9F171A0022A143 /* YHSelectCountryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSelectCountryViewController.swift; sourceTree = "<group>"; };
045EEE6B2B9F171A0022A143 /* area.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = area.plist; sourceTree = "<group>"; };
045EEE6C2B9F171A0022A143 /* YHAddressModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressModel.swift; sourceTree = "<group>"; }; 045EEE6C2B9F171A0022A143 /* YHAddressModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressModel.swift; sourceTree = "<group>"; };
045EEE6D2B9F171A0022A143 /* YHAddressViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressViewController.swift; sourceTree = "<group>"; }; 045EEE6D2B9F171A0022A143 /* YHAddressViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressViewController.swift; sourceTree = "<group>"; };
045EEE6E2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressPickViewTableViewCell.swift; sourceTree = "<group>"; }; 045EEE6E2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressPickViewTableViewCell.swift; sourceTree = "<group>"; };
...@@ -578,6 +577,7 @@ ...@@ -578,6 +577,7 @@
0468D4392B579EAC00CFB916 /* YHLoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginViewModel.swift; sourceTree = "<group>"; }; 0468D4392B579EAC00CFB916 /* YHLoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginViewModel.swift; sourceTree = "<group>"; };
047294E72B988A19008E0B84 /* YHNewWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHNewWebViewController.swift; sourceTree = "<group>"; }; 047294E72B988A19008E0B84 /* YHNewWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHNewWebViewController.swift; sourceTree = "<group>"; };
04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField+Extension.swift"; sourceTree = "<group>"; }; 04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField+Extension.swift"; sourceTree = "<group>"; };
047619E82BA9867100F45358 /* YHCountryHotView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCountryHotView.swift; sourceTree = "<group>"; };
0477E1792BA41C7E00436346 /* YHCertificateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateModel.swift; sourceTree = "<group>"; }; 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateModel.swift; sourceTree = "<group>"; };
0477E17B2BA4238400436346 /* YHMaterialListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMaterialListViewController.swift; sourceTree = "<group>"; }; 0477E17B2BA4238400436346 /* YHMaterialListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMaterialListViewController.swift; sourceTree = "<group>"; };
0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCustomNavigationBar.swift; sourceTree = "<group>"; }; 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCustomNavigationBar.swift; sourceTree = "<group>"; };
...@@ -942,6 +942,7 @@ ...@@ -942,6 +942,7 @@
045EEDE42B9F171A0022A143 /* YHWorkIntroductionTableViewCell.swift */, 045EEDE42B9F171A0022A143 /* YHWorkIntroductionTableViewCell.swift */,
045EEDE52B9F171A0022A143 /* YHClipperButton.swift */, 045EEDE52B9F171A0022A143 /* YHClipperButton.swift */,
045EEDE62B9F171A0022A143 /* YHWorkExampleTypeView.swift */, 045EEDE62B9F171A0022A143 /* YHWorkExampleTypeView.swift */,
047619E82BA9867100F45358 /* YHCountryHotView.swift */,
045EEDE72B9F171A0022A143 /* YHResultBottomView.swift */, 045EEDE72B9F171A0022A143 /* YHResultBottomView.swift */,
045EEDE82B9F171A0022A143 /* YHWorkFileItemView.swift */, 045EEDE82B9F171A0022A143 /* YHWorkFileItemView.swift */,
); );
...@@ -1357,7 +1358,6 @@ ...@@ -1357,7 +1358,6 @@
045EEE6A2B9F171A0022A143 /* YHAddressPicker */ = { 045EEE6A2B9F171A0022A143 /* YHAddressPicker */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
045EEE6B2B9F171A0022A143 /* area.plist */,
045EEE6C2B9F171A0022A143 /* YHAddressModel.swift */, 045EEE6C2B9F171A0022A143 /* YHAddressModel.swift */,
045EEE6D2B9F171A0022A143 /* YHAddressViewController.swift */, 045EEE6D2B9F171A0022A143 /* YHAddressViewController.swift */,
045EEE6E2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift */, 045EEE6E2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift */,
...@@ -2103,7 +2103,6 @@ ...@@ -2103,7 +2103,6 @@
04808C062B4686510056D53C /* ATAuthSDK.bundle in Resources */, 04808C062B4686510056D53C /* ATAuthSDK.bundle in Resources */,
A5C5B2EE2B4F9B8800A7C5D1 /* Localizable.xcstrings in Resources */, A5C5B2EE2B4F9B8800A7C5D1 /* Localizable.xcstrings in Resources */,
A58951C52B398D1000225C19 /* Launch Screen.storyboard in Resources */, A58951C52B398D1000225C19 /* Launch Screen.storyboard in Resources */,
045EEF182B9F171A0022A143 /* area.plist in Resources */,
A51044182B493675006B60BB /* README.md in Resources */, A51044182B493675006B60BB /* README.md in Resources */,
A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */, A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */,
A5E69D512BA304D400411932 /* DIN Alternate Bold.ttf in Resources */, A5E69D512BA304D400411932 /* DIN Alternate Bold.ttf in Resources */,
...@@ -2441,6 +2440,7 @@ ...@@ -2441,6 +2440,7 @@
045EEEA02B9F171A0022A143 /* YHWorkItemListModel.swift in Sources */, 045EEEA02B9F171A0022A143 /* YHWorkItemListModel.swift in Sources */,
045EEEAD2B9F171A0022A143 /* YHWorkExperienceListTableViewCell.swift in Sources */, 045EEEAD2B9F171A0022A143 /* YHWorkExperienceListTableViewCell.swift in Sources */,
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */, 049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */,
047619E92BA9867100F45358 /* YHCountryHotView.swift in Sources */,
045EEEF82B9F171A0022A143 /* YHFormItemOnlyDoubleChoiceCell.swift in Sources */, 045EEEF82B9F171A0022A143 /* YHFormItemOnlyDoubleChoiceCell.swift in Sources */,
0480976D2BA158A1000B9DCA /* YHCertificateResourceUploadVC.swift in Sources */, 0480976D2BA158A1000B9DCA /* YHCertificateResourceUploadVC.swift in Sources */,
045EEE8B2B9F171A0022A143 /* YHPreviewMainApplicantInfoViewController.swift in Sources */, 045EEE8B2B9F171A0022A143 /* YHPreviewMainApplicantInfoViewController.swift in Sources */,
......
...@@ -13,10 +13,10 @@ class YHSelectCountryViewController: YHBaseViewController { ...@@ -13,10 +13,10 @@ class YHSelectCountryViewController: YHBaseViewController {
var searchView: UITextField! var searchView: UITextField!
var flagLabel: UILabel! var flagLabel: UILabel!
var tableView: UITableView! var tableView: UITableView!
var collectionView: UICollectionView!
var hotDataSource = ["中国-China","中国香港-Hong Kong","中国澳门-Macau","中国台湾-Taiwan","新加坡-Singapore","澳大利亚-Australia","美国-United States"] var hotDataSource = ["中国-China","中国香港-Hong Kong","中国澳门-Macau","中国台湾-Taiwan","新加坡-Singapore","澳大利亚-Australia","美国-United States"]
var searchDataSource: [YHCountryMessage]? var searchDataSource: [YHCountryMessage]?
var viewModel: YHSelectCountryViewModel? var viewModel: YHSelectCountryViewModel?
var typeView: YHCountryHotView!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -86,25 +86,24 @@ class YHSelectCountryViewController: YHBaseViewController { ...@@ -86,25 +86,24 @@ class YHSelectCountryViewController: YHBaseViewController {
make.height.equalTo(20) make.height.equalTo(20)
} }
collectionView = { typeView = {
let layout = UICollectionViewFlowLayout() let view = YHCountryHotView()
layout.minimumInteritemSpacing = 12 // 设置水平间距 view.dataSource = self.hotDataSource
layout.minimumLineSpacing = 16 // 设置垂直间距 view.isHidden = false
layout.scrollDirection = .vertical view.hotBlock = {[weak self] string in
// 初始化UICollectionView对象 guard let self = self else { return }
let collection = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout) view.isHidden = true
collection.dataSource = self if let backLocationStringController = backLocationStringController {
collection.delegate = self backLocationStringController(string)
self.navigationController?.popViewController()
// 注册自定义单元格类型 }
collection.register(cellWithClass: YHCountryCollectionViewCell.self) }
return collection return view
}() }()
view.addSubview(collectionView) view.addSubview(typeView)
collectionView.snp.makeConstraints { make in typeView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 114) make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 114)
make.left.equalTo(21) make.left.right.equalToSuperview()
make.right.equalTo(-21)
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
} }
...@@ -115,14 +114,14 @@ extension YHSelectCountryViewController: UITextFieldDelegate { ...@@ -115,14 +114,14 @@ extension YHSelectCountryViewController: UITextFieldDelegate {
if textField.text == "" { if textField.text == "" {
tableView.isHidden = true tableView.isHidden = true
flagLabel.isHidden = false flagLabel.isHidden = false
collectionView.isHidden = false typeView.isHidden = false
} else { } else {
viewModel?.requestCountry(textField.text ?? "") { [weak self] success, error in viewModel?.requestCountry(textField.text ?? "") { [weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.searchDataSource = success as? [YHCountryMessage] self.searchDataSource = success as? [YHCountryMessage]
self.tableView.isHidden = false self.tableView.isHidden = false
self.flagLabel.isHidden = true self.flagLabel.isHidden = true
self.collectionView.isHidden = true self.typeView.isHidden = true
self.tableView.reloadData() self.tableView.reloadData()
} }
} }
...@@ -157,62 +156,6 @@ extension YHSelectCountryViewController: UITableViewDelegate, UITableViewDataSou ...@@ -157,62 +156,6 @@ extension YHSelectCountryViewController: UITableViewDelegate, UITableViewDataSou
} }
} }
extension YHSelectCountryViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return hotDataSource.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let collectionCell = collectionView.dequeueReusableCell(withClass: YHCountryCollectionViewCell.self, for: indexPath)
collectionCell.label.text = hotDataSource[indexPath.row]
return collectionCell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let string = hotDataSource[indexPath.row]
let size = (string as NSString).size(withAttributes: [NSAttributedString.Key.font : UIFont.PFSC_R(ofSize: 13)])
return CGSize(width: size.width + 25, height: 32) // 这里可以根据需求设置不同的尺寸
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let string = hotDataSource[indexPath.row]
if let backLocationStringController = backLocationStringController {
backLocationStringController(string)
self.navigationController?.popViewController()
}
}
}
class YHCountryCollectionViewCell: UICollectionViewCell {
var label: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
label = {
let view = UILabel()
view.textAlignment = .center
view.font = UIFont.PFSC_R(ofSize: 13)
view.textColor = UIColor.mainTextColor
view.backgroundColor = UIColor.contentBkgColor
view.layer.masksToBounds = true
view.layer.cornerRadius = 16
return view
}()
contentView.addSubview(label)
label.snp.makeConstraints { make in
make.top.bottom.right.left.equalToSuperview()
}
}
}
class YHCountryTableViewCell: UITableViewCell { class YHCountryTableViewCell: UITableViewCell {
var titleLabel: UILabel! var titleLabel: UILabel!
......
...@@ -14,9 +14,6 @@ struct YHCountryModel { ...@@ -14,9 +14,6 @@ struct YHCountryModel {
for (key,value) in dic { for (key,value) in dic {
let model = YHProvincesModel(name: key, dic: value) let model = YHProvincesModel(name: key, dic: value)
provincesArray.append(model) provincesArray.append(model)
provincesArray.sort { a, b in
a.provincesName < b.provincesName
}
} }
} }
} }
......
...@@ -287,6 +287,7 @@ class YHAddressPickView: UIView { ...@@ -287,6 +287,7 @@ class YHAddressPickView: UIView {
backLocationString!(selectLocation,selectedProvince,selectedCity,selectedArea) backLocationString!(selectLocation,selectedProvince,selectedCity,selectedArea)
} }
} }
/// 从area.plist获取全部地区数据 /// 从area.plist获取全部地区数据
private func initLocationData() { private func initLocationData() {
guard let dic = NSDictionary(contentsOfFile: Bundle.main.path(forResource: "area", ofType: "plist") ?? "") as? [String:[String]] else { guard let dic = NSDictionary(contentsOfFile: Bundle.main.path(forResource: "area", ofType: "plist") ?? "") as? [String:[String]] else {
......
...@@ -74,7 +74,7 @@ class YHCompanySelectViewController: YHBaseViewController { ...@@ -74,7 +74,7 @@ class YHCompanySelectViewController: YHBaseViewController {
button.backgroundColor = UIColor(hex:0x2274ee) button.backgroundColor = UIColor(hex:0x2274ee)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16) button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center button.contentHorizontalAlignment = .center
button.setTitle("保存", for: .normal) button.setTitle("确认", for: .normal)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 12) button.titleLabel?.font = UIFont.PFSC_M(ofSize: 12)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal) button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = 16.5 button.layer.cornerRadius = 16.5
......
...@@ -286,18 +286,30 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -286,18 +286,30 @@ class YHWorkIntroductionViewController: YHBaseViewController {
@objc func startClick() { @objc func startClick() {
view.endEditing(true) view.endEditing(true)
YHDatePickView.show(type: .yyyymmdd, title: "请选择开始时间") { date in YHDatePickView.show(type: .yyyymmdd, title: "请选择开始时间") { date in
if date > self.dataSource.project_end_time ?? "" {
self.startTextField.text = ""
self.dataSource.project_start_time = ""
YHHUD.flash(message: "开始时间不能晚于结束时间")
} else {
self.startTextField.text = date self.startTextField.text = date
self.dataSource.project_start_time = date self.dataSource.project_start_time = date
} }
} }
}
@objc func endClick() { @objc func endClick() {
view.endEditing(true) view.endEditing(true)
YHDatePickView.show(type: .yyyymmdd, title: "请选择结束时间") { date in YHDatePickView.show(type: .yyyymmdd, title: "请选择结束时间") { date in
if date < self.dataSource.project_start_time ?? "" {
self.endTextField.text = ""
self.dataSource.project_end_time = ""
YHHUD.flash(message: "结束时间不能早于开始时间")
} else {
self.endTextField.text = date self.endTextField.text = date
self.dataSource.project_end_time = date self.dataSource.project_end_time = date
} }
} }
}
func isShowPromptsLabel() { func isShowPromptsLabel() {
if messageTextField.text.count != 0 { if messageTextField.text.count != 0 {
......
//
// YHCountryHotView.swift
// galaxy
//
// Created by EDY on 2024/3/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCountryHotView: UIView {
typealias HotBlock = (_ index: String) -> ()
var hotBlock: HotBlock?
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() {
}
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.mainTextColor, for: .normal)
button.setBackgroundColor(color: UIColor.contentBkgColor, forState: .normal)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 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(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 = hotBlock {
block(dataSource?[tag] ?? "")
}
}
}
...@@ -84,9 +84,23 @@ class YHWorkExperienceViewModel: YHBaseViewModel { ...@@ -84,9 +84,23 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
case .id8: // 职位 case .id8: // 职位
mainModel.position = item.message ?? "" mainModel.position = item.message ?? ""
case .id9: // 入职年月 case .id9: // 入职年月
if item.message ?? "" > mainModel.departure_time {
mainModel.entry_time = ""
if item.message != "" {
YHHUD.flash(message: "入职日期不能晚于离职日期")
}
} else {
mainModel.entry_time = item.message ?? "" mainModel.entry_time = item.message ?? ""
}
case .id10: // 离职年月 case .id10: // 离职年月
if item.message ?? "" < mainModel.entry_time {
mainModel.departure_time = ""
if item.message != "" {
YHHUD.flash(message: "离职日期不能早于入职日期")
}
} else {
mainModel.departure_time = item.message ?? "" mainModel.departure_time = item.message ?? ""
}
case .id11: // 工作证明文件 case .id11: // 工作证明文件
mainModel.work_certificate = item.message ?? "" mainModel.work_certificate = item.message ?? ""
case .id12: // 职责性质 case .id12: // 职责性质
......
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