Commit 047f5a71 authored by Steven杜宇's avatar Steven杜宇

// 模版指引

parent bb6aab00
...@@ -18,10 +18,14 @@ class YHCertificateUploadContentListVC: YHBaseViewController { ...@@ -18,10 +18,14 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
templateArr.removeAll() templateArr.removeAll()
if let uploadInfo = supplementInfo { if let uploadInfo = supplementInfo {
if uploadInfo.templateInfo.materialPath.count > 0 { if uploadInfo.templateInfo.materialPath.count > 0 {
templateArr.append(uploadInfo.templateInfo.materialPath[0]) let template = uploadInfo.templateInfo.materialPath[0]
template.type = 0
templateArr.append(template)
} }
if uploadInfo.templateInfo.guideFilePath.count > 0 { if uploadInfo.templateInfo.guideFilePath.count > 0 {
templateArr.append(uploadInfo.templateInfo.guideFilePath[0]) let guide = uploadInfo.templateInfo.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
} }
} }
self.tableView.reloadData() self.tableView.reloadData()
...@@ -496,7 +500,13 @@ extension YHCertificateUploadContentListVC { ...@@ -496,7 +500,13 @@ extension YHCertificateUploadContentListVC {
} }
} }
self.uploadBtn.alpha = (items.count >= 100 ? 0.5 : 1.0) if categoryInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
self.uploadBtn.isHidden = true
} else {
self.uploadBtn.isHidden = false
self.uploadBtn.alpha = (items.count >= 99 ? 0.5 : 1.0)
}
self.tableView.reloadData() self.tableView.reloadData()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 { if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
......
...@@ -250,6 +250,8 @@ class YHTemplateInfo: SmartCodable { ...@@ -250,6 +250,8 @@ class YHTemplateInfo: SmartCodable {
class YHMaterialPath: SmartCodable { class YHMaterialPath: SmartCodable {
var name: String = "" var name: String = ""
var url: String = "" var url: String = ""
// 自定义类型 0:模版 1:指引
var type: Int = 0
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case name = "name" case name = "name"
...@@ -260,7 +262,8 @@ class YHMaterialPath: SmartCodable { ...@@ -260,7 +262,8 @@ class YHMaterialPath: SmartCodable {
} }
init(name: String = "", url: String = "") { init(type:Int, name: String = "", url: String = "") {
self.type = type
self.name = name self.name = name
self.url = url self.url = url
} }
......
...@@ -72,7 +72,18 @@ class YHCertificateSampleTemplateView: UIView { ...@@ -72,7 +72,18 @@ class YHCertificateSampleTemplateView: UIView {
class YHCertificateTemplateCell: UITableViewCell { class YHCertificateTemplateCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateTemplateCell" static let cellReuseIdentifier = "YHCertificateTemplateCell"
var templatePath: YHMaterialPath? var templatePath: YHMaterialPath? {
didSet {
if let path = templatePath {
var title = "查看证件示例模版"
if path.type == 1 { // 指引
title = "查看证件操作指引"
}
templateView.titleLabel.text = title
}
}
}
lazy var templateView: YHCertificateSampleTemplateView = { lazy var templateView: YHCertificateSampleTemplateView = {
let view = YHCertificateSampleTemplateView(frame:CGRectZero) let view = YHCertificateSampleTemplateView(frame:CGRectZero)
......
...@@ -140,12 +140,16 @@ class YHCertificateTemplateSheetView: UIView { ...@@ -140,12 +140,16 @@ class YHCertificateTemplateSheetView: UIView {
} }
templateArr.removeAll() templateArr.removeAll()
if model.materialPath.count > 0 { if model.materialPath.count > 0 {
templateArr.append(model.materialPath[0]) let template = model.materialPath[0]
template.type = 0
templateArr.append(template)
} }
if model.guideFilePath.count > 0 { if model.guideFilePath.count > 0 {
templateArr.append(model.guideFilePath[0]) let guide = model.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
} }
self.tableView.reloadData() self.tableView.reloadData()
......
...@@ -64,10 +64,14 @@ class YHCertificateUploadSheetView: UIView { ...@@ -64,10 +64,14 @@ class YHCertificateUploadSheetView: UIView {
templateArr.removeAll() templateArr.removeAll()
if let templateInfo = templateInfo { if let templateInfo = templateInfo {
if templateInfo.materialPath.count > 0 { if templateInfo.materialPath.count > 0 {
templateArr.append(templateInfo.materialPath[0]) let template = templateInfo.materialPath[0]
template.type = 0
templateArr.append(template)
} }
if templateInfo.guideFilePath.count > 0 { if templateInfo.guideFilePath.count > 0 {
templateArr.append(templateInfo.guideFilePath[0]) let guide = templateInfo.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
} }
} }
let totalHeight = calculateHeight() let totalHeight = calculateHeight()
...@@ -300,6 +304,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour ...@@ -300,6 +304,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
dismiss() dismiss()
} else if operationItem.type == .photo { } else if operationItem.type == .photo {
selectPhoto() selectPhoto()
} else if operationItem.type == .camera { } else if operationItem.type == .camera {
...@@ -430,17 +435,22 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav ...@@ -430,17 +435,22 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
} }
if !authorization { if !authorization {
YHHUD.flash(message: "请在设置中打开相册权限") YHHUD.flash(message: "请在设置中打开相册权限")
return return
} }
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){ let isMultiSelect = false
let imagePicker = UIImagePickerController() if !isMultiSelect {
imagePicker.delegate = self if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
imagePicker.sourceType = .photoLibrary let imagePicker = UIImagePickerController()
// 这一句,开始调用图库 imagePicker.delegate = self
UIViewController.current?.present(imagePicker,animated: true) imagePicker.sourceType = .photoLibrary
// 这一句,开始调用图库
UIViewController.current?.present(imagePicker,animated: true)
}
} else {
} }
} }
......
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