Commit b3264fb0 authored by Steven杜宇's avatar Steven杜宇

配偶信息填写

parent 775eb79d
......@@ -67,8 +67,11 @@ class YHSpouseFormVC: YHBaseViewController {
}
func loadSponseInfo() {
guard let spouse = spouse else { return }
items.removeAll()
// 随行
let title0 = YHFormTitleItem(type: .accompany)
let item0 = YHFormDetailItem(type: .accompany)
......@@ -170,7 +173,6 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormTitleItem { // 标题
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
// createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.titleLabel.text = item.getTitle()
return cell
......@@ -181,21 +183,37 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .accompany || detailItem.type == .hkPassport {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
// createCorner(cell: cell, arr: arr,indexPath: indexPath)
cell.question = detailItem.getTitle()
cell.title = detailItem.getTitle()
if detailItem.type == .accompany {
cell.response = detailItem.isAccompany
} else if detailItem.type == .hkPassport {
}
cell.responseBlock = {
[weak self] choice in
if detailItem.type == .accompany {
self?.spouse?.follow = (choice ? 1 : 0)
self?.loadSponseInfo()
} else if detailItem.type == .hkPassport {
}
}
return cell
} else if detailItem.type == .isLiveTother || detailItem.isHongKongMacouPassport {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
// createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.question = detailItem.getTitle()
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
// createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
return cell
......
......@@ -16,13 +16,15 @@ class YHDoubleChoiceFormCell: UITableViewCell {
let btnTitleSelectColor = UIColor(hex: 0x4487F9)
let btnTitleDefaultColor = UIColor(hex:0x222222)
let btnBgColor = UIColor(hex:0xF8F9FB)
let confirmTag = 9527
let negativeTag = 9528
let negativeTag = 9527
let confirmTag = 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),
......@@ -31,13 +33,19 @@ class YHDoubleChoiceFormCell: 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 response:Bool = false {
didSet {
showResponse(response)
}
}
lazy var questionLabel: UILabel = {
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .left
......@@ -82,15 +90,15 @@ class YHDoubleChoiceFormCell: UITableViewCell {
self.selectionStyle = .none
question = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
title = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
contentView.addSubview(questionLabel)
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(22)
make.left.equalToSuperview().offset(16)
make.right.equalTo(confirmBtn.snp.left).offset(-8)
......@@ -111,13 +119,16 @@ class YHDoubleChoiceFormCell: 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)
}
}
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