Commit 67218898 authored by Alex朱枝文's avatar Alex朱枝文

续签文书管理文书预览和编辑调整

parent 457ceb1a
...@@ -170,13 +170,26 @@ extension YHResignDocumentDetailViewController { ...@@ -170,13 +170,26 @@ extension YHResignDocumentDetailViewController {
var config = YHResignDocumentStatusCell.ButtonsConfig() var config = YHResignDocumentStatusCell.ButtonsConfig()
var actions: [(() -> Void)] = [] var actions: [(() -> Void)] = []
editEvent = { [weak self] in editEvent = { [weak self] in
guard model.link.count > 0, let url = URL(string: model.link) else { guard let self = self else {
return return
} }
let safariViewController = SFSafariViewController(url: url) YHHUD.show(.progress(message: "加载中..."))
safariViewController.dismissButtonStyle = .close self.viewModel.getResginDocumentUrl(docId: model.docId, isEditable: true) { [weak self] model, error in
safariViewController.modalPresentationStyle = .fullScreen guard let self = self else {
self?.present(safariViewController, animated: true, completion: nil) return
}
YHHUD.hide()
if let urlString = model?.url, let url = URL(string: urlString) {
let safariViewController = SFSafariViewController(url: url)
safariViewController.dismissButtonStyle = .close
safariViewController.modalPresentationStyle = .fullScreen
self.present(safariViewController, animated: true, completion: nil)
} else if let error = error {
let errorMsg = error.errorMsg
YHHUD.show(.error(message: errorMsg))
YHHUD.hide(afterDelay: 1)
}
}
printLog("###editEvent") printLog("###editEvent")
} }
...@@ -234,7 +247,7 @@ extension YHResignDocumentDetailViewController { ...@@ -234,7 +247,7 @@ extension YHResignDocumentDetailViewController {
return return
} }
YHHUD.show(.progress(message: "加载中...")) YHHUD.show(.progress(message: "加载中..."))
self.viewModel.previewResginDocument(docId: model.docId) { [weak self] model, error in self.viewModel.getResginDocumentUrl(docId: model.docId, isEditable: false) { [weak self] model, error in
guard let self = self else { guard let self = self else {
return return
} }
......
...@@ -131,4 +131,29 @@ class YHResignDocumentViewModel: YHBaseViewModel { ...@@ -131,4 +131,29 @@ class YHResignDocumentViewModel: YHBaseViewModel {
} }
} }
func getResginDocumentUrl(docId: Int, isEditable: Bool, callback: @escaping (_ documentModel: YHResignDocumentPreviewModel?, _ error: YHErrorModel?) -> ()) {
let params: [String : Any] = ["id": docId, "type": isEditable ? 1 : 0]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.ResignDocument.getResginDocumentUrl
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { json, code in
//1. json字符串 转 对象
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let dic = json.data?.peel as? [String : Any], let resultModel = YHResignDocumentPreviewModel.deserialize(from: dic) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callback(nil, err)
return
}
callback(resultModel, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback(nil, err)
}
} failBlock: { err in
callback(nil, err)
}
}
} }
...@@ -544,6 +544,8 @@ class YHAllApiName { ...@@ -544,6 +544,8 @@ class YHAllApiName {
static let resginDocumentSignature = "super-app/renewal/signature" static let resginDocumentSignature = "super-app/renewal/signature"
// 预览签字文档 // 预览签字文档
static let previewResginDocument = "super-app/renewal/views" static let previewResginDocument = "super-app/renewal/views"
// 获取临时链接
static let getResginDocumentUrl = "super-app/renewal/doc/url"
} }
// 在港记录 // 在港记录
......
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