Commit 3d4e60bd authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  // 家庭信息
  // 家庭成员
parents 2a1c66ed 2310572c
......@@ -361,12 +361,6 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
return createDefaultCell(indexPath)
}
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section >= items.count { return }
......@@ -568,5 +562,11 @@ extension YHChildBasicInfoVC {
}
return true
}
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
}
......@@ -93,7 +93,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
self.saveInfo(isShowToast: true)
self.saveInfo(isSubmit: false, isShowLoading: true, callBack:nil)
}
stepView.snp.makeConstraints { make in
......@@ -161,16 +161,22 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
func submit() {
if let targetVC = getCurrentStepViewController() {
if targetVC.nextStep() {
// 当前步骤已是最后一步
if let vc = stepVCs.last, vc.step == currentStep {
YHHUD.flash(message: "已经是最后一步!")
return
}
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
saveInfo(isSubmit: true, isShowLoading: true) {
[weak self] success, error in
guard let self = self else { return }
if success {
// 当前步骤已是最后一步
if let vc = stepVCs.last, vc.step == currentStep {
self.navigationController?.popViewController()
return
}
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
}
print("currentIndex:\(currentStep)")
}
}
print("currentIndex:\(currentStep)")
}
}
}
......@@ -206,8 +212,9 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
extension YHChildInfoContainerVC {
// isSubmit:是否为提交 false为保存 true为提交
func saveInfo(isSubmit:Bool, callBack:((Bool, String?)->Void)?) {
// @param isSubmit:是否为提交 false为保存 true为提交
// @param isShowLoading: 是否展示loading和toast
func saveInfo(isSubmit:Bool, isShowLoading:Bool, callBack:((Bool, String?)->Void)?) {
guard let child = child else { return }
guard let info = child.toDictionary() else { return }
......@@ -218,26 +225,19 @@ extension YHChildInfoContainerVC {
"next":isSubmit,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) {
self.familyRequest.addOrSaveFamilyMember(params:dict, isShowLoading: isShowLoading) {
[weak self] success, error in
guard let self = self else { return }
if isShowLoading {
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
if let callBack = callBack {
callBack(success, error?.errorMsg)
}
}
}
func saveInfo(isShowToast:Bool) {
saveInfo(isSubmit: false) {
[weak self] success, msg in
guard let self = self else { return }
if !isShowToast { return }
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
}
func saveInfoSilent() {
saveInfo(isShowToast: false)
saveInfo(isSubmit:false, isShowLoading:false, callBack:nil)
}
}
......@@ -45,10 +45,10 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
createUI()
loadChildInfo()
loadInfo()
}
func loadChildInfo() {
func loadInfo() {
guard let child = child else { return }
......@@ -248,7 +248,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .ownCustody { // 抚养权
self.child?.setOwnCustody(option)
}
self.loadChildInfo()
self.loadInfo()
save()
}
return cell
......@@ -277,7 +277,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
if isEditEnd {
self.loadChildInfo()
self.loadInfo()
save()
}
}
......@@ -346,7 +346,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.child?.address.country = country
}
self.loadChildInfo()
self.loadInfo()
}
self.navigationController?.pushViewController(vc)
......@@ -358,7 +358,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.address.area = [string2, string3, string4]
self.loadChildInfo()
self.loadInfo()
}
self.present(vc, animated: true)
......@@ -369,7 +369,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .birthday {
self.child?.birthday = date
}
self.loadChildInfo()
self.loadInfo()
}
}
}
......@@ -443,10 +443,6 @@ extension YHChildPrimaryInfoVC {
delegate.saveInfoSilent()
}
}
func loadInfo() {
self.tableView.reloadData()
}
}
......
......@@ -117,7 +117,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
saveInfo(isShowToast: true)
saveInfo(isSubmit: false, isLoading: true, callBack: nil)
}
stepView.snp.makeConstraints { make in
......@@ -188,7 +188,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
extension YHSpouseInfoContainerVC {
// isSubmit:是否为提交 false为保存 true为提交
func saveInfo(isSubmit:Bool, callBack:((Bool, String?)->Void)?) {
func saveInfo(isSubmit:Bool, isLoading:Bool, callBack:((Bool, String?)->Void)?) {
guard let spouse = spouse else { return }
guard let info = spouse.toDictionary() else { return }
......@@ -199,41 +199,32 @@ extension YHSpouseInfoContainerVC {
"next":isSubmit,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) {
self.familyRequest.addOrSaveFamilyMember(params:dict, isShowLoading: isLoading) {
[weak self] success, error in
guard let self = self else { return }
if isLoading {
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
if let callBack = callBack {
callBack(success, error?.errorMsg)
}
}
}
func saveInfo(isShowToast:Bool) {
saveInfo(isSubmit: false) {
[weak self] success, msg in
guard let self = self else { return }
if !isShowToast { return }
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
}
func saveInfoSilent() {
saveInfo(isShowToast: false)
saveInfo(isSubmit: false, isLoading: false, callBack: nil)
}
func submit() {
if let targetVC = getCurrentStepViewController() {
if targetVC.nextStep() {
saveInfo(isSubmit: true) {
saveInfo(isSubmit: true, isLoading: true) {
[weak self] success, tips in
guard let self = self else { return }
if success {
// 当前步骤已是最后一步
if let vc = stepVCs.last, vc.step == currentStep {
YHHUD.flash(message: "已经是最后一步!")
self.navigationController?.popViewController()
return
}
......
......@@ -203,16 +203,16 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = (detailItem.value == YHCNIdentityCard.longTime ? "" : detailItem.value)
cell.isLontTime = (detailItem.value == YHCNIdentityCard.longTime)
cell.isLongTime = (detailItem.value == YHCNIdentityCard.longTime)
cell.clickBlock = {
[weak self] isLongTime in
guard let self = self else { return }
if title.type == .chinaIdCardInfo {
self.familyMember?.certificates.cnIdentityCard.issueDateEndAt = (isLongTime ? YHCNIdentityCard.longTime : "")
let issueAt = self.familyMember?.certificates.cnIdentityCard.issueAt
self.familyMember?.certificates.cnIdentityCard.issueDateEndAt = ((isLongTime ? YHCNIdentityCard.longTime : issueAt)!)
loadInfo()
save()
}
}
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell
......
......@@ -559,6 +559,7 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
// 兄弟姐妹
if detailItem.relationType == .brother {
let vc = YHBrotherInfoVC()
vc.orderId = orderId
vc.brotherInfo = detailItem
self.navigationController?.pushViewController(vc)
return
......
......@@ -20,6 +20,7 @@ class YHParentInfoVC: YHBaseViewController {
var bottomView: YHSaveAndSubmitView = {
let view = YHSaveAndSubmitView.createView()
view.isHiddenSave = true
view.changeRightBtnTitle("保存")
return view
}()
......@@ -53,7 +54,7 @@ class YHParentInfoVC: YHBaseViewController {
gk_navTitle = parentInfo.relationType == .father ? "父亲信息填写".local : "母亲信息填写".local
}
createUI()
loadBasicInfo()
loadInfo()
}
func createUI() {
......@@ -64,7 +65,12 @@ class YHParentInfoVC: YHBaseViewController {
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
self.submitInfo()
self.saveInfo(isSubmit: true, isLoading: true) {
[weak self] success, msg in
if success {
self?.navigationController?.popViewController(animated: true)
}
}
}
bottomView.snp.makeConstraints { make in
......@@ -79,11 +85,11 @@ class YHParentInfoVC: YHBaseViewController {
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
}
loadBasicInfo()
loadInfo()
}
func loadBasicInfo() {
func loadInfo() {
guard let parentInfo = parentInfo else { return }
......@@ -311,8 +317,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
}
if isEditEnd {
self.loadBasicInfo()
self.submitInfo()
self.loadInfo()
saveInfoSilent()
}
}
return cell
......@@ -347,7 +353,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
let selectItem = answers[index]
self.parentInfo?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .isHaveHkIdentityCard { // 是否办理过香港身份证
var select = false
......@@ -364,7 +371,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .isHaveHkIdentityCard {
self.parentInfo?.setHaveHKIdentityCard(selectItem.title == "是".local)
}
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
}
......@@ -382,11 +390,13 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: !isDead),
YHFormChoiceItem(title: "已故".local, isSelect: isDead)]
cell.answerArr = answers
cell.answerBlock = { [weak self]
(arr, selectIndex) in
cell.answerBlock = {
[weak self] (arr, selectIndex) in
guard let self = self else { return }
let selectItem:YHFormChoiceItem = arr[selectIndex]
self?.parentInfo?.setIsDead(selectItem.title == "已故")
self?.loadBasicInfo()
self.parentInfo?.setIsDead(selectItem.title == "已故")
self.loadInfo()
saveInfoSilent()
}
return cell
}
......@@ -438,7 +448,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .birthday {
self.parentInfo?.birthday = date
}
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .birthCity { // 出生城市
......@@ -456,7 +467,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.birthPlace.area = [string2, string3, string4]
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
......@@ -466,7 +478,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] selectType in
guard let self = self else { return }
self.parentInfo?.occupation = selectType.title
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .marriageState { // 婚姻
......@@ -475,7 +488,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] selectType in
guard let self = self else { return }
self.parentInfo?.married = selectType.title
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
let vc = YHAddressViewController()
......@@ -484,7 +498,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.liveCountry = string2
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
}
......@@ -563,17 +578,20 @@ extension YHParentInfoVC {
return true
}
func submitInfo() {
// let isChecked = checkIntegrity()
// isNeedShowError = !isChecked
//
// self.tableView .reloadData()
//
// if !isChecked {
// YHHUD.flash(message: "资料还未填完")
// return
// }
// isSubmit 是否是提交 isSilent:是否显示toast
func saveInfo(isSubmit:Bool, isLoading:Bool, callBack:((Bool, String?)->Void)?) {
if isSubmit {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return
}
}
guard let parentInfo = parentInfo else { return }
guard let info = parentInfo.toDictionary() else { return }
......@@ -581,13 +599,20 @@ extension YHParentInfoVC {
let dict:[String: Any] = ["order_id":orderId,
"relation":parentInfo.relation,
"step":parentInfo.step,
"next":false,
"next":isSubmit,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in
YHHUD.flash(message: success ? "保存成功" : "保存失败")
self.familyRequest.addOrSaveFamilyMember(params:dict, isShowLoading: isLoading) { success, error in
if isLoading {
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
if let callBack = callBack {
callBack(success, error?.errorMsg)
}
}
}
func saveInfoSilent() {
saveInfo(isSubmit: false, isLoading: false, callBack:nil)
}
}
......@@ -14,8 +14,8 @@ class YHFamilyRequestViewModel {
//请求所有家庭成员信息
func getFamilyInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
// let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
// let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
YHHUD.show(.progress(message: "数据加载中..."))
......@@ -41,16 +41,20 @@ class YHFamilyRequestViewModel {
}
// 添加家庭成员
func addOrSaveFamilyMember(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
func addOrSaveFamilyMember(params:[String:Any], isShowLoading:Bool = true, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
if isShowLoading {
YHHUD.show(.progress(message: "数据加载中..."))
}
// let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
// let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
if isShowLoading {
YHHUD.hide()
}
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
......
......@@ -47,7 +47,7 @@ class YHFormItemExpireDateCell: UITableViewCell {
}
}
var isLontTime:Bool = false {
var isLongTime:Bool = false {
didSet {
updateUI()
}
......@@ -184,17 +184,17 @@ class YHFormItemExpireDateCell: UITableViewCell {
func updateUI() {
detailLabel.isHidden = isLontTime
if isLontTime {
detailLabel.isHidden = isLongTime
if isLongTime {
tipsLabel.isHidden = true
} else {
tipsLabel.isHidden = !isEmptyString(detail)
}
longTimeBtn.isSelected = isLontTime
longTimeBtn.isSelected = isLongTime
longTimeBtn.snp.remakeConstraints { make in
make.size.equalTo(CGSizeMake(longTimeBtnWidth, 40))
make.centerY.equalTo(titleLabel)
if isLontTime {
if isLongTime {
make.left.equalTo(detailLabel)
} else {
make.right.equalToSuperview().offset(-16)
......@@ -204,10 +204,10 @@ class YHFormItemExpireDateCell: UITableViewCell {
@objc func didClickLongTimeBtn() {
isLontTime = !isLontTime
isLongTime = !isLongTime
if let clickBlock = clickBlock {
clickBlock(isLontTime)
clickBlock(isLongTime)
}
}
}
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