Commit 97495372 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  // 我的证件
  // 我的证件
  // 我的证件
  // 我的证件
  // 我的证书
  // 搜索按钮
  // 我的证件
parents da21f00f bfa3f3c6
......@@ -25,7 +25,7 @@ class YHCertificateCategoryItem {
case .preUpload:
return "待上传".local
case .finish:
return "已通过".local
return "已完成".local
}
}
......@@ -39,11 +39,10 @@ class YHCertificateListContainerVC: YHBaseViewController {
static let segmentHeight = 53.0
var orderId : Int?
var filterDict : [String: Any] = [:]
var filterDict : [String: String] = [:]
var categoryInfo: YHCategoryData = YHCategoryData()
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
bar.title = "资料上传".local
bar.showLeftSecondButtonType(.search)
bar.backBlock = {
[weak self] in
......@@ -60,7 +59,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
return bar
}()
var titles = ["全部(0)", "待上传(0)", "已驳回(0)", "审核中(0)", "已通过(0)"]
var titles = ["全部", "待上传(0)", "已驳回(0)", "审核中(0)", "已完成(0)"]
let categoryItems = [ YHCertificateCategoryItem(type: .all),
YHCertificateCategoryItem(type: .preUpload),
YHCertificateCategoryItem(type: .rejected),
......@@ -112,11 +111,20 @@ 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 }
self.filterDict = dict
let allValues = Array(dict.values)
var isNoFilterCondition = true
for value in allValues {
if !value.isEmpty {
isNoFilterCondition = false
}
}
self.filterBtn.isSelect = !isNoFilterCondition
if let vc = itemVCs.first {
vc.requestList(status:vc.status, extra:dict)
}
......@@ -130,6 +138,17 @@ class YHCertificateListContainerVC: YHBaseViewController {
super.viewDidLoad()
self.gk_navigationBar.isHidden = true
self.navBar.title = "资料".local
if categoryInfo.categoryId == YHCertificateCategoryId.mainApplicant.rawValue {
self.navBar.title = "主申请人资料".local
} else if categoryInfo.categoryId == YHCertificateCategoryId.spouse.rawValue {
self.navBar.title = "配偶资料".local
} else if categoryInfo.categoryId == YHCertificateCategoryId.child.rawValue {
self.navBar.title = "子女资料".local
}
NotificationCenter.default.addObserver(self, selector: #selector(didCertificateCountStatistics(_:)), name:countStatisticsNotify , object: nil)
for item in categoryItems {
......@@ -193,10 +212,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
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] {
if let count = dic[YHCertificateUploadStatus.preUpload] {
titles[1] = "待上传(\(count))"
} else if let count = dic[YHCertificateUploadStatus.rejected] {
......@@ -206,7 +222,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
titles[3] = "审核中(\(count))"
} else if let count = dic[YHCertificateUploadStatus.finish] {
titles[4] = "已通过(\(count))"
titles[4] = "已完成(\(count))"
}
DispatchQueue.main.async {
self.segmentedDataSource.titles = self.titles
......@@ -225,10 +241,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:
......
......@@ -196,7 +196,7 @@ extension YHCertificateListVC {
}
print(params)
// state: 3:待上传 2:已驳回 1:已通过 0:审核中
// state: 3:待上传 2:已驳回 1:已完成 0:审核中
viewModel.getCertificateList(params: params) {
[weak self] listInfo, error in
......@@ -303,7 +303,7 @@ extension YHCertificateListVC {
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
......
......@@ -58,7 +58,13 @@ class YHCertificateSearchViewController: YHBaseViewController {
[weak self] text in
guard let self = self else { return }
requestList(keyWord: text)
}
bar.textChange = {
[weak self] text in
guard let self = self else { return }
if isEmptyString(text) {
requestList(keyWord: "")
}
}
return bar
}()
......@@ -218,7 +224,7 @@ extension YHCertificateSearchViewController {
"keyword": keywords]
print(params)
// state: 3:待上传 2:已驳回 1:已通过 0:审核中
// state: 3:待上传 2:已驳回 1:已完成 0:审核中
viewModel.getCertificateList(params: params) {
[weak self] listInfo, error in
......@@ -313,7 +319,7 @@ extension YHCertificateSearchViewController {
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
......
......@@ -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()
}
......@@ -113,7 +114,12 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
}
@objc func didClickUploadBtn() {
let sheetView = YHCertificateUploadSheetView.sheetView
if items.count >= 100 {
YHHUD.flash(message: "最多上传100张图片或文件")
return
}
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
......@@ -210,7 +216,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 +290,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)
......@@ -326,7 +332,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
bgColor = UIColor(hexString: "#2F7EF6", 0.08)
} else if supplementInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
text = "已通过".local
text = "已完成".local
textColor = UIColor(hexString: "#49D2B1")
bgColor = UIColor(hexString: "#49D2B1", 0.08)
......@@ -340,7 +346,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 +410,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)")
}
}
}
......@@ -476,6 +488,8 @@ extension YHCertificateUploadContentListVC {
items.append(contentsOf: item.contentUrl)
}
}
self.uploadBtn.alpha = (items.count >= 100 ? 0.5 : 1.0)
self.tableView.reloadData()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
......
......@@ -78,7 +78,7 @@ class YHSupplementInfo: SmartCodable {
} else if checkStatus == YHCertificateUploadStatus.preUpload.rawValue {
return "待上传".local
} else if checkStatus == YHCertificateUploadStatus.finish.rawValue {
return "已通过".local
return "已完成".local
} else if checkStatus == YHCertificateUploadStatus.rejected.rawValue {
return "已驳回".local
}
......@@ -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() {
}
......
......@@ -37,7 +37,7 @@ class YHCertificateEntryHeadView: UIView {
private lazy var statiticLable : UILabel = {
let titleLable = UILabel(text: "待上传2件,已驳回3件,审核中4件,已通过10件")
let titleLable = UILabel(text: "待上传2件,已驳回3件,审核中4件,已完成10件")
titleLable.font = UIFont.PFSC_R(ofSize: 13)
titleLable.textColor = UIColor.mainTextColor
return titleLable
......@@ -75,7 +75,7 @@ private extension YHCertificateEntryHeadView {
let cc: ASAttributedString = .init("0", .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let d: ASAttributedString = .init("件,已通过", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let d: ASAttributedString = .init("件,已完成", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let dd: ASAttributedString = .init("0", .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
......@@ -113,7 +113,7 @@ private extension YHCertificateEntryHeadView {
let cc: ASAttributedString = .init(NSAttributedString(string: String(dataModel.to_be_audit_num)), .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let d: ASAttributedString = .init("件,已通过", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let d: ASAttributedString = .init("件,已完成", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let dd: ASAttributedString = .init(NSAttributedString(string: String(dataModel.pass_num)), .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
......
......@@ -63,9 +63,7 @@ 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 : Any])->())?
var confirmBlock:(([String : String])->())?
var items:[YHCertificateFilterSectionInfo] = [
YHCertificateFilterSectionInfo(title: "类型".local, items: [YHCertificateFilterItem(type: .certificate, title: "证件"),
......@@ -76,7 +74,7 @@ class YHCertificateFilterView: UIView {
YHCertificateFilterSectionInfo(title: "状态".local, items: [YHCertificateFilterItem(type: .preUpload, title: "待上传"),
YHCertificateFilterItem(type: .rejected, title: "已驳回"),
YHCertificateFilterItem(type: .review, title: "审核中"),
YHCertificateFilterItem(type: .finish, title: "已通过"),
YHCertificateFilterItem(type: .finish, title: "已完成"),
])]
lazy var collectionView: UICollectionView = {
......@@ -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;
......@@ -286,8 +289,8 @@ extension YHCertificateFilterView {
}
let statusStr = statusValues.joined(separator: ",")
let typeStr = typeValues.joined(separator: ",")
let dict:[String : Any] = [ "status_all": statusStr,
"template_cate_id": typeStr]
let dict:[String : String] = [ "status_all": statusStr,
"template_cate_id": typeStr]
print(dict)
if let confirmBlock = confirmBlock {
confirmBlock(dict)
......
......@@ -50,14 +50,23 @@ class YHCertificateInfoCell: UITableViewCell {
title = "审核中".local
case .finish:
titleColor = .labelTextColor2
title = "已通过".local
title = "已完成".local
case .all:
titleColor = .labelTextColor2
}
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"
......
......@@ -73,10 +73,16 @@ class YHCertificateSearchBar: UIView {
}
}
func setSearchButtonEnable(_ enable: Bool) {
searchBtn.isUserInteractionEnabled = enable
searchBtn.alpha = (enable ? 1.0 : 0.5)
}
func createUI() {
self.backgroundColor = .white
setSearchButtonEnable(false)
contentView.addSubview(textField)
contentView.addSubview(searchBtn)
self.addSubview(contentView)
......@@ -99,6 +105,11 @@ class YHCertificateSearchBar: UIView {
}
@objc func textFieldChanged(textField:UITextField) {
if isEmptyString(textField.text) {
setSearchButtonEnable(false)
} else {
setSearchButtonEnable(true)
}
if let textChange = textChange {
textChange(textField.text)
}
......
......@@ -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
......
......@@ -8,7 +8,7 @@
/*
【Usage】
YHCertificateUploadSheetView.sheetView.show {
YHCertificateUploadSheetView.sheetView().show {
[weak self] actionType in
guard let self = self else { return }
print("%d", actionType.rawValue)
......@@ -31,7 +31,10 @@ enum YHCertificateUploadType: Int {
class YHCertificateUploadSheetView: UIView {
static let sheetView = YHCertificateUploadSheetView(frame:UIScreen.main.bounds)
static func sheetView() -> YHCertificateUploadSheetView {
let view = YHCertificateUploadSheetView(frame:UIScreen.main.bounds)
return view
}
func calculateHeight() -> CGFloat {
guard let templateInfo = templateInfo else { return 0.0}
......@@ -339,7 +342,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