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

配偶信息填写

parent 775eb79d
...@@ -69,6 +69,9 @@ class YHSpouseFormVC: YHBaseViewController { ...@@ -69,6 +69,9 @@ class YHSpouseFormVC: YHBaseViewController {
func loadSponseInfo() { func loadSponseInfo() {
guard let spouse = spouse else { return } guard let spouse = spouse else { return }
items.removeAll()
// 随行 // 随行
let title0 = YHFormTitleItem(type: .accompany) let title0 = YHFormTitleItem(type: .accompany)
let item0 = YHFormDetailItem(type: .accompany) let item0 = YHFormDetailItem(type: .accompany)
...@@ -170,7 +173,6 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -170,7 +173,6 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormTitleItem { // 标题 if item is YHFormTitleItem { // 标题
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
// createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.titleLabel.text = item.getTitle() cell.titleLabel.text = item.getTitle()
return cell return cell
...@@ -181,21 +183,37 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -181,21 +183,37 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .accompany || detailItem.type == .hkPassport { if detailItem.type == .accompany || detailItem.type == .hkPassport {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
// createCorner(cell: cell, arr: arr,indexPath: indexPath) cell.title = detailItem.getTitle()
cell.question = 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 return cell
} else if detailItem.type == .isLiveTother || detailItem.isHongKongMacouPassport { } else if detailItem.type == .isLiveTother || detailItem.isHongKongMacouPassport {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
// createCorner(cell: cell, arr: arr, indexPath: indexPath) cell.title = detailItem.getTitle()
cell.question = detailItem.getTitle()
return cell return cell
} else if detailItem.type == .country || detailItem.type == .liveContry || detailItem.type == .liveCity || detailItem.type == .detailAddress { } 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: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
// createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
return cell return cell
......
...@@ -16,13 +16,15 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -16,13 +16,15 @@ class YHDoubleChoiceFormCell: UITableViewCell {
let btnTitleSelectColor = UIColor(hex: 0x4487F9) let btnTitleSelectColor = UIColor(hex: 0x4487F9)
let btnTitleDefaultColor = UIColor(hex:0x222222) let btnTitleDefaultColor = UIColor(hex:0x222222)
let btnBgColor = UIColor(hex:0xF8F9FB) let btnBgColor = UIColor(hex:0xF8F9FB)
let confirmTag = 9527 let negativeTag = 9527
let negativeTag = 9528 let confirmTag = 9528
var question:String? { var responseBlock:((Bool)->Void)?
var title:String? {
didSet { didSet {
if let question = question { if let question = title {
let str = "*"+question let str = "*"+question
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSCR(ofSize: 14), .font: UIFont.PFSCR(ofSize: 14),
...@@ -31,13 +33,19 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -31,13 +33,19 @@ class YHDoubleChoiceFormCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes) let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1) let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange) questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
} }
} }
} }
lazy var questionLabel: UILabel = { var response:Bool = false {
didSet {
showResponse(response)
}
}
lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor(hexString:"#333333") label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .left label.textAlignment = .left
...@@ -82,15 +90,15 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -82,15 +90,15 @@ class YHDoubleChoiceFormCell: UITableViewCell {
self.selectionStyle = .none self.selectionStyle = .none
question = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? " title = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
contentView.addSubview(questionLabel) contentView.addSubview(titleLabel)
contentView.addSubview(negativeBtn) contentView.addSubview(negativeBtn)
contentView.addSubview(confirmBtn) 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.top.equalTo(contentView.snp.top).offset(22)
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.right.equalTo(confirmBtn.snp.left).offset(-8) make.right.equalTo(confirmBtn.snp.left).offset(-8)
...@@ -111,13 +119,16 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -111,13 +119,16 @@ class YHDoubleChoiceFormCell: UITableViewCell {
} }
@objc func didClickResponseBtn(btn: UIButton) { @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.layer.borderColor = (isConfirm ? btnTitleSelectColor : .clear).cgColor
confirmBtn.setTitleColor((isConfirm ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal) confirmBtn.setTitleColor((isConfirm ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal)
negativeBtn.layer.borderColor = (isConfirm ? .clear : btnTitleSelectColor).cgColor negativeBtn.layer.borderColor = (isConfirm ? .clear : btnTitleSelectColor).cgColor
negativeBtn.setTitleColor((isConfirm ? btnTitleDefaultColor: btnTitleSelectColor), for: .normal) 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