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

新增配偶

parent f9642897
This diff is collapsed.
......@@ -215,6 +215,16 @@ class YHMyInformationItemCell: UITableViewCell {
block(self.dataSource ?? YHUserInformationModel())
}
}
case .selectAddress:
YHSheetPickerView.show(type:.educationDegree, selectTitle: self.dataSource?.message) {
[weak self] item in
guard let self = self else { return }
self.dataSource?.message = item.title
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHUserInformationModel())
}
}
}
}
......
......@@ -125,10 +125,12 @@ extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSourc
[weak self] editType in
guard let self = self else { return }
if editType == .rename {
let vc = YHAdopterNewPeopleViewController()
self.navigationController?.pushViewController(vc)
}
if editType == .preview {
let vc = YHAdopterNewPeopleViewController()
self.navigationController?.pushViewController(vc)
}
if editType == .delete {
......
//
// YHAdopterNewPeopleViewController.swift
// galaxy
//
// Created by EDY on 2024/8/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterNewPeopleViewController: YHBaseViewController {
var stepView: YHStepView!
var bottomView: YHBottomNextView!
var tableView: UITableView!
var viewModel: YHAdopterNewPeopleViewModel!
var dataSource: [YHSectionItemModel] = []
var cardDataSource: [YHAdopterCardModel] = []
var isShowPrompt: Bool = false
var orderId: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
viewModel = YHAdopterNewPeopleViewModel()
gk_navTitle = "新增配偶"
gk_navBackgroundColor = .white
gk_navBarAlpha = 1
setView()
getData()
// Do any additional setup after loading the view.
}
func getData() {
self.updateDataSource()
// viewModel.requestMainInformation("\(orderId)") {[weak self] success, error in
// guard let self = self else { return }
// self.stepView.maxIndex = self.viewModel.mainModel.step
// self.stepView.currentIndex = self.viewModel.mainModel.step
// self.updateDataSource()
// if self.stepView.currentIndex == 3 {
// self.bottomView.nextButton.setTitle("提交", for: .normal)
// } else {
// self.bottomView.nextButton.setTitle("下一步", for: .normal)
// }
// }
}
func updateDataSource() {
if self.stepView.currentIndex == 0 {
self.dataSource = self.viewModel.getBaseDataSource(isShowPrompt)
self.bottomView.nextButton.setTitle("下一步", for: .normal)
} else if self.stepView.currentIndex == 1 {
self.cardDataSource = self.viewModel.getIdCardInformation()
// self.bottomView.nextButton.setTitle("下一步", for: .normal)
}
self.tableView.reloadData()
}
func setView() {
view.backgroundColor = .contentBkgColor
stepView = {
let step = YHStepView()
step.dataSource = ["完善配偶信息", "上传配偶资料"]
step.block = { [weak self] (index) in
guard let self = self else { return }
self.updateDataSource()
}
return step
}()
view.addSubview(stepView)
stepView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.height.equalTo(104)
}
tableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHMainInformationTableViewCell.self)
tableView.register(cellWithClass: YHAdopterCardTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + YHStepView.height)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.bottom.equalTo(view)
}
bottomView = {
let bottom = YHBottomNextView()
bottom.nextblock = { [weak self] in
// bottom.nextButton.isEnabled = false
guard let self = self else { return }
self.stepView.currentIndex = self.stepView.currentIndex + 1
self.updateDataSource()
// if self.viewModel.isCanNext(self.stepView.currentIndex) {
// self.viewModel.mainModel.step = self.stepView.currentIndex
// } else {
//
// }
}
bottom.saveBlock = { [weak self] in
guard let self = self else { return }
}
return bottom
}()
view.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(k_Height_safeAreaInsetsBottom() + 64)
}
bottomView.layoutIfNeeded()
bottomView.nextButton.addYinHeGradualLayer()
}
}
extension YHAdopterNewPeopleViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if stepView.currentIndex == 1 {
return cardDataSource.count
}
return dataSource.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if stepView.currentIndex == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterCardTableViewCell.self)
cell.dataSource = cardDataSource[indexPath.row]
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHMainInformationTableViewCell.self)
cell.country = self.viewModel.mainModel.address.country
cell.dataSource = dataSource[indexPath.row]
cell.informationBlock = {[weak self] model in
guard let self = self else { return }
// self.viewModel.updateModel(model)
// let id = model.id
// if id != .id32 && id != .id4 && id != .id8 && id != .id9 && id != .id12 && id != .id13 && id != .id17 && id != .id18 && id != .id21 && id != .id22 && id != .id23 && id != .id34 && id != .id29 && id != .id30 && id != .id35 {
// self.updateDataSource()
// }
}
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if stepView.currentIndex == 1 {
let model = cardDataSource[indexPath.row]
if model.type == .china || model.type == .resident {
return 90
} else {
return 78
}
} else {
let array = dataSource[indexPath.row].models ?? []
var h = 0
for i in 0..<array.count {
let data = array[i]
let isShow = data.isShowPrompts ?? false
let message = data.message ?? ""
let isNeed = data.isNeed ?? false
if data.id == .id3 || data.id == .id4 || data.id == .id32 || data.id == .id33 {
if isShow && message.count == 0 && isNeed {
h = h + 72 + 20
} else {
h = h + 72
}
} else {
if isShow && message.count == 0 && isNeed {
h = h + 52 + 20
} else {
h = h + 52
}
}
}
return CGFloat(h + 52 + 14)
}
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 7))
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 7
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if stepView.currentIndex == 1 {
let model = cardDataSource[indexPath.row]
switch model.type {
case .travel:
let vc = YHAdopterTravelViewController()
self.navigationController?.pushViewController(vc)
case .china:
break
case .resident:
break
case .birth:
break
case .id:
break
case .other:
break
case .marry:
break
}
}
}
}
//
// YHAdopterTravelViewController.swift
// galaxy
//
// Created by EDY on 2024/8/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterTravelViewController: YHBaseViewController {
var tableView: UITableView!
var nextButton: UIButton!
var clickIndex = -1
var data: [YHItemModel] = []
var viewModel = YHYHAdopterTravelViewModel()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "上传存款证明"
gk_navBackgroundColor = .white
gk_navBarAlpha = 1
setView()
getData()
}
func getData() {
data = viewModel.getBaseDataSource(false)
tableView.reloadData()
}
func setView() {
view.backgroundColor = .white
tableView = {
let tableView = UITableView(frame:.zero, style:.plain)
tableView.contentInsetAdjustmentBehavior = .never
tableView.backgroundColor = .white
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHAdopterIncomeTitleTableViewCell.self)
tableView.register(cellWithClass: YHAdopterTravelCardTableViewCell.self)
tableView.register(cellWithClass: YHAdopterTravelItemTableViewCell.self)
// tableView.register(cellWithClass: YHAdopterIncomeFileCountTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 8)
make.bottom.left.right.equalTo(view)
}
nextButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("确认上传", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(nextStep), for: .touchUpInside)
return button
}()
view.addSubview(nextButton)
nextButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-8 - k_Height_safeAreaInsetsBottom())
make.height.equalTo(48)
}
}
@objc func nextStep() {
}
@objc func submit() {
}
}
extension YHAdopterTravelViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return 2
}
return data.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeTitleTableViewCell.self)
return cell
}
if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterTravelCardTableViewCell.self)
return cell
}
}
let cell = tableView.dequeueReusableCell(withClass: YHAdopterTravelItemTableViewCell.self)
cell.dataSource = data[indexPath.row]
cell.informationBlock = {[weak self] model in
guard let self = self else { return }
// self.viewModel.updateModel(model)
// let id = model.id
// if id != .id32 && id != .id4 && id != .id8 && id != .id9 && id != .id12 && id != .id13 && id != .id17 && id != .id18 && id != .id21 && id != .id22 && id != .id23 && id != .id34 && id != .id29 && id != .id30 && id != .id35 {
// self.updateDataSource()
// }
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
if indexPath.row == 0 {
return 119
}
if indexPath.row == 1 {
return 173
}
}
let model = data[indexPath.row]
let isShow = model.isShowPrompts ?? false
let message = model.message ?? ""
let isNeed = model.isNeed ?? false
if isShow && message.count == 0 && isNeed {
return 52 + 20
} else {
return 52
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
}
//
// YHAdopterCardModel.swift
// galaxy
//
// Created by EDY on 2024/8/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHAdopterCardType {
case travel
case china
case resident
case birth
case id
case other
case marry
}
struct YHAdopterCardModel {
var type: YHAdopterCardType = .travel
var title: String = ""
var state: Int = 0 // 0 1 2 3 待上传 审核中 已通过 已驳回
init(type: YHAdopterCardType, title: String, state: Int) {
self.type = type
self.title = title
self.state = state
}
}
//
// YHAdopterCardTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/8/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHAdopterCardTableViewCell: UITableViewCell {
typealias ClicktBlock = (_ model: Int) -> ()
var clickBlock: ClicktBlock?
var centerView: UIView!
var titleLabel: UILabel!
var selectLabel: UILabel!
var moreButton: UIButton!
var dataSource: YHAdopterCardModel? {
didSet {
updateContent()
}
}
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 = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(7)
make.bottom.equalTo(-7)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.text = "主申请人资料"
let str = "*" + "受养人信息核实"
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 17),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(20)
make.height.equalTo(22)
make.right.equalTo(-18)
}
selectLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.mainTextColor50
label.numberOfLines = 0
let a: ASAttributedString = .init("温馨提示:", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
let b: ASAttributedString = .init("存款证明有效期为3个月", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.brandMainColor))
let c: ASAttributedString = .init(",并且存款金额为每个成员(包括额外新增受养人)", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
let d: ASAttributedString = .init("最低为12万", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.brandMainColor))
label.attributed.text = a + b + c + d
return label
}()
centerView.addSubview(selectLabel)
selectLabel.snp.makeConstraints { make in
make.left.equalTo(20)
make.bottom.equalTo(-12)
make.right.equalTo(-20)
}
moreButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13)
button.contentHorizontalAlignment = .center
button.setTitle("待上传", for: .normal)
button.setImage(UIImage(named: "service_adopter_income_start"), for: .normal)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.addTarget(self, action: #selector(more), for: .touchUpInside)
return button
}()
centerView.addSubview(moreButton)
moreButton.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(-20)
make.height.equalTo(20)
make.width.equalTo(69)
}
moreButton.iconInRight(with: 1)
}
@objc func more() {
if let block = clickBlock {
block(0)
}
}
func updateContent() {
guard let data = dataSource else { return }
if data.type == .travel || data.type == .marry || data.type == .id {
let str = "*" + data.title
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 16),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
} else {
let str = data.title
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 16),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
titleLabel.attributedText = questionAttrStr
}
if data.type == .china {
let a: ASAttributedString = .init("如有", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
let b: ASAttributedString = .init("中国身份证", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.brandMainColor))
let c: ASAttributedString = .init(",需要供用做证明", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
selectLabel.attributed.text = a + b + c
titleLabel.snp.remakeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(12)
make.height.equalTo(22)
make.right.equalTo(-18)
}
} else if data.type == .resident {
let a: ASAttributedString = .init("如曾更名,需要供用做证明", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
selectLabel.attributed.text = a
titleLabel.snp.remakeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(12)
make.height.equalTo(22)
make.right.equalTo(-18)
}
} else {
let a: ASAttributedString = .init("", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
selectLabel.attributed.text = a
titleLabel.snp.remakeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(20)
make.height.equalTo(22)
make.right.equalTo(-18)
}
}
}
}
//
// YHAdopterTravelItemTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/8/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterTravelItemTableViewCell: UITableViewCell {
typealias InformationBlock = (_ model: YHItemModel) -> ()
var informationBlock: InformationBlock?
var itemView: YHItemView!
var dataSource: YHItemModel? {
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() {
contentView.backgroundColor = .clear
backgroundColor = .clear
let line = UIView()
line.backgroundColor = UIColor.separatorColor
contentView.addSubview(line)
line.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(y)
make.height.equalTo(1)
make.right.equalTo(-18)
}
itemView = {
let view = YHItemView()
return view
}()
itemView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.informationBlock {
block(model)
}
}
contentView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.bottom.equalTo(0)
make.right.equalTo(-18)
}
}
func updateAllViews() {
itemView.dataSource = dataSource
}
}
//
// YHAdopterNewPeopleViewModel.swift
// galaxy
//
// Created by EDY on 2024/8/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterNewPeopleViewModel: YHBaseViewModel {
var mainModel: YHMainInformationModel = YHMainInformationModel()
override init() {
super.init()
}
func getBaseDataSource(_ isShowPrompt: Bool) -> [YHSectionItemModel] {
let item = YHItemModel(id: .id1, isNeed: true, title: "姓名", isUserKeyBoard: true, prompts: "请输入", message: "", isShowPrompts: isShowPrompt, alertMessage:"请选择国家/地区")
let item1 = YHItemModel(id: .id1, isNeed: true, title: "国家/地区", isUserKeyBoard: false, prompts: "请选择", message: "", type: .selectAddress, isShowPrompts: isShowPrompt, alertMessage:"请选择国家/地区")
let section = YHSectionItemModel(title: "配偶信息", models: [item, item1])
return [section]
}
func getIdCardInformation() -> [YHAdopterCardModel] {
let item = YHAdopterCardModel(type: .travel, title: "旅行证件(港澳通行证/护照)", state: 0)
let item1 = YHAdopterCardModel(type: .china, title: "身份证-正反面", state: 0)
let item2 = YHAdopterCardModel(type: .resident, title: "户口信息页", state: 0)
let item3 = YHAdopterCardModel(type: .birth, title: "中国居留许可签证", state: 0)
let item4 = YHAdopterCardModel(type: .id, title: "2寸白底证件照片", state: 0)
let item5 = YHAdopterCardModel(type: .other, title: "其他相关证件", state: 0)
let item6 = YHAdopterCardModel(type: .marry, title: "结婚证", state: 0)
return [item, item1, item2, item3, item4, item5, item6]
}
}
//
// YHYHAdopterTravelViewModel.swift
// galaxy
//
// Created by EDY on 2024/8/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHYHAdopterTravelViewModel: YHBaseViewModel {
var mainModel: YHMainInformationModel = YHMainInformationModel()
override init() {
super.init()
}
func getBaseDataSource(_ isShowPrompt: Bool) -> [YHItemModel] {
let item = YHItemModel(id: .id1, isNeed: true, title: "旅行证件类型", isUserKeyBoard: false, prompts: "请选择", message: "", type: .id, isShowPrompts: isShowPrompt, alertMessage:"请选择旅行证件类型")
let item1 = YHItemModel(id: .id1, isNeed: true, title: "英文姓名", isUserKeyBoard: true, prompts: "请输入", message: "", isShowPrompts: isShowPrompt, alertMessage:"请输入英文姓名")
let item2 = YHItemModel(id: .id1, isNeed: true, title: "旅行证件号码", isUserKeyBoard: true, prompts: "请输入", message: "", isShowPrompts: isShowPrompt, alertMessage:"请输入旅行证件号码")
let item3 = YHItemModel(id: .id1, isNeed: true, title: "签发地点", isUserKeyBoard: true, prompts: "请输入", message: "", isShowPrompts: isShowPrompt, alertMessage:"请输入签发地点")
let item4 = YHItemModel(id: .id1, isNeed: true, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: "", type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择签发日期")
let item5 = YHItemModel(id: .id1, isNeed: true, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: "", type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择届满日期")
return [item, item1, item2, item3, item4, item5]
}
}
......@@ -411,6 +411,8 @@ extension YHSheetPickerView {
return "选择证书名称"
case .degreeCategory:
return "选择学位类型"
case .selectAdress:
return "选择国家地区"
}
}
......
......@@ -38,6 +38,8 @@ enum YHSheetPickerViewType: Int {
case professionCertificate
// 学位类型
case degreeCategory
// 国家地区
case selectAdress
}
class YHSheetPickerViewItem {
......
......@@ -20,6 +20,7 @@ enum YHItemSelectType: Int {
case constellation = 8
case school = 9
case degree = 10
case selectAddress = 11
}
enum YHItemID: Int {
......
......@@ -505,6 +505,16 @@ class YHItemView: UIView {
block(self.dataSource ?? YHItemModel())
}
}
case .selectAddress:
YHOtherPickerView.show(type: .selectAddress, selectTitle: self.dataSource?.message ?? "") {[weak self] data in
guard let self = self else { return }
self.dataSource?.message = data.title
self.dataSource?.value = [data.index]
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHItemModel())
}
}
default: break
}
}
......
......@@ -244,6 +244,8 @@ class YHOtherPickerView: UIView {
return "选择婚姻状况"
case .constellation:
return "选择星座"
case .selectAddress:
return "选择国家地区"
default:
return "请选择"
}
......@@ -281,7 +283,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
switch type {
case .nature,.certificate,.structure,.level,.prove,.idType,.sex,.marry,.constellation:
case .nature,.certificate,.structure,.level,.prove,.idType,.sex,.marry,.constellation,.selectAddress:
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_M(ofSize: 14)
......@@ -430,6 +432,14 @@ extension YHOtherPickerView {
arrData.append(model)
}
title = getTitle(type: type)
case .selectAddress:
let arr = YHConstantArrayData.arrSelectAddress
arrData.removeAll()
arr.forEach { item in
let model = YHOtherPickerViewItemData(title: item["title"] ?? "-", subTitle: "", index: item["id"] ?? "-")
arrData.append(model)
}
title = getTitle(type: type)
default:
return
}
......
......@@ -37,6 +37,8 @@ enum YHOtherPickerViewType: Int {
case degreeAddress
//星座
case constellation
//选择国家地区
case selectAddress
}
......@@ -361,7 +363,7 @@ class YHConstantArrayData {
[
"id" : "3",
"title" : "博士学位",
],
]
]
//学位颁发地
......@@ -418,7 +420,26 @@ class YHConstantArrayData {
[
"id" : "capricorn",
"title" : "摩羯座",
]
]
static let arrSelectAddress = [
[
"id":"中国大陆",
"title" : "中国大陆",
],
[
"id" : "中国澳门",
"title" : "中国澳门",
],
[
"id" : "中国台湾",
"title" : "中国台湾",
],
[
"id":"外国地区",
"title" : "外国地区",
]
]
//通过 id 获取 title
static func getShowNameBy(indexStr:String,type : YHOtherPickerViewType) -> String {
......@@ -443,6 +464,8 @@ class YHConstantArrayData {
arrData = YHConstantArrayData.arrDegreeAddress
case .constellation:
arrData = YHConstantArrayData.arrDegreeConstellation
case .selectAddress:
arrData = YHConstantArrayData.arrSelectAddress
default:
arrData = [[:]]
}
......
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