Commit 690d3da2 authored by David黄金龙's avatar David黄金龙

Merge branch '630-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into 630-dev

* '630-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  微信分享小程序部分代码
parents 7bf0a0bb f349e07c
......@@ -23,7 +23,9 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
var oldUrl: String?
var type: Int = 0
var isSign: Bool = false
var isAuth: Bool = true //小程序分享字段
var fileType: String = "sign"
var orderID: Int = 0
lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds)
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
......@@ -376,6 +378,18 @@ class YHMyDocumentsDetailViewController: YHBaseViewController {
}
}
func getMiniPath() -> String {
var isAuthString = ""
if isAuth {
isAuthString = "true"
} else {
isAuthString = "false"
}
// let path = "/serviceHousekeeper/pages/documentEdit/documentEdit?id=\(self.id)&docType=\(self.fileType)&signId=\(self.viewModel.mainModel?.writing_document.doc_sign.id ?? 0)&auth=\(isAuthString)&order_id=\(orderID)"
let path = "/serviceHousekeeper/pages/documentEdit/documentEdit?id=\(self.id)&docType=doc&signId=\(self.viewModel.mainModel?.writing_document.doc_sign.id ?? 0)&auth=\(isAuthString)&order_id=\(orderID)"
return path
}
deinit {
removeNotify()
}
......@@ -453,6 +467,7 @@ extension YHMyDocumentsDetailViewController: UITableViewDelegate, UITableViewDat
let cell = tableView.dequeueReusableCell(withClass: YHDocumentToActionTableViewCell.self)
cell.dataSource = self.viewModel.mainModel
cell.isSign = self.isSign
cell.nimiPath = getMiniPath()
if self.type == 5 || self.type == 4 {
cell.isSign = true
}
......
......@@ -356,6 +356,9 @@ extension YHMyDocumentsListViewController: UITableViewDelegate, UITableViewDataS
} else {
let vc = YHMyDocumentsDetailViewController()
vc.id = model.id
vc.isAuth = viewModel?.mainModel?.user_info.is_auth ?? true
vc.fileType = model.file_type
vc.orderID = orderId
self.navigationController?.pushViewController(vc)
}
}
......
......@@ -18,10 +18,13 @@ class YHDocumentToActionTableViewCell: UITableViewCell {
var bottomLeftLineView: UIView!
var bottomRightLineView: UIView!
var fileImageView: UIImageView!
var fileNameLabel: UILabel!
var fileNameLabel: UILabel!
var shareButton: UIButton!
var editButton: UIButton!
var submitButton: UIButton!
var lookButton: UIButton!
var nimiPath: String = ""
var dataSource: YHMyDocumentDetailModel? {
didSet {
updateAllViews()
......@@ -97,6 +100,20 @@ class YHDocumentToActionTableViewCell: UITableViewCell {
make.top.equalTo(52)
}
shareButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "share_mini_program"), for: .normal)
button.addTarget(self, action: #selector(shareButtonClick), for: .touchUpInside)
return button
}()
centerView.addSubview(shareButton)
shareButton.snp.makeConstraints { make in
make.top.equalTo(18)
make.right.equalTo(-24)
make.height.equalTo(20)
make.width.equalTo(80)
}
bottomView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
......@@ -253,6 +270,10 @@ class YHDocumentToActionTableViewCell: UITableViewCell {
}
}
@objc func shareButtonClick() {
YHShareManager.shared.sendMiniProgram(path: nimiPath)
}
func updataButton() {
if isSign {
bottomLeftLineView.isHidden = true
......
......@@ -21,6 +21,8 @@ class YHMySignatureDetailViewController: YHBaseViewController {
var oldUrl: String?
var type: Int = 0
var isSign: Bool = false
var isAuth: Bool = true //小程序分享字段
var orderID: Int = 0
lazy var previewFileTool:YHFilePreviewTool = {
let tool = YHFilePreviewTool(targetVC: self)
return tool
......@@ -332,6 +334,17 @@ class YHMySignatureDetailViewController: YHBaseViewController {
}
}
func getMiniPath() -> String {
var isAuthString = ""
if isAuth {
isAuthString = "true"
} else {
isAuthString = "false"
}
let path = "/serviceHousekeeper/pages/documentEdit/documentEdit?id=\(self.id)&docType=sign&signId=\(self.id)&auth=\(isAuthString)&order_id=\(orderID)"
return path
}
deinit {
removeNotify()
}
......@@ -353,6 +366,7 @@ extension YHMySignatureDetailViewController: UITableViewDelegate, UITableViewDat
let cell = tableView.dequeueReusableCell(withClass: YHSignatureToActionTableViewCell.self)
cell.dataSource = self.viewModel.mainModel
cell.isSign = self.isSign
cell.nimiPath = getMiniPath()
if self.type == 5 || self.type == 4 {
cell.isSign = true
}
......
......@@ -341,6 +341,8 @@ extension YHMySignatureListViewController: UITableViewDelegate, UITableViewDataS
} else {
let vc = YHMySignatureDetailViewController()
vc.id = model.id
vc.isAuth = viewModel.mainModel?.user_info.is_auth ?? true
vc.orderID = orderId
self.navigationController?.pushViewController(vc)
}
}
......
......@@ -34,6 +34,8 @@ class YHSignatureToActionTableViewCell: UITableViewCell {
var editButton: UIButton!
var submitButton: UIButton!
var lookButton: UIButton!
var nimiPath: String = ""
var dataSource: YHMySignatureDetailModel? {
didSet {
updateAllViews()
......@@ -281,7 +283,7 @@ class YHSignatureToActionTableViewCell: UITableViewCell {
}
@objc func shareButtonClick() {
YHShareManager.shared.sendMiniProgram()
YHShareManager.shared.sendMiniProgram(path: nimiPath)
}
func updataButton() {
......
......@@ -202,23 +202,26 @@ extension YHShareManager {
}
}
func sendMiniProgram() {
func sendMiniProgram(path: String) {
guard WXApi.isWXAppInstalled() else {
YHHUD.flash(message: "拉起微信失败")
return
}
let iamge = UIImage(named: "my_doc_share") ?? UIImage()
let message = WXMediaMessage()
//发送的小程序
let object = WXMiniProgramObject()
object.path = ""
object.path = path
object.webpageUrl = ""
object.userName = "gh_35ddbd2e68d4"
object.miniProgramType = .preview
message.mediaObject = object
message.title = "智汇银河"
message.description = "小程序"
message.thumbData = nil
message.title = "有文书分享转发给您,需要您帮忙签署,快来看看吧~"
message.description = "有文书分享转发给您,需要您帮忙签署,快来看看吧~"
// message.thumbData = nil
message.setThumbImage(iamge)
let req = SendMessageToWXReq()
req.bText = false
req.message = message
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "my_doc_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "my_doc_share@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