Commit 7eea12aa authored by Steven杜宇's avatar Steven杜宇

// 子女初始信息

parent 77813929
......@@ -25,6 +25,7 @@
042FBBC12B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */; };
042FBBC32B63DA4C00F9DE23 /* YHParentInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */; };
042FBBC52B64AE3D00F9DE23 /* YHFormItemOnlyDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC42B64AE3D00F9DE23 /* YHFormItemOnlyDoubleChoiceCell.swift */; };
042FBBC72B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBC62B64CFBF00F9DE23 /* YHChildInitialInfoVC.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 */; };
......@@ -187,6 +188,7 @@
042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDegreeInfoCell.swift; sourceTree = "<group>"; };
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHParentInfoVC.swift; sourceTree = "<group>"; };
042FBBC42B64AE3D00F9DE23 /* YHFormItemOnlyDoubleChoiceCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemOnlyDoubleChoiceCell.swift; sourceTree = "<group>"; };
042FBBC62B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChildInitialInfoVC.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>"; };
......@@ -377,6 +379,7 @@
042FBBBA2B62806D00F9DE23 /* YHCertificateViewController.swift */,
042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */,
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBC62B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -1177,6 +1180,7 @@
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */,
A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */,
042FBBBB2B62806D00F9DE23 /* YHCertificateViewController.swift in Sources */,
042FBBC72B64CFBF00F9DE23 /* YHChildInitialInfoVC.swift in Sources */,
A5ACE9562B4564F7002C94D2 /* YHBouncesContentView.swift in Sources */,
A5ACE9302B4564F7002C94D2 /* Algorithm.swift in Sources */,
A5C5B32B2B57D17600A7C5D1 /* YHDavidCell5.swift in Sources */,
......
//
// YHChildInitialInfoVC.swift
// galaxy
//
// Created by edy on 2024/1/27.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHChildInitialInfoVC: YHBaseViewController {
var child:YHChild?
lazy 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(YHFormItemQuestionCell.self, forCellReuseIdentifier: YHFormItemQuestionCell.cellReuseIdentifier)
tableView.register(YHFormItemSelectSheetCell.self, forCellReuseIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier)
return tableView
}()
lazy var submitBtn:UIButton = {
let btn = UIButton()
btn.setTitle("提交".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSCR(ofSize: 14)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor(hexString:"#4388FF")
btn.layer.cornerRadius = 8.0
btn.addTarget(self, action: #selector(didClickSubmitBtn), for: .touchUpInside)
return btn
}()
lazy var saveBtn:UIButton = {
let btn = UIButton()
btn.setTitle("保存", for: .normal)
btn.titleLabel?.font = UIFont.PFSCR(ofSize: 14)
btn.setTitleColor(UIColor(hexString:"#222222"), for: .normal)
btn.backgroundColor = UIColor(hexString:"#F8F9FB")
btn.layer.cornerRadius = 8.0
btn.addTarget(self, action: #selector(didClickSaveBtn), for: .touchUpInside)
return btn
}()
lazy var bottomView:UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(submitBtn)
view.addSubview(saveBtn)
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "子女信息填写".local
createUI()
loadSponseInfo()
}
func loadSponseInfo() {
guard let child = child else { return }
items.removeAll()
// 随行
let title0 = YHFormTitleItem(type: .accompany)
let item00 = YHFormDetailItem(type: .ownCustody)
let item01 = YHFormDetailItem(type: .birthday)
let item02 = YHFormDetailItem(type: .isAccompanyToHK)
item02.isAccompany = (child.follow == 1)
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02]
items.append(arr0)
if item02.isAccompany { // 随行才加后面的信息
// 国籍
let title1 = YHFormTitleItem(type: .country)
let item10 = YHFormDetailItem(type: .nationOrArea)
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
let title2 = YHFormTitleItem(type: .liveInfo)
let item20 = YHFormDetailItem(type: .isLiveTother)
item20.isLiveTogether = (child.finishFollow == 1)
let item21 = YHFormDetailItem(type: .nationOrArea)
let item22 = YHFormDetailItem(type: .liveCity)
let item23 = YHFormDetailItem(type: .detailAddress)
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23]
// 港澳通信证
let title3 = YHFormTitleItem(type: .hkAndMacaoPassport)
let item30 = YHFormDetailItem(type: .isHandleHKPassPort)
item30.isHandleHkPassport = (child.isHandled == 1)
let arr3:[YHFormItemProtocol] = [title3, item30]
items.append(contentsOf:[arr1, arr2, arr3])
}
tableView.reloadData()
}
func createUI() {
view.addSubview(tableView);
view.addSubview(bottomView)
let submitBtnHeight = 48.0
let gap = 8.0
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalTo(view)
make.height.equalTo(submitBtnHeight+gap*2+k_Height_safeAreaInsetsBottom())
}
saveBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.size.equalTo(CGSize(width: 86.0, height: 48.0))
make.top.equalTo(8)
}
submitBtn.snp.makeConstraints { make in
make.left.equalTo(saveBtn.snp.right).offset(10)
make.right.equalToSuperview().offset(-16)
make.height.equalTo(48)
make.centerY.equalTo(saveBtn)
}
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
}
}
@objc func didClickSubmitBtn() {
}
@objc func didClickSaveBtn() {
}
}
extension YHChildInitialInfoVC : 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
} else if item is YHFormDetailItem { // 具体信息
let detailItem = item as! YHFormDetailItem
if detailItem.type == .isAccompanyToHK || detailItem.type == .isHandleHKPassPort || detailItem.type == .isLiveTother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.title = detailItem.getTitle()
let answers = [YHFormChoiceItem(title: "是".local, isSelect: true),YHFormChoiceItem(title: "否".local, isSelect: false)]
cell.answerArr = answers
if detailItem.type == .isAccompanyToHK {
let answers =
[YHFormChoiceItem(title: "是".local, isSelect: detailItem.isAccompany),
YHFormChoiceItem(title: "否".local, isSelect: !detailItem.isAccompany)]
cell.answerArr = answers
} else if detailItem.type == .isHandleHKPassPort {
let answers =
[YHFormChoiceItem(title: "是".local, isSelect: detailItem.isHandleHkPassport),
YHFormChoiceItem(title: "否".local, isSelect: !detailItem.isHandleHkPassport)]
cell.answerArr = answers
} else if detailItem.type == .isLiveTother {
let answers =
[YHFormChoiceItem(title: "是".local, isSelect: detailItem.isLiveTogether),
YHFormChoiceItem(title: "否".local, isSelect: !detailItem.isLiveTogether)]
cell.answerArr = answers
}
cell.answerBlock = {
[weak self] (arr, selectIndex) in
let selectItem:YHFormChoiceItem = arr[selectIndex]
if detailItem.type == .isAccompanyToHK { // 是否随行
let follow = (selectItem.title == "是".local ? 1 : 0)
self?.child?.follow = follow
self?.loadSponseInfo()
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
let handlePassport = (selectItem.title == "是".local ? 1 : 0)
self?.child?.isHandled = handlePassport
self?.loadSponseInfo()
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
let isLiveTother = (selectItem.title == "是".local ? 1 : 0)
self?.child?.finishFollow = (selectItem.title == "是".local ? 1 : 0)
self?.loadSponseInfo()
}
}
return cell
} else if detailItem.type == .nationOrArea || detailItem.type == .nationOrArea || detailItem.type == .liveCity || detailItem.type == .detailAddress || detailItem.type == .birthday {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
return cell
} else if detailItem.type == .ownCustody {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemQuestionCell.cellReuseIdentifier, for: indexPath) as! YHFormItemQuestionCell
cell.title = 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 {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .isLiveTother ||
detailItem.type == .isAccompanyToHK ||
detailItem.type == .isHandleHKPassPort ||
detailItem.type == .ownCustody
{
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) {
let vc = YHCertificateViewController()
self.navigationController?.pushViewController(vc)
}
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
}
}
}
......@@ -662,6 +662,15 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
self.navigationController?.pushViewController(vc)
return
}
// 子女
if item is YHChild {
let child = item as! YHChild
let vc = YHChildInitialInfoVC()
vc.child = child
self.navigationController?.pushViewController(vc)
return
}
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
......
......@@ -137,6 +137,8 @@ enum YHFormDetailItemType:Int {
case liveNationOrArea = 31
// 仅有两个按钮 标题数组有外部提供
case onlyDoubleChoice = 32
// 主申请人和现配偶是否拥有孩子抚养权
case ownCustody = 33
}
......@@ -372,6 +374,8 @@ class YHFormDetailItem : YHFormItemProtocol {
return "婚姻状况".local
case .liveNationOrArea:
return "现居住国家/地区".local
case .ownCustody:
return "主申请人和现配偶是否拥有孩子抚养权".local
case .onlyDoubleChoice:
return "".local
......
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