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