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

// 模版指引

parent bb6aab00
......@@ -18,10 +18,14 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
templateArr.removeAll()
if let uploadInfo = supplementInfo {
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 {
templateArr.append(uploadInfo.templateInfo.guideFilePath[0])
let guide = uploadInfo.templateInfo.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
}
}
self.tableView.reloadData()
......@@ -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()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
......
......@@ -250,6 +250,8 @@ class YHTemplateInfo: SmartCodable {
class YHMaterialPath: SmartCodable {
var name: String = ""
var url: String = ""
// 自定义类型 0:模版 1:指引
var type: Int = 0
enum CodingKeys: String, CodingKey {
case name = "name"
......@@ -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.url = url
}
......
......@@ -72,7 +72,18 @@ class YHCertificateSampleTemplateView: UIView {
class YHCertificateTemplateCell: UITableViewCell {
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 = {
let view = YHCertificateSampleTemplateView(frame:CGRectZero)
......
......@@ -140,12 +140,16 @@ class YHCertificateTemplateSheetView: UIView {
}
templateArr.removeAll()
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 {
templateArr.append(model.guideFilePath[0])
let guide = model.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
}
self.tableView.reloadData()
......
......@@ -64,10 +64,14 @@ class YHCertificateUploadSheetView: UIView {
templateArr.removeAll()
if let templateInfo = templateInfo {
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 {
templateArr.append(templateInfo.guideFilePath[0])
let guide = templateInfo.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
}
}
let totalHeight = calculateHeight()
......@@ -300,6 +304,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
dismiss()
} else if operationItem.type == .photo {
selectPhoto()
} else if operationItem.type == .camera {
......@@ -430,17 +435,22 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
}
if !authorization {
YHHUD.flash(message: "请在设置中打开相册权限")
return
}
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .photoLibrary
// 这一句,开始调用图库
UIViewController.current?.present(imagePicker,animated: true)
let isMultiSelect = false
if !isMultiSelect {
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
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