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

Merge branch 'develop' into davidhuang

* develop:
  上传证件照UI
  // 选择器
  // 单行选择器
parents 0b64d6d5 38dadba6
......@@ -28,6 +28,7 @@
042FBBC72B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC62B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift */; };
042FBBC92B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC82B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift */; };
042FBBCB2B65058000F9DE23 /* YHChildBasicInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBCA2B65058000F9DE23 /* YHChildBasicInfoVC.swift */; };
042FBBD42B67A2FE00F9DE23 /* YHFormPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBD32B67A2F900F9DE23 /* YHFormPickerView.swift */; };
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */; };
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */; };
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */; };
......@@ -47,6 +48,8 @@
0468D44B2B625AAB00CFB916 /* YHItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D44A2B625AAB00CFB916 /* YHItemModel.swift */; };
0468D44D2B62643700CFB916 /* YHMainInformationTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D44C2B62643700CFB916 /* YHMainInformationTableViewCell.swift */; };
0468D44F2B634E8B00CFB916 /* YHMainApplicantInformationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D44E2B634E8A00CFB916 /* YHMainApplicantInformationViewModel.swift */; };
0468D4512B67721700CFB916 /* YHMainInformationCardTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4502B67721700CFB916 /* YHMainInformationCardTableViewCell.swift */; };
0468D4532B6782BE00CFB916 /* YHCardExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4522B6782BE00CFB916 /* YHCardExampleView.swift */; };
04808C062B4686510056D53C /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04808C042B4686510056D53C /* ATAuthSDK.bundle */; };
04808C082B4686C10056D53C /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04808C032B4686510056D53C /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
......@@ -209,6 +212,7 @@
042FBBC62B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChildInitialInfoVC.swift; sourceTree = "<group>"; };
042FBBC82B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemExpireDateCell.swift; sourceTree = "<group>"; };
042FBBCA2B65058000F9DE23 /* YHChildBasicInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChildBasicInfoVC.swift; sourceTree = "<group>"; };
042FBBD32B67A2F900F9DE23 /* YHFormPickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFormPickerView.swift; sourceTree = "<group>"; };
0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVerificationCodeLoginController.swift; sourceTree = "<group>"; };
0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPhoneMessageView.swift; sourceTree = "<group>"; };
0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeResultViewController.swift; sourceTree = "<group>"; };
......@@ -228,6 +232,8 @@
0468D44A2B625AAB00CFB916 /* YHItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHItemModel.swift; sourceTree = "<group>"; };
0468D44C2B62643700CFB916 /* YHMainInformationTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMainInformationTableViewCell.swift; sourceTree = "<group>"; };
0468D44E2B634E8A00CFB916 /* YHMainApplicantInformationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMainApplicantInformationViewModel.swift; sourceTree = "<group>"; };
0468D4502B67721700CFB916 /* YHMainInformationCardTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMainInformationCardTableViewCell.swift; sourceTree = "<group>"; };
0468D4522B6782BE00CFB916 /* YHCardExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCardExampleView.swift; sourceTree = "<group>"; };
04808C032B4686510056D53C /* ATAuthSDK_D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ATAuthSDK_D.framework; sourceTree = "<group>"; };
04808C042B4686510056D53C /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ATAuthSDK.bundle; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
......@@ -394,6 +400,7 @@
041B52892B5E14EB007EBCEB /* View */ = {
isa = PBXGroup;
children = (
042FBBD22B67A2F900F9DE23 /* PickerView */,
041B52922B5E6CBA007EBCEB /* YHFormItemTitleCell.swift */,
041B52942B5E7037007EBCEB /* YHFormItemAddCell.swift */,
041B528A2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift */,
......@@ -432,6 +439,14 @@
path = M;
sourceTree = "<group>";
};
042FBBD22B67A2F900F9DE23 /* PickerView */ = {
isa = PBXGroup;
children = (
042FBBD32B67A2F900F9DE23 /* YHFormPickerView.swift */,
);
path = PickerView;
sourceTree = "<group>";
};
0468D4292B55017400CFB916 /* Analytics */ = {
isa = PBXGroup;
children = (
......@@ -498,6 +513,8 @@
0468D4462B624AF000CFB916 /* YHBottomNextView.swift */,
0468D4482B6258A900CFB916 /* YHItemView.swift */,
0468D44C2B62643700CFB916 /* YHMainInformationTableViewCell.swift */,
0468D4502B67721700CFB916 /* YHMainInformationCardTableViewCell.swift */,
0468D4522B6782BE00CFB916 /* YHCardExampleView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -1157,8 +1174,10 @@
A5FD63E62B67908000D1D9DA /* YHPersonInfoControllerHoldViewController.swift in Sources */,
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */,
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */,
0468D4532B6782BE00CFB916 /* YHCardExampleView.swift in Sources */,
A5ACE9362B4564F7002C94D2 /* YHNetworkStatusManager.swift in Sources */,
A5ACE92C2B4564F7002C94D2 /* YHLoginStyleButton.swift in Sources */,
042FBBD42B67A2FE00F9DE23 /* YHFormPickerView.swift in Sources */,
A5ACE92F2B4564F7002C94D2 /* YHMyViewController.swift in Sources */,
A5C5B2E62B4EC0BF00A7C5D1 /* YHDavidTestViewController.swift in Sources */,
A5ACE9332B4564F7002C94D2 /* NetBaseModel.swift in Sources */,
......@@ -1183,6 +1202,7 @@
041B52DB2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift in Sources */,
A5FD63D22B650BA700D1D9DA /* YHScorePersonInfoCell.swift in Sources */,
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */,
0468D4512B67721700CFB916 /* YHMainInformationCardTableViewCell.swift in Sources */,
0468D4362B57752F00CFB916 /* YHUserModel.swift in Sources */,
A5ACE9512B4564F7002C94D2 /* YhConstant.swift in Sources */,
A5ACE94A2B4564F7002C94D2 /* BsHUDProgressView.swift in Sources */,
......
......@@ -628,6 +628,12 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let picker = YHFormPickerView(type: .marriage)
picker.selectTitle = "女"
picker.selectType = .marriage(.separated)
picker.show()
return
let arr = items[indexPath.section]
let item:YHFormItemProtocol = arr[indexPath.row]
......
//
// YHFormPickerView.swift
// galaxy
//
// Created by edy on 2024/1/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHFormPickerViewType: Int {
// 按自然顺序递增
case none = 0
// 学位
case degree = 1
// 婚姻
case marriage = 2
// 授课形式
case edution = 3
// 职业
case occupation = 4
// 性别
case gender = 5
}
enum YHFormPickerViewSubType {
case none
case marriage(YHPickerViewMarriageType)
case degree(YHPickerViewDegreeType)
case education(YHPickerViewEducationType)
case occupation(YHPickerViewOccupationType)
case gender(YHPickerViewGenderType)
var title:String {
switch self {
case .none:
return "".local
case .marriage(.unmarriage):
return "未婚".local
case .marriage(.marriaged):
return "已婚".local
case .marriage(.separated):
return "分居".local
case .marriage(.divorced):
return "离婚".local
case .marriage(.widowed):
return "丧偶".local
case .degree(.bachelor):
return "学士学位".local
case .degree(.master):
return "硕士学位".local
case .degree(.doctor):
return "博士学位".local
case .education(.fullTime):
return "全日制".local
case .education(.partTime):
return "兼职制".local
case.education(.distanceCourses):
return "遥距课程".local
case .occupation(.onTheJob):
return "在职".local
case .occupation(.retire):
return "退休".local
case .occupation(.unemployed):
return "无业".local
case .occupation(.student):
return "学生".local
case .gender(.male):
return "男".local
case .gender(.female):
return "女".local
}
}
static func getType(_ title: String?) -> YHFormPickerViewSubType {
guard let title = title else { return .none }
if title == "未婚".local {
return .marriage(.unmarriage)
} else if title == "已婚".local {
return .marriage(.marriaged)
} else if title == "分居".local {
return .marriage(.separated)
} else if title == "离婚".local {
return .marriage(.divorced)
} else if title == "丧偶".local {
return .marriage(.widowed)
} else if title == "学士学位".local {
return .degree(.bachelor)
} else if title == "硕士学位".local {
return .degree(.master)
} else if title == "硕士学位".local {
return .degree(.doctor)
} else if title == "全日制".local {
return .education(.fullTime)
} else if title == "兼读制".local {
return .education(.partTime)
} else if title == "遥距课程".local {
return .education(.distanceCourses)
} else if title == "在职".local {
return .occupation(.onTheJob)
} else if title == "退休".local {
return .occupation(.retire)
} else if title == "无业".local {
return .occupation(.unemployed)
} else if title == "学生".local {
return .occupation(.student)
} else if title == "男".local {
return .gender(.male)
} else if title == "女".local {
return .gender(.female)
}
return .none
}
}
enum YHPickerViewMarriageType {
// 未婚
case unmarriage
// 已婚
case marriaged
// 离婚
case divorced
// 分居
case separated
// 丧偶
case widowed
}
enum YHPickerViewDegreeType {
// 学士
case bachelor
// 硕士
case master
// 博士
case doctor
}
enum YHPickerViewEducationType {
// 全日制
case fullTime
// 兼读制
case partTime
// 遥距课程
case distanceCourses
}
enum YHPickerViewOccupationType {
// 在职
case onTheJob
// 退休
case retire
// 无业
case unemployed
// 学生
case student
}
enum YHPickerViewGenderType {
// 男
case male
// 女
case female
}
class YHFormPickerViewItem {
let type: YHFormPickerViewSubType
lazy var title = {
return type.title
}()
init(type: YHFormPickerViewSubType) {
self.type = type
}
}
class YHFormPickerView: UIView {
let type: YHFormPickerViewType
var selectType:YHFormPickerViewSubType?
var selectTitle:String? {
didSet {
let type:YHFormPickerViewSubType = YHFormPickerViewSubType.getType(selectTitle)
selectType = type
}
}
var selectBlock:((YHFormPickerViewSubType)->Void)?
var title: String? {
didSet {
titleLabel.text = title
}
}
lazy var pickerView:UIPickerView = {
let view = UIPickerView()
view.dataSource = self
view.delegate = self
return view
}()
lazy var blackMaskView: UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
let tap = UITapGestureRecognizer(target: self, action: #selector(dismiss))
view.addGestureRecognizer(tap)
return view
}()
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
lazy var topView:UIView = {
let view = UIView()
view.addSubview(titleLabel)
view.addSubview(cancelBtn)
view.addSubview(confirmBtn)
titleLabel.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
cancelBtn.snp.makeConstraints { make in
make.left.top.bottom.equalToSuperview()
make.width.equalTo(60)
}
confirmBtn.snp.makeConstraints { make in
make.right.top.bottom.equalToSuperview()
make.width.equalTo(60)
}
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#222222")
label.textAlignment = .center
label.font = UIFont.PingFangScR(ofSize: 16)
label.text = "请选择"
return label
}()
lazy var cancelBtn: UIButton = {
let btn = UIButton()
btn.setTitle("取消".local, for: .normal)
btn.titleLabel?.font = UIFont.PingFangScR(ofSize: 14)
btn.setTitleColor(UIColor(hex: 0x222222), for: .normal)
btn.addTarget(self, action: #selector(didClickCancelButton), for: .touchUpInside)
return btn
}()
lazy var confirmBtn: UIButton = {
let btn = UIButton()
btn.setTitle("确定".local, for: .normal)
btn.titleLabel?.font = UIFont.PingFangScR(ofSize: 14)
btn.setTitleColor(UIColor(hex: 0x4487F9), for: .normal)
btn.addTarget(self, action: #selector(didClickConfirmButton), for: .touchUpInside)
return btn
}()
lazy var dataDict:[ YHFormPickerViewType: [YHFormPickerViewItem]] = {
return [
// 此处顺序需遵循 YHFormPickerViewType 枚举顺序
// 默认无
.none:[],
// 学位
.degree:
[YHFormPickerViewItem(type: .degree(.bachelor)),
YHFormPickerViewItem(type: .degree(.master)),
YHFormPickerViewItem(type: .degree(.doctor))],
// 婚姻
.marriage:
[YHFormPickerViewItem(type: .marriage(.unmarriage)),
YHFormPickerViewItem(type: .marriage(.marriaged)),
YHFormPickerViewItem(type: .marriage(.divorced)),
YHFormPickerViewItem(type: .marriage(.separated)),
YHFormPickerViewItem(type: .marriage(.widowed))],
// 教育
.edution:
[YHFormPickerViewItem(type: .education(.fullTime)),
YHFormPickerViewItem(type: .education(.partTime)),
YHFormPickerViewItem(type: .education(.distanceCourses))],
// 职业
.occupation:
[YHFormPickerViewItem(type: .occupation(.onTheJob)),
YHFormPickerViewItem(type: .occupation(.retire)),
YHFormPickerViewItem(type: .occupation(.unemployed)),
YHFormPickerViewItem(type: .occupation(.student))],
// 性别
.gender:
[YHFormPickerViewItem(type: .gender(.male)),
YHFormPickerViewItem(type: .gender(.female))],
]
}()
init(type: YHFormPickerViewType) {
self.type = type
super.init(frame: UIScreen.main.bounds)
self.createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func show() {
showSelectType(&selectType)
UIApplication.shared.yhKeyWindow()?.addSubview(self)
}
@objc func dismiss() {
self.removeFromSuperview()
}
func createUI() {
self.addSubview(blackMaskView)
self.addSubview(whiteContentView)
whiteContentView.addSubview(topView)
whiteContentView.addSubview(pickerView)
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(16.0, 16.0));
let layer = CAShapeLayer();
layer.frame = whiteContentView.bounds;
layer.path = path.cgPath;
whiteContentView.layer.mask = layer;
if let title = title {
titleLabel.text = title
} else {
titleLabel.text = getTitle(type: type)
}
blackMaskView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
whiteContentView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalToSuperview().offset(KScreenHeight*2/3.0)
}
topView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(52)
}
pickerView.snp.makeConstraints { make in
make.top.equalTo(topView.snp.bottom)
make.left.right.bottom.equalToSuperview()
}
}
@objc func didClickCancelButton() {
dismiss()
}
@objc func didClickConfirmButton() {
if let selectBlock = selectBlock {
if let selectType = selectType {
selectBlock(selectType)
} else {
// 默认选中第一行
let arr = dataDict[type]
if let arr = arr, !arr.isEmpty {
let item:YHFormPickerViewItem = arr[0]
selectType = item.type
selectBlock(item.type)
}
}
}
dismiss()
}
func showSelectType(_ selectType: inout YHFormPickerViewSubType?) {
// 处理从外部传入的选中第几行的参数
// 是否找到选中行数据
var selectIndex:Int = -1
if let selectType = selectType, let arr = dataDict[type], !arr.isEmpty {
for (index, item) in arr.enumerated() {
if selectType.title == item.type.title {
selectIndex = index
break
}
}
}
if selectIndex != -1 { // 找到了选择行
pickerView.selectRow(selectIndex, inComponent: 0, animated: true)
} else { // 未找到选中行数据则滚动至第一行
if dataDict[type]?.isEmpty == true { return }
if let arr = dataDict[type], !arr.isEmpty {
let item = arr[0]
selectType = item.type
pickerView.selectRow(0, inComponent: 0, animated: true)
}
}
}
func getTitle(type: YHFormPickerViewType)-> String {
switch type {
case .none:
return ""
case .degree:
return "选择学位"
case .marriage:
return "选择婚姻状况"
case .edution:
return "选择学位"
case .occupation:
return "选择职业"
case .gender:
return "选择性别"
}
}
}
extension YHFormPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
if let arr = dataDict[type], !arr.isEmpty {
return arr.count
}
return 0
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if let arr = dataDict[type] {
if 0 <= row && row < arr.count {
let item :YHFormPickerViewItem = arr[row]
return item.title
}
}
return ""
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if let arr = dataDict[type] {
if 0 <= row && row < arr.count {
let item :YHFormPickerViewItem = arr[row]
print(item.title)
selectType = item.type
}
}
}
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
let label = UILabel()
label.textColor = UIColor(hexString:"#222222")
label.textAlignment = .center
label.font = UIFont.PingFangScR(ofSize: 14)
label.text = ""
if let arr = dataDict[type] {
if 0 <= row && row < arr.count {
let item :YHFormPickerViewItem = arr[row]
label.text = item.title
}
}
// 选中背景色
if #available(iOS 14.0, *), self.subviews.count > 1 {
pickerView.subviews[1].backgroundColor = UIColor(hex: 0x4487F9, alpha: 0.06)
}
return label
}
}
......@@ -65,6 +65,7 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHMainInformationTableViewCell.self)
tableView.register(cellWithClass: YHMainInformationCardTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
......@@ -88,6 +89,16 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
make.left.right.bottom.equalTo(view)
make.height.equalTo(k_Height_safeAreaInsetsBottom() + 64)
}
stepView.isHidden = true
tableView.isHidden = true
bottomView.isHidden = true
let datePicker = UIDatePicker(frame: CGRect(x: 0, y: 150, width: self.view.bounds.width, height: 200))
datePicker.datePickerMode = .dateAndTime
// datePicker.addTarget(self, action: #selector(handleDateChange), for: .valueChanged)
// 将日期选择器添加到视图上
self.view.addSubview(datePicker)
}
}
......@@ -98,13 +109,24 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHMainInformationTableViewCell.self)
cell.dataSource = dataSource?[indexPath.row]
return cell
if stepView.currentIndex == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHMainInformationCardTableViewCell.self)
cell.dataSource = dataSource?[indexPath.row]
cell.type = YHCardType(rawValue: indexPath.row)
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHMainInformationTableViewCell.self)
cell.dataSource = dataSource?[indexPath.row]
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let count = dataSource?[indexPath.row].models?.count ?? 0
return CGFloat(count * 52 + 52 + 14)
if stepView.currentIndex == 1 {
return 217.0
} else {
return CGFloat(count * 52 + 52 + 14)
}
}
}
//
// YHCardExampleView.swift
// galaxy
//
// Created by EDY on 2024/1/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCardExampleView: UIView {
var centerView: UIView!
var titleLabel: UILabel!
var closeButton: UIButton!
var lineView: UIView!
var messageLabel: UILabel!
var topImageView: UIImageView!
var bottomImageView: UIImageView!
var bottomButton: UIButton!
var type: YHCardType? {
didSet {
guard let type = type else { return }
switch type {
case .identity:
messageLabel.isHidden = false
topImageView.image = UIImage(named: "service_card_id_back")
bottomImageView.image = UIImage(named: "service_card_id_frant")
case .passport:
messageLabel.isHidden = true
topImageView.image = UIImage(named: "service_card_passport_frant")
bottomImageView.image = UIImage(named: "service_card_passport_back")
topImageView.snp.remakeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.height.equalTo(207)
make.top.equalTo(109)
}
}
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap))
tap.delegate = self
addGestureRecognizer(tap)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
backgroundColor = UIColor(hex: 0x0000, alpha: 0.5)
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 12
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(686)
}
titleLabel = {
let label = UILabel()
label.text = "身份证示例模板"
label.font = kFont(size: 17)
label.textColor = UIColor(hex:0x222222)
label.textAlignment = .left
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(21)
make.height.equalTo(21)
make.top.equalTo(16)
}
closeButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_close"), for: .normal)
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(closeButton)
closeButton.snp.makeConstraints { make in
make.right.equalTo(-21)
make.width.height.equalTo(24)
make.top.equalTo(16)
}
lineView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xf0f0f0)
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52)
make.height.equalTo(1)
make.right.equalTo(-18)
}
messageLabel = {
let label = UILabel()
label.text = "*须使用二代身份证"
label.font = kFont(size: 14)
label.textColor = UIColor(hex:0xc0c0c0)
label.textAlignment = .left
label.numberOfLines = 0
return label
}()
centerView.addSubview(messageLabel)
messageLabel.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.height.equalTo(20)
make.top.equalTo(109)
}
topImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "service_card_id_back")
return imageView
}()
centerView.addSubview(topImageView)
topImageView.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.height.equalTo(207)
make.top.equalTo(150)
}
bottomImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "service_card_passport_back")
return imageView
}()
centerView.addSubview(bottomImageView)
bottomImageView.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.height.equalTo(207)
make.top.equalTo(topImageView.snp.bottom).offset(16)
}
bottomButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x4d9ffb)
button.titleLabel?.font = kBoldFont(size: 16)
button.contentHorizontalAlignment = .center
button.setTitle("知道了", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = 8
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(bottomButton)
bottomButton.snp.makeConstraints { make in
make.right.equalTo(-21)
make.left.equalTo(21)
make.bottom.equalTo(-42)
make.height.equalTo(48)
}
let array = ["四角完整", "照片清晰", "亮度均匀"]
for i in 0 ..< array.count {
let imageView = UIImageView()
imageView.image = UIImage(named: "service_card_complete")
centerView.addSubview(imageView)
imageView.snp.makeConstraints { make in
make.top.equalTo(76)
make.left.equalTo(21 + i * 85)
make.width.height.equalTo(14)
}
let label = UILabel()
label.text = array[i]
label.textColor = UIColor(hex: 0x222222)
label.font = kFont(size: 14)
centerView.addSubview(label)
label.snp.makeConstraints { make in
make.top.equalTo(73)
make.left.equalTo(43 + i * 85)
make.height.equalTo(20)
make.width.equalTo(65)
}
}
}
@objc private func handleTap(_ sender: AnyObject?) {
print("处理点击手势")
dismiss()
}
@objc func dismiss() {
removeFromSuperview()
}
}
extension YHCardExampleView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer:UIGestureRecognizer, shouldReceive touch:UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
//
// YHMainInformationCardTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/1/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHCardType: Int {
case identity = 0
case passport = 1
}
class YHMainInformationCardTableViewCell: UITableViewCell {
var centerView: UIView!
var titleLabel: UILabel!
var exampleButton: UIButton!
var frontLabel: UILabel!
var backSurfaceLabel: UILabel!
var frontImageButton: UIButton!
var backSurfaceImageButton: UIButton!
var type: YHCardType? {
didSet {
guard let type = type else { return }
switch type {
case .identity:
titleLabel.text = "中国身份证(选填)"
frontLabel.text = "身份证人像面"
backSurfaceLabel.text = "身份证国徽面"
case .passport:
titleLabel.text = "港澳通行证(选填)"
frontLabel.text = "港澳通行证正面"
backSurfaceLabel.text = "港澳通行证反面"
}
}
}
var dataSource: YHSectionItemModel?{
didSet {
updataData()
}
}
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 = UIColor(hex: 0xe9e9e9)
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 12
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 = kFont(size: 17)
label.textColor = UIColor(hex:0x222222)
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(20)
}
exampleButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x1f93ff).withAlphaComponent(0.12)
button.titleLabel?.font = kBoldFont(size: 10)
button.contentHorizontalAlignment = .center
button.setTitle("示例模板", for: .normal)
button.setTitleColor( UIColor(hex:0x0085ff), for: .normal)
button.layer.cornerRadius = 4
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
return button
}()
centerView.addSubview(exampleButton)
exampleButton.snp.makeConstraints { make in
make.left.equalTo(titleLabel.snp.right)
make.centerY.equalTo(titleLabel.snp.centerY)
make.height.equalTo(14)
make.width.equalTo(48)
}
let lineView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xf0f0f0)
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52)
make.height.equalTo(1)
make.right.equalTo(-18)
}
frontLabel = {
let label = UILabel()
label.font = kFont(size: 12)
label.textColor = UIColor(hex:0x888f98)
label.textAlignment = .center
return label
}()
centerView.addSubview(frontLabel)
frontLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(centerView.snp.centerX)
make.top.equalTo(64)
make.height.equalTo(20)
}
backSurfaceLabel = {
let label = UILabel()
label.font = kFont(size: 12)
label.textColor = UIColor(hex:0x888f98)
label.textAlignment = .center
return label
}()
centerView.addSubview(backSurfaceLabel)
backSurfaceLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(centerView.snp.centerX)
make.top.equalTo(64)
make.height.equalTo(20)
}
frontImageButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_front"), for: .normal)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
return button
}()
centerView.addSubview(frontImageButton)
frontImageButton.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(96)
make.height.equalTo(91)
make.width.equalTo(147)
}
backSurfaceImageButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_back"), for: .normal)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
return button
}()
centerView.addSubview(backSurfaceImageButton)
backSurfaceImageButton.snp.makeConstraints { make in
make.right.equalTo(-18)
make.top.equalTo(96)
make.height.equalTo(91)
make.width.equalTo(147)
}
}
@objc func exampleClick() {
let view = YHCardExampleView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.type = type
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
func updataData() {
titleLabel.text = "中国身份证(选填)"
frontLabel.text = "身份证人像面"
backSurfaceLabel.text = "身份证国徽面"
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_card_back@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_card_back@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_card_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_card_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_card_complete@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_card_complete@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_card_front@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_card_front@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_card_id_back@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_card_id_back@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_card_id_frant@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_card_id_frant@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_card_passport_back@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_card_passport_back@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_card_passport_frant@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_card_passport_frant@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