Commit 06e0f159 authored by Steven杜宇's avatar Steven杜宇

// 覆盖高才文件夹

parent f193870a
This diff is collapsed.
//
// YHGCMineSchemeViewController.swift
// galaxy
//
// Created by alexzzw on 2024/11/12.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGCMineSchemeViewController: YHBaseViewController {
var tableView: UITableView!
var dataSource: [YHScemeItemModel]? = []
lazy var reqSchemeVM: YHMySchemeViewModel = {
let vm = YHMySchemeViewModel()
return vm
}()
lazy var headView: YHGCSchemeTableHeadView = {
let headView = YHGCSchemeTableHeadView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 422))
headView.update(type: .typeA, name: "--")
return headView
}()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "我的方案"
gk_navTitleColor = .white
gk_navBarAlpha = 1
gk_navBackgroundImage = UIImage(named: "my_scheme_nav")
gk_backImage = UIImage(named: "nav_icon_back_white")
setView()
loadData()
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}
extension YHGCMineSchemeViewController: 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: YHSchemeTableViewCell.self)
cell.dataSource = dataSource?[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
return 199
} else if indexPath.row == 1 {
return 251
} else if indexPath.row == 2 {
return 190
}
return 0
}
}
extension YHGCMineSchemeViewController {
func getData() {
let model1 = YHScemeItemModel(title: "行业定位", mainMessage: "根据您目前给来的材料,初步建议您申请的行业:--", lightMessage: "--", subMessage: "后续会根据您文书准备的补充情况来最终确定,如有修改会再告知您。")
let model2 = YHScemeItemModel(title: "资料清单", buttonTitle: "资料清单", mainMessage: "这是您的资料清单,请您前往查看。请您在1-2周内上传基础类证件哦,需要重新办理的可以晚些提供。需要注意的点如下:", lightMessage: "1-2周内", subMessage: "(1)港澳通如未办理,请尽快办理好反馈过来;\n(2)如为国内学校,需要尽快办理学位认证报告;\n(3)如为海外学校,需提供成绩单副本")
let model3 = YHScemeItemModel(title: "文书清单", buttonTitle: "文书写作", mainMessage: "这是您的文书清单,包括推荐信、赴港计划书,我写好后会发在微信里,与您一起沟通进行哈。3周-4周左右完成,需要咱们共同配合完成的噢", lightMessage: "3周-4周")
dataSource = [model1, model2, model3]
tableView.reloadData()
}
func updateDataSource() {
}
func setView() {
view.backgroundColor = .contentBkgColor
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.tableFooterView = YHSchemeTableFooterView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 112))
tableView.tableHeaderView = headView
tableView.register(cellWithClass: YHSchemeTableViewCell.self)
tableView.bounces = false
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.bottom.equalToSuperview()
}
}
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let param = ["order_id": orderID]
reqSchemeVM.getMySchemeData(params: param) { [weak self] success, error in
guard let self = self else {
return
}
if success == true {
guard let model = self.reqSchemeVM.schemeModel else { return }
let industry = model.industry.defaultStringIfEmpty()
let model1 = YHScemeItemModel(title: "行业定位", mainMessage: "根据您目前给来的材料,初步建议您申请的行业:" + industry, lightMessage: industry, subMessage: "后续会根据您文书准备的补充情况来最终确定,如有修改会再告知您。")
let model2 = YHScemeItemModel(title: "资料清单", buttonTitle: "资料清单", mainMessage: "这是您的资料清单,请您前往查看。请您在1-2周内上传基础类证件哦,需要重新办理的可以晚些提供。需要注意的点如下:", lightMessage: "1-2周内", subMessage: "(1)港澳通如未办理,请尽快办理好反馈过来;\n(2)如为国内学校,需要尽快办理学位认证报告;\n(3)如为海外学校,需提供成绩单副本")
let model3 = YHScemeItemModel(title: "文书清单", buttonTitle: "文书写作", mainMessage: "这是您的文书清单,包括推荐信、赴港计划书,我写好后会发在微信里,与您一起沟通进行哈。3周-4周左右完成,需要咱们共同配合完成的噢", lightMessage: "3周-4周")
self.dataSource = [model1, model2, model3]
self.tableView.reloadData()
let ageTxt = "年龄" + model.age_score.string + "分"
let eduTxtA = "学历" + model.education_score_a.string + "分,名校加分XX分"
let workExp = "工作经验加分" + model.work_experience_score.string + "分"
let famous_enterprise = "名企加分" + model.famous_enterprise.string + "分"
let talent_list = "人才清单加分" + model.talent_list.string + "分"
let language = "语言加分" + model.language_score.string + "分"
let family = "家庭背景加分" + model.background_score.string + "分"
let arrText: [String] = [ageTxt, eduTxtA, workExp, famous_enterprise, talent_list, language, family]
let arrH: [String] = [model.age_score.string, model.education_score_a.string, model.work_experience_score.string, model.famous_enterprise.string, model.talent_list.string, model.language_score.string, model.background_score.string]
self.headView.update(type: .typeA, name: model.username.defaultStringIfEmpty())
} else {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
}
} else {
printLog("error : orderID 为空")
}
}
}
//
// YHGCApplicationTypeResultController.swift
// galaxy
//
// Created by alexzzw on 2024/11/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGCApplicationTypeResultController: YHBaseViewController {
private lazy var bgIcon: UIImageView = {
let view = UIImageView()
return view
}()
private lazy var backButton: UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.setTitle("返回", for: .normal)
button.setTitle("返回", for: .highlighted)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .highlighted)
button.addTarget(self, action: #selector(clickBackButton), for: .touchUpInside)
button.layer.cornerRadius = kCornerRadius3
button.clipsToBounds = true
button.backgroundColor = .brandMainColor
return button
}()
private lazy var headerLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.font = .PFSC_M(ofSize: 21)
label.text = "您已选定高才申请类型"
return label
}()
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_B(ofSize: 17)
label.textColor = .mainTextColor
return label
}()
private lazy var infoDetailLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString: "#6D788A")
label.font = .PFSC_R(ofSize: 13)
label.lineBreakMode = .byCharWrapping
label.numberOfLines = 3
return label
}()
private lazy var barView: UIView = {
let view = UIView()
return view
}()
private lazy var actionBtn: UIButton = {
let button = UIButton(type: .custom)
button.setTitle("申请标准", for: .normal)
button.setTitleColor(.mainTextColor, for: .normal)
button.titleLabel?.font = .PFSC_R(ofSize: 14)
button.setImage(UIImage(named: "right_arrow_black_20"), for: .normal)
button.addTarget(self, action: #selector(actionBtnClicked), for: .touchUpInside)
return button
}()
private lazy var subContainerView: YHBaseDynamicCornerRadiusView = {
let view = YHBaseDynamicCornerRadiusView(cornerRadius: 6, corner: .allCorners)
view.backgroundColor = .white
return view
}()
private lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
var backButtonEvent: (() -> Void)?
private let type: YHGCApplicationType
init(type: YHGCApplicationType) {
self.type = type
super.init(nibName: nil, bundle: nil)
}
@MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
}
extension YHGCApplicationTypeResultController {
@objc private func actionBtnClicked() {
showPopVC(type: type)
}
@objc private func clickBackButton() {
backButtonEvent?()
navigationController?.popViewController(animated: true)
}
private func setupUI() {
gk_navTitle = "申请类别"
gk_navBarAlpha = 0
gk_navigationBar.backgroundColor = .clear
view.backgroundColor = UIColor.contentBkgColor
view.addSubview(bgIcon)
view.addSubview(headerLabel)
view.addSubview(bottomView)
bottomView.addSubview(backButton)
view.addSubview(subContainerView)
subContainerView.addSubview(barView)
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(infoDetailLabel)
subContainerView.addSubview(actionBtn)
let ratio = 318.0 / 375.0
bgIcon.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(bgIcon.snp.width).multipliedBy(ratio)
}
headerLabel.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 42)
make.left.equalToSuperview().offset(20)
make.right.lessThanOrEqualToSuperview().offset(-20)
}
subContainerView.snp.makeConstraints { make in
make.top.equalTo(headerLabel.snp.bottom).offset(50)
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.height.equalTo(148)
}
barView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.centerY.equalToSuperview()
make.width.equalTo(3)
make.height.equalTo(108)
}
infoTitleLabel.snp.makeConstraints { make in
make.left.equalTo(barView.snp.right).offset(20)
make.top.equalTo(barView.snp.top)
make.right.lessThanOrEqualToSuperview().offset(-20)
}
infoDetailLabel.snp.makeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.left)
make.top.equalTo(infoTitleLabel.snp.bottom).offset(8)
make.right.lessThanOrEqualToSuperview().offset(-20)
}
actionBtn.snp.makeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.left)
make.top.greaterThanOrEqualTo(infoDetailLabel.snp.bottom).offset(0).priority(.high)
make.bottom.equalTo(barView.snp.bottom)
}
actionBtn.iconInRight(with: 0)
bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-66)
}
backButton.snp.makeConstraints { make in
make.left.equalToSuperview().offset(kMargin)
make.right.equalToSuperview().offset(-kMargin)
make.top.equalToSuperview().offset(8)
make.height.equalTo(48)
}
bgIcon.image = UIImage(named: type.bgIconTitle())
infoTitleLabel.text = type.titleString
infoDetailLabel.text = type.detailString
barView.backgroundColor = type.barColor()
}
private func showPopVC(type: YHGCApplicationType) {
let vc = YHGCVisaProgramPopVC(type: type)
let pc = YHBottomPresentationController(presentedViewController: vc, presenting: self)
pc.customRadius = 8.0
vc.transitioningDelegate = pc
vc.sureButtonEvent = { [weak vc] in
vc?.dismiss(animated: true)
}
present(vc, animated: true, completion: nil)
}
}
private extension YHGCApplicationType {
func bgIconTitle() -> String {
switch self {
case .typeA:
return "gc_application_type_bg_a"
case .typeB:
return "gc_application_type_bg_b"
case .typeC:
return "gc_application_type_bg_c"
}
}
func barColor() -> UIColor? {
switch self {
case .typeA:
return UIColor(hexString: "#EEDBBD")
case .typeB:
return UIColor(hexString: "#BFCDEF")
case .typeC:
return UIColor(hexString: "#BBE1F2")
}
}
}
//
// YHGCVisaProgramPopVC.swift
// galaxy
//
// Created by alexzzw on 2024/11/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHGCVisaProgramPopVC: YHBaseViewController {
private lazy var topProgramIcon: UIImageView = {
let view = UIImageView()
return view
}()
private lazy var sureButton: UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.setTitle("我已知悉,确认", for: .normal)
button.setTitle("我已知悉,确认", for: .highlighted)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .highlighted)
button.addTarget(self, action: #selector(clickSureButton), for: .touchUpInside)
button.layer.cornerRadius = kCornerRadius3
button.clipsToBounds = true
button.backgroundColor = .brandMainColor
return button
}()
private lazy var infoDetailLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.font = .PFSC_R(ofSize: 14)
label.lineBreakMode = .byCharWrapping
label.numberOfLines = 0
return label
}()
private lazy var subContainerView: YHBaseDynamicCornerRadiusView = {
let view = YHBaseDynamicCornerRadiusView(cornerRadius: 6, corner: .allCorners)
view.backgroundColor = .contentBkgColor
return view
}()
private lazy var infoMarkLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString: "#6D788A")
label.font = .PFSC_R(ofSize: 14)
label.lineBreakMode = .byCharWrapping
label.numberOfLines = 0
return label
}()
var sureButtonEvent: (() -> Void)?
private let type: YHGCApplicationType
init(type: YHGCApplicationType) {
self.type = type
super.init(nibName: nil, bundle: nil)
}
@MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
}
extension YHGCVisaProgramPopVC {
@objc private func clickSureButton() {
sureButtonEvent?()
}
private func setupUI() {
gk_navBarAlpha = 0
gk_navigationBar.isHidden = true
view.backgroundColor = UIColor.white
view.addSubview(topProgramIcon)
view.addSubview(sureButton)
view.addSubview(infoDetailLabel)
view.addSubview(subContainerView)
subContainerView.addSubview(infoMarkLabel)
let ratio = 143.0 / 375.0
topProgramIcon.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(topProgramIcon.snp.width).multipliedBy(ratio)
}
let widthRatio = KScreenWidth / 375.0
infoDetailLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(124.0 * widthRatio)
make.left.equalToSuperview().offset(20 * widthRatio)
make.right.equalToSuperview().offset(-20 * widthRatio)
}
subContainerView.snp.makeConstraints { make in
make.top.equalTo(infoDetailLabel.snp.bottom).offset(20.0 * widthRatio)
make.left.equalToSuperview().offset(20 * widthRatio)
make.right.equalToSuperview().offset(-20 * widthRatio)
}
infoMarkLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16.0 * widthRatio)
make.left.equalToSuperview().offset(16 * widthRatio)
make.right.equalToSuperview().offset(-16 * widthRatio)
make.bottom.equalToSuperview().offset(-16.0 * widthRatio)
}
sureButton.snp.makeConstraints { make in
make.top.greaterThanOrEqualTo(subContainerView.snp.bottom).offset(10)
make.left.equalToSuperview().offset(kMargin * widthRatio)
make.right.equalToSuperview().offset(-kMargin * widthRatio)
make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-10 * widthRatio)
make.height.equalTo(48)
}
topProgramIcon.image = UIImage(named: type.programIconTitle())
infoDetailLabel.text = type.detailText()
infoMarkLabel.attributed.text = type.attributedTips()
preferredContentSize = CGSize(width: KScreenWidth, height: 452 * widthRatio)
}
}
private extension YHGCApplicationType {
func programIconTitle() -> String {
switch self {
case .typeA:
return "gc_visa_program_a"
case .typeB:
return "gc_visa_program_b"
case .typeC:
return "gc_visa_program_c"
}
}
func detailText() -> String {
switch self {
case .typeA:
return "在紧接申请前一年,全年收入达港币250万元或以上(或等值外币) 的人士"
case .typeB:
return "4个指定榜单中的世界百强大学的学士学位毕业生(以入境处内置榜单为准),且过去5年累积有不低于3年的工作经验"
case .typeC:
return "过去5年在4个指定榜单中的世界百强大学取得学士学位(以入境处内置榜单为准),但累积工作经验不足3年"
}
}
func attributedTips() -> ASAttributedString {
switch self {
case .typeA:
let attr1: ASAttributedString = .init(string: "注:必须是", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor(hexString: "#6D788A") ?? UIColor.gray))
let attr2: ASAttributedString = .init(string: "课税收入", .font(UIFont.PFSC_B(ofSize: 14)), .foreground(UIColor.brandMainColor))
let attr3: ASAttributedString = .init(string: ",享受税收优惠、免税的收入,不计算在内", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor(hexString: "#6D788A") ?? UIColor.gray))
return attr1 + attr2 + attr3
case .typeB:
let attr1: ASAttributedString = .init(string: "注:必须是", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor(hexString: "#6D788A") ?? UIColor.gray))
let attr2: ASAttributedString = .init(string: "紧接申请", .font(UIFont.PFSC_B(ofSize: 14)), .foreground(UIColor.brandMainColor))
let attr3: ASAttributedString = .init(string: "的前五年,累积工作经验不低于三年", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor(hexString: "#6D788A") ?? UIColor.gray))
return attr1 + attr2 + attr3
case .typeC:
let attr1: ASAttributedString = .init(string: "注:", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor(hexString: "#6D788A") ?? UIColor.gray))
let attr2: ASAttributedString = .init(string: "不适用于", .font(UIFont.PFSC_B(ofSize: 14)), .foreground(UIColor.brandMainColor))
let attr3: ASAttributedString = .init(string: "在港修读全日制经本地评审课程而获得学士学位的非本地生", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor(hexString: "#6D788A") ?? UIColor.gray))
return attr1 + attr2 + attr3
}
}
}
//
// YHGCApplicationModel.swift
// galaxy
//
// Created by alexzzw on 2024/11/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
class YHGCApplicationModel {
var type: YHGCApplicationType = .typeA
var isSelected: Bool = false
init(type: YHGCApplicationType, isSelected: Bool) {
self.type = type
self.isSelected = isSelected
}
}
//
// YHGCApplicationType.swift
// galaxy
//
// Created by alexzzw on 2024/11/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
enum YHGCApplicationType: Int {
case typeA = 1
case typeB = 2
case typeC = 3
var titleString: String {
switch self {
case .typeA:
return "高才A类申请"
case .typeB:
return "高才B类申请"
case .typeC:
return "高才C类申请"
}
}
var detailString: String {
switch self {
case .typeA:
return "近一年度纳税收入250万港元及以上人士"
case .typeB:
return "百强大学毕业,且近5年累积工作经验时长不低于3年人士"
case .typeC:
return "百强大学毕业不足5年,且工作经验时长不足3年人士"
}
}
}
//
// YHGCApplicationTypeResponseModel.swift
// galaxy
//
// Created by alexzzw on 2024/11/12.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHGCApplicationTypeResponseModel: SmartCodable {
var apply_type: Int = -1
required init() {
}
}
//
// YHGCApplicationTypeSelectCell.swift
// galaxy
//
// Created by alexzzw on 2024/11/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGCApplicationTypeSelectCell: UITableViewCell {
static let cellReuseIdentifier = "YHGCApplicationTypeSelectCell"
private let selectedBorderColor: UIColor = .brandMainColor
var actionBtnEvent: (() -> Void)?
var isCurrentSelected: Bool = false {
didSet {
guard isCurrentSelected != oldValue else {
return
}
selectIconView.image = isCurrentSelected ? UIImage(named: "gc_application_type_selected"): UIImage(named: "gc_application_type_unselected")
subContainerView.lineWidth = isCurrentSelected ? 1 : nil
subContainerView.lineColor = isCurrentSelected ? selectedBorderColor.cgColor : nil
}
}
private lazy var subContainerView: YHBaseCornerRadiusBorderView = {
let view = YHBaseCornerRadiusBorderView(cornerRadius: 6, corner: .allCorners, lineWidth: nil, lineColor: nil)
view.backgroundColor = .white
return view
}()
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_B(ofSize: 17)
label.textColor = .mainTextColor
return label
}()
private lazy var infoDetailLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString: "#6D788A")
label.font = .PFSC_R(ofSize: 13)
label.lineBreakMode = .byCharWrapping
label.numberOfLines = 3
return label
}()
private lazy var iconView: UIImageView = {
let imageView = UIImageView()
return imageView
}()
private lazy var selectIconView: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "gc_application_type_unselected")
return imageView
}()
private lazy var actionBtn: UIButton = {
let button = UIButton(type: .custom)
button.setTitle("申请标准", for: .normal)
button.setTitleColor(.mainTextColor, for: .normal)
button.titleLabel?.font = .PFSC_R(ofSize: 14)
button.setImage(UIImage(named: "right_arrow_black_20"), for: .normal)
button.addTarget(self, action: #selector(actionBtnClicked), for: .touchUpInside)
return button
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(type: YHGCApplicationType, isCurrentSelected: Bool) {
infoTitleLabel.text = type.titleString
infoDetailLabel.text = type.detailString
iconView.image = UIImage(named: type.iconString())
self.isCurrentSelected = isCurrentSelected
}
}
extension YHGCApplicationTypeSelectCell {
@objc private func actionBtnClicked() {
actionBtnEvent?()
}
private func setupUI() {
selectionStyle = .none
backgroundColor = .clear
contentView.addSubview(subContainerView)
subContainerView.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
}
subContainerView.addSubview(iconView)
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(selectIconView)
subContainerView.addSubview(infoDetailLabel)
subContainerView.addSubview(actionBtn)
iconView.setContentCompressionResistancePriority(.required, for: .horizontal)
infoTitleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
selectIconView.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
infoDetailLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
actionBtn.setContentCompressionResistancePriority(.required, for: .vertical)
infoDetailLabel.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
iconView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(20)
make.left.equalToSuperview().offset(20)
make.width.equalTo(88)
make.height.equalTo(108).priority(.high)
make.bottom.lessThanOrEqualToSuperview().offset(-20)
}
infoTitleLabel.snp.makeConstraints { make in
make.left.equalTo(iconView.snp.right).offset(20)
make.top.equalTo(iconView.snp.top)
}
selectIconView.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-20)
make.top.equalTo(iconView.snp.top)
make.left.greaterThanOrEqualTo(infoTitleLabel.snp.right).offset(20)
}
infoDetailLabel.snp.makeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.left)
make.top.equalTo(infoTitleLabel.snp.bottom).offset(8)
make.right.lessThanOrEqualToSuperview().offset(-20)
}
actionBtn.snp.makeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.left)
make.top.greaterThanOrEqualTo(infoDetailLabel.snp.bottom).offset(0).priority(.high)
make.bottom.equalTo(iconView.snp.bottom)
}
actionBtn.iconInRight(with: 0)
}
}
private extension YHGCApplicationType {
func iconString() -> String {
switch self {
case .typeA:
return "gc_application_type_a"
case .typeB:
return "gc_application_type_b"
case .typeC:
return "gc_application_type_c"
}
}
}
//
// YHGCApplicationTypeViewModel.swift
// galaxy
//
// Created by alexzzw on 2024/11/12.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGCApplicationTypeViewModel: YHBaseViewModel {
func getApplyType(orderId: Int, callback: @escaping (_ model: YHGCApplicationTypeResponseModel?, _ error: YHErrorModel?) -> ()) {
let params = ["order_id": orderId]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.GCApplyType.getApplyType
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { json, code in
//1. json字符串 转 对象
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let dic = json.data?.peel as? [String : Any], let resultModel = YHGCApplicationTypeResponseModel.deserialize(from: dic) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callback(nil, err)
return
}
callback(resultModel, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback(nil, err)
}
} failBlock: { err in
callback(nil, err)
}
}
func submitApplyType(_ orderId: Int, _ applyType: Int, callBackBlock: @escaping (_ success: Bool, _ error:YHErrorModel?) -> () ) {
let params: [String : Any] = ["order_id": orderId, "apply_type": applyType]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.GCApplyType.submitApplyType
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, code in
//1. json字符串 转 对象
printLog("model 是 ==> \(json)")
if json.code == 200 {
callBackBlock(true, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false, err)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
}
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