Commit 2b6fb829 authored by Steven杜宇's avatar Steven杜宇

// 家庭成员信息

parent da66c041
......@@ -658,8 +658,8 @@
041B52962B5E8E3B007EBCEB /* C */ = {
isa = PBXGroup;
children = (
04C8F4812B720DCD00ADF59B /* Child(子女) */,
04C8F4802B720DAB00ADF59B /* Spouse(配偶) */,
04C8F4812B720DCD00ADF59B /* Child(子女) */,
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
......
......@@ -53,10 +53,10 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(topHeight)
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-bottomHeight)
make.height.equalTo(KScreenHeight-topHeight-bottomHeight)
}
}
......
......@@ -29,13 +29,28 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
}
var stepVCs:[YHFaimilyStepItem] = []
var currentStep = 0 {
didSet {
var _currentStep = 0
var currentStep:Int {
get {
return _currentStep
}
set {
if let child = child, !child.isFollow(), newValue > 0 {
_currentStep = 3
} else {
_currentStep = newValue
}
let index = getArrayIndexOfCurrentStep()
if let index = index {
stepView.currentIndex = index
bottomView.changeRightBtnTitle(index == stepVCs.count-1 ? "提交".local : "下一步".local)
}
for vcItem in stepVCs {
vcItem.vc.view.isHidden = (vcItem.step != currentStep)
if vcItem.step == currentStep {
......@@ -54,7 +69,10 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}()
var bottomView: YHSaveAndSubmitView = {
return YHSaveAndSubmitView.createView()
let view = YHSaveAndSubmitView.createView()
view.changeRightBtnTitle("下一步")
return view
}()
let primaryInfoVC = YHChildPrimaryInfoVC()
......@@ -79,7 +97,8 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
updateStepView()
print("step:\(child.step)")
currentStep = child.step
stepView.maxIndex = child.step
stepView.maxIndex = getArrayIndexOfCurrentStep() ?? stepVCs.count-1
view.addSubview(stepView)
view.addSubview(bottomView)
......@@ -116,6 +135,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
for vc in self.children {
vc.willMove(toParent: nil)
vc.removeFromParent()
vc.view.removeFromSuperview()
}
print(self.children)
......@@ -135,6 +155,9 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
var titles:[String] = []
for vcItem in stepVCs {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
vcItem.vc.view.frame = CGRectMake(0, topHeight, KScreenWidth, KScreenHeight-topHeight-bottomHeight)
self.addChild(vcItem.vc)
self.view.addSubview(vcItem.vc.view)
titles.append(vcItem.title)
......@@ -173,6 +196,8 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
child?.step = item.step
stepView.maxIndex = cur+1
}
print("currentIndex:\(currentStep)")
}
......
......@@ -119,10 +119,10 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(topHeight)
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-bottomHeight)
make.height.equalTo(KScreenHeight-topHeight-bottomHeight)
}
}
......
......@@ -69,10 +69,10 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(topHeight)
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-bottomHeight)
make.height.equalTo(KScreenHeight-topHeight-bottomHeight)
}
}
......
......@@ -49,13 +49,25 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
}
}
var currentStep = 0 {
didSet {
var _currentStep = 0
var currentStep:Int {
get {
return _currentStep
}
set {
if let spouse = spouse, !spouse.isFollow(), newValue > 0 {
_currentStep = 3
} else {
_currentStep = newValue
}
let index = getArrayIndexOfCurrentStep()
if let index = index {
stepView.currentIndex = index
bottomView.changeRightBtnTitle(index == stepVCs.count-1 ? "提交".local : "下一步".local)
}
for vcItem in stepVCs {
vcItem.vc.view.isHidden = (vcItem.step != currentStep)
......@@ -105,7 +117,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
updateStepView()
print("step:\(spouse.step)")
currentStep = spouse.step
stepView.maxIndex = spouse.step
stepView.maxIndex = getArrayIndexOfCurrentStep() ?? stepVCs.count-1
bottomView.submitBlock = {
[weak self] in
......@@ -139,6 +151,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
for vc in self.children {
vc.willMove(toParent: nil)
vc.removeFromParent()
vc.view.removeFromSuperview()
}
print(self.children)
......@@ -158,6 +171,9 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
var titles:[String] = []
for vcItem in stepVCs {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
vcItem.vc.view.frame = CGRectMake(0, topHeight, KScreenWidth, KScreenHeight-topHeight-bottomHeight)
self.addChild(vcItem.vc)
self.view.addSubview(vcItem.vc.view)
titles.append(vcItem.title)
......@@ -229,6 +245,8 @@ extension YHSpouseInfoContainerVC {
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
spouse?.step = item.step
stepView.maxIndex = cur+1
}
print("currentIndex:\(currentStep)")
}
......
......@@ -24,6 +24,8 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 52.0
tableView.estimatedSectionHeaderHeight = 14.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
......@@ -122,10 +124,10 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(topHeight)
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-bottomHeight)
make.height.equalTo(KScreenHeight-topHeight-bottomHeight)
}
}
}
......
......@@ -54,10 +54,10 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(topHeight)
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-bottomHeight)
make.height.equalTo(KScreenHeight-topHeight-bottomHeight)
}
guard let familyMember = familyMember else { return }
......
......@@ -22,7 +22,7 @@ class YHCertificateUploadVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
view.backgroundColor = UIColor(hexString:"#F8F8F8")
createUI()
}
......@@ -49,10 +49,14 @@ class YHCertificateUploadVC: YHBaseViewController, YHFamilyMemberProtol {
return tableView
}()
view.addSubview(tableView)
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + YHStepView.height)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.bottom.equalTo(view)
make.top.equalToSuperview()
make.left.equalToSuperview()
make.right.equalToSuperview()
make.height.equalTo(KScreenHeight-topHeight-bottomHeight)
}
}
}
......
......@@ -491,10 +491,6 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let arr = items[indexPath.section]
let item:YHFormItemProtocol = arr[indexPath.row]
return UITableView.automaticDimension
}
......
......@@ -28,6 +28,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
private let btnWidth = 70.0
private let btnHeight = 32.0
private let titleFont = UIFont.PFSC_R(ofSize: 14)
private let btnTitleSelectColor = UIColor.brandMainColor
private let btnTitleDefaultColor = UIColor.mainTextColor
private let btnBgDefaultColor = UIColor.contentBkgColor
......@@ -41,12 +42,13 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
var title:String? {
didSet {
var titleStr = ""
if let title = title, !title.isEmpty {
let str = (isMust ? ("*"+title) : title)
let titleStr = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let questionAttrStr = NSMutableAttributedString(string: titleStr, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
......@@ -165,13 +167,10 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
contentView.addSubview(tipsLabel)
contentView.addSubview(topLine)
titleLabel.snp.makeConstraints { make in
make.top.equalTo(contentView.snp.top).offset(16)
make.left.equalToSuperview().offset(horizonalGap)
make.height.greaterThanOrEqualTo(btnHeight)
make.right.equalTo(answer1Btn.snp.left).offset(-8)
}
answer1Btn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: btnWidth, height: btnHeight))
......@@ -191,6 +190,13 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
make.height.equalTo(1.0)
make.top.equalToSuperview()
}
tipsLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.top.equalTo(titleLabel.snp.bottom)
make.height.equalTo(0)
make.bottom.equalToSuperview().offset(-16)
}
setTips("", isShow: false)
}
......@@ -198,21 +204,16 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
func setTips(_ tips:String?, isShow:Bool) {
tipsLabel.text = tips
tipsLabel.isHidden = !isShow
if isShow {
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.top.equalTo(titleLabel.snp.bottom)
make.bottom.equalToSuperview().offset(-16)
}
} else {
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.top.equalTo(titleLabel.snp.bottom)
make.height.equalTo(0)
make.bottom.equalToSuperview().offset(-16)
}
var tipsHeight = 0.0
if let tips = tips, tips.count > 0 {
var bounds = CGRect()
let maxWidth = KScreenWidth-16*2-horizonalGap*2
bounds = NSString(string:tips).boundingRect(with: CGSize(width:maxWidth, height: .greatestFiniteMagnitude), options: [.usesLineFragmentOrigin], attributes: [.font : titleFont], context: nil)
tipsHeight = ceill(bounds.size.height)
}
tipsLabel.snp.updateConstraints { make in
make.height.equalTo(tipsHeight)
}
self.setNeedsLayout()
self.layoutIfNeeded()
......
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