Commit 6a1e4b75 authored by Steven杜宇's avatar Steven杜宇

// 子女信息

parent 6160004a
This diff is collapsed.
......@@ -11,8 +11,7 @@ import UIKit
class YHChildBasicInfoVC: YHBaseViewController {
var child:YHFamilyMember?
var cardInfo: YHCNIdentityCard?
weak var delegate:YHSpouseInfoVCProtocol?
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -23,6 +22,8 @@ class YHChildBasicInfoVC: YHBaseViewController {
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.estimatedSectionHeaderHeight = 14.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
......@@ -49,11 +50,13 @@ class YHChildBasicInfoVC: YHBaseViewController {
func createUI() {
view.addSubview(tableView);
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-100)
make.top.equalToSuperview().offset(topHeight)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-bottomHeight)
}
}
......@@ -247,12 +250,19 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
return 52.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 14.0
}
......
//
// YHChildInfoContainerVC.swift
// galaxy
//
// Created by edy on 2024/2/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
//@objc protocol YHchildInfoVCProtocol {
//
// @objc optional func updateStepView()
// @objc optional func saveInfo()
//}
class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
var orderId:Int = 0
var child:YHFamilyMember? {
didSet {
initalInfoVC.child = child
certificateVC.familyMember = child
basicInfoVC.child = child
}
}
var currentIndex = 0 {
didSet {
currentIndex %= self.children.count
stepView.currentIndex = currentIndex
for (i, vc) in self.children.enumerated() {
vc.view.isHidden = (currentIndex != i)
if currentIndex == i {
}
}
}
}
var stepView:YHStepView = {
let step = YHStepView()
return step
}()
var bottomView: YHSaveAndSubmitView = {
return YHSaveAndSubmitView.createView()
}()
let initalInfoVC = YHChildPrimaryInfoVC()
let uploadVC = UIViewController()
let certificateVC = YHCertificateInfoController()
let basicInfoVC = YHChildBasicInfoVC()
override func viewDidLoad() {
super.viewDidLoad()
createUI()
}
func createUI() {
guard child != nil else { return }
initalInfoVC.delegate = self
certificateVC.delegate = self
basicInfoVC.delegate = self
updateStepView()
currentIndex = 0
view.addSubview(stepView)
view.addSubview(bottomView)
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
self.didClickSubmitBtn()
}
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
self.saveInfo()
}
stepView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.height.equalTo(YHStepView.height)
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.height.equalTo(YHSaveAndSubmitView.height)
}
}
func didClickSubmitBtn() {
currentIndex += 1;
}
func updateStepView() {
guard let child = child else { return }
for vc in self.children {
vc.willMove(toParent: nil)
vc.removeFromParent()
}
if child.isFollow() {
self.addChild(initalInfoVC)
self.addChild(uploadVC)
self.addChild(certificateVC)
self.addChild(basicInfoVC)
self.view.addSubview(basicInfoVC.view)
self.view.addSubview(certificateVC.view)
self.view.addSubview(uploadVC.view)
self.view.addSubview(initalInfoVC.view)
stepView.dataSource = ["初始信息".local, "证件上传".local, "证件信息".local, "基本信息".local]
stepView.block = {[weak self] (index) in
guard let self = self else { return }
print("follow:%d", self.orderId)
}
} else {
self.addChild(initalInfoVC)
self.addChild(basicInfoVC)
self.view.addSubview(basicInfoVC.view)
self.view.addSubview(initalInfoVC.view)
stepView.dataSource = ["初始信息".local, "基本信息".local]
stepView.block = {[weak self] (index) in
guard let self = self else { return }
print("follow:%d", self.orderId)
}
}
self.view.bringSubviewToFront(stepView)
self.view.bringSubviewToFront(bottomView)
}
}
extension YHChildInfoContainerVC {
func saveInfo() {
guard let child = child else { return }
guard let info = child.toDictionary() else { return }
let dict:[String: Any] = ["orderId":child.orderId,
"relation":child.relationType.rawValue,
"step":child.step,
"next":false,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { [weak self] success, error in
guard let self = self else { return }
if success {
}
}
}
}
......@@ -456,7 +456,7 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
// 子女
if detailItem.relationType == .child {
let vc = YHChildInitialInfoVC()
let vc = YHChildInfoContainerVC()
vc.child = detailItem
self.navigationController?.pushViewController(vc)
return
......
......@@ -51,7 +51,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
return YHSaveAndSubmitView.createView()
}()
let initalInfoVC = YHSpouseInitialInfoVC()
let initalInfoVC = YHSpousePrimaryInfoVC()
let uploadVC = UIViewController()
let certificateVC = YHCertificateInfoController()
let basicInfoVC = YHSpouseBasicInfoVC()
......@@ -157,22 +157,11 @@ extension YHSpouseInfoContainerVC {
func saveInfo() {
guard let spouse = spouse else { return }
guard var info = spouse.toDictionary() else { return }
// let certi = [ "cnIdentityCard":
// ["id":116871,"number":"421087199005010811","issue_at":"深圳","issue_date_start_at":"2017-01-01","issue_date_end_at":"2029-01-01","img_front":"","img_back":""],
// "passport":["id":116872,"number":"421087199005010811","issue_at":"深圳","issue_date_start_at":"2020-01-01","issue_date_end_at":"2023-01-01","img_front":"","img_back":"","passport_type":3],
// "hkMacaoPass":["id":118182,"number":"P103265(1)","issue_at":"SFAA","issue_date_start_at":"2024-01-31","issue_date_end_at":"2024-01-31","img_front":"","img_back":""]
// ]
//
// if let cer = info["certificates"] {
// info["certificates"] = certi
// }
let cer = info["certificates"]
let dict:[String: Any] = ["orderId":self.orderId,
guard let info = spouse.toDictionary() else { return }
let dict:[String: Any] = ["orderId":spouse.orderId,
"relation":spouse.relationType.rawValue,
"step":0,
"step":spouse.step,
"next":false,
"info":info]
......
......@@ -9,7 +9,7 @@
import UIKit
import SmartCodable
class YHSpouseInitialInfoVC: YHBaseViewController {
class YHSpousePrimaryInfoVC: YHBaseViewController {
var spouse:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
......@@ -141,7 +141,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
}
extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
......
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