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

参考用例模版UI接口

parent ff2f301a
......@@ -104,6 +104,12 @@
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 */; };
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 */; };
......@@ -364,6 +370,12 @@
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>"; };
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>"; };
......@@ -791,6 +803,7 @@
children = (
04E86E242B81EA1000A35F4B /* YHWorkItemListViewModel.swift */,
04E86E372B83306800A35F4B /* YHWorkExperienceViewModel.swift */,
04E86E622B85EE9A00A35F4B /* YHWorkIntroductionViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
......@@ -800,6 +813,7 @@
children = (
04E86E262B81EA1000A35F4B /* YHWorkItemListModel.swift */,
04E86E392B83321600A35F4B /* YHWorkExperienceModel.swift */,
04E86E602B85CAEA00A35F4B /* YHWorkExampleModel.swift */,
);
path = Model;
sourceTree = "<group>";
......@@ -810,6 +824,7 @@
04E86E282B81EA1000A35F4B /* YHWorkExperienceListViewController.swift */,
04E86E332B83268F00A35F4B /* YHWorkExperienceViewController.swift */,
04E86E562B848D5A00A35F4B /* YHWorkIntroductionViewController.swift */,
04E86E582B84AD6200A35F4B /* YHWorkExampleViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -824,6 +839,7 @@
04E86E4C2B84756A00A35F4B /* YHWorkIntroductionTableViewCell.swift */,
04E86E502B847D1B00A35F4B /* YHWorkMessageSelectTableViewCell.swift */,
04E86E522B8485E300A35F4B /* YHWorkFileSyncTableViewCell.swift */,
04E86E5E2B84D07000A35F4B /* YHWorkExampleMessageTableViewCell.swift */,
04E86E542B8486FF00A35F4B /* YHWorkFileItemView.swift */,
04E86E4E2B8479B700A35F4B /* YHWorkIntroductionItemView.swift */,
04E86E482B8445F400A35F4B /* YHWorkActionView.swift */,
......@@ -831,6 +847,8 @@
04E86E2C2B81EA1000A35F4B /* YHWorkItemAddView.swift */,
04E86E3B2B833DB900A35F4B /* YHWorkExperienceItemView.swift */,
04E86E3D2B834FC100A35F4B /* YHWorkExperienceTextItemView.swift */,
04E86E5A2B84BF2000A35F4B /* YHWorkExampleTypeView.swift */,
04E86E5C2B84CC9700A35F4B /* YHWorkExampleMessageView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -1651,6 +1669,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 */,
......@@ -1749,6 +1768,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 */,
......@@ -1779,8 +1799,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 */,
......@@ -1800,6 +1822,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 */,
......@@ -1817,6 +1840,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 */,
......
//
// 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)
}
}
......@@ -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)
......
......@@ -17,16 +17,22 @@ class YHWorkIntroductionViewController: YHBaseViewController {
var actionView: YHWorkActionView!
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]?
}
......@@ -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,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)
......
......@@ -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,7 +10,8 @@ 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)
}
}
}
{
"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