Commit 5a9ec4cd authored by Steven杜宇's avatar Steven杜宇

// 我的证书

parent 2a2db3b7
...@@ -205,6 +205,9 @@ extension YHCertificateResourceUploadVC { ...@@ -205,6 +205,9 @@ extension YHCertificateResourceUploadVC {
} }
items.append(contentsOf: results) items.append(contentsOf: results)
} }
// 数量统计
NotificationCenter.default.post(name: countStatisticsNotify, object: [self.status: items.count])
emptyDataTipsView.isHidden = items.count > 0 emptyDataTipsView.isHidden = items.count > 0
self.tableView.reloadData() self.tableView.reloadData()
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
import UIKit import UIKit
import JXSegmentedView import JXSegmentedView
// 统计数量
public let countStatisticsNotify = NSNotification.Name("didCertificateCountStatistics")
class YHCertificateCategoryItem { class YHCertificateCategoryItem {
var type : YHCertificateUploadStatus = .all var type : YHCertificateUploadStatus = .all
var title : String { var title : String {
...@@ -57,7 +60,7 @@ class YHMaterialListViewController: YHBaseViewController { ...@@ -57,7 +60,7 @@ class YHMaterialListViewController: YHBaseViewController {
return bar return bar
}() }()
var titles = ["全部".local, "待上传".local, "已驳回".local, "审核中".local, "已通过".local] var titles = ["全部(0)", "待上传(0)", "已驳回(0)", "审核中(0)", "已通过(0)"]
let categoryItems = [ YHCertificateCategoryItem(type: .all), let categoryItems = [ YHCertificateCategoryItem(type: .all),
YHCertificateCategoryItem(type: .preUpload), YHCertificateCategoryItem(type: .preUpload),
YHCertificateCategoryItem(type: .rejected), YHCertificateCategoryItem(type: .rejected),
...@@ -79,14 +82,14 @@ class YHMaterialListViewController: YHBaseViewController { ...@@ -79,14 +82,14 @@ class YHMaterialListViewController: YHBaseViewController {
return segview return segview
}() }()
lazy var segmentedDataSource: JXSegmentedBaseDataSource = { lazy var segmentedDataSource: JXSegmentedTitleDataSource = {
let dataSource = JXSegmentedTitleDataSource() let dataSource = JXSegmentedTitleDataSource()
dataSource.isTitleColorGradientEnabled = true dataSource.isTitleColorGradientEnabled = true
dataSource.titles = titles dataSource.titles = titles
dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 14) dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 14)
dataSource.titleNormalColor = .labelTextColor2 dataSource.titleNormalColor = .labelTextColor2
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 16) dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 16)
dataSource.titleSelectedColor = .brandMainColor dataSource.titleSelectedColor = UIColor(hexString: "#000000")
dataSource.isItemSpacingAverageEnabled = false dataSource.isItemSpacingAverageEnabled = false
dataSource.itemWidth = JXSegmentedViewAutomaticDimension dataSource.itemWidth = JXSegmentedViewAutomaticDimension
dataSource.itemSpacing = 24 dataSource.itemSpacing = 24
...@@ -125,13 +128,14 @@ class YHMaterialListViewController: YHBaseViewController { ...@@ -125,13 +128,14 @@ class YHMaterialListViewController: YHBaseViewController {
super.viewDidLoad() super.viewDidLoad()
self.gk_navigationBar.isHidden = true self.gk_navigationBar.isHidden = true
titles.removeAll() NotificationCenter.default.addObserver(self, selector: #selector(didCertificateCountStatistics(_:)), name:countStatisticsNotify , object: nil)
for item in categoryItems { for item in categoryItems {
titles.append(item.title)
let vc = YHCertificateResourceUploadVC() let vc = YHCertificateResourceUploadVC()
vc.orderId = orderId vc.orderId = orderId
vc.status = item.type vc.status = item.type
vc.categoryInfo = categoryInfo vc.categoryInfo = categoryInfo
vc.requestList(status: item.type)
itemVCs.append(vc) itemVCs.append(vc)
} }
view.addSubview(navBar) view.addSubview(navBar)
...@@ -174,6 +178,35 @@ class YHMaterialListViewController: YHBaseViewController { ...@@ -174,6 +178,35 @@ class YHMaterialListViewController: YHBaseViewController {
//离开页面的时候,需要恢复屏幕边缘手势,不能影响其他页面 //离开页面的时候,需要恢复屏幕边缘手势,不能影响其他页面
navigationController?.interactivePopGestureRecognizer?.isEnabled = true navigationController?.interactivePopGestureRecognizer?.isEnabled = true
} }
@objc func didCertificateCountStatistics(_ notification: Notification) {
guard let dic = notification.object as? [YHCertificateUploadStatus: Int] else { return }
print(dic)
if let count = dic[YHCertificateUploadStatus.all] {
titles[0] = "全部(\(count))"
} else if let count = dic[YHCertificateUploadStatus.preUpload] {
titles[1] = "待上传(\(count))"
} else if let count = dic[YHCertificateUploadStatus.rejected] {
titles[2] = "已驳回(\(count))"
} else if let count = dic[YHCertificateUploadStatus.review] {
titles[3] = "审核中(\(count))"
} else if let count = dic[YHCertificateUploadStatus.finish] {
titles[4] = "已通过(\(count))"
}
DispatchQueue.main.async {
self.segmentedDataSource.titles = self.titles
self.segmentedView.reloadData()
}
}
deinit {
NotificationCenter.default.removeObserver(self)
}
} }
......
...@@ -179,10 +179,16 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -179,10 +179,16 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
[weak self] contentItem in [weak self] contentItem in
guard let self = self else { return } guard let self = self else { return }
selectEditItem = contentItem selectEditItem = contentItem
let items = [YHCertificateEditItem(type:.rename, title:"重命名"), var items = [YHCertificateEditItem(type:.rename, title:"重命名"),
YHCertificateEditItem(type:.preview, title:"预览"), YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.delete, title:"删除"), YHCertificateEditItem(type:.delete, title:"删除"),
YHCertificateEditItem(type:.cancel, title:"取消")] YHCertificateEditItem(type:.cancel, title:"取消")]
if uploadInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
items = [YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.cancel, title:"取消")]
}
YHCertificateEditSheetView.sheetView(items:items) { YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in [weak self] editType in
guard let self = self else { return } guard let self = self else { return }
...@@ -194,7 +200,12 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -194,7 +200,12 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
renameInputView.textField.becomeFirstResponder() renameInputView.textField.becomeFirstResponder()
} else if editType == .delete { // 删除 } else if editType == .delete { // 删除
let msg = "您确定要删除文档\(contentItem.name)吗"
YHTwoOptionAlertView.showAlertView(message:msg) { sure in
if !sure { return }
self.updateCertificateItem(contentItem, operation: "del", rename: "") self.updateCertificateItem(contentItem, operation: "del", rename: "")
}
} else if editType == .preview { // 预览 } else if editType == .preview { // 预览
// 预览 contentItem // 预览 contentItem
...@@ -238,13 +249,37 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -238,13 +249,37 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
view.addSubview(titlelabel) view.addSubview(titlelabel)
let statusLabel = UILabel() let statusLabel = UILabel()
statusLabel.textColor = .warnColor
statusLabel.backgroundColor = .warnColor8
statusLabel.textAlignment = .center statusLabel.textAlignment = .center
statusLabel.font = UIFont.PFSC_M(ofSize:10) statusLabel.font = UIFont.PFSC_M(ofSize:10)
statusLabel.text = uploadInfo.getStatusName() statusLabel.layer.cornerRadius = 3.0
view.addSubview(statusLabel) view.addSubview(statusLabel)
var text = ""
var textColor:UIColor = .clear
var bgColor:UIColor = .clear
if uploadInfo.checkStatus == YHCertificateUploadStatus.review.rawValue {
text = "审核中".local
textColor = UIColor(hexString: "#FF9900")
bgColor = UIColor(hexString: "#FF9900", 0.08)
} else if uploadInfo.checkStatus == YHCertificateUploadStatus.preUpload.rawValue {
text = "待上传".local
textColor = UIColor(hexString: "#2F7EF6")
bgColor = UIColor(hexString: "#2F7EF6", 0.08)
} else if uploadInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
text = "已通过".local
textColor = UIColor(hexString: "#49D2B1")
bgColor = UIColor(hexString: "#49D2B1", 0.08)
} else if uploadInfo.checkStatus == YHCertificateUploadStatus.rejected.rawValue {
text = "已驳回".local
textColor = UIColor(hexString: "#F81D22")
bgColor = UIColor(hexString: "#F81D22", 0.08)
}
statusLabel.text = text
statusLabel.textColor = textColor
statusLabel.backgroundColor = bgColor
let tipsLabel = UILabel() let tipsLabel = UILabel()
tipsLabel.textColor = .warnColor tipsLabel.textColor = .warnColor
tipsLabel.font = UIFont.PFSC_R(ofSize:12) tipsLabel.font = UIFont.PFSC_R(ofSize:12)
...@@ -293,7 +328,7 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -293,7 +328,7 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
label.textColor = UIColor.labelTextColor2 label.textColor = UIColor.labelTextColor2
label.textAlignment = .center label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize:12) label.font = UIFont.PFSC_R(ofSize:12)
label.text = "*最多上传5/99张图片或文件" label.text = "*最多上传\(items.count)/99张图片或文件"
view.addSubview(label) view.addSubview(label)
return view return view
...@@ -312,8 +347,8 @@ extension YHUploadContentVC { ...@@ -312,8 +347,8 @@ extension YHUploadContentVC {
func addKeyBoardNotify() { func addKeyBoardNotify() {
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification), name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification), name: UIResponder.keyboardWillHideNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
} }
func removeNotify() { func removeNotify() {
......
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