Commit 8a801aa1 authored by Steven杜宇's avatar Steven杜宇

// 我的证件

parent fe30bb3c
......@@ -127,10 +127,10 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
// if item.checkStatus == YHCertificateUploadStatus.preUpload { // 待上传
if item.checkStatus == YHCertificateUploadStatus.preUpload { // 待上传
showUploadSheetView(item.templateInfo)
return
// }
}
// 非待上传的进入详情
let vc = YHUploadContentVC()
vc.orderId = orderId
......
......@@ -13,8 +13,22 @@ class YHUploadContentVC: YHBaseViewController {
var orderId : Int!
var categoryInfo: YHCategoryData!
var uploadInfo: YHSupplementInfo!
var uploadInfo: YHSupplementInfo! {
didSet {
templateArr.removeAll()
if let uploadInfo = uploadInfo {
if uploadInfo.templateInfo.materialPath.count > 0 {
templateArr.append(uploadInfo.templateInfo.materialPath[0])
}
if uploadInfo.templateInfo.guideFilePath.count > 0 {
templateArr.append(uploadInfo.templateInfo.guideFilePath[0])
}
}
self.tableView.reloadData()
}
}
var viewModel: YHCertificateViewModel = YHCertificateViewModel()
var templateArr:[YHMaterialPath] = []
var items:[YHContentUrl] = []
var selectEditItem: YHContentUrl?
......@@ -94,6 +108,7 @@ class YHUploadContentVC: YHBaseViewController {
@objc func didClickUploadBtn() {
let sheetView = YHCertificateUploadSheetView.sheetView
sheetView.templateInfo = uploadInfo.templateInfo
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
......@@ -154,7 +169,7 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return 1
return templateArr.count
}
return items.count
}
......@@ -164,12 +179,14 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateTemplateCell.cellReuseIdentifier, for: indexPath) as! YHCertificateTemplateCell
// cell.templateInfo = uploadInfo.templateInfo
cell.templateClick = {
[weak self] path in
guard let self = self else { return }
// 查看模版 uploadInfo.templateInfo
cell.update(bottomMargin: 20)
if 0 <= indexPath.row && indexPath.row < templateArr.count {
cell.templatePath = templateArr[indexPath.row]
cell.templateClick = {
[weak self] path in
guard let self = self else { return }
// 查看模版 uploadInfo.templateInfo
}
}
return cell
}
......@@ -221,18 +238,19 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
if uploadInfo.templateInfo.isNeedShowTemplate() {
return UITableView.automaticDimension
}
return 0.0
return 82.0
}
return 55.0
return UITableView.automaticDimension
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
if section == 0 {
return 1.0
if uploadInfo.templateInfo.isNeedShowTemplate() {
return UITableView.automaticDimension
}
return 0.0
}
return UITableView.automaticDimension
}
......@@ -240,10 +258,46 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
if section == 0 {
return view
if section == 0 { // 证件示例模版
if !uploadInfo.templateInfo.isNeedShowTemplate() {
return view
}
let titlelabel = UILabel()
titlelabel.textColor = UIColor.mainTextColor
titlelabel.textAlignment = .left
titlelabel.font = UIFont.PFSC_M(ofSize:17)
titlelabel.text = "\(uploadInfo.name)示例模版"
titlelabel.numberOfLines = 0
view.addSubview(titlelabel)
titlelabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
}
let tipsLabel = UILabel()
tipsLabel.textColor = UIColor.mainTextColor
tipsLabel.textAlignment = .left
tipsLabel.font = UIFont.PFSC_R(ofSize:14)
tipsLabel.numberOfLines = 0
if !uploadInfo.templateInfo.description.isEmpty {
tipsLabel.text = "注意事项:\(uploadInfo.templateInfo.description)"
}
view.addSubview(tipsLabel)
tipsLabel.snp.makeConstraints { make in
make.top.equalTo(titlelabel.snp.bottom).offset(5)
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.bottom.equalToSuperview().offset(-20)
}
return view
}
// 证件标题和状态
let titlelabel = UILabel()
titlelabel.textColor = UIColor.mainTextColor
titlelabel.textAlignment = .left
......@@ -256,6 +310,7 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
statusLabel.textAlignment = .center
statusLabel.font = UIFont.PFSC_M(ofSize:10)
statusLabel.layer.cornerRadius = 3.0
statusLabel.clipsToBounds = true
view.addSubview(statusLabel)
var text = ""
......
......@@ -184,7 +184,7 @@ class YHTemplateInfo: SmartCodable {
var guideFilePath: [YHMaterialPath] = []
func isNeedShowTemplate() -> Bool {
if self.description.isEmpty && self.materialPath.isEmpty {
if self.description.isEmpty && self.materialPath.isEmpty && self.guideFilePath.isEmpty {
return false
}
return true
......
......@@ -89,6 +89,7 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel = UILabel()
nameLabel.textColor = UIColor.mainTextColor
nameLabel.textAlignment = .left
nameLabel.numberOfLines = 0
nameLabel.font = UIFont.PFSC_M(ofSize:14)
nameLabel.text = "文档名称.doc"
whiteView.addSubview(nameLabel)
......@@ -109,8 +110,8 @@ class YHCertificateNameCell: UITableViewCell {
whiteView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.height.equalTo(55)
make.top.equalToSuperview().offset(15)
make.bottom.equalToSuperview()
}
iconImgV.snp.makeConstraints { make in
......@@ -121,14 +122,14 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel.snp.makeConstraints { make in
make.left.equalTo(iconImgV.snp.right).offset(18)
make.height.equalTo(20)
make.bottom.equalTo(whiteView.snp.centerY).offset(-1)
make.top.equalToSuperview().offset(7)
make.right.equalTo(editBtn.snp.left)
}
timeLabel.snp.makeConstraints { make in
make.left.right.equalTo(nameLabel)
make.top.equalTo(whiteView.snp.centerY).offset(1)
make.top.equalTo(nameLabel.snp.bottom).offset(2)
make.bottom.equalToSuperview().offset(-7)
make.height.equalTo(20)
}
......
......@@ -229,7 +229,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateTemplateCell.cellReuseIdentifier, for: indexPath) as! YHCertificateTemplateCell
cell.update(bottomMargin: 20)
if 0 <= indexPath.row && indexPath.row < templateArr.count {
cell.templatePath = templateArr[indexPath.row]
cell.templateClick = {
......@@ -240,7 +240,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 62.0
return 82.0
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
......@@ -253,7 +253,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 20.0
return 1.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
......
......@@ -247,7 +247,9 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateUploadTypeCell.cellReuseIdentifier, for: indexPath) as! YHCertificateUploadTypeCell
if 0 <= indexPath.row && indexPath.row < uploadTypeArr.count {
cell.item = uploadTypeArr[indexPath.row]
}
return cell
}
......
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