Commit 29c6cda5 authored by Steven杜宇's avatar Steven杜宇

// 我的证书

parent 7b50b714
...@@ -315,6 +315,7 @@ extension YHCertificateListVC { ...@@ -315,6 +315,7 @@ extension YHCertificateListVC {
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) { func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
let sheetView = YHCertificateUploadSheetView.sheetView() let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.templateInfo = supplementInfo.templateInfo sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = { sheetView.clickTemplateBlock = {
[weak self] path in [weak self] path in
......
...@@ -329,6 +329,7 @@ extension YHCertificateSearchViewController { ...@@ -329,6 +329,7 @@ extension YHCertificateSearchViewController {
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) { func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
let sheetView = YHCertificateUploadSheetView.sheetView() let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.templateInfo = supplementInfo.templateInfo sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = { sheetView.clickTemplateBlock = {
[weak self] path in [weak self] path in
......
...@@ -138,6 +138,7 @@ class YHCertificateUploadContentListVC: YHBaseViewController { ...@@ -138,6 +138,7 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
} }
let sheetView = YHCertificateUploadSheetView.sheetView() let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 99-items.count
sheetView.templateInfo = supplementInfo.templateInfo sheetView.templateInfo = supplementInfo.templateInfo
sheetView.uploadFilesBlock = { sheetView.uploadFilesBlock = {
[weak self] fileUrl in [weak self] fileUrl in
...@@ -145,7 +146,6 @@ class YHCertificateUploadContentListVC: YHBaseViewController { ...@@ -145,7 +146,6 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
print(fileUrl) print(fileUrl)
uploadFile(fileUrl) uploadFile(fileUrl)
} }
sheetView.uploadImageBlock = { sheetView.uploadImageBlock = {
[weak self] imgArr in [weak self] imgArr in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -42,34 +42,19 @@ enum YHCertificateUploadType: Int { ...@@ -42,34 +42,19 @@ enum YHCertificateUploadType: Int {
class YHCertificateUploadSheetView: UIView { class YHCertificateUploadSheetView: UIView {
static func sheetView() -> YHCertificateUploadSheetView { private var _maxSelectCount: Int = 9
let view = YHCertificateUploadSheetView(frame:UIScreen.main.bounds) var maxSelectCount = 9 {
return view didSet {
} if maxSelectCount >= 9 {
_maxSelectCount = 9
func calculateHeight() -> CGFloat { } else if 0 < maxSelectCount && maxSelectCount < 9 {
guard let templateInfo = templateInfo else { return 0.0} _maxSelectCount = maxSelectCount
} else {
// 注意事项文字高度 _maxSelectCount = 0
var descHeight = templateInfo.description.boundingRect(with: CGSize(width:KScreenWidth-40.0 , height:.greatestFiniteMagnitude), }
options: .usesLineFragmentOrigin,
attributes: [.font : UIFont.PFSC_R(ofSize:14)],
context: nil).size.height
descHeight = ceil(descHeight)+20
// 所有模版高度之和
let templatesHeight = 82.0 * Double(templateArr.count)
// 底部四个操作行高度之和
let actionsHeight = 52.0 * 4.0
let tableViewHeight = descHeight+templatesHeight+actionsHeight
// 白色View总高度
var totalHeight = 53.0+20.0+tableViewHeight+k_Height_safeAreaInsetsBottom()
if totalHeight > KScreenHeight {
totalHeight = 458
} }
return totalHeight
} }
var templateInfo: YHTemplateInfo? { var templateInfo: YHTemplateInfo? {
didSet { didSet {
templateArr.removeAll() templateArr.removeAll()
...@@ -222,6 +207,12 @@ class YHCertificateUploadSheetView: UIView { ...@@ -222,6 +207,12 @@ class YHCertificateUploadSheetView: UIView {
createUI() createUI()
} }
static func sheetView() -> YHCertificateUploadSheetView {
let view = YHCertificateUploadSheetView(frame:UIScreen.main.bounds)
return view
}
func createUI() { func createUI() {
self.addSubview(blackMaskView) self.addSubview(blackMaskView)
...@@ -254,6 +245,29 @@ class YHCertificateUploadSheetView: UIView { ...@@ -254,6 +245,29 @@ class YHCertificateUploadSheetView: UIView {
} }
} }
func calculateHeight() -> CGFloat {
guard let templateInfo = templateInfo else { return 0.0}
// 注意事项文字高度
var descHeight = templateInfo.description.boundingRect(with: CGSize(width:KScreenWidth-40.0 , height:.greatestFiniteMagnitude),
options: .usesLineFragmentOrigin,
attributes: [.font : UIFont.PFSC_R(ofSize:14)],
context: nil).size.height
descHeight = ceil(descHeight)+20
// 所有模版高度之和
let templatesHeight = 82.0 * Double(templateArr.count)
// 底部四个操作行高度之和
let actionsHeight = 52.0 * 4.0
let tableViewHeight = descHeight+templatesHeight+actionsHeight
// 白色View总高度
var totalHeight = 53.0+20.0+tableViewHeight+k_Height_safeAreaInsetsBottom()
if totalHeight > KScreenHeight {
totalHeight = 458
}
return totalHeight
}
} }
extension YHCertificateUploadSheetView { extension YHCertificateUploadSheetView {
...@@ -454,7 +468,7 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav ...@@ -454,7 +468,7 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
var configuration = PHPickerConfiguration() var configuration = PHPickerConfiguration()
// 设置最大选择数量 // 设置最大选择数量
configuration.selectionLimit = 9 configuration.selectionLimit = _maxSelectCount
// 设置选择器的过滤条件 只显示图片 // 设置选择器的过滤条件 只显示图片
configuration.filter = .images configuration.filter = .images
let picker = PHPickerViewController(configuration: configuration) let picker = PHPickerViewController(configuration: configuration)
......
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