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

// 我的证书

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