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

// 文书签字 微信上传

parent 144f86d9
...@@ -233,6 +233,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -233,6 +233,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
} else if extMsg == "wx_upload_renewal_data" { } else if extMsg == "wx_upload_renewal_data" {
NotificationCenter.default.post(name: YhConstant.YhNotification.didMyResignMaterialWeChatFileUploadCallBackNotification, object: nil) NotificationCenter.default.post(name: YhConstant.YhNotification.didMyResignMaterialWeChatFileUploadCallBackNotification, object: nil)
} else if extMsg == "wx_upload_sign_apply" {
NotificationCenter.default.post(name: YhConstant.YhNotification.didMySignWeChatFileUploadCallBackNotification, object: nil)
} }
} }
......
...@@ -68,7 +68,7 @@ class YHMyDocumentsDetailViewController: YHBaseViewController { ...@@ -68,7 +68,7 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
getData() getData()
} }
func getData() { @objc 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 success { if success {
...@@ -643,6 +643,11 @@ extension YHMyDocumentsDetailViewController: UITableViewDelegate, UITableViewDat ...@@ -643,6 +643,11 @@ extension YHMyDocumentsDetailViewController: UITableViewDelegate, UITableViewDat
maxCount = 9 maxCount = 9
} }
let sheetView = YHDocumentUploadView.sheetView() let sheetView = YHDocumentUploadView.sheetView()
sheetView.uploadTypeArr = [ YHCertificateUploadItem(type:.camera, title:"拍照上传"),
YHCertificateUploadItem(type:.photo, title:"相册上传"),
YHCertificateUploadItem(type:.phoneFile, title:"手机文件上传", subtitle:"从手机文件管理中上传"),
YHCertificateUploadItem(type:.wechatUpload, title:"微信上传"),
YHCertificateUploadItem(type:.cancel, title:"取消")]
sheetView.maxSelectCount = maxCount sheetView.maxSelectCount = maxCount
sheetView.uploadFilesBlock = { sheetView.uploadFilesBlock = {
[weak self] fileUrl in [weak self] fileUrl in
...@@ -693,6 +698,18 @@ extension YHMyDocumentsDetailViewController: UITableViewDelegate, UITableViewDat ...@@ -693,6 +698,18 @@ extension YHMyDocumentsDetailViewController: UITableViewDelegate, UITableViewDat
} }
} }
} }
sheetView.wechatUploadBlock = {
[weak self] in
guard let self = self else { return }
let token = YHLoginManager.shared.h5Token
var opt_type = 1
if let oldUrl = self.oldUrl, !oldUrl.isEmpty {
opt_type = 2
}
let path = "/superApp/pages/wxUpload/wxUpload?param=\(token)&id=\(self.id)&opt_type=\(opt_type)&type=wx_upload_sign_apply&old_url=\(self.oldUrl ?? "")"
YHShareManager.shared.openMiniProgram(path:path, title: "微信上传")
}
sheetView.show() sheetView.show()
} }
...@@ -851,6 +868,9 @@ extension YHMyDocumentsDetailViewController { ...@@ -851,6 +868,9 @@ extension YHMyDocumentsDetailViewController {
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(getData), name: YhConstant.YhNotification.didMySignWeChatFileUploadCallBackNotification, object: nil)
} }
func removeNotify() { func removeNotify() {
......
...@@ -24,12 +24,23 @@ class YHDocumentUploadView: UIView { ...@@ -24,12 +24,23 @@ class YHDocumentUploadView: UIView {
} }
} }
var tips = "" {
didSet {
updateLayouts()
}
}
var templateArr: [YHMaterialPath] = [] var templateArr: [YHMaterialPath] = []
var uploadTypeArr = [ var uploadTypeArr = [
YHCertificateUploadItem(type:.camera, title:"拍照上传"), YHCertificateUploadItem(type:.camera, title:"拍照上传"),
YHCertificateUploadItem(type:.photo, title:"相册上传"), YHCertificateUploadItem(type:.photo, title:"相册上传"),
YHCertificateUploadItem(type:.phoneFile, title:"手机文件上传", subtitle:"从手机文件管理中上传"), YHCertificateUploadItem(type:.phoneFile, title:"手机文件上传", subtitle:"从手机文件管理中上传"),
YHCertificateUploadItem(type:.cancel, title:"取消")] YHCertificateUploadItem(type:.cancel, title:"取消")]
{
didSet {
updateLayouts()
}
}
// 上传文件 // 上传文件
var uploadFilesBlock:((URL)->())? var uploadFilesBlock:((URL)->())?
...@@ -37,6 +48,8 @@ class YHDocumentUploadView: UIView { ...@@ -37,6 +48,8 @@ class YHDocumentUploadView: UIView {
var uploadImageBlock:(([YHSelectImageItem])->())? var uploadImageBlock:(([YHSelectImageItem])->())?
// 点击模板 // 点击模板
var clickTemplateBlock:((YHMaterialPath?)->())? var clickTemplateBlock:((YHMaterialPath?)->())?
// 微信上传
var wechatUploadBlock:(()->())?
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
let view = UIView() let view = UIView()
...@@ -59,6 +72,7 @@ class YHDocumentUploadView: UIView { ...@@ -59,6 +72,7 @@ class YHDocumentUploadView: UIView {
let line = UIView() let line = UIView()
line.backgroundColor = .separatorColor line.backgroundColor = .separatorColor
line.isHidden = true
view.addSubview(line) view.addSubview(line)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
...@@ -179,6 +193,38 @@ class YHDocumentUploadView: UIView { ...@@ -179,6 +193,38 @@ class YHDocumentUploadView: UIView {
make.top.equalTo(topView.snp.bottom).offset(-1) make.top.equalTo(topView.snp.bottom).offset(-1)
} }
} }
func updateLayouts() {
let whiteHeight = calculateHeight()
whiteContentView.snp.remakeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(whiteHeight)
}
topView.snp.remakeConstraints { make in
make.top.left.right.equalToSuperview()
}
tableView.snp.remakeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(topView.snp.bottom).offset(0)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
func calculateHeight() -> CGFloat {
// 底部5个操作行高度之和
let actionsHeight = 52.0 * Double(uploadTypeArr.count)
var tableViewHeight = actionsHeight
// 白色View总高度
var totalHeight = 53.0+tableViewHeight+k_Height_safeAreaInsetsBottom()
if totalHeight > KScreenHeight {
totalHeight = 458
}
return totalHeight
}
} }
extension YHDocumentUploadView { extension YHDocumentUploadView {
...@@ -225,6 +271,9 @@ extension YHDocumentUploadView: UITableViewDelegate, UITableViewDataSource { ...@@ -225,6 +271,9 @@ extension YHDocumentUploadView: UITableViewDelegate, UITableViewDataSource {
} else if operationItem.type == .phoneFile { } else if operationItem.type == .phoneFile {
selectFile() selectFile()
} else if operationItem.type == .wechatUpload {
selectFileFromWeChatPragram()
} }
} }
} }
...@@ -461,3 +510,11 @@ extension YHDocumentUploadView: UIDocumentPickerDelegate { ...@@ -461,3 +510,11 @@ extension YHDocumentUploadView: UIDocumentPickerDelegate {
} }
} }
extension YHDocumentUploadView {
func selectFileFromWeChatPragram() {
self.wechatUploadBlock?()
dismiss()
}
}
...@@ -63,7 +63,7 @@ class YHMySignatureDetailViewController: YHBaseViewController { ...@@ -63,7 +63,7 @@ class YHMySignatureDetailViewController: YHBaseViewController {
getData() getData()
} }
func getData() { @objc func getData() {
viewModel.requestSignatureDetail("\(id)", callBackBlock: {[weak self] success, error in viewModel.requestSignatureDetail("\(id)", callBackBlock: {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if success { if success {
...@@ -492,7 +492,13 @@ extension YHMySignatureDetailViewController: UITableViewDelegate, UITableViewDat ...@@ -492,7 +492,13 @@ extension YHMySignatureDetailViewController: UITableViewDelegate, UITableViewDat
maxCount = 9 maxCount = 9
} }
let sheetView = YHDocumentUploadView.sheetView() let sheetView = YHDocumentUploadView.sheetView()
sheetView.uploadTypeArr = [ YHCertificateUploadItem(type:.camera, title:"拍照上传"),
YHCertificateUploadItem(type:.photo, title:"相册上传"),
YHCertificateUploadItem(type:.phoneFile, title:"手机文件上传", subtitle:"从手机文件管理中上传"),
YHCertificateUploadItem(type:.wechatUpload, title:"微信上传"),
YHCertificateUploadItem(type:.cancel, title:"取消")]
sheetView.maxSelectCount = maxCount sheetView.maxSelectCount = maxCount
sheetView.uploadFilesBlock = { sheetView.uploadFilesBlock = {
[weak self] fileUrl in [weak self] fileUrl in
guard let self = self else { return } guard let self = self else { return }
...@@ -543,6 +549,18 @@ extension YHMySignatureDetailViewController: UITableViewDelegate, UITableViewDat ...@@ -543,6 +549,18 @@ extension YHMySignatureDetailViewController: UITableViewDelegate, UITableViewDat
} }
} }
} }
sheetView.wechatUploadBlock = {
[weak self] in
guard let self = self else { return }
let token = YHLoginManager.shared.h5Token
var opt_type = 1
if let oldUrl = self.oldUrl, !oldUrl.isEmpty {
opt_type = 2
}
let path = "/superApp/pages/wxUpload/wxUpload?param=\(token)&id=\(self.id)&opt_type=\(opt_type)&type=wx_upload_sign_apply&old_url=\(self.oldUrl ?? "")"
YHShareManager.shared.openMiniProgram(path:path, title: "微信上传")
}
sheetView.show() sheetView.show()
} }
...@@ -700,6 +718,16 @@ extension YHMySignatureDetailViewController { ...@@ -700,6 +718,16 @@ extension YHMySignatureDetailViewController {
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
// self.viewModel.requestFileAction("\(self.id)", action, successArr, self.oldUrl ?? "") {[weak self] success, error in
// guard let self = self else { return }
// self.getData()
// }
NotificationCenter.default.addObserver(self, selector: #selector(getData), name: YhConstant.YhNotification.didMySignWeChatFileUploadCallBackNotification, object: nil)
} }
func removeNotify() { func removeNotify() {
......
...@@ -399,7 +399,7 @@ extension YhConstant { ...@@ -399,7 +399,7 @@ extension YhConstant {
// 我的证件 微信文件上传回调 // 我的证件 微信文件上传回调
public static let didMyCertificateWeChatFileUploadCallBackNotification = Notification.Name(rawValue: "com.yinhe.myCertificate.wechat.fileUpload") public static let didMyCertificateWeChatFileUploadCallBackNotification = Notification.Name(rawValue: "com.yinhe.myCertificate.wechat.fileUpload")
public static let didMyResignMaterialWeChatFileUploadCallBackNotification = Notification.Name(rawValue: "com.yinhe.resignMaterial.wechat.fileUpload") public static let didMyResignMaterialWeChatFileUploadCallBackNotification = Notification.Name(rawValue: "com.yinhe.resignMaterial.wechat.fileUpload")
public static let didMySignWeChatFileUploadCallBackNotification = Notification.Name(rawValue: "com.yinhe.sign.wechat.fileUpload")
// 已经展示银河管家 // 已经展示银河管家
public static let didLoadYhManagerNotification = Notification.Name(rawValue: "com.yinhe.didLoadYhManager") public static let didLoadYhManagerNotification = Notification.Name(rawValue: "com.yinhe.didLoadYhManager")
public static let backToHomeNotification = Notification.Name(rawValue: "com.yinhe.backToHomeNotification") public static let backToHomeNotification = Notification.Name(rawValue: "com.yinhe.backToHomeNotification")
......
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