Commit 33879c41 authored by Alex朱枝文's avatar Alex朱枝文

优化续签文书刷新接口逻辑,避免在上传时更新接口,但是也不影响先前跳转

parent 42661bed
...@@ -43,10 +43,10 @@ class YHResignDocumentDetailViewController: YHBaseViewController { ...@@ -43,10 +43,10 @@ class YHResignDocumentDetailViewController: YHBaseViewController {
private let docId: Int private let docId: Int
private var name: String private var name: String
private let uploadMaxCount = 10 private let uploadMaxCount = 10
// 进签字QMAS、信息确认等再出来就要刷新接口,而上传文件预览文件就不能刷新接口,
private var isEditUploadFiles: Bool = false // 跟踪编辑状态 上传 预览 删除等 // 因此增加这个字段判断,后续如果有跳其他页面且退回该页面需要设置为true
private var isEditUploadFilesDidDisappear: Bool = false // 跟踪编辑状态 上传 预览 删除等时是否页面消失 private var isNeedUpdateData: Bool = true
init(_ docId: Int, _ name: String = "") { init(_ docId: Int, _ name: String = "") {
self.docId = docId self.docId = docId
self.name = name self.name = name
...@@ -123,29 +123,18 @@ class YHResignDocumentDetailViewController: YHBaseViewController { ...@@ -123,29 +123,18 @@ class YHResignDocumentDetailViewController: YHBaseViewController {
super.viewDidLoad() super.viewDidLoad()
setupUI() setupUI()
addKeyBoardNotify() addKeyBoardNotify()
tableView.reloadData()
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
let needLoading = isNeedShowLoading let needLoading = isNeedShowLoading
isNeedShowLoading = false isNeedShowLoading = false
if isEditUploadFilesDidDisappear { if isNeedUpdateData {
isEditUploadFiles = false isNeedUpdateData = false
isEditUploadFilesDidDisappear = false
} else {
isEditUploadFiles = false
requestData(isNeedLoading: needLoading) requestData(isNeedLoading: needLoading)
} }
} }
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if isEditUploadFiles {
isEditUploadFilesDidDisappear = true
}
}
deinit { deinit {
removeNotify() removeNotify()
} }
...@@ -312,7 +301,6 @@ extension YHResignDocumentDetailViewController: UITableViewDelegate, UITableView ...@@ -312,7 +301,6 @@ extension YHResignDocumentDetailViewController: UITableViewDelegate, UITableView
cell.setupCellInfo(title, cellType: cellType) cell.setupCellInfo(title, cellType: cellType)
cell.editButtonClickEvent = { [weak self] in cell.editButtonClickEvent = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
self.isEditUploadFiles = true
let items: [YHCertificateEditItem] = editTypes.map { let items: [YHCertificateEditItem] = editTypes.map {
YHCertificateEditItem(type: $0, title: $0.editName()) YHCertificateEditItem(type: $0, title: $0.editName())
} }
...@@ -355,7 +343,6 @@ extension YHResignDocumentDetailViewController: UITableViewDelegate, UITableView ...@@ -355,7 +343,6 @@ extension YHResignDocumentDetailViewController: UITableViewDelegate, UITableView
guard let detailModel = self.detailModel else { guard let detailModel = self.detailModel else {
return return
} }
self.isEditUploadFiles = true
let count = detailModel.signedDocument.count let count = detailModel.signedDocument.count
if count >= 10 { if count >= 10 {
YHHUD.flash(message: "最多上传10个图片或文件") YHHUD.flash(message: "最多上传10个图片或文件")
...@@ -477,6 +464,7 @@ extension YHResignDocumentDetailViewController { ...@@ -477,6 +464,7 @@ extension YHResignDocumentDetailViewController {
return return
} }
self.isNeedShowLoading = true self.isNeedShowLoading = true
self.isNeedUpdateData = true
let url = signatureModel.url let url = signatureModel.url
// 跳签字 // 跳签字
let vc = YHSignatureWebViewController() let vc = YHSignatureWebViewController()
...@@ -526,6 +514,7 @@ extension YHResignDocumentDetailViewController { ...@@ -526,6 +514,7 @@ extension YHResignDocumentDetailViewController {
printLog("跳转QMAS") printLog("跳转QMAS")
if let param = YHLoginManager.shared.userModel?.token, param.count > 5 { if let param = YHLoginManager.shared.userModel?.token, param.count > 5 {
self.isNeedUpdateData = true
printLog(param) printLog(param)
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/guide/qmas" var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/guide/qmas"
//https://test-hkdiy-h5.galaxy-immi.com/superAppBridge.html#/guide/qmas?token=xx&doc_id=xx //https://test-hkdiy-h5.galaxy-immi.com/superAppBridge.html#/guide/qmas?token=xx&doc_id=xx
......
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