Commit b7c7c226 authored by Steven杜宇's avatar Steven杜宇

// 静默保存

parent 4d54cb23
...@@ -68,7 +68,7 @@ class YHQualificationDetailVC: YHBaseViewController { ...@@ -68,7 +68,7 @@ class YHQualificationDetailVC: YHBaseViewController {
bottomView.saveBlock = { bottomView.saveBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
saveDetailInfo(isNeedPop: true) saveDetailInfo(isNeedPop: true, isShowToast: true)
} }
bottomView.submitBlock = { bottomView.submitBlock = {
[weak self] in [weak self] in
...@@ -200,7 +200,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -200,7 +200,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
if isEditEnd { if isEditEnd {
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
} }
...@@ -275,7 +275,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -275,7 +275,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.certName = selectType.title detailInfo.certName = selectType.title
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
...@@ -287,7 +287,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -287,7 +287,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.issuingYear = Int(date) ?? 2024 detailInfo.issuingYear = Int(date) ?? 2024
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
...@@ -300,7 +300,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -300,7 +300,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.issuingAddr.country = country detailInfo.issuingAddr.country = country
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
...@@ -316,7 +316,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -316,7 +316,7 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.issuingAddr.area = [string1, string2, string3, string4] detailInfo.issuingAddr.area = [string1, string2, string3, string4]
loadInfo() loadInfo()
if detailId != 0 { if detailId != 0 {
saveDetailInfo(isNeedPop: false) saveDetailInfo(isNeedPop: false, isShowToast: false)
} }
} }
self.present(vc, animated: true) self.present(vc, animated: true)
...@@ -390,8 +390,10 @@ extension YHQualificationDetailVC { ...@@ -390,8 +390,10 @@ extension YHQualificationDetailVC {
} }
} }
// 保存数据 isNeedPop:保存成功后是否需要退出该页面 // 保存数据
func saveDetailInfo(isNeedPop:Bool) { // @param isNeedPop:保存成功后是否需要退出该页面
// @param isShowToast: 请求完成后是否弹Toast
func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) {
var dict:[String : Any] = ["orderId":self.orderId] var dict:[String : Any] = ["orderId":self.orderId]
var quaDict:[String : Any] = detailInfo.toDictionary() ?? [:] var quaDict:[String : Any] = detailInfo.toDictionary() ?? [:]
...@@ -403,13 +405,17 @@ extension YHQualificationDetailVC { ...@@ -403,13 +405,17 @@ extension YHQualificationDetailVC {
[weak self] success, error in [weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if success { if success {
YHHUD.flash(message: "保存成功") if isShowToast {
YHHUD.flash(message: "保存成功")
}
if isNeedPop { if isNeedPop {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
} else { } else {
YHHUD.flash(message: "保存失败") if isShowToast {
YHHUD.flash(message: "保存失败")
}
} }
} }
} }
...@@ -424,7 +430,8 @@ extension YHQualificationDetailVC { ...@@ -424,7 +430,8 @@ extension YHQualificationDetailVC {
YHHUD.flash(message: "资料还未填完") YHHUD.flash(message: "资料还未填完")
return return
} }
saveDetailInfo(isNeedPop: true) saveDetailInfo(isNeedPop: true, isShowToast: true)
} }
// 检查填写信息完整性 // 检查填写信息完整性
......
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