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

Merge branch 'develop' into davidhuang

* develop:
  // 表单cell 更名
  // 证件信息填写
  // 证书
  // 双项选择题
parents 19acaa2c fda3d7de
This diff is collapsed.
//
// YHCertificateViewController.swift
// galaxy
//
// Created by edy on 2024/1/25.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateViewController: YHBaseViewController {
var spouse:YHSpouse?
var cardInfo: YHCNIdentityCard?
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.plain)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHFormItemDoubleChoiceCell.self, forCellReuseIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier)
tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier)
tableView.register(YHFormItemEnterDetailCell.self, forCellReuseIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier)
tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier)
tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier)
tableView.register(YHFormItemSelectSheetCell.self, forCellReuseIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier)
return tableView
}()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "配偶信息填写".local
createUI()
loadCertificateInfo()
}
func createUI() {
view.addSubview(tableView);
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-100)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
}
}
func loadCertificateInfo() {
let title0 = YHFormTitleItem(type: .chinaIdCardInfo)
let item01 = YHFormDetailItem(type: .certificateNumber)
let item02 = YHFormDetailItem(type: .certificateSignPlace)
let item03 = YHFormDetailItem(type: .certificateSignDate)
let item04 = YHFormDetailItem(type: .certificateValidDate)
let arr0:[YHFormItemProtocol] = [title0, item01, item02, item03, item04]
let title1 = YHFormTitleItem(type: .passPortInfo)
let item10 = YHFormDetailItem(type: .cetificateType)
let item11 = YHFormDetailItem(type: .certificateNumber)
let item12 = YHFormDetailItem(type: .certificateSignPlace)
let item13 = YHFormDetailItem(type: .certificateSignDate)
let item14 = YHFormDetailItem(type: .certificateValidDate)
let arr1:[YHFormItemProtocol] = [title1, item10, item11, item12, item13, item14]
items.append(contentsOf: [arr0, arr1])
tableView.reloadData()
}
}
extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section >= items.count { return 0 }
let arr = items[section]
return arr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section >= items.count { return createDefaultCell(indexPath) }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return createDefaultCell(indexPath) }
let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.titleLabel.text = item.getTitle()
return cell
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .certificateNumber || detailItem.type == .certificateSignPlace { // 证件号码和签发地需要填写
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
let titleItem = arr[0] as! YHFormTitleItem
if detailItem.type == .certificateNumber {
cell.titleLabel.text = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码")
} else {
cell.titleLabel.text = detailItem.getTitle()
}
return cell
}
if detailItem.type == .cetificateType || detailItem.type == .certificateSignDate || detailItem.type == .certificateValidDate {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.title = detailItem.getTitle()
cell.detail = "中国"
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.titleLabel.text = detailItem.getTitle()
return cell
}
return createDefaultCell(indexPath)
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section >= items.count { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return }
createCorner(cell: cell, arr: arr, indexPath: indexPath)
}
func createDefaultCell(_ indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 14.0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
cell.layer.mask = nil
// 设置每块section圆角
if (indexPath.row == 0) {
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
} else if (indexPath.row == arr.count-1) {
let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
} else {
cell.layer.mask = nil
}
}
}
......@@ -35,11 +35,11 @@ class YHFamilyMemberFormVC: YHBaseViewController {
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHDoubleChoiceFormCell.self, forCellReuseIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier)
tableView.register(YHSingleLineInputCell.self, forCellReuseIdentifier: YHSingleLineInputCell.cellReuseIdentifier)
tableView.register(YHSingleLineSelectCell.self, forCellReuseIdentifier: YHSingleLineSelectCell.cellReuseIdentifier)
tableView.register(YHFormTitleCell.self, forCellReuseIdentifier: YHFormTitleCell.cellReuseIdentifier)
tableView.register(YHFormAddInfoCell.self, forCellReuseIdentifier: YHFormAddInfoCell.cellReuseIdentifier)
tableView.register(YHFormItemDoubleChoiceCell.self, forCellReuseIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier)
tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier)
tableView.register(YHFormItemEnterDetailCell.self, forCellReuseIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier)
tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier)
tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier)
return tableView
}()
......@@ -494,7 +494,7 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
let formItem = item as! YHFormTitleItem
// 配偶父母子女兄妹title
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.titleLabel.text = formItem.getTitle()
cell.subTitleLabel.text = formItem.getSubTitle()
......@@ -531,7 +531,7 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
// 配偶父母子女兄妹具体条目
if item is YHParent || item is YHChild || item is YHSpouse || item is YHBrother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.isShowDeleteBtn = false
cell.deleteBlock = nil
if item is YHChild || item is YHBrother {
......@@ -574,7 +574,7 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
let formItem = item as! YHFormAddItem
if formItem.type == .addChild || formItem.type == .addBrother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.clickBlock = { [weak self] in
if formItem.type == .addBrother {
self?.addBrother()
......
......@@ -27,11 +27,11 @@ class YHSpouseFormVC: YHBaseViewController {
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHDoubleChoiceFormCell.self, forCellReuseIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier)
tableView.register(YHSingleLineInputCell.self, forCellReuseIdentifier: YHSingleLineInputCell.cellReuseIdentifier)
tableView.register(YHSingleLineSelectCell.self, forCellReuseIdentifier: YHSingleLineSelectCell.cellReuseIdentifier)
tableView.register(YHFormTitleCell.self, forCellReuseIdentifier: YHFormTitleCell.cellReuseIdentifier)
tableView.register(YHFormAddInfoCell.self, forCellReuseIdentifier: YHFormAddInfoCell.cellReuseIdentifier)
tableView.register(YHFormItemDoubleChoiceCell.self, forCellReuseIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier)
tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier)
tableView.register(YHFormItemEnterDetailCell.self, forCellReuseIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier)
tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier)
tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier)
return tableView
}()
......@@ -95,7 +95,7 @@ class YHSpouseFormVC: YHBaseViewController {
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23]
// 港澳通信证
let title3 = YHFormTitleItem(type: .hkPassport)
let title3 = YHFormTitleItem(type: .getHKPassport)
let item30 = YHFormDetailItem(type: .hkPassport)
let arr3:[YHFormItemProtocol] = [title3, item30]
......@@ -172,7 +172,7 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.titleLabel.text = item.getTitle()
return cell
......@@ -182,7 +182,7 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .accompany || detailItem.type == .hkPassport {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.title = detailItem.getTitle()
if detailItem.type == .accompany {
......@@ -207,13 +207,13 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isLiveTother || detailItem.isHongKongMacouPassport {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.title = detailItem.getTitle()
return cell
} else if detailItem.type == .country || detailItem.type == .liveContry || detailItem.type == .liveCity || detailItem.type == .detailAddress {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
return cell
......@@ -272,6 +272,8 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHCertificateViewController()
self.navigationController?.pushViewController(vc)
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
......
//
// YHCertificateInfo.swift
// galaxy
//
// Created by edy on 2024/1/25.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateInfo: NSObject {
}
......@@ -26,7 +26,12 @@ enum YHFormTitleItemType:Int {
case accompany = 5
case country = 6
case liveInfo = 7
case hkPassport = 8
case getHKPassport = 8
// 中国身份证
case chinaIdCardInfo = 9
// 护照
case passPortInfo = 10
}
// 表单添加条目类型
......@@ -46,6 +51,18 @@ enum YHFormDetailItemType:Int {
case liveCity = 5
case detailAddress = 6
case hkPassport = 7
// 证件类别
case cetificateType = 8
// 证件号码
case certificateNumber = 9
// 签发日期
case certificateSignDate = 10
// 届满日期
case certificateValidDate = 11
// 签发地
case certificateSignPlace = 12
}
//添加item
......@@ -97,8 +114,13 @@ class YHFormTitleItem : YHFormItemProtocol {
return "国籍".local
case .liveInfo:
return "居住信息".local
case .hkPassport:
case .getHKPassport:
return "港澳通行证".local
case .chinaIdCardInfo:
return "中国身份证".local
case .passPortInfo:
return String(format: "%@(%@)", "护照及其他旅行证件".local, "选填".local)
}
}
......@@ -118,8 +140,14 @@ class YHFormTitleItem : YHFormItemProtocol {
return "".local
case .liveInfo:
return "".local
case .hkPassport:
case .getHKPassport:
return "".local
case .chinaIdCardInfo:
return "".local
case .passPortInfo:
return "".local
}
}
}
......@@ -170,6 +198,21 @@ class YHFormDetailItem : YHFormItemProtocol {
return "详细地址".local
case .hkPassport:
return "是否办理".local
// 证件类别
case .cetificateType:
return "证件类别".local
// 证件号码
case .certificateNumber:
return "中国身份证号".local
// 签发日期
case .certificateSignDate:
return "签发日期".local
// 届满日期
case .certificateValidDate:
return "届满日期".local
case .certificateSignPlace:
return "签发地".local
}
}
......
......@@ -8,9 +8,9 @@
import UIKit
class YHFormAddInfoCell: UITableViewCell {
class YHFormItemAddCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormAddInfoCell"
static let cellReuseIdentifier = "YHFormItemAddCell"
let btnTitleColor = UIColor(hexString:"#4388FF")
let btnHeight = 44.0
......
......@@ -8,9 +8,9 @@
import UIKit
class YHDoubleChoiceFormCell: UITableViewCell {
class YHFormItemDoubleChoiceCell: UITableViewCell {
static let cellReuseIdentifier = "YHDoubleChoiceFormCell"
static let cellReuseIdentifier = "YHFormItemDoubleChoiceCell"
let btnWidth = 70.0
let btnHeight = 32.0
let btnTitleSelectColor = UIColor(hex: 0x4487F9)
......
......@@ -8,9 +8,9 @@
import UIKit
class YHSingleLineSelectCell: UITableViewCell {
class YHFormItemEnterDetailCell: UITableViewCell {
static let cellReuseIdentifier = "YHSingleLineSelectCell"
static let cellReuseIdentifier = "YHFormItemEnterDetailCell"
// 是否必填 如必填title会展示红色*
var isMust = false
......@@ -53,7 +53,7 @@ class YHSingleLineSelectCell: UITableViewCell {
lazy var detailLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textColor = UIColor(hexString: "#888F98")
label.textAlignment = .right
label.numberOfLines = 0
label.font = UIFont.PFSCR(ofSize: 14)
......@@ -89,8 +89,6 @@ class YHSingleLineSelectCell: UITableViewCell {
contentView.addSubview(arrowImgView)
contentView.addSubview(deleteButton)
title = "婚姻状况"
detailLabel.text = "沙发上发顺丰"
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalTo(detailLabel.snp.left).offset(-8)
......
......@@ -8,9 +8,9 @@
import UIKit
class YHSingleLineInputCell: UITableViewCell {
class YHFormItemInputTextCell: UITableViewCell {
static let cellReuseIdentifier = "YHSingleLineInputCell"
static let cellReuseIdentifier = "YHFormItemInputTextCell"
// 是否必填 如必填title会展示红色*
var isMust = false
......@@ -24,7 +24,7 @@ class YHSingleLineInputCell: UITableViewCell {
.font: UIFont.PFSCR(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222)
]
var questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
......@@ -72,17 +72,17 @@ class YHSingleLineInputCell: UITableViewCell {
contentView.addSubview(textField)
isMust = true
title = "曾用名"
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalTo(textField.snp.left).offset(-8)
make.width.equalTo(120)
make.centerY.equalToSuperview()
}
textField.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(contentView.snp.right).offset(-16)
make.left.equalTo(titleLabel.snp.right).offset(10)
}
}
......
......@@ -9,9 +9,9 @@
import UIKit
class YHDoubleChoiceQuestionCell: UITableViewCell {
class YHFormItemQuestionCell: UITableViewCell {
static let cellReuseIdentifier = "YHDoubleChoiceQuestionCell"
static let cellReuseIdentifier = "YHFormItemQuestionCell"
let btnWidth = 70.0
let btnHeight = 32.0
let btnTitleSelectColor = UIColor(hex: 0x4487F9)
......@@ -20,10 +20,12 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
let confirmTag = 9527
let negativeTag = 9528
var question:String? {
var responseBlock:((Bool)->Void)?
var title:String? {
didSet {
if let question = question {
if let question = title {
let str = "*"+question
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSCR(ofSize: 14),
......@@ -32,15 +34,18 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionLabel.attributedText = questionAttrStr
titleLabel.attributedText = questionAttrStr
}
}
}
var selectBlock:((Bool) ->Void)?
var response:Bool = false {
didSet {
showResponse(response)
}
}
lazy var questionLabel: UILabel = {
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.textColor = UIColor(hexString:"#333333")
......@@ -84,14 +89,14 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
self.selectionStyle = .none
question = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
contentView.addSubview(questionLabel)
title = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
contentView.addSubview(titleLabel)
contentView.addSubview(negativeBtn)
contentView.addSubview(confirmBtn)
// 默认选择否按钮
didClickResponseBtn(btn: negativeBtn)
response = false
questionLabel.snp.makeConstraints { make in
titleLabel.snp.makeConstraints { make in
make.top.equalTo(contentView.snp.top).offset(12)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
......@@ -99,8 +104,8 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
negativeBtn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: btnWidth, height: btnHeight))
make.left.equalTo(questionLabel)
make.top.equalTo(questionLabel.snp.bottom).offset(12)
make.left.equalTo(titleLabel)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.bottom.equalToSuperview().offset(-16)
}
......@@ -112,12 +117,16 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
}
@objc func didClickResponseBtn(btn: UIButton) {
let isConfirm = (btn.tag == confirmTag)
response = (btn.tag == confirmTag)
if let responseBlock = responseBlock {
responseBlock(btn.tag==confirmTag)
}
}
func showResponse(_ isConfirm: Bool) {
confirmBtn.layer.borderColor = (isConfirm ? btnTitleSelectColor : .clear).cgColor
confirmBtn.setTitleColor((isConfirm ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal)
negativeBtn.layer.borderColor = (isConfirm ? .clear : btnTitleSelectColor).cgColor
negativeBtn.setTitleColor((isConfirm ? btnTitleDefaultColor: btnTitleSelectColor), for: .normal)
}
}
//
// YHSheetSelectCell.swift
// galaxy
//
// Created by edy on 2024/1/26.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHFormItemSelectSheetCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemSelectSheetCell"
// 是否必填 如必填title会展示红色*
var isMust = false
var title:String? {
didSet {
if let title = title {
let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSCR(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222)
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
}
titleLabel.attributedText = questionAttrStr
}
}
}
var tips:String? {
didSet {
tipsLabel.text = tips
}
}
var detail:String? {
didSet {
detailLabel.text = detail
if let detail = detail, !detail.isEmpty {
tipsLabel.isHidden = true
detailLabel.isHidden = false
} else {
tipsLabel.isHidden = false
detailLabel.isHidden = true
}
}
}
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSCR(ofSize: 14)
return label
}()
private lazy var detailLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString: "#222222")
label.textAlignment = .left
label.font = UIFont.PFSCR(ofSize: 14)
label.isHidden = true
return label
}()
private lazy var tipsLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString: "#C0C0C0")
label.text = "请选择".local
label.textAlignment = .left
label.font = UIFont.PFSCR(ofSize: 14)
label.isHidden = false
return label
}()
lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
contentView.addSubview(titleLabel)
contentView.addSubview(detailLabel)
contentView.addSubview(tipsLabel)
contentView.addSubview(arrowImgView)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalTo(detailLabel.snp.left).offset(-8)
make.width.equalTo(120)
make.centerY.equalToSuperview()
}
detailLabel.snp.makeConstraints { make in
make.right.equalTo(arrowImgView.snp.left)
make.centerY.equalToSuperview()
}
tipsLabel.snp.makeConstraints { make in
make.edges.equalTo(detailLabel)
}
arrowImgView.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(20, 20))
make.right.equalToSuperview().offset(-16)
make.centerY.equalToSuperview()
}
}
}
......@@ -8,9 +8,9 @@
import UIKit
class YHFormTitleCell: UITableViewCell {
class YHFormItemTitleCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormTitleCell"
static let cellReuseIdentifier = "YHFormItemTitleCell"
let editTag = 9527
let cancelTag = 9528
......
......@@ -45,11 +45,11 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHDoubleChoiceFormCell.self, forCellReuseIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier)
tableView.register(YHSingleLineInputCell.self, forCellReuseIdentifier: YHSingleLineInputCell.cellReuseIdentifier)
tableView.register(YHSingleLineSelectCell.self, forCellReuseIdentifier: YHSingleLineSelectCell.cellReuseIdentifier)
tableView.register(YHFormTitleCell.self, forCellReuseIdentifier: YHFormTitleCell.cellReuseIdentifier)
tableView.register(YHFormAddInfoCell.self, forCellReuseIdentifier: YHFormAddInfoCell.cellReuseIdentifier)
tableView.register(YHFormItemDoubleChoiceCell.self, forCellReuseIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier)
tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier)
tableView.register(YHFormItemEnterDetailCell.self, forCellReuseIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier)
tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier)
tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier)
return tableView
}()
view.addSubview(tableView)
......
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