Commit 60594a51 authored by Steven杜宇's avatar Steven杜宇

// 我的证件

parent dce87db9
......@@ -112,7 +112,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
}()
lazy var filterSheetView: YHCertificateFilterView = {
let view = YHCertificateFilterView.sheetView
let view = YHCertificateFilterView.sheetView()
view.confirmBlock = {
[weak self] dict in
guard let self = self else { return }
......@@ -231,10 +231,13 @@ extension YHCertificateListContainerVC: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
if 0 <= index && index < itemVCs.count {
let vc = itemVCs[index]
vc.requestList(status: vc.status, extra: self.filterDict)
if index == 0 {
vc.requestList(status: vc.status, extra: self.filterDict)
} else {
vc.requestList(status: vc.status)
}
}
}
/// 正在滚动中的回调
///
/// - Parameters:
......
......@@ -100,7 +100,8 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
renameInputView.editBlock = {
[weak self] text in
guard let self = self else { return }
if let selectEditItem = selectEditItem, let text = text {
if let selectEditItem = selectEditItem, var text = text {
text = text + "." + selectEditItem.getFileSuffixName()
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:selectEditItem, operation: "rename", rename: text) {
self.requestList()
}
......@@ -210,7 +211,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
if editType == .rename { // 重命名
IQKeyboardManager.shared.enable = false
renameInputView.textField.text = contentItem.name
renameInputView.textField.text = contentItem.getFileNameWithoutSuffix()
renameInputView.textField.becomeFirstResponder()
} else if editType == .delete { // 删除
......@@ -284,7 +285,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
tipsLabel.font = UIFont.PFSC_R(ofSize:14)
tipsLabel.numberOfLines = 0
if !supplementInfo.templateInfo.description.isEmpty {
tipsLabel.text = "注意事项:\(supplementInfo.templateInfo.description)"
tipsLabel.text = supplementInfo.templateInfo.description
}
view.addSubview(tipsLabel)
......@@ -340,7 +341,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
statusLabel.backgroundColor = bgColor
let tipsLabel = UILabel()
tipsLabel.textColor = .warnColor
tipsLabel.textColor = .failColor
tipsLabel.font = UIFont.PFSC_R(ofSize:12)
tipsLabel.textAlignment = .left
tipsLabel.numberOfLines = 0
......@@ -404,7 +405,13 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
}
} else if indexPath.section == 1 { // 证件列表
if 0 <= indexPath.row && indexPath.row < items.count {
let cer = items[indexPath.row]
print("\(cer.url)")
print("\(cer.name)")
print("\(cer.suffix)")
}
}
}
......
......@@ -143,6 +143,37 @@ class YHContentUrl: SmartCodable {
case updatedAt = "updated_at"
}
// 获取文件后缀名 eg:123.pdf -> pdf
func getFileSuffixName()->String {
let res1 = url.pathExtension.lowercased()
if !res1.isEmpty {
return res1
}
let res2 = name.pathExtension.lowercased()
if !res2.isEmpty {
return res2
}
if !suffix.isEmpty {
return suffix
}
return ""
}
// 获取文件名(不包含后缀) eg:123.pdf -> 123
func getFileNameWithoutSuffix()->String {
if name.isEmpty {
return name
}
if !name.contains(".") {
return name
}
if !name.pathExtension.isEmpty {
let fileName = (name as NSString).deletingPathExtension
return fileName
}
return ""
}
required init() {
}
......
......@@ -63,8 +63,6 @@ class YHCertificateFilterView: UIView {
static let margin = 21.0
static let gap = 12.0
static let itemHeight = 36.0
static let sheetView = YHCertificateFilterView(frame:UIScreen.main.bounds)
var confirmBlock:(([String : String])->())?
var items:[YHCertificateFilterSectionInfo] = [
......@@ -174,13 +172,18 @@ class YHCertificateFilterView: UIView {
createUI()
}
static func sheetView() -> YHCertificateFilterView {
let sheetView = YHCertificateFilterView(frame:UIScreen.main.bounds)
return sheetView
}
func createUI() {
self.addSubview(blackMaskView)
self.addSubview(whiteContentView)
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(16.0, 16.0));
let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(8.0, 8.0));
let layer = CAShapeLayer();
layer.frame = whiteContentView.bounds;
layer.path = path.cgPath;
......
......@@ -57,7 +57,16 @@ class YHCertificateInfoCell: UITableViewCell {
statusLabel.text = title
statusLabel.textColor = titleColor
}
infoLabel.text = "类型: \(model.typeName) 所属人: \(model.nameExtra.userName)"
var infoStr = ""
var typeStr = "无"
var ownerStr = "无"
if !model.typeName.isEmpty {
typeStr = model.typeName
}
if !model.nameExtra.userName.isEmpty {
ownerStr = model.nameExtra.userName
}
infoLabel.text = "类型: \(typeStr) 所属人: \(ownerStr)"
var result:ASAttributedString = .init(string:"", .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor))
......
......@@ -37,15 +37,9 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel.text = model.name
timeLabel.text = "上传于\(model.updatedAt)"
var suffix = ""
var suffix = model.getFileSuffixName()
var iconImgName = ""
if !model.url.pathExtension.isEmpty {
suffix = model.url.pathExtension
} else {
suffix = model.suffix
}
if suffix == "jpeg" {
iconImgName = "my_cer_type_jpg"
......
......@@ -263,7 +263,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = "注意事项:\(desc)"
label.text = desc
view.addSubview(label)
label.snp.makeConstraints { make in
......
......@@ -339,7 +339,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = "注意事项:\(desc)"
label.text = desc
view.addSubview(label)
label.snp.makeConstraints { make in
......
......@@ -40,7 +40,7 @@ class YHFileRenameInputView: UIView {
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_B(ofSize:17)
label.text = "请选择上传方式"
label.text = "文件重命名"
return label
}()
......
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