Commit 8bbb69de authored by pete谢兆麟's avatar pete谢兆麟

我的文书详情UI

parent 3f9212f3
...@@ -242,6 +242,10 @@ ...@@ -242,6 +242,10 @@
04E86E0B2B70C13300A35F4B /* YHCodeSueecssViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E0A2B70C13300A35F4B /* YHCodeSueecssViewController.swift */; }; 04E86E0B2B70C13300A35F4B /* YHCodeSueecssViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E0A2B70C13300A35F4B /* YHCodeSueecssViewController.swift */; };
04E86E0D2B70D51D00A35F4B /* YHWebViewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */; }; 04E86E0D2B70D51D00A35F4B /* YHWebViewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */; };
04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */; }; 04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */; };
04EA23082BB50753009DA928 /* YHDocumentMessageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA23072BB50753009DA928 /* YHDocumentMessageTableViewCell.swift */; };
04EA230A2BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA23092BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift */; };
04EA230C2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA230B2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift */; };
04EA230E2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA230D2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift */; };
04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */; }; 04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; }; 6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; }; A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; };
...@@ -629,6 +633,10 @@ ...@@ -629,6 +633,10 @@
04E86E0A2B70C13300A35F4B /* YHCodeSueecssViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeSueecssViewController.swift; sourceTree = "<group>"; }; 04E86E0A2B70C13300A35F4B /* YHCodeSueecssViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeSueecssViewController.swift; sourceTree = "<group>"; };
04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWebViewViewController.swift; sourceTree = "<group>"; }; 04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWebViewViewController.swift; sourceTree = "<group>"; };
04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginManager.swift; sourceTree = "<group>"; }; 04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginManager.swift; sourceTree = "<group>"; };
04EA23072BB50753009DA928 /* YHDocumentMessageTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocumentMessageTableViewCell.swift; sourceTree = "<group>"; };
04EA23092BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocumentPromptTableViewCell.swift; sourceTree = "<group>"; };
04EA230B2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocumentToActionTableViewCell.swift; sourceTree = "<group>"; };
04EA230D2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocumentUploadTableViewCell.swift; sourceTree = "<group>"; };
04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; }; 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; };
19B28612265782F9DC1BE0B0 /* Pods-galaxy.testenv.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.testenv.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.testenv.xcconfig"; sourceTree = "<group>"; }; 19B28612265782F9DC1BE0B0 /* Pods-galaxy.testenv.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.testenv.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.testenv.xcconfig"; sourceTree = "<group>"; };
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; }; 58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; };
...@@ -1032,6 +1040,7 @@ ...@@ -1032,6 +1040,7 @@
045EEDF82B9F171A0022A143 /* MyDocuments(我的文书) */ = { 045EEDF82B9F171A0022A143 /* MyDocuments(我的文书) */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04EA23062BB50719009DA928 /* View */,
04A7BD0D2BA41C7600BD35A2 /* ViewModel */, 04A7BD0D2BA41C7600BD35A2 /* ViewModel */,
04A7BD0C2BA41C6E00BD35A2 /* Model */, 04A7BD0C2BA41C6E00BD35A2 /* Model */,
045EEDF92B9F171A0022A143 /* C */, 045EEDF92B9F171A0022A143 /* C */,
...@@ -1549,6 +1558,17 @@ ...@@ -1549,6 +1558,17 @@
path = Server; path = Server;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
04EA23062BB50719009DA928 /* View */ = {
isa = PBXGroup;
children = (
04EA23072BB50753009DA928 /* YHDocumentMessageTableViewCell.swift */,
04EA23092BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift */,
04EA230B2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift */,
04EA230D2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift */,
);
path = View;
sourceTree = "<group>";
};
4758815B24BAF3CAA24EC6A8 /* Pods */ = { 4758815B24BAF3CAA24EC6A8 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -2448,6 +2468,7 @@ ...@@ -2448,6 +2468,7 @@
045EEEB52B9F171A0022A143 /* YHWorkIntroductionItemView.swift in Sources */, 045EEEB52B9F171A0022A143 /* YHWorkIntroductionItemView.swift in Sources */,
045EEF202B9F171A0022A143 /* YHCardExampleView.swift in Sources */, 045EEF202B9F171A0022A143 /* YHCardExampleView.swift in Sources */,
04A6715E2B9FFCA700C1FB91 /* YHCertificateNameCell.swift in Sources */, 04A6715E2B9FFCA700C1FB91 /* YHCertificateNameCell.swift in Sources */,
04EA23082BB50753009DA928 /* YHDocumentMessageTableViewCell.swift in Sources */,
045EEE8E2B9F171A0022A143 /* YHPreviewInfoWorkSummaryView.swift in Sources */, 045EEE8E2B9F171A0022A143 /* YHPreviewInfoWorkSummaryView.swift in Sources */,
045EEECE2B9F171A0022A143 /* YHScoreDetailViewController.swift in Sources */, 045EEECE2B9F171A0022A143 /* YHScoreDetailViewController.swift in Sources */,
A5C5B3252B57C74900A7C5D1 /* YHDavidCell3.swift in Sources */, A5C5B3252B57C74900A7C5D1 /* YHDavidCell3.swift in Sources */,
...@@ -2492,6 +2513,7 @@ ...@@ -2492,6 +2513,7 @@
A5C382CF2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift in Sources */, A5C382CF2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift in Sources */,
045EEEA52B9F171A0022A143 /* YHImageViewController.swift in Sources */, 045EEEA52B9F171A0022A143 /* YHImageViewController.swift in Sources */,
045EEEF32B9F171A0022A143 /* YHFamilyMemberInfoListVC.swift in Sources */, 045EEEF32B9F171A0022A143 /* YHFamilyMemberInfoListVC.swift in Sources */,
04EA230C2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift in Sources */,
A5C5B2EA2B4ECA4D00A7C5D1 /* YHDavidModel0.swift in Sources */, A5C5B2EA2B4ECA4D00A7C5D1 /* YHDavidModel0.swift in Sources */,
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */, A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */,
045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */, 045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */,
...@@ -2508,6 +2530,7 @@ ...@@ -2508,6 +2530,7 @@
045EEEE12B9F171A0022A143 /* YHMySignatureListViewModel.swift in Sources */, 045EEEE12B9F171A0022A143 /* YHMySignatureListViewModel.swift in Sources */,
04A7BD152BA4361700BD35A2 /* YHMyDocumentDetailModel.swift in Sources */, 04A7BD152BA4361700BD35A2 /* YHMyDocumentDetailModel.swift in Sources */,
045EEEA02B9F171A0022A143 /* YHWorkItemListModel.swift in Sources */, 045EEEA02B9F171A0022A143 /* YHWorkItemListModel.swift in Sources */,
04EA230E2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift in Sources */,
045EEEAD2B9F171A0022A143 /* YHWorkExperienceListTableViewCell.swift in Sources */, 045EEEAD2B9F171A0022A143 /* YHWorkExperienceListTableViewCell.swift in Sources */,
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */, 049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */,
047619E92BA9867100F45358 /* YHCountryHotView.swift in Sources */, 047619E92BA9867100F45358 /* YHCountryHotView.swift in Sources */,
...@@ -2555,6 +2578,7 @@ ...@@ -2555,6 +2578,7 @@
A5C5B3272B57C8D500A7C5D1 /* YHDavidCell2.swift in Sources */, A5C5B3272B57C8D500A7C5D1 /* YHDavidCell2.swift in Sources */,
045EEEB72B9F171A0022A143 /* YHWorkItemAddView.swift in Sources */, 045EEEB72B9F171A0022A143 /* YHWorkItemAddView.swift in Sources */,
A5ACE9372B4564F7002C94D2 /* YHBaseUrlManager.swift in Sources */, A5ACE9372B4564F7002C94D2 /* YHBaseUrlManager.swift in Sources */,
04EA230A2BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift in Sources */,
045EEF092B9F171A0022A143 /* YHBasicInfoFillModel.swift in Sources */, 045EEF092B9F171A0022A143 /* YHBasicInfoFillModel.swift in Sources */,
A5ACE9352B4564F7002C94D2 /* YHNetRequest.swift in Sources */, A5ACE9352B4564F7002C94D2 /* YHNetRequest.swift in Sources */,
A5FD63CB2B63D6C300D1D9DA /* YHInformationFillTipsCell.swift in Sources */, A5FD63CB2B63D6C300D1D9DA /* YHInformationFillTipsCell.swift in Sources */,
......
...@@ -50,7 +50,6 @@ class YHFilePreviewTool: NSObject { ...@@ -50,7 +50,6 @@ class YHFilePreviewTool: NSObject {
} }
func openXLSXFile(at fileURL: URL, fileName: String?) { func openXLSXFile(at fileURL: URL, fileName: String?) {
let controller = UIDocumentInteractionController(url: fileURL) let controller = UIDocumentInteractionController(url: fileURL)
// 设置标题显示 // 设置标题显示
if let fileName = fileName, !fileName.isEmpty { if let fileName = fileName, !fileName.isEmpty {
......
...@@ -11,17 +11,20 @@ import SafariServices ...@@ -11,17 +11,20 @@ import SafariServices
class YHMyDocumentsDetailViewController: YHBaseViewController { class YHMyDocumentsDetailViewController: YHBaseViewController {
var stepView: YHStepView!
var bottomView: UIView! var bottomView: UIView!
var bottomButton: UIButton! var bottomButton: UIButton!
var tableView: UITableView! var tableView: UITableView!
var dataSource: [YHWorkItemListModel]? var dataSource: [YHWorkItemListModel]?
var viewModel: YHMyDocumentsDetailViewModel? var viewModel: YHMyDocumentsDetailViewModel!
var id: Int = 0 var id: Int = 0
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
viewModel = YHMyDocumentsDetailViewModel() viewModel = YHMyDocumentsDetailViewModel()
gk_navTitle = "我的签字" gk_navTitle = "文书操作"
gk_navBackgroundColor = .white
gk_navBarAlpha = 1
setView() setView()
getData() getData()
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
...@@ -33,8 +36,22 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -33,8 +36,22 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
} }
func getData() { func getData() {
viewModel?.requestDocumentsDetail("\(id)", callBackBlock: {[weak self] success, error in viewModel.requestDocumentsDetail("\(id)", callBackBlock: {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if self.viewModel.mainModel?.prospectus.id != 0 {
self.stepView.snp.remakeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(self.view)
make.height.equalTo(0)
}
self.bottomView.isHidden = true
}
if self.viewModel.mainModel?.writing_document.doc_sign.supplement_id == 0 {
self.stepView.currentIndex = 0
self.bottomView.isHidden = true
} else {
self.stepView.currentIndex = 1
}
self.tableView.reloadData() self.tableView.reloadData()
}) })
} }
...@@ -45,8 +62,21 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -45,8 +62,21 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
} }
func setView() { func setView() {
view.backgroundColor = .contentBkgColor
stepView = {
let step = YHStepView()
step.dataSource = ["文书稿件", "文书签章"]
return step
}()
view.addSubview(stepView)
stepView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.height.equalTo(104)
}
tableView = { tableView = {
let tableView = UITableView(frame:.zero, style:.plain) let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) { if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never tableView.contentInsetAdjustmentBehavior = .never
} }
...@@ -54,12 +84,15 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -54,12 +84,15 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.delegate = self tableView.delegate = self
tableView.dataSource = self tableView.dataSource = self
tableView.register(cellWithClass: YHMyFileMethodTableViewCell.self) tableView.register(cellWithClass: YHDocumentMessageTableViewCell.self)
tableView.register(cellWithClass: YHDocumentPromptTableViewCell.self)
tableView.register(cellWithClass: YHDocumentToActionTableViewCell.self)
tableView.register(cellWithClass: YHDocumentUploadTableViewCell.self)
return tableView return tableView
}() }()
view.addSubview(tableView) view.addSubview(tableView)
tableView.snp.makeConstraints { make in tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar) make.top.equalTo(k_Height_NavigationtBarAndStatuBar + YHStepView.height)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64) make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.bottom.equalTo(view) make.left.right.bottom.equalTo(view)
} }
...@@ -80,7 +113,7 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -80,7 +113,7 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
// button.backgroundColor = UIColor(hex:0x2274ee) // button.backgroundColor = UIColor(hex:0x2274ee)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16) button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center button.contentHorizontalAlignment = .center
button.setTitle("提交", for: .normal) button.setTitle("确定已签章,提交", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal) button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius6 button.layer.cornerRadius = kCornerRadius6
button.clipsToBounds = true button.clipsToBounds = true
...@@ -106,38 +139,243 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -106,38 +139,243 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
safariViewController.delegate = self safariViewController.delegate = self
self.navigationController?.pushViewController(safariViewController) self.navigationController?.pushViewController(safariViewController)
} }
func showSureAlert() {
YHCommonAlertView.show("", "请确认是否已完成编辑并提交", "取消", "确认") {[weak self] in
guard let self = self else { return }
self.viewModel.requestDocumentSubmit("\(self.id)") {[weak self] success, error in
guard let self = self else { return }
if success {
self.navigationController?.popViewController()
}
}
}
}
} }
extension YHMyDocumentsDetailViewController: UITableViewDelegate, UITableViewDataSource { extension YHMyDocumentsDetailViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if stepView.currentIndex == 0 {
return 1 return 1
} }
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHMyFileMethodTableViewCell.self) if stepView.currentIndex == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHDocumentMessageTableViewCell.self)
cell.dataSource = self.viewModel.mainModel
cell.backgroundColor = .clear cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear cell.contentView.backgroundColor = .clear
return cell cell.block = {[weak self] type in
guard let self = self else { return }
if type == .edit {
if self.viewModel.mainModel?.prospectus.id != 0 {
// 跳转赴港计划书编辑页面
} else {
self.viewModel.requestDocumentsTemporaryUrl("\(id)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
if success {
self.viewModel.requestDocumentRecord("\(id)", 2) { success, error in
}
guard let url = URL(string: self.viewModel?.urlModel?.url) else { return }
let tmpVC = SFSafariViewController(url: url)
tmpVC.dismissButtonStyle = .close
tmpVC.delegate = self
self.navigationController?.pushViewController(tmpVC)
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
})
}
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { if type == .submit {
return CGFloat(180) self.showSureAlert()
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if type == .look {
viewModel?.requestDocumentsTemporaryUrl("\(id)", callBackBlock: {[weak self] success, error in if self.viewModel.mainModel?.prospectus.id != 0 {
guard let self = self else { return } // 跳转赴港计划书查看页面
if success { } else {
guard let url = URL(string: self.viewModel?.urlModel?.url) else { return } self.viewModel.requestDocumentRecord("\(id)", 1) { success, error in
}
guard let url = URL(string: self.viewModel.mainModel?.writing_document.tencent_file_url ?? "") else { return }
let tmpVC = SFSafariViewController(url: url) let tmpVC = SFSafariViewController(url: url)
tmpVC.dismissButtonStyle = .close tmpVC.dismissButtonStyle = .close
tmpVC.delegate = self tmpVC.delegate = self
self.navigationController?.pushViewController(tmpVC) self.navigationController?.pushViewController(tmpVC)
}
}
}
return cell
} else {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHDocumentPromptTableViewCell.self)
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
} else if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHDocumentToActionTableViewCell.self)
cell.dataSource = self.viewModel.mainModel?.writing_document.doc_sign
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
cell.block = { [weak self] type in
guard let self = self else { return }
if type == .sign {
self.viewModel.requestSignaturePageURL("\(id)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
if error?.errorCode == 1008611 {
YHCommonAlertView.show("实名认证", "为保证签署有效,请先实名认证", "取消", "去认证") {
self.viewModel.requestSignaturePersonalURL(callBackBlock: {[weak self] success, error in
guard let self = self else { return }
let url = URL(string: self.viewModel.personalUrl)!
let safariViewController = SFSafariViewController(url: url)
safariViewController.dismissButtonStyle = .close
safariViewController.delegate = self
self.navigationController?.pushViewController(safariViewController)
})
}
} else {
if success ?? false {
let url = URL(string: self.viewModel.pageUrl)!
let safariViewController = SFSafariViewController(url: url)
safariViewController.dismissButtonStyle = .close
safariViewController.delegate = self
self.navigationController?.pushViewController(safariViewController)
} else { } else {
YHHUD.flash(message: error?.errorMsg ?? "") YHHUD.flash(message: error?.errorMsg ?? "")
} }
}
}) })
} }
if type == .look {
self.viewModel.requestSignatureLook("\(id)") {[weak self] success, error in
guard let self = self else { return }
if success {
let url = URL(string: self.viewModel.pageUrl)!
let safariViewController = SFSafariViewController(url: url)
safariViewController.dismissButtonStyle = .close
safariViewController.delegate = self
self.navigationController?.pushViewController(safariViewController)
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
if type == .downLoad {
self.viewModel.requestSignatureDownload("\(id)") { [weak self] success, error in
guard let self = self else { return }
//获取到下载链接发送到邮箱
}
}
}
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHDocumentUploadTableViewCell.self)
cell.dataSource = self.viewModel.mainModel?.writing_document.doc_sign
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
cell.block = { [weak self] type, index in
guard let self = self else { return }
if type == .upload {
let sheetView = YHCertificateUploadSheetView.sheetView()
// sheetView.maxSelectCount = 99-items.count
// sheetView.templateInfo = supplementInfo.templateInfo
// sheetView.uploadFilesBlock = {
// [weak self] fileUrl in
// guard let self = self else { return }
// print(fileUrl)
// uploadFile(fileUrl)
// }
// sheetView.uploadImageBlock = {
// [weak self] imgArr in
// guard let self = self else { return }
// let group = DispatchGroup()
// var successArr:[YHSelectImageItem] = []
// var failArr:[YHSelectImageItem] = []
//
// YHHUD.show(.progress(message: "上传中..."))
// for item in imgArr {
// if let image = item.data {
// group.enter()
// uploadImage(image, imageName:item.name) {
// success in
// if success {
// successArr.append(item)
// } else {
// failArr.append(item)
// }
// group.leave()
// }
// }
// }
//
// // 等待所有任务完成
// group.notify(queue: .main) {
// // 所有任务完成,回到主线程继续执行
// print("所有任务完成")
// if imgArr.count == successArr.count {
// YHHUD.flash(message: "上传成功")
//
// } else {
// YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
// }
// YHHUD.hide()
// }
// }
sheetView.show()
}
if type == .reUpload {
}
if type == .delete {
}
}
return cell
}
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if stepView.currentIndex == 0 {
return 190
} else {
if indexPath.row == 0 {
return 104
} else if indexPath.row == 1 {
return 180
} else {
return 221
}
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 7))
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 7
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
} }
extension YHMyDocumentsDetailViewController: SFSafariViewControllerDelegate { extension YHMyDocumentsDetailViewController: SFSafariViewControllerDelegate {
......
//
// YHDocumentMessageTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/3/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHDocumentMessageTableViewCell: UITableViewCell {
typealias Block = (YHMyFileMethodType) -> ()
var block: Block?
var centerView: UIView!
var titleLabel: UILabel!
var subTitleLabel: UILabel!
var topLineView: UIView!
var bottomView: UIView!
var bottomCenterLineView: UIView!
var fileImageView: UIImageView!
var fileNameLabel: UILabel!
var editButton: UIButton!
var submitButton: UIButton!
var lookButton: UIButton!
var dataSource: YHMyDocumentDetailModel? {
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.bottom.equalTo(-8)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.text = "文书稿件"
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(24)
}
subTitleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 10)
label.textColor = UIColor.labelTextColor2
label.backgroundColor = UIColor.warnColor.withAlphaComponent(0.08)
label.textAlignment = .left
label.text = "核对中"
label.layer.cornerRadius = 3
label.masksToBounds = true
return label
}()
centerView.addSubview(subTitleLabel)
subTitleLabel.snp.makeConstraints { make in
make.height.equalTo(18)
make.left.equalTo(titleLabel.snp.right).offset(4)
make.centerY.equalTo(titleLabel.snp.centerY)
}
topLineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(topLineView)
topLineView.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(18)
make.height.equalTo(1)
make.top.equalTo(52)
}
bottomView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.right.left.equalToSuperview()
make.height.equalTo(1)
make.top.equalTo(123)
}
bottomCenterLineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(bottomCenterLineView)
bottomCenterLineView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.width.equalTo(1)
make.bottom.equalTo(-17.5)
make.height.equalTo(16)
}
editButton = {
let button = UIButton(type: .custom)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.setTitle("编辑", for: .normal)
button.addTarget(self, action: #selector(editButtonClick), for: .touchUpInside)
return button
}()
centerView.addSubview(editButton)
editButton.snp.makeConstraints { make in
make.left.bottom.equalToSuperview()
make.top.equalTo(bottomView.snp.bottom)
make.right.equalTo(bottomCenterLineView.snp.left)
}
submitButton = {
let button = UIButton(type: .custom)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.setTitle("提交", for: .normal)
button.addTarget(self, action: #selector(submitButtonClick), for: .touchUpInside)
return button
}()
centerView.addSubview(submitButton)
submitButton.snp.makeConstraints { make in
make.right.bottom.equalToSuperview()
make.top.equalTo(bottomView.snp.bottom)
make.left.equalTo(bottomCenterLineView.snp.right)
}
lookButton = {
let button = UIButton(type: .custom)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.setTitle("查看", for: .normal)
button.addTarget(self, action: #selector(lookButtonClick), for: .touchUpInside)
return button
}()
centerView.addSubview(lookButton)
lookButton.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(bottomView.snp.bottom)
}
fileImageView = {
let view = UIImageView()
view.image = UIImage(named: "")
return view
}()
centerView.addSubview(fileImageView)
fileImageView.snp.makeConstraints { make in
make.left.equalTo(24)
make.centerY.equalToSuperview()
make.width.height.equalTo(31)
}
fileNameLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor.mainTextColor
label.numberOfLines = 0
label.text = "雇主的推荐信(仅签字)华为科技有限公司.doc"
return label
}()
centerView.addSubview(fileNameLabel)
fileNameLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(67)
make.height.equalTo(40)
make.centerY.equalToSuperview()
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
if dataSource.prospectus.id == 0 {
//state 1待提交 2待客户确认 3待核对 4待审核 5驳回 6已定稿
var color = UIColor.red
var title = " 待提交 "
if dataSource.writing_document.status == 1 {
title = " 待提交 "
color = UIColor.brandMainColor
lookButton.isHidden = true
}
if dataSource.writing_document.status == 2 {
title = " 待确认 "
color = UIColor.brandMainColor
lookButton.isHidden = true
}
if dataSource.writing_document.status == 3 {
title = " 待核对 "
color = UIColor.warnColor
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
}
if dataSource.writing_document.status == 4 {
title = " 待审核 "
color = UIColor.warnColor
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
}
if dataSource.writing_document.status == 5 {
title = " 已驳回 "
color = UIColor.failColor
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
}
if dataSource.writing_document.status == 6 {
title = " 已定稿 "
color = UIColor.labelTextColor2
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
}
subTitleLabel.text = title
subTitleLabel.textColor = color
subTitleLabel.backgroundColor = color.withAlphaComponent(0.08)
fileNameLabel.text = dataSource.writing_document.name
let suffix = dataSource.writing_document.name.pathExtension.lowercased()
var iconImgName = ""
if suffix == "jpeg" {
iconImgName = "my_cer_type_jpg"
} else if suffix == "jpg" {
iconImgName = "my_cer_type_jpg"
} else if suffix == "png" {
iconImgName = "my_cer_type_png"
} else if suffix == "pdf" {
iconImgName = "my_cer_type_pdf"
} else if suffix == "doc" || suffix == "docx" {
iconImgName = "my_cer_type_word"
} else if suffix == "ppt" || suffix == "pptx" {
iconImgName = "my_cer_type_ppt"
}
fileImageView.image = UIImage(named: iconImgName)
} else {
// 赴港计划书逻辑
}
}
@objc func editButtonClick() {
if let block = block {
block(.edit)
}
}
@objc func lookButtonClick() {
if let block = block {
block(.look)
}
}
@objc func submitButtonClick() {
if let block = block {
block(.submit)
}
}
}
//
// YHDocumentPromptTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/3/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHDocumentPromptTableViewCell: UITableViewCell {
var centerView: UIImageView!
var promptImageView: UIImageView!
var titleLabel: UILabel!
var subTitleLabel: UILabel!
var dataSource: YHMyDocumentDetailModel? {
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
backgroundColor = .clear
centerView = {
let view = UIImageView()
view.image = UIImage(named: "document_prompt_bg")
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.bottom.equalTo(-8)
}
promptImageView = {
let view = UIImageView()
view.image = UIImage(named: "document_prompt_icon")
return view
}()
centerView.addSubview(promptImageView)
promptImageView.snp.makeConstraints { make in
make.width.height.equalTo(14)
make.left.equalTo(16)
make.top.equalTo(16)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 12)
label.textColor = UIColor.brandMainColor
label.text = "温馨提示:"
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(38)
make.top.equalTo(16)
make.height.equalTo(17)
}
subTitleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.labelTextColor2
label.numberOfLines = 0
let a: ASAttributedString = .init("您可以", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.subTextColor2))
let aa: ASAttributedString = .init("先下载原件,然后打印去签字/盖章,最后扫描签字/盖章件上传", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.brandMainColor))
label.attributed.text = a + aa
return label
}()
centerView.addSubview(subTitleLabel)
subTitleLabel.snp.makeConstraints { make in
make.left.equalTo(15)
make.right.equalTo(-15)
make.top.equalTo(38.5)
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
// titleLabel.text = dataSource.doc_name
// subTitleLabel.text = "\(dataSource.doc_type)"
}
}
//
// YHDocumentToActionTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/3/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHDocumentToActionTableViewCell: UITableViewCell {
typealias Block = (YHMyFileMethodType) -> ()
var block: Block?
var centerView: UIView!
var titleLabel: UILabel!
var topLineView: UIView!
var bottomView: UIView!
var bottomLeftLineView: UIView!
var bottomRightLineView: UIView!
var fileImageView: UIImageView!
var fileNameLabel: UILabel!
var editButton: UIButton!
var submitButton: UIButton!
var lookButton: UIButton!
var dataSource: YHMyDocumentWritingDocumentDocSignModel? {
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
let width = (KScreenWidth - 32)/3.0
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.bottom.equalTo(-8)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.text = "电子签"
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(24)
}
topLineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(topLineView)
topLineView.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(18)
make.height.equalTo(1)
make.top.equalTo(52)
}
bottomView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.right.left.equalToSuperview()
make.height.equalTo(1)
make.top.equalTo(123)
}
bottomLeftLineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(bottomLeftLineView)
bottomLeftLineView.snp.makeConstraints { make in
make.left.equalTo(width)
make.width.equalTo(1)
make.bottom.equalTo(-17.5)
make.height.equalTo(16)
}
bottomRightLineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(bottomRightLineView)
bottomRightLineView.snp.makeConstraints { make in
make.left.equalTo(width * 2)
make.width.equalTo(1)
make.bottom.equalTo(-17.5)
make.height.equalTo(16)
}
editButton = {
let button = UIButton(type: .custom)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.setTitle("签署", for: .normal)
button.addTarget(self, action: #selector(editButtonClick), for: .touchUpInside)
return button
}()
centerView.addSubview(editButton)
editButton.snp.makeConstraints { make in
make.left.bottom.equalToSuperview()
make.top.equalTo(bottomView.snp.bottom)
make.width.equalTo(width)
}
submitButton = {
let button = UIButton(type: .custom)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.setTitle("查看", for: .normal)
button.addTarget(self, action: #selector(submitButtonClick), for: .touchUpInside)
return button
}()
centerView.addSubview(submitButton)
submitButton.snp.makeConstraints { make in
make.bottom.equalToSuperview()
make.top.equalTo(bottomView.snp.bottom)
make.left.equalTo(width)
make.width.equalTo(width)
}
lookButton = {
let button = UIButton(type: .custom)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.setTitle("下载", for: .normal)
button.addTarget(self, action: #selector(lookButtonClick), for: .touchUpInside)
return button
}()
centerView.addSubview(lookButton)
lookButton.snp.makeConstraints { make in
make.right.bottom.equalToSuperview()
make.top.equalTo(bottomView.snp.bottom)
make.width.equalTo(width)
}
fileImageView = {
let view = UIImageView()
view.image = UIImage(named: "")
return view
}()
centerView.addSubview(fileImageView)
fileImageView.snp.makeConstraints { make in
make.left.equalTo(24)
make.centerY.equalToSuperview()
make.width.height.equalTo(31)
}
fileNameLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor.mainTextColor
label.numberOfLines = 0
label.text = "雇主的推荐信(仅签字)华为科技有限公司.doc"
return label
}()
centerView.addSubview(fileNameLabel)
fileNameLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(67)
make.height.equalTo(40)
make.centerY.equalToSuperview()
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
// titleLabel.text = dataSource.doc_name
// subTitleLabel.text = "\(dataSource.doc_type)"
}
@objc func editButtonClick() {
if let block = block {
block(.sign)
}
}
@objc func lookButtonClick() {
if let block = block {
block(.look)
}
}
@objc func submitButtonClick() {
if let block = block {
block(.downLoad)
}
}
}
//
// YHDocumentUploadTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/3/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHDocumentUploadTableViewCell: UITableViewCell {
typealias Block = (YHMyFileMethodType, Int) -> ()
var block: Block?
var centerView: UIView!
var titleLabel: UILabel!
var topLineView: UIView!
var fileImageView: UIImageView!
var fileNameLabel: UILabel!
var promptLabel: UILabel!
var bottomView: YHWorkItemAddView!
var dataSource: YHMyDocumentWritingDocumentDocSignModel? {
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
let width = (KScreenWidth - 32)/3.0
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.bottom.equalTo(-8)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.text = "上传已签章件"
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(24)
}
topLineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(topLineView)
topLineView.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(18)
make.height.equalTo(1)
make.top.equalTo(52)
}
fileImageView = {
let view = UIImageView()
view.image = UIImage(named: "")
return view
}()
centerView.addSubview(fileImageView)
fileImageView.snp.makeConstraints { make in
make.left.equalTo(24)
make.centerY.equalToSuperview()
make.width.height.equalTo(31)
}
fileNameLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor.mainTextColor
label.numberOfLines = 0
label.text = "雇主的推荐信(仅签字)华为科技有限公司.doc"
return label
}()
centerView.addSubview(fileNameLabel)
fileNameLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(67)
make.height.equalTo(40)
make.centerY.equalToSuperview()
}
promptLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.labelTextColor2
label.numberOfLines = 0
label.text = "注意:1.支持PDF、JPEG、JPG、PNG、BMP、TIFF文件格式,文件大小不限制;2.上传成功后会自动更新文件名;3.最多上传10张图片或文件,若有问题可联系文案"
return label
}()
centerView.addSubview(promptLabel)
promptLabel.snp.makeConstraints { make in
make.right.equalTo(-16)
make.left.equalTo(16)
make.height.equalTo(60)
make.bottom.equalTo(-16)
}
bottomView = {
let view = YHWorkItemAddView()
view.addBtn.setTitle("上传已签章件".local, for: .normal)
view.clickBlock = {[weak self] in
guard let self = self else { return }
if let block = self.block {
block(.upload, 0)
}
}
return view
}()
centerView.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.bottom.equalTo(-92)
make.left.equalTo(18)
make.right.equalTo(-18)
make.height.equalTo(45)
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
// titleLabel.text = dataSource.doc_name
// subTitleLabel.text = "\(dataSource.doc_type)"
}
}
...@@ -11,6 +11,9 @@ import UIKit ...@@ -11,6 +11,9 @@ import UIKit
class YHMyDocumentsDetailViewModel: YHBaseViewModel { class YHMyDocumentsDetailViewModel: YHBaseViewModel {
var mainModel: YHMyDocumentDetailModel? var mainModel: YHMyDocumentDetailModel?
var urlModel: YHMyDocumentsUrlModel? var urlModel: YHMyDocumentsUrlModel?
var pageUrl: String?
var personalUrl: String?
override init() { override init() {
super.init() super.init()
} }
...@@ -61,4 +64,135 @@ class YHMyDocumentsDetailViewModel: YHBaseViewModel { ...@@ -61,4 +64,135 @@ class YHMyDocumentsDetailViewModel: YHBaseViewModel {
callBackBlock(false, err) callBackBlock(false, err)
} }
} }
func requestDocumentSubmit(_ supplementId: String, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String : Any] = ["supplement_id": supplementId]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Documents.submit
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
// authority 1-读 2-写
func requestDocumentRecord(_ supplementId: String, _ authority: Int, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String : Any] = ["supplement_id": supplementId,
"authority": authority]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Documents.record
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestSignaturePageURL(_ id: String, callBackBlock:@escaping (_ success: Bool?, _ error: YHErrorModel?)->()) {
// let params: [String : Any] = ["order_id": orderId]
let params: [String : Any] = ["id": id]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.pageUrl
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
// let dic = json.data
// guard let result = YHMySignatureURLModel.deserialize(from: dic as? Dictionary) else {
// callBackBlock(false,nil)
// return
// }
self.pageUrl = json.data as? String
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestSignaturePersonalURL(callBackBlock:@escaping (_ success: Bool?, _ error: YHErrorModel?)->()) {
// let params: [String : Any] = ["order_id": orderId]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.personalUrl
let _ = YHNetRequest.postRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHMySignatureURLModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.personalUrl = result.url
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestSignatureLook(_ id: String, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String : Any] = ["id": id]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.look
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHMySignatureURLModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.pageUrl = result.url
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestSignatureDownload(_ id: String, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String : Any] = ["id": id]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.download
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHMySignatureURLModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.pageUrl = result.url
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
} }
...@@ -176,6 +176,16 @@ extension YHMySignatureDetailViewController: UITableViewDelegate, UITableViewDat ...@@ -176,6 +176,16 @@ extension YHMySignatureDetailViewController: UITableViewDelegate, UITableViewDat
printLog("下载") printLog("下载")
case .look: case .look:
printLog("查看") printLog("查看")
case .edit:
break
case .submit:
break
case .upload:
break
case .delete:
break
case .reUpload:
break
} }
} }
cell.backgroundColor = .clear cell.backgroundColor = .clear
......
...@@ -12,6 +12,11 @@ enum YHMyFileMethodType: Int { ...@@ -12,6 +12,11 @@ enum YHMyFileMethodType: Int {
case sign = 0 // 签署 case sign = 0 // 签署
case downLoad = 1 // 下载 case downLoad = 1 // 下载
case look = 2 // 查看 case look = 2 // 查看
case edit = 3 // 编辑
case submit = 4 // 提交
case upload = 5 // 上传
case delete = 6 // 删除
case reUpload = 7 // 重传
} }
class YHMyFileMethodTableViewCell: UITableViewCell { class YHMyFileMethodTableViewCell: UITableViewCell {
......
...@@ -105,4 +105,50 @@ class YHMySignatureDetailViewModel: YHBaseViewModel { ...@@ -105,4 +105,50 @@ class YHMySignatureDetailViewModel: YHBaseViewModel {
callBackBlock(false, err) callBackBlock(false, err)
} }
} }
func requestSignatureLook(_ id: String, callBackBlock:@escaping (_ success: Bool?, _ error: YHErrorModel?)->()) {
let params: [String : Any] = ["id": id]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.look
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHMySignatureURLModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.pageUrl = result.url
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestSignatureDownload(_ id: String, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String : Any] = ["id": id]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.download
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHMySignatureURLModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.pageUrl = result.url
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
} }
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "document_prompt_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "document_prompt_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "document_prompt_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "document_prompt_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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