Commit 3214f962 authored by Steven杜宇's avatar Steven杜宇

// 我的证书

parent 3f581fbd
...@@ -18,7 +18,7 @@ class YHCertificateResourceUploadVC: YHBaseViewController { ...@@ -18,7 +18,7 @@ class YHCertificateResourceUploadVC: YHBaseViewController {
var status: YHCertificateUploadStatus = .all var status: YHCertificateUploadStatus = .all
var items:[YHSupplementInfo] = [] var items:[YHSupplementInfo] = []
var viewModel: YHCertificateViewModel = YHCertificateViewModel() var viewModel: YHCertificateViewModel = YHCertificateViewModel()
var categoryInfo: YHCategoryData = YHCategoryData() var categoryInfo: YHCategoryData!
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
...@@ -97,20 +97,23 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou ...@@ -97,20 +97,23 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let item = items[indexPath.section]
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateInfoCell.cellReuseIdentifier, for: indexPath) as! YHCertificateInfoCell let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateInfoCell.cellReuseIdentifier, for: indexPath) as! YHCertificateInfoCell
cell.updateModel(item)
cell.templateBlock = { if 0 <= indexPath.section && indexPath.section < items.count {
[weak self] in let item = items[indexPath.section]
guard let self = self else { return } cell.updateModel(item)
let view = YHCertificateTemplateView.templateView(item.templateInfo) cell.templateBlock = {
view.scanTemplateBlock = { [weak self] in
[weak self] temlateInfo in
guard let self = self else { return } guard let self = self else { return }
let vc = UIViewController() let view = YHCertificateTemplateView.templateView(item.templateInfo)
self.navigationController?.pushViewController(vc) view.scanTemplateBlock = {
[weak self] temlateInfo in
guard let self = self else { return }
let vc = UIViewController()
self.navigationController?.pushViewController(vc)
}
view.show()
} }
view.show()
} }
return cell return cell
} }
...@@ -122,6 +125,12 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou ...@@ -122,6 +125,12 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHUploadContentVC() let vc = YHUploadContentVC()
vc.orderId = orderId
vc.categoryInfo = categoryInfo
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
vc.uploadInfo = item
}
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
...@@ -68,7 +68,22 @@ class YHSupplementInfo: SmartCodable { ...@@ -68,7 +68,22 @@ class YHSupplementInfo: SmartCodable {
var applicantName: String = "" var applicantName: String = ""
var nameExtra: YHNameExtra = YHNameExtra() var nameExtra: YHNameExtra = YHNameExtra()
var templateInfo: YHTemplateInfo = YHTemplateInfo() var templateInfo: YHTemplateInfo = YHTemplateInfo()
var auditContent: String = ""
var uploadRequirement: String = ""
var contentUrl: [YHContentUrl] = [] var contentUrl: [YHContentUrl] = []
func getStatusName() -> String {
if checkStatus == YHCertificateUploadStatus.review.rawValue {
return "审核中".local
} else if checkStatus == YHCertificateUploadStatus.preUpload.rawValue {
return "待上传".local
} else if checkStatus == YHCertificateUploadStatus.finish.rawValue {
return "已通过".local
} else if checkStatus == YHCertificateUploadStatus.rejected.rawValue {
return "已驳回".local
}
return ""
}
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id = "id" case id = "id"
...@@ -81,6 +96,8 @@ class YHSupplementInfo: SmartCodable { ...@@ -81,6 +96,8 @@ class YHSupplementInfo: SmartCodable {
case applicantName = "applicant_name" case applicantName = "applicant_name"
case nameExtra = "name_extra" case nameExtra = "name_extra"
case templateInfo = "template_info" case templateInfo = "template_info"
case auditContent = "audit_content"
case uploadRequirement = "upload_requirement"
case contentUrl = "content_url" case contentUrl = "content_url"
} }
...@@ -165,6 +182,13 @@ class YHTemplateInfo: SmartCodable { ...@@ -165,6 +182,13 @@ class YHTemplateInfo: SmartCodable {
var description: String = "" var description: String = ""
var materialPath: [YHMaterialPath] = [] var materialPath: [YHMaterialPath] = []
func isNeedShowTemplate() -> Bool {
if self.description.isEmpty && self.materialPath.isEmpty {
return false
}
return true
}
required init() { required init() {
} }
......
...@@ -12,13 +12,16 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -12,13 +12,16 @@ class YHCertificateNameCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateNameCell" static let cellReuseIdentifier = "YHCertificateNameCell"
var editBlock:((YHContentUrl)->())?
var whiteView: UIView! var whiteView: UIView!
var iconImgV: UIImageView! var iconImgV: UIImageView!
var nameLabel: UILabel! var nameLabel: UILabel!
var timeLabel: UILabel! var timeLabel: UILabel!
var editBtn: UIButton! var editBtn: UIButton!
var contentItem: YHContentUrl!
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
} }
...@@ -29,10 +32,49 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -29,10 +32,49 @@ class YHCertificateNameCell: UITableViewCell {
} }
func updateModel(_ model: YHContentUrl) { func updateModel(_ model: YHContentUrl) {
contentItem = model
nameLabel.text = model.name nameLabel.text = model.name
timeLabel.text = "上传于\(model.updatedAt)" timeLabel.text = "上传于\(model.updatedAt)"
var suffix = ""
var iconImgName = ""
if !model.url.pathExtension.isEmpty {
suffix = model.url.pathExtension
} else {
suffix = model.suffix
}
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"
}
iconImgV.image = UIImage(named: iconImgName)
} }
@objc func didEditBtnClicked() {
if let editBlock = editBlock {
editBlock(contentItem)
}
}
func setupUI() { func setupUI() {
self.selectionStyle = .none self.selectionStyle = .none
...@@ -60,6 +102,8 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -60,6 +102,8 @@ class YHCertificateNameCell: UITableViewCell {
editBtn = UIButton() editBtn = UIButton()
editBtn.setImage(UIImage(named:"my_cer_btn_edit"), for:.normal) editBtn.setImage(UIImage(named:"my_cer_btn_edit"), for:.normal)
editBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
editBtn.addTarget(self, action: #selector(didEditBtnClicked), for: .touchUpInside)
whiteView.addSubview(editBtn) whiteView.addSubview(editBtn)
whiteView.snp.makeConstraints { make in whiteView.snp.makeConstraints { make in
......
...@@ -11,14 +11,46 @@ import UIKit ...@@ -11,14 +11,46 @@ import UIKit
class YHCertificateTemplateCell: UITableViewCell { class YHCertificateTemplateCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateTemplateCell" static let cellReuseIdentifier = "YHCertificateTemplateCell"
var templateInfo: YHTemplateInfo? {
didSet {
guard let templateInfo = templateInfo else {
contentView.isHidden = true
return
}
if templateInfo.description.isEmpty && templateInfo.materialPath.isEmpty {
contentView.isHidden = true
return
}
contentView.isHidden = false
if !templateInfo.name.isEmpty {
templateTitleLabel.text = "\(templateInfo.name)示例模版"
} else {
templateTitleLabel.text = ""
}
if !templateInfo.description.isEmpty {
tipsLabel.text = "注意事项: \(templateInfo.description)"
} else {
tipsLabel.text = ""
}
let noTemplate = templateInfo.materialPath.isEmpty
templateView.isHidden = noTemplate
templateView.snp.updateConstraints { make in
make.height.equalTo(noTemplate ? 0.0 : 62.0)
make.bottom.equalToSuperview().offset(noTemplate ? 0.0 : -34.0)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
lazy var tipsLabel: UILabel = { lazy var tipsLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor.labelTextColor2 label.textColor = UIColor.labelTextColor2
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:12) label.font = UIFont.PFSC_R(ofSize:12)
label.numberOfLines = 0 label.numberOfLines = 0
label.text = "注意事项:这里是上传应该注意的事项这里是上传应该注意的事项这里是上传应该注意的事项。"
return label return label
}() }()
...@@ -27,7 +59,8 @@ class YHCertificateTemplateCell: UITableViewCell { ...@@ -27,7 +59,8 @@ class YHCertificateTemplateCell: UITableViewCell {
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:17) label.font = UIFont.PFSC_M(ofSize:17)
label.text = "身份证示例模版" label.text = "示例模版"
label.numberOfLines = 0
return label return label
}() }()
...@@ -49,6 +82,8 @@ class YHCertificateTemplateCell: UITableViewCell { ...@@ -49,6 +82,8 @@ class YHCertificateTemplateCell: UITableViewCell {
func createUI() { func createUI() {
self.selectionStyle = .none
contentView.addSubview(templateTitleLabel) contentView.addSubview(templateTitleLabel)
contentView.addSubview(tipsLabel) contentView.addSubview(tipsLabel)
contentView.addSubview(templateView) contentView.addSubview(templateView)
...@@ -57,7 +92,6 @@ class YHCertificateTemplateCell: UITableViewCell { ...@@ -57,7 +92,6 @@ class YHCertificateTemplateCell: UITableViewCell {
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.top.equalToSuperview().offset(16) make.top.equalToSuperview().offset(16)
make.height.equalTo(24.0)
} }
tipsLabel.snp.makeConstraints { make in tipsLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
......
...@@ -53,20 +53,20 @@ class YHCertificateTemplateView: UIView { ...@@ -53,20 +53,20 @@ class YHCertificateTemplateView: UIView {
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.equalToSuperview().offset(16)
make.left.right.equalToSuperview() make.left.equalToSuperview().offset(64)
make.height.equalTo(24) make.right.equalToSuperview().offset(-64)
make.bottom.equalToSuperview().offset(-12)
} }
closeBtn.snp.makeConstraints { make in closeBtn.snp.makeConstraints { make in
make.centerY.equalTo(titleLabel) make.top.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.width.height.equalTo(24) make.width.height.equalTo(24)
} }
closeBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) closeBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)
line.snp.makeConstraints { make in line.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.height.equalTo(1) make.height.equalTo(1)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
return view return view
...@@ -91,6 +91,7 @@ class YHCertificateTemplateView: UIView { ...@@ -91,6 +91,7 @@ class YHCertificateTemplateView: UIView {
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.textAlignment = .center label.textAlignment = .center
label.font = UIFont.PFSC_B(ofSize:17) label.font = UIFont.PFSC_B(ofSize:17)
label.numberOfLines = 0
label.text = "示例模版" label.text = "示例模版"
return label return label
}() }()
...@@ -151,9 +152,9 @@ class YHCertificateTemplateView: UIView { ...@@ -151,9 +152,9 @@ class YHCertificateTemplateView: UIView {
if !model.description.isEmpty { if !model.description.isEmpty {
tipsLabel.text = "注意事项:\(model.description)" tipsLabel.text = "注意事项:\(model.description)"
} }
templateView.isHidden = model.materialPath.isEmpty
let topMargin = model.description.isEmpty ? 0 : 20 let topMargin = model.description.isEmpty ? 0 : 20
templateView.snp.updateConstraints { make in templateView.snp.updateConstraints { make in
make.top.equalTo(tipsLabel.snp.bottom).offset(topMargin) make.top.equalTo(tipsLabel.snp.bottom).offset(topMargin)
} }
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
// //
/* /*
【Usage】 【Usage】
let view = YHFileRenameInputView.inputView(defalutText:"adfasfsf", editBlock: { let view = YHFileRenameInputView.inputView(defalutText:"adfasfsf")
text in view.editBlock = {
print("\(text)") text in
}) }
*/ */
import UIKit import UIKit
...@@ -18,7 +18,7 @@ import UIKit ...@@ -18,7 +18,7 @@ import UIKit
class YHFileRenameInputView: UIView { class YHFileRenameInputView: UIView {
static let height = 217.0 static let height = 217.0
var editBlock:((String?)->())? var editBlock:((String?)->Void)?
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds) let view = UIView(frame:UIScreen.main.bounds)
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5) view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
...@@ -66,7 +66,7 @@ class YHFileRenameInputView: UIView { ...@@ -66,7 +66,7 @@ class YHFileRenameInputView: UIView {
lazy var textField:UITextField = { lazy var textField:UITextField = {
let textField = UITextField() let textField = UITextField()
textField.backgroundColor = .clear textField.backgroundColor = .clear
textField.placeholder = "请输入文件名称" textField.attributedPlaceholder = NSAttributedString(string: "请输入文件名称", attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
textField.font = UIFont.PFSC_M(ofSize: 16) textField.font = UIFont.PFSC_M(ofSize: 16)
textField.tintColor = UIColor.brandMainColor textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor textField.textColor = UIColor.mainTextColor
...@@ -104,10 +104,9 @@ class YHFileRenameInputView: UIView { ...@@ -104,10 +104,9 @@ class YHFileRenameInputView: UIView {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
static func inputView(defalutText:String?, editBlock:((String?)->())?)-> YHFileRenameInputView { static func inputView(defalutText:String?)-> YHFileRenameInputView {
let view = YHFileRenameInputView(frame:CGRect(x: 0, y: 0, width:KScreenWidth, height:Self.height)) let view = YHFileRenameInputView(frame:CGRect(x: 0, y: 0, width:KScreenWidth, height:Self.height))
view.textField.text = defalutText view.textField.text = defalutText
view.editBlock = editBlock
return view return view
} }
...@@ -186,10 +185,15 @@ extension YHFileRenameInputView { ...@@ -186,10 +185,15 @@ extension YHFileRenameInputView {
} }
@objc func didClickConfirmBtn() { @objc func didClickConfirmBtn() {
dismiss() if isEmptyString(textField.text) {
YHHUD.flash(message: "重命名不可为空")
return
}
if let editBlock = editBlock { if let editBlock = editBlock {
editBlock(textField.text) editBlock(textField.text)
} }
dismiss()
} }
} }
......
...@@ -137,7 +137,7 @@ class YHCertificateViewModel: YHBaseViewModel { ...@@ -137,7 +137,7 @@ class YHCertificateViewModel: YHBaseViewModel {
} }
func uploadCertificates(params:[String : Any], isSilient:Bool = false, callBack:@escaping ((Bool)->())) { func updateCertificates(params:[String : Any], isSilient:Bool = false, callBack:@escaping ((Bool)->())) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.certificateUploadApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.certificateUploadApi
......
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