Commit 611667f3 authored by David黄金龙's avatar David黄金龙

Merge commit '2bfd6f29' into davidhuang

* commit '2bfd6f29':
  我的签字 我的文书详情页逻辑

# Conflicts:
#	galaxy/galaxy.xcodeproj/project.pbxproj
#	galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyDocuments(我的文书)/V/YHDocumentUploadView.swift
#	galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyDocuments(我的文书)/V/YHFileItemView.swift
parents f6a8337c 2bfd6f29
......@@ -20,6 +20,7 @@
044867B42BA1953B00DFAD4A /* YHCertificateFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044867B32BA1953B00DFAD4A /* YHCertificateFilterView.swift */; };
044867B62BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044867B52BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift */; };
044867B82BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044867B72BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift */; };
044CF8D42BB6BCF700008CE8 /* YHSignatureUploadTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044CF8D32BB6BCF700008CE8 /* YHSignatureUploadTableViewCell.swift */; };
045EEE792B9F171A0022A143 /* YHPreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9A2B9F171A0022A143 /* YHPreviewViewModel.swift */; };
045EEE7A2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9C2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift */; };
045EEE7B2B9F171A0022A143 /* YHPersonInfoCellModel2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9D2B9F171A0022A143 /* YHPersonInfoCellModel2.swift */; };
......@@ -254,6 +255,8 @@
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */; };
A517A4DF2BB53BE8000DEECD /* YHDocListBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A517A4DE2BB53BE8000DEECD /* YHDocListBottomView.swift */; };
A517A4E12BB573EB000DEECD /* YHDocListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A517A4E02BB573EB000DEECD /* YHDocListCell.swift */; };
A517A4E42BB6C4BB000DEECD /* YHDocumentUploadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A517A4E22BB6C4BB000DEECD /* YHDocumentUploadView.swift */; };
A517A4E52BB6C4BB000DEECD /* YHFileItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A517A4E32BB6C4BB000DEECD /* YHFileItemView.swift */; };
A520124F2BABCE05008655EA /* YHFileListContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A520124E2BABCE05008655EA /* YHFileListContentView.swift */; };
A53026902B4E6F2700F35102 /* YHHomeCustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */; };
A53B61122BB128AF0010B573 /* YHFileListItemsView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53B61112BB128AF0010B573 /* YHFileListItemsView2.swift */; };
......@@ -415,6 +418,7 @@
044867B32BA1953B00DFAD4A /* YHCertificateFilterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateFilterView.swift; sourceTree = "<group>"; };
044867B52BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateFilterItemCell.swift; sourceTree = "<group>"; };
044867B72BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadFailTipsView.swift; sourceTree = "<group>"; };
044CF8D32BB6BCF700008CE8 /* YHSignatureUploadTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSignatureUploadTableViewCell.swift; sourceTree = "<group>"; };
045EED9A2B9F171A0022A143 /* YHPreviewViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPreviewViewModel.swift; sourceTree = "<group>"; };
045EED9C2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPreviewForOtherInfoModel.swift; sourceTree = "<group>"; };
045EED9D2B9F171A0022A143 /* YHPersonInfoCellModel2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPersonInfoCellModel2.swift; sourceTree = "<group>"; };
......@@ -652,6 +656,8 @@
A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceCenterSecondViewController.swift; sourceTree = "<group>"; };
A517A4DE2BB53BE8000DEECD /* YHDocListBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocListBottomView.swift; sourceTree = "<group>"; };
A517A4E02BB573EB000DEECD /* YHDocListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocListCell.swift; sourceTree = "<group>"; };
A517A4E22BB6C4BB000DEECD /* YHDocumentUploadView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHDocumentUploadView.swift; sourceTree = "<group>"; };
A517A4E32BB6C4BB000DEECD /* YHFileItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFileItemView.swift; sourceTree = "<group>"; };
A520124E2BABCE05008655EA /* YHFileListContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFileListContentView.swift; sourceTree = "<group>"; };
A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeCustomCell.swift; sourceTree = "<group>"; };
A53B61112BB128AF0010B573 /* YHFileListItemsView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListItemsView2.swift; sourceTree = "<group>"; };
......@@ -1192,6 +1198,7 @@
children = (
045EEE262B9F171A0022A143 /* YHMySignatureListTableViewCell.swift */,
0435FA802BA186D600024EAE /* YHMyFileMethodTableViewCell.swift */,
044CF8D32BB6BCF700008CE8 /* YHSignatureUploadTableViewCell.swift */,
0435FA7E2BA178C100024EAE /* YHCommonAlertView.swift */,
);
path = V;
......@@ -1628,6 +1635,8 @@
A53B61172BB3C9410010B573 /* V */ = {
isa = PBXGroup;
children = (
A517A4E22BB6C4BB000DEECD /* YHDocumentUploadView.swift */,
A517A4E32BB6C4BB000DEECD /* YHFileItemView.swift */,
04EA23072BB50753009DA928 /* YHDocumentMessageTableViewCell.swift */,
04EA23092BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift */,
04EA230B2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift */,
......@@ -2334,6 +2343,7 @@
045EEEBF2B9F171A0022A143 /* YHWorkFileItemView.swift in Sources */,
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */,
A520124F2BABCE05008655EA /* YHFileListContentView.swift in Sources */,
A517A4E42BB6C4BB000DEECD /* YHDocumentUploadView.swift in Sources */,
045EEF042B9F171A0022A143 /* YHIdentityCardCell.swift in Sources */,
045EEEB42B9F171A0022A143 /* YHWorkExampleMessageTableViewCell.swift in Sources */,
045EEF132B9F171A0022A143 /* YHCountryMessage.swift in Sources */,
......@@ -2475,6 +2485,7 @@
045EEF1D2B9F171A0022A143 /* YHAddressPickView.swift in Sources */,
A58AC0A12BAC0B2900A30FA9 /* YHFileListItemView.swift in Sources */,
045EEED12B9F171A0022A143 /* YHScorePersonInfoCell.swift in Sources */,
044CF8D42BB6BCF700008CE8 /* YHSignatureUploadTableViewCell.swift in Sources */,
045EEF0D2B9F171A0022A143 /* YHBasicInfoFillCell.swift in Sources */,
045EEEEC2B9F171A0022A143 /* YHBrotherInfoVC.swift in Sources */,
0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */,
......@@ -2533,6 +2544,7 @@
04EA230C2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift in Sources */,
A5C5B2EA2B4ECA4D00A7C5D1 /* YHDavidModel0.swift in Sources */,
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */,
A517A4E52BB6C4BB000DEECD /* YHFileItemView.swift in Sources */,
045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */,
045EEEDD2B9F171A0022A143 /* YHCollegeNameCell.swift in Sources */,
045EEF162B9F171A0022A143 /* YHMainApplicantInformationViewController.swift in Sources */,
......
......@@ -26,6 +26,7 @@ enum YHCertificateEditType:Int {
case preview = 2
case delete = 3
case cancel = 4
case reUpload = 5
}
class YHCertificateEditItem {
......
......@@ -46,6 +46,7 @@ class YHMyDocumentWritingDocumentModel: YHBaseModel {
}
class YHMyDocumentWritingDocumentDocSignModel: YHBaseModel {
var id: Int = 0
var is_upload: Int = 0
var supplement_id: Int = 0
var doc_send: String = ""
......
......@@ -22,7 +22,7 @@ class YHDocumentToActionTableViewCell: UITableViewCell {
var editButton: UIButton!
var submitButton: UIButton!
var lookButton: UIButton!
var dataSource: YHMyDocumentWritingDocumentDocSignModel? {
var dataSource: YHMyDocumentDetailModel? {
didSet {
updateAllViews()
}
......@@ -208,8 +208,23 @@ class YHDocumentToActionTableViewCell: UITableViewCell {
func updateAllViews() {
guard let dataSource = dataSource else { return }
// titleLabel.text = dataSource.doc_name
// subTitleLabel.text = "\(dataSource.doc_type)"
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)
fileNameLabel.text = dataSource.writing_document.name
}
@objc func editButtonClick() {
......@@ -220,13 +235,13 @@ class YHDocumentToActionTableViewCell: UITableViewCell {
@objc func lookButtonClick() {
if let block = block {
block(.look)
block(.downLoad)
}
}
@objc func submitButtonClick() {
if let block = block {
block(.downLoad)
block(.look)
}
}
}
......
......@@ -14,12 +14,11 @@ class YHDocumentUploadTableViewCell: UITableViewCell {
var centerView: UIView!
var titleLabel: UILabel!
var topLineView: UIView!
var fileImageView: UIImageView!
var fileNameLabel: UILabel!
var promptLabel: UILabel!
var mainItemView: UIView!
var bottomView: YHWorkItemAddView!
var dataSource: YHMyDocumentWritingDocumentDocSignModel? {
var dataSource: YHMyDocumentDetailModel? {
didSet {
updateAllViews()
}
......@@ -77,47 +76,6 @@ class YHDocumentUploadTableViewCell: UITableViewCell {
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)
......@@ -152,13 +110,57 @@ class YHDocumentUploadTableViewCell: UITableViewCell {
make.right.equalTo(-18)
make.height.equalTo(45)
}
mainItemView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
centerView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalTo(-153)
make.top.equalTo(52)
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
// titleLabel.text = dataSource.doc_name
// subTitleLabel.text = "\(dataSource.doc_type)"
mainItemView.removeSubviews()
var y = 0
for i in 0 ..< (dataSource.writing_document.doc_sign.doc_return_manual.count) {
let line = UIView()
line.backgroundColor = UIColor.separatorColor
mainItemView.addSubview(line)
line.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(y)
make.height.equalTo(1)
make.right.equalTo(-18)
}
y = y + 1
let data = dataSource.writing_document.doc_sign.doc_return_manual[i]
let h = 51
let itemView = YHFileItemView()
itemView.index = i
itemView.docType = dataSource.writing_document.doc_sign.doc_type
itemView.dataSource = data
itemView.itemBlock = {[weak self] type, index in
guard let self = self else { return }
if let block = block {
block(type, index)
}
}
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(y)
make.height.equalTo(h)
make.right.equalTo(-18)
}
y = y + h
}
}
}
//
// YHFileItemView.swift
// galaxy
//
// Created by EDY on 2024/3/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHFileItemView: UIView {
typealias ItemBlock = (YHMyFileMethodType, Int) -> ()
var itemBlock: ItemBlock?
var fileImageView: UIImageView!
var fileNameLabel: UILabel!
var deleteButton: UIButton!
var centerButton: UIButton!
var index: Int = 0
var docType: Int = 0
var dataSource: String? {
didSet {
updateAllViews()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
fileImageView = {
let view = UIImageView()
view.image = UIImage(named: "")
return view
}()
addSubview(fileImageView)
fileImageView.snp.makeConstraints { make in
make.left.equalTo(6)
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
}()
addSubview(fileNameLabel)
fileNameLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(49)
make.top.bottom.equalToSuperview()
}
centerButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(centerClick), for: .touchUpInside)
return button
}()
addSubview(centerButton)
centerButton.snp.makeConstraints { make in
make.right.top.bottom.equalToSuperview()
make.left.equalTo(112)
}
deleteButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "my_cer_btn_edit"), for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
return button
}()
addSubview(deleteButton)
deleteButton.snp.makeConstraints { make in
make.right.equalToSuperview()
make.centerY.equalToSuperview()
make.width.height.equalTo(16)
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
// 1-代理委托书,2-受养人声明,3-工作经验补充表,4-声明书,5-人才清单声明书,6-个人陈述书,7-推荐信,8-组织架构图
var name = ""
if docType == 1 {
name = "代理委托书"
}
if docType == 2 {
name = "受养人声明"
}
if docType == 3 {
name = "工作经验补充表"
}
if docType == 4 {
name = "声明书"
}
if docType == 5 {
name = "人才清单声明书"
}
if docType == 6 {
name = "个人陈述书"
}
if docType == 7 {
name = "推荐信"
}
if docType == 8 {
name = "组织架构图"
}
let suffix = dataSource.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)
fileNameLabel.text = name + "." + suffix + "(已签章)"
}
@objc func centerClick() {
if let block = itemBlock {
block(.look, index)
}
}
@objc func deleteClick() {
let items = [YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.reUpload, title:"重传"),
YHCertificateEditItem(type:.delete, title:"删除"),
YHCertificateEditItem(type:.cancel, title:"取消")]
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
guard let self = self else { return }
if editType == .reUpload {
if let block = itemBlock {
block(.reUpload, index)
}
} else if editType == .delete { // 删除
if let block = itemBlock {
block(.delete, index)
}
} else if editType == .preview { // 预览
if let block = itemBlock {
block(.look, index)
}
}
}.show()
}
}
......@@ -158,11 +158,7 @@ class YHMyDocumentsDetailViewModel: YHBaseViewModel {
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
self.pageUrl = json.data as? String
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
......@@ -195,4 +191,66 @@ class YHMyDocumentsDetailViewModel: YHBaseViewModel {
callBackBlock(false, err)
}
}
func requestFileAction(_ id: String, _ type: Int, _ newArray: [String], _ oldUrl: String,callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String : Any] = ["id": id,
"op_type": type,
"new_url": newArray,
"old_url": oldUrl]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.upload
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
// 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 requestSignCallBack(_ 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.callBack
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
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 requestSignConfirm(_ 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.confirm
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
}
//
// YHSignatureUploadTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/3/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSignatureUploadTableViewCell: UITableViewCell {
typealias Block = (YHMyFileMethodType, Int) -> ()
var block: Block?
var centerView: UIView!
var titleLabel: UILabel!
var topLineView: UIView!
var promptLabel: UILabel!
var mainItemView: UIView!
var bottomView: YHWorkItemAddView!
var dataSource: YHMySignatureDetailModel? {
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)
}
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)
}
mainItemView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
centerView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalTo(-153)
make.top.equalTo(52)
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
mainItemView.removeSubviews()
var y = 0
for i in 0 ..< (dataSource.doc_return_manual.count) {
let line = UIView()
line.backgroundColor = UIColor.separatorColor
mainItemView.addSubview(line)
line.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(y)
make.height.equalTo(1)
make.right.equalTo(-18)
}
y = y + 1
let data = dataSource.doc_return_manual[i]
let h = 51
let itemView = YHFileItemView()
itemView.index = i
itemView.docType = dataSource.doc_type
itemView.dataSource = data
itemView.itemBlock = {[weak self] type, index in
guard let self = self else { return }
if let block = block {
block(type, index)
}
}
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(y)
make.height.equalTo(h)
make.right.equalTo(-18)
}
y = y + h
}
}
}
......@@ -106,7 +106,7 @@ class YHMySignatureDetailViewModel: YHBaseViewModel {
}
}
func requestSignatureLook(_ id: String, callBackBlock:@escaping (_ success: Bool?, _ error: YHErrorModel?)->()) {
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
......@@ -114,11 +114,7 @@ class YHMySignatureDetailViewModel: YHBaseViewModel {
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
self.pageUrl = json.data as? String
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
......@@ -151,4 +147,48 @@ class YHMySignatureDetailViewModel: YHBaseViewModel {
callBackBlock(false, err)
}
}
func requestSignConfirm(_ 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.confirm
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
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 requestFileAction(_ id: String, _ type: Int, _ newArray: [String], _ oldUrl: String,callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String : Any] = ["id": id,
"op_type": type,
"new_url": newArray,
"old_url": oldUrl]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Signature.upload
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
// 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)
}
}
}
......@@ -153,8 +153,8 @@ class YHStepView: UIScrollView {
@objc func buttonClick(_ button: UIButton) {
let tag = button.tag
if tag - 1000 <= maxIndex {
currentIndex = tag - 1000
if let block = block {
currentIndex = tag - 1000
block(currentIndex)
}
}
......
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