Commit 70009ba4 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '2d5acb60' into xiezhaolin

parents df3949cc 2d5acb60
...@@ -55,9 +55,6 @@ extension YHBasicInfoFillViewController { ...@@ -55,9 +55,6 @@ extension YHBasicInfoFillViewController {
bottomView.block = { tag in bottomView.block = { tag in
if tag == 0 { if tag == 0 {
//点击了保存按钮 //点击了保存按钮
// let arr = self.basicInfoVM.arrBasicInfoSessionDataForEdit
// printLog(arr)
printLog("点击了保存按钮") printLog("点击了保存按钮")
self.saveData() self.saveData()
} else { } else {
...@@ -97,12 +94,36 @@ extension YHBasicInfoFillViewController { ...@@ -97,12 +94,36 @@ extension YHBasicInfoFillViewController {
private func saveData() { private func saveData() {
//保存
submitAndSaveDataOp(isSaveFlag: true) submitAndSaveDataOp(isSaveFlag: true)
} }
private func submitData() { private func submitData() {
//提交 //提交
submitAndSaveDataOp(isSaveFlag: false) //1.校验
if dataIsOK() == true {
//提交数据
submitAndSaveDataOp(isSaveFlag: false)
} else {
homeTableView.reloadData()
YHHUD.flash(message: "请完善信息")
}
}
//检查数据是否合法
private func dataIsOK() -> Bool {
var returnValue : Bool = true
let arr = basicInfoVM.arrBasicInfoSessionDataForEdit
for item in arr {
for (_,item0) in item.arrQuestionItem.enumerated() {
if (item0.answer == "Y" && item0.info.count < 1) || item0.answer == "" {
item0.needCheckFlag = true
returnValue = returnValue && false
}
}
}
return returnValue
} }
private func submitAndSaveDataOp(isSaveFlag : Bool) { private func submitAndSaveDataOp(isSaveFlag : Bool) {
...@@ -164,7 +185,6 @@ extension YHBasicInfoFillViewController { ...@@ -164,7 +185,6 @@ extension YHBasicInfoFillViewController {
arr = tArr arr = tArr
} }
var applicant : [String : Any] = [:] var applicant : [String : Any] = [:]
for (index0,item0) in item.arrQuestionItem.enumerated() { for (index0,item0) in item.arrQuestionItem.enumerated() {
if index0 == 0 { if index0 == 0 {
...@@ -182,7 +202,6 @@ extension YHBasicInfoFillViewController { ...@@ -182,7 +202,6 @@ extension YHBasicInfoFillViewController {
applicant.updateValue(item.model?.subset_name ?? "", forKey: "subset_name") applicant.updateValue(item.model?.subset_name ?? "", forKey: "subset_name")
arr.append(applicant) arr.append(applicant)
param.updateValue(arr, forKey: "child") param.updateValue(arr, forKey: "child")
} else if item.sessionTitle == "家庭背景" { } else if item.sessionTitle == "家庭背景" {
var applicant : [String : Any] = [:] var applicant : [String : Any] = [:]
...@@ -194,8 +213,6 @@ extension YHBasicInfoFillViewController { ...@@ -194,8 +213,6 @@ extension YHBasicInfoFillViewController {
printLog("其他数据没有处理") printLog("其他数据没有处理")
} }
} }
applicant.updateValue(basicInfoVM.dataModelForBasicInfo?.spouse?.id ?? 0, forKey: "id")
applicant.updateValue(basicInfoVM.dataModelForBasicInfo?.spouse?.subset_name ?? 0, forKey: "subset_name")
param.updateValue(applicant, forKey: "background") param.updateValue(applicant, forKey: "background")
} else { } else {
...@@ -204,9 +221,15 @@ extension YHBasicInfoFillViewController { ...@@ -204,9 +221,15 @@ extension YHBasicInfoFillViewController {
printLog(param) printLog(param)
basicInfoVM.saveBasicInfo(params: param) { success, error in self.basicInfoVM.saveBasicInfo(params: param) {[weak self] success, error in
if success == true { if success == true {
YHHUD.flash(message: "操作成功") YHHUD.flash(message: "操作成功")
if isSaveFlag == false {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
self?.navigationController?.popViewController(animated: true)
}
}
} else { } else {
let msg = error?.errorMsg ?? "操作失败" let msg = error?.errorMsg ?? "操作失败"
YHHUD.flash(message: msg) YHHUD.flash(message: msg)
......
...@@ -13,12 +13,16 @@ class YHBasicInfoCellModel { ...@@ -13,12 +13,16 @@ class YHBasicInfoCellModel {
var answer : String = "" var answer : String = ""
var info : String = "" var info : String = ""
var needCheckFlag : Bool = false
var model : backgroundModel? var model : backgroundModel?
var type : Int = 0 //0- 输入型 1-选择型 var type : Int = 0 //0- 输入型 1-选择型
init(question: String, answer: String, info: String, type : Int = 0) { init(question: String, answer: String, info: String, type : Int = 0, needCheckFlag : Bool = false) {
self.question = question self.question = question
self.answer = answer self.answer = answer
self.info = info self.info = info
self.type = type self.type = type
self.needCheckFlag = needCheckFlag
} }
} }
...@@ -133,6 +133,22 @@ class YHBasicInfoFillView: UIView, UITextViewDelegate { ...@@ -133,6 +133,22 @@ class YHBasicInfoFillView: UIView, UITextViewDelegate {
private var arrCheckBtns : [UIButton] = [] private var arrCheckBtns : [UIButton] = []
private let kTipsString : String = "如选择“是”,请详细说明" private let kTipsString : String = "如选择“是”,请详细说明"
private lazy var noChoiceTipsLable: UILabel = {
let label = UILabel()
label.textColor = .failColor
label.font = UIFont.PFSC_R(ofSize: 12)
label.text = "请选择"
return label
}()
private lazy var noTextTipsLable: UILabel = {
let label = UILabel()
label.textColor = .failColor
label.font = UIFont.PFSC_R(ofSize: 12)
label.text = "请补充详细说明"
return label
}()
} }
...@@ -201,6 +217,22 @@ private extension YHBasicInfoFillView { ...@@ -201,6 +217,22 @@ private extension YHBasicInfoFillView {
mutilChoiceHoldView.snp.makeConstraints { make in mutilChoiceHoldView.snp.makeConstraints { make in
make.edges.equalTo(0) make.edges.equalTo(0)
} }
addSubview(noChoiceTipsLable)
noChoiceTipsLable.isHidden = true
noChoiceTipsLable.snp.makeConstraints { make in
make.top.right.left.equalToSuperview()
make.height.equalTo(20)
}
addSubview(noTextTipsLable)
noTextTipsLable.isHidden = true
noTextTipsLable.snp.makeConstraints { make in
make.top.right.left.equalToSuperview()
make.height.equalTo(20)
}
} }
@objc func didClickResponseBtn(btn: UIButton) { @objc func didClickResponseBtn(btn: UIButton) {
...@@ -215,66 +247,15 @@ private extension YHBasicInfoFillView { ...@@ -215,66 +247,15 @@ private extension YHBasicInfoFillView {
btn.isSelected = true btn.isSelected = true
updateAnswerButton(btn, true) updateAnswerButton(btn, true)
if btn == answer1Btn { if btn == answer1Btn {
answer2Btn.isSelected = false answer2Btn.isSelected = false
updateAnswerButton(answer2Btn, false) updateAnswerButton(answer2Btn, false)
additionHoldView.snp.removeConstraints()
mutilChoiceHoldView.snp.removeConstraints()
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
additionHoldView.isHidden = true
bottomLine.isHidden = false
mutilChoiceHoldView.isHidden = true
model?.answer = "N" model?.answer = "N"
layoutForNO()
} else { } else {
answer1Btn.isSelected = false answer1Btn.isSelected = false
updateAnswerButton(answer1Btn, false) updateAnswerButton(answer1Btn, false)
bottomLine.snp.removeConstraints() layoutForYES()
if model?.type == 0 {
additionHoldView.snp.removeConstraints()
additionHoldView.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(78)
make.bottom.equalToSuperview().offset(-18)
}
model?.answer = "Y"
additionHoldView.isHidden = false
bottomLine.isHidden = true
mutilChoiceHoldView.isHidden = true
} else {
mutilChoiceHoldView.snp.removeConstraints()
mutilChoiceHoldView.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-18)
}
model?.answer = "Y"
additionHoldView.isHidden = true
bottomLine.isHidden = true
mutilChoiceHoldView.isHidden = false
}
} }
...@@ -326,27 +307,12 @@ private extension YHBasicInfoFillView { ...@@ -326,27 +307,12 @@ private extension YHBasicInfoFillView {
title = model.question title = model.question
if model.answer == "Y" { if model.answer == "Y" {
didClickResponseBtn(btn: answer2Btn) didClickResponseBtn(btn: answer2Btn)
mutilChoiceHoldView.isHidden = false
} else { } else {
if model.answer == "N" { if model.answer == "N" {
didClickResponseBtn(btn: answer1Btn) didClickResponseBtn(btn: answer1Btn)
} else { } else {
answer2Btn.isSelected = false layoutForMakeNoChoice()
updateAnswerButton(answer2Btn, false)
additionHoldView.snp.removeConstraints()
mutilChoiceHoldView.snp.removeConstraints()
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
additionHoldView.isHidden = true
bottomLine.isHidden = false
mutilChoiceHoldView.isHidden = true
} }
} }
return return
...@@ -365,8 +331,8 @@ private extension YHBasicInfoFillView { ...@@ -365,8 +331,8 @@ private extension YHBasicInfoFillView {
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14) btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(UIColor.mainTextColor, for: .normal) btn.setTitleColor(UIColor.mainTextColor, for: .normal)
btn.setTitleColor(UIColor.brandMainColor, for: .selected) btn.setTitleColor(UIColor.brandMainColor, for: .selected)
btn.setImage(UIImage(named: "basic_info_check_0"), for: .normal) btn.setImage(UIImage(named: "basic_info_radio_0"), for: .normal)
btn.setImage(UIImage(named: "basic_info_check_1"), for: .selected) btn.setImage(UIImage(named: "basic_info_radio_1"), for: .selected)
btn.iconInLeft(spacing: 6) btn.iconInLeft(spacing: 6)
btn.tag = item.id btn.tag = item.id
btn.addTarget(self, action: #selector(clickCheckBtn(sender:)), for: .touchUpInside) btn.addTarget(self, action: #selector(clickCheckBtn(sender:)), for: .touchUpInside)
...@@ -405,40 +371,26 @@ private extension YHBasicInfoFillView { ...@@ -405,40 +371,26 @@ private extension YHBasicInfoFillView {
title = model.question title = model.question
if model.answer == "Y" { if model.answer == "Y" {
didClickResponseBtn(btn: answer2Btn) didClickResponseBtn(btn: answer2Btn)
mutilChoiceHoldView.isHidden = false
} else { } else {
if model.answer == "N" { if model.answer == "N" {
didClickResponseBtn(btn: answer1Btn) didClickResponseBtn(btn: answer1Btn)
} else { } else {
answer2Btn.isSelected = false layoutForMakeNoChoice()
updateAnswerButton(answer2Btn, false)
additionHoldView.snp.removeConstraints()
mutilChoiceHoldView.snp.removeConstraints()
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
additionHoldView.isHidden = true
bottomLine.isHidden = false
mutilChoiceHoldView.isHidden = true
} }
} }
} else { }
additionHoldView.isHidden = false else {
mutilChoiceHoldView.isHidden = true
title = model.question title = model.question
if model.answer == "Y" { if model.answer == "Y" {
didClickResponseBtn(btn: answer2Btn)
myTextView.text = model.info.count > 0 ? model.info : kTipsString myTextView.text = model.info.count > 0 ? model.info : kTipsString
didClickResponseBtn(btn: answer2Btn)
} else { } else {
if model.answer == "N" { if model.answer == "N" {
didClickResponseBtn(btn: answer1Btn) didClickResponseBtn(btn: answer1Btn)
} else {
//没有做选择的情况下
layoutForMakeNoChoice()
} }
} }
} }
...@@ -474,6 +426,15 @@ extension YHBasicInfoFillView : UITextFieldDelegate { ...@@ -474,6 +426,15 @@ extension YHBasicInfoFillView : UITextFieldDelegate {
} }
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if !text.isEmpty {
if textView.text.count > 999 {
return false
}
}
return true
}
...@@ -485,6 +446,7 @@ extension YHBasicInfoFillView : UITextFieldDelegate { ...@@ -485,6 +446,7 @@ extension YHBasicInfoFillView : UITextFieldDelegate {
} }
textView.textColor = UIColor.mainTextColor textView.textColor = UIColor.mainTextColor
layoutForYES()
} }
...@@ -498,6 +460,231 @@ extension YHBasicInfoFillView : UITextFieldDelegate { ...@@ -498,6 +460,231 @@ extension YHBasicInfoFillView : UITextFieldDelegate {
sender.isSelected = true sender.isSelected = true
model?.info = String(sender.tag) model?.info = String(sender.tag)
} }
layoutForYES()
}
}
//各种情况下的布局
private extension YHBasicInfoFillView {
//选择 是 的布局
func layoutForYES() {
guard let model = model else {
printLog("error : 有问题 需要处理。。。。")
return
}
model.answer = "Y"
additionHoldView.isHidden = true
bottomLine.isHidden = true
mutilChoiceHoldView.isHidden = true
noChoiceTipsLable.isHidden = true
noTextTipsLable.isHidden = true
additionHoldView.snp.removeConstraints()
bottomLine.snp.removeConstraints()
mutilChoiceHoldView.snp.removeConstraints()
noChoiceTipsLable.snp.removeConstraints()
additionHoldView.snp.removeConstraints()
noTextTipsLable.snp.removeConstraints()
if model.needCheckFlag == false {
//不需要展示 提示的情况
if model.type == 0 {
additionHoldView.isHidden = false
bottomLine.isHidden = false
additionHoldView.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(78)
}
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(additionHoldView.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
} else {
bottomLine.isHidden = false
mutilChoiceHoldView.isHidden = false
mutilChoiceHoldView.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
}
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(mutilChoiceHoldView.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
}
}
else {
//需要展示提示的情况
if model.type == 0 {
additionHoldView.isHidden = false
bottomLine.isHidden = false
additionHoldView.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(78)
}
if model.info.count < 1 {
noTextTipsLable.isHidden = false
noTextTipsLable.snp.remakeConstraints { make in
make.top.equalTo(additionHoldView.snp.bottom).offset(6)
make.left.right.equalToSuperview()
make.height.equalTo(20)
}
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(noTextTipsLable.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
} else {
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(additionHoldView.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
}
} else {
mutilChoiceHoldView.isHidden = false
bottomLine.isHidden = false
mutilChoiceHoldView.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
}
if model.info.count < 1 {
noChoiceTipsLable.isHidden = false
noChoiceTipsLable.snp.remakeConstraints { make in
make.top.equalTo(mutilChoiceHoldView.snp.bottom).offset(6)
make.left.right.equalToSuperview()
make.height.equalTo(20)
}
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(noChoiceTipsLable.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
} else {
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(mutilChoiceHoldView.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
}
}
}
}
//选择 否 的布局
func layoutForNO() {
guard model != nil else {
printLog("error : 有问题 需要处理。。。。")
return
}
//隐藏提示
bottomLine.isHidden = false
noChoiceTipsLable.isHidden = true
additionHoldView.isHidden = true
mutilChoiceHoldView.isHidden = true
noTextTipsLable.isHidden = true
additionHoldView.snp.removeConstraints()
mutilChoiceHoldView.snp.removeConstraints()
noChoiceTipsLable.snp.removeConstraints()
noTextTipsLable.snp.removeConstraints()
bottomLine.snp.removeConstraints()
bottomLine.snp.makeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
}
//没有选择 是和否的情况
func layoutForMakeNoChoice() {
guard let model = model else {
printLog("error : 有问题 需要处理。。。。")
return
}
if model.needCheckFlag == true {
//展示提示
bottomLine.isHidden = false
noChoiceTipsLable.isHidden = false
additionHoldView.isHidden = true
mutilChoiceHoldView.isHidden = true
noTextTipsLable.isHidden = true
additionHoldView.snp.removeConstraints()
mutilChoiceHoldView.snp.removeConstraints()
noChoiceTipsLable.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(18)
make.left.right.equalToSuperview()
make.height.equalTo(20)
}
bottomLine.snp.removeConstraints()
bottomLine.snp.makeConstraints { make in
make.top.equalTo(noChoiceTipsLable.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
} else {
//隐藏提示
bottomLine.isHidden = false
noChoiceTipsLable.isHidden = true
additionHoldView.isHidden = true
mutilChoiceHoldView.isHidden = true
noTextTipsLable.isHidden = true
additionHoldView.snp.removeConstraints()
mutilChoiceHoldView.snp.removeConstraints()
noChoiceTipsLable.snp.removeConstraints()
bottomLine.snp.removeConstraints()
bottomLine.snp.makeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
}
} }
} }
...@@ -99,12 +99,15 @@ extension YHBasicInfoFillViewModel { ...@@ -99,12 +99,15 @@ extension YHBasicInfoFillViewModel {
do { do {
//配偶 //配偶
let model1 = YHBasicInfoCellModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: dataModelForBasicInfo.spouse?.child_departure?.has ?? "", info: dataModelForBasicInfo.spouse?.child_departure?.info ?? "")
let model2 = YHBasicInfoCellModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: dataModelForBasicInfo.spouse?.child_deny?.has ?? "", info: dataModelForBasicInfo.spouse?.child_deny?.info ?? "")
let arr = [model1,model2]
let sessionModel = YHBasicInfoSessionModel(sessionTitle: "配偶", arrQuestionItem: arr) if let spouse = dataModelForBasicInfo.spouse {
arrData.append(sessionModel) let model1 = YHBasicInfoCellModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: spouse.child_departure?.has ?? "", info: spouse.child_departure?.info ?? "")
let model2 = YHBasicInfoCellModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: spouse.child_deny?.has ?? "", info: spouse.child_deny?.info ?? "")
let arr = [model1,model2]
let sessionModel = YHBasicInfoSessionModel(sessionTitle: "配偶", arrQuestionItem: arr)
arrData.append(sessionModel)
}
} }
...@@ -128,11 +131,14 @@ extension YHBasicInfoFillViewModel { ...@@ -128,11 +131,14 @@ extension YHBasicInfoFillViewModel {
do { do {
//家庭背景 //家庭背景
let model1 = YHBasicInfoCellModel(question:"1、至少一名直系家庭成员(已婚配偶、父母、兄弟姊妹、子女)是现居于香港的香港永久性居民", answer: dataModelForBasicInfo.background?.background_member?.has ?? "", info: dataModelForBasicInfo.background?.background_member?.info ?? "",type: 1) if let model = dataModelForBasicInfo.background {
model1.model = dataModelForBasicInfo.background let model1 = YHBasicInfoCellModel(question:"1、至少一名直系家庭成员(已婚配偶、父母、兄弟姊妹、子女)是现居于香港的香港永久性居民", answer: model.background_member?.has ?? "", info: model.background_member?.info ?? "",type: 1)
let arr = [model1] model1.model = model
let sessionModel = YHBasicInfoSessionModel(sessionTitle: "家庭背景", arrQuestionItem: arr) let arr = [model1]
arrData.append(sessionModel) let sessionModel = YHBasicInfoSessionModel(sessionTitle: "家庭背景", arrQuestionItem: arr)
arrData.append(sessionModel)
}
} }
arrBasicInfoSessionDataForEdit = arrData arrBasicInfoSessionDataForEdit = arrData
...@@ -142,8 +148,8 @@ extension YHBasicInfoFillViewModel { ...@@ -142,8 +148,8 @@ extension YHBasicInfoFillViewModel {
extension YHBasicInfoFillViewModel { extension YHBasicInfoFillViewModel {
//获取基本资料信息 //获取基本资料信息
func getBasicInfo( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func getBasicInfo( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
// createOrgBasiceInfoData() // createOrgBasiceInfoData()
// callBackBlock(true,nil)//先返回数据 让界面展示相关的UI // callBackBlock(true,nil)//先返回数据 让界面展示相关的UI
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Basics.basicInfoApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Basics.basicInfoApi
...@@ -177,8 +183,6 @@ extension YHBasicInfoFillViewModel { ...@@ -177,8 +183,6 @@ extension YHBasicInfoFillViewModel {
//保存基本资料信息 //保存基本资料信息
func saveBasicInfo( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func saveBasicInfo( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Basics.updateBasicInfoApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Basics.updateBasicInfoApi
// let strUrl = "http://192.168.25.21:10087/" + "infoflow/basics/update_basics"
let _ = YHNetRequest.postRequest(url: strUrl,params: params) { [weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象 //1. json字符串 转 对象
guard self != nil else { return } guard self != nil else { return }
......
...@@ -137,6 +137,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -137,6 +137,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
guard let self = self else { return } guard let self = self else { return }
if let targetStep = getStepForArrayIndex(index) { if let targetStep = getStepForArrayIndex(index) {
currentStep = targetStep currentStep = targetStep
child.step = targetStep
} }
print("index:\(index)") print("index:\(index)")
} }
......
...@@ -66,7 +66,9 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -66,7 +66,9 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}() }()
var bottomView: YHSaveAndSubmitView = { var bottomView: YHSaveAndSubmitView = {
return YHSaveAndSubmitView.createView() let view = YHSaveAndSubmitView.createView()
view.changeRightBtnTitle("下一步")
return view
}() }()
let primaryInfoVC = YHSpousePrimaryInfoVC() let primaryInfoVC = YHSpousePrimaryInfoVC()
......
...@@ -249,7 +249,7 @@ extension YHFamilyMemberInfoVC { ...@@ -249,7 +249,7 @@ extension YHFamilyMemberInfoVC {
// 添加兄弟姐妹子女 // 添加兄弟姐妹子女
func addFamilyMember(_ type:YHFamilyMemberType) { func addFamilyMember(_ type:YHFamilyMemberType) {
let dict:[String: Any] = ["orderId":self.orderId, let dict:[String: Any] = ["order_id":self.orderId,
"relation":String(type.rawValue), "relation":String(type.rawValue),
"step":0, "step":0,
"next":false, "next":false,
...@@ -543,6 +543,7 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -543,6 +543,7 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.relationType == .father || detailItem.relationType == .mother { if detailItem.relationType == .father || detailItem.relationType == .mother {
let vc = YHParentInfoVC() let vc = YHParentInfoVC()
vc.parentInfo = detailItem vc.parentInfo = detailItem
vc.orderId = orderId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
return return
} }
......
...@@ -11,6 +11,7 @@ import UIKit ...@@ -11,6 +11,7 @@ import UIKit
class YHParentInfoVC: YHBaseViewController { class YHParentInfoVC: YHBaseViewController {
var parentInfo: YHFamilyMember? var parentInfo: YHFamilyMember?
var orderId: Int = 0
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]() var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel() let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
// 是否显示未填写错误提示 // 是否显示未填写错误提示
...@@ -581,29 +582,27 @@ extension YHParentInfoVC { ...@@ -581,29 +582,27 @@ extension YHParentInfoVC {
func submitInfo() { func submitInfo() {
let isChecked = checkIntegrity() // let isChecked = checkIntegrity()
isNeedShowError = !isChecked // isNeedShowError = !isChecked
//
self.tableView .reloadData() // self.tableView .reloadData()
//
if !isChecked { // if !isChecked {
YHHUD.flash(message: "资料还未填完") // YHHUD.flash(message: "资料还未填完")
return // return
} // }
guard let parentInfo = parentInfo else { return } guard let parentInfo = parentInfo else { return }
guard let info = parentInfo.toDictionary() else { return } guard let info = parentInfo.toDictionary() else { return }
let dict:[String: Any] = ["orderId":parentInfo.orderId, let dict:[String: Any] = ["order_id":orderId,
"relation":parentInfo.relationType.rawValue, "relation":parentInfo.relation,
"step":parentInfo.step, "step":parentInfo.step,
"next":false, "next":false,
"info":info] "info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in
if success { YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
} }
} }
......
...@@ -157,7 +157,7 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -157,7 +157,7 @@ class YHFormItemSelectSheetCell: UITableViewCell {
arrowImgView.snp.makeConstraints { make in arrowImgView.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(20, 20)) make.size.equalTo(CGSizeMake(20, 20))
make.right.equalToSuperview().offset(-horizonalGap) make.right.equalToSuperview().offset(-horizonalGap)
make.centerY.equalTo(detailLabel) make.top.equalTo(titleLabel)
} }
topLine.snp.makeConstraints { make in topLine.snp.makeConstraints { make in
......
...@@ -140,6 +140,10 @@ class YHSaveAndSubmitView: UIView { ...@@ -140,6 +140,10 @@ class YHSaveAndSubmitView: UIView {
} }
} }
func changeRightBtnTitle(_ title:String?) {
submitBtn.setTitle(title, for: .normal)
}
@objc func didClickSubmitBtn() { @objc func didClickSubmitBtn() {
if let submitBlock = submitBlock { if let submitBlock = submitBlock {
submitBlock() submitBlock()
......
...@@ -59,7 +59,6 @@ extension YHLoginViewModel { ...@@ -59,7 +59,6 @@ extension YHLoginViewModel {
return return
} }
if json.code == 200 { if json.code == 200 {
if resultModel.token?.count != 0 { if resultModel.token?.count != 0 {
//token 正常 //token 正常
......
...@@ -95,7 +95,7 @@ class YHNetRequest: NSObject { ...@@ -95,7 +95,7 @@ class YHNetRequest: NSObject {
requestHeader.add(name:"sign",value:sign) requestHeader.add(name:"sign",value:sign)
requestHeader.add(name: "token", value: YHLoginManager.shared.userModel?.token ?? "-") requestHeader.add(name: "token", value: YHLoginManager.shared.userModel?.token ?? "-")
// testToken(&requestHeader) //for test hjl 使用固定token testToken(&requestHeader) //for test hjl 使用固定token
headers = requestHeader headers = requestHeader
} }
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Ellipse 323@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Ellipse 323@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 3040@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 3040@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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