Commit e9298c1b authored by pete谢兆麟's avatar pete谢兆麟

优化按钮闪烁问题

parent 79c1067e
...@@ -84,6 +84,18 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -84,6 +84,18 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
let state = self.viewModel.mainModel?.writing_document.doc_sign.status ?? 0 let state = self.viewModel.mainModel?.writing_document.doc_sign.status ?? 0
// 0-待上传,1-未发送, 2-发送中,3-已发送,4-已签收,5-审核通过,6-驳回 // 0-待上传,1-未发送, 2-发送中,3-已发送,4-已签收,5-审核通过,6-驳回
self.type = state self.type = state
}
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
self.checkSign()
})
}
func checkSign() {
viewModel?.requestSignCallBack("\(self.viewModel.mainModel?.writing_document.doc_sign.id ?? 0)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
let state = self.type
if state < 3 { if state < 3 {
//没有doc_sign //没有doc_sign
self.stepView.currentIndex = 0 self.stepView.currentIndex = 0
...@@ -96,6 +108,10 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -96,6 +108,10 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
self.bottomButton.alpha = 1 self.bottomButton.alpha = 1
self.bottomButton.setTitle("确定已签章,提交", for: .normal) self.bottomButton.setTitle("确定已签章,提交", for: .normal)
self.stepView.currentIndex = 1 self.stepView.currentIndex = 1
if self.viewModel.mainModel?.writing_document.doc_sign.doc_return_manual.count == 0 && !success {
self.bottomButton.isEnabled = false
self.bottomButton.alpha = 0.4
}
} else if state == 4 { } else if state == 4 {
self.promptView.isHidden = true self.promptView.isHidden = true
self.bottomButton.isEnabled = false self.bottomButton.isEnabled = false
...@@ -125,24 +141,7 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -125,24 +141,7 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
} }
self.stepView.currentIndex = 1 self.stepView.currentIndex = 1
} }
}
self.tableView.reloadData()
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
self.checkSign()
})
}
func checkSign() {
viewModel?.requestSignCallBack("\(self.viewModel.mainModel?.writing_document.doc_sign.id ?? 0)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.isSign = success self.isSign = success
if self.type == 3 && self.viewModel.mainModel?.writing_document.doc_sign.doc_return_manual.count == 0 && !success {
self.bottomButton.isEnabled = false
self.bottomButton.alpha = 0.4
}
self.tableView.reloadData() self.tableView.reloadData()
}) })
} }
...@@ -234,6 +233,7 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -234,6 +233,7 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
button.setTitleColor( UIColor(hex:0xffffff), for: .normal) button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3 button.layer.cornerRadius = kCornerRadius3
button.clipsToBounds = true button.clipsToBounds = true
button.alpha = 0
button.addTarget(self, action: #selector(submit), for: .touchUpInside) button.addTarget(self, action: #selector(submit), for: .touchUpInside)
return button return button
}() }()
......
...@@ -68,12 +68,28 @@ class YHMySignatureDetailViewController: YHBaseViewController { ...@@ -68,12 +68,28 @@ class YHMySignatureDetailViewController: YHBaseViewController {
let state = self.viewModel.mainModel?.status ?? 0 let state = self.viewModel.mainModel?.status ?? 0
// 0-待上传,1-未发送, 2-发送中,3-已发送,4-已签收,5-审核通过,6-驳回 // 0-待上传,1-未发送, 2-发送中,3-已发送,4-已签收,5-审核通过,6-驳回
self.type = state self.type = state
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
self.checkSign()
})
}
func checkSign() {
viewModel?.requestSignCallBack("\(self.id)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.isSign = success
let state = self.type
if state == 0 || state == 1 || state == 2 || state == 3 { if state == 0 || state == 1 || state == 2 || state == 3 {
self.promptView.isHidden = true self.promptView.isHidden = true
self.bottomButton.isEnabled = true self.bottomButton.isEnabled = true
self.bottomView.isHidden = false self.bottomView.isHidden = false
self.bottomButton.alpha = 1 self.bottomButton.alpha = 1
self.bottomButton.setTitle("确定已签章,提交", for: .normal) self.bottomButton.setTitle("确定已签章,提交", for: .normal)
if self.type == 3 && self.viewModel.mainModel?.doc_return_manual.count == 0 && !success {
self.bottomButton.isEnabled = false
self.bottomButton.alpha = 0.4
}
} else if state == 4 { } else if state == 4 {
self.promptView.isHidden = true self.promptView.isHidden = true
self.bottomButton.isEnabled = false self.bottomButton.isEnabled = false
...@@ -101,22 +117,6 @@ class YHMySignatureDetailViewController: YHBaseViewController { ...@@ -101,22 +117,6 @@ class YHMySignatureDetailViewController: YHBaseViewController {
} }
} }
self.tableView.reloadData() self.tableView.reloadData()
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
self.checkSign()
})
}
func checkSign() {
viewModel?.requestSignCallBack("\(self.id)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.isSign = success
if self.type == 3 && self.viewModel.mainModel?.doc_return_manual.count == 0 && !success {
self.bottomButton.isEnabled = false
self.bottomButton.alpha = 0.4
}
self.tableView.reloadData()
}) })
} }
...@@ -195,6 +195,7 @@ class YHMySignatureDetailViewController: YHBaseViewController { ...@@ -195,6 +195,7 @@ class YHMySignatureDetailViewController: YHBaseViewController {
button.setTitleColor( UIColor(hex:0xffffff), for: .normal) button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3 button.layer.cornerRadius = kCornerRadius3
button.clipsToBounds = true button.clipsToBounds = true
button.alpha = 0
button.addTarget(self, action: #selector(submit), for: .touchUpInside) button.addTarget(self, action: #selector(submit), for: .touchUpInside)
return button return button
}() }()
......
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