Commit 3214f962 authored by Steven杜宇's avatar Steven杜宇

// 我的证书

parent 3f581fbd
...@@ -18,7 +18,7 @@ class YHCertificateResourceUploadVC: YHBaseViewController { ...@@ -18,7 +18,7 @@ class YHCertificateResourceUploadVC: YHBaseViewController {
var status: YHCertificateUploadStatus = .all var status: YHCertificateUploadStatus = .all
var items:[YHSupplementInfo] = [] var items:[YHSupplementInfo] = []
var viewModel: YHCertificateViewModel = YHCertificateViewModel() var viewModel: YHCertificateViewModel = YHCertificateViewModel()
var categoryInfo: YHCategoryData = YHCategoryData() var categoryInfo: YHCategoryData!
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
...@@ -97,20 +97,23 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou ...@@ -97,20 +97,23 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let item = items[indexPath.section]
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateInfoCell.cellReuseIdentifier, for: indexPath) as! YHCertificateInfoCell let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateInfoCell.cellReuseIdentifier, for: indexPath) as! YHCertificateInfoCell
cell.updateModel(item)
cell.templateBlock = { if 0 <= indexPath.section && indexPath.section < items.count {
[weak self] in let item = items[indexPath.section]
guard let self = self else { return } cell.updateModel(item)
let view = YHCertificateTemplateView.templateView(item.templateInfo) cell.templateBlock = {
view.scanTemplateBlock = { [weak self] in
[weak self] temlateInfo in
guard let self = self else { return } guard let self = self else { return }
let vc = UIViewController() let view = YHCertificateTemplateView.templateView(item.templateInfo)
self.navigationController?.pushViewController(vc) view.scanTemplateBlock = {
[weak self] temlateInfo in
guard let self = self else { return }
let vc = UIViewController()
self.navigationController?.pushViewController(vc)
}
view.show()
} }
view.show()
} }
return cell return cell
} }
...@@ -122,6 +125,12 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou ...@@ -122,6 +125,12 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHUploadContentVC() let vc = YHUploadContentVC()
vc.orderId = orderId
vc.categoryInfo = categoryInfo
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
vc.uploadInfo = item
}
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
...@@ -10,17 +10,16 @@ import UIKit ...@@ -10,17 +10,16 @@ import UIKit
import IQKeyboardManagerSwift import IQKeyboardManagerSwift
class YHUploadContentVC: YHBaseViewController { class YHUploadContentVC: YHBaseViewController {
var orderId : Int? var orderId : Int!
var categoryInfo: YHCategoryData!
var uploadInfo: YHSupplementInfo!
var viewModel: YHCertificateViewModel = YHCertificateViewModel() var viewModel: YHCertificateViewModel = YHCertificateViewModel()
var items:[YHContentUrl] = []
var items:[Int] = [1,2,3,4,5] var selectEditItem: YHContentUrl?
var renameInputView: YHFileRenameInputView = { var renameInputView: YHFileRenameInputView = {
let view = YHFileRenameInputView.inputView(defalutText:"请输入名称", editBlock: { let view = YHFileRenameInputView.inputView(defalutText: "请输入名称")
text in
print("\(text)")
})
return view return view
}() }()
...@@ -54,29 +53,72 @@ class YHUploadContentVC: YHBaseViewController { ...@@ -54,29 +53,72 @@ class YHUploadContentVC: YHBaseViewController {
return tableView return tableView
}() }()
lazy var uploadBtn:UIButton = {
let btn = UIButton()
btn.setTitle("继续上传".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor(hexString:"#4388FF")
btn.layer.cornerRadius = 6.0
btn.addTarget(self, action: #selector(didClickUploadBtn), for: .touchUpInside)
return btn
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.view.backgroundColor = .white self.view.backgroundColor = .white
self.gk_navTitle = "上传内容" self.gk_navTitle = "上传内容"
addKeyBoardNotify() addKeyBoardNotify()
createUI() createUI()
items.removeAll()
items.append(contentsOf: uploadInfo.contentUrl)
tableView.reloadData()
requestList()
renameInputView.editBlock = {
[weak self] text in
guard let self = self else { return }
if let selectEditItem = selectEditItem, let text = text {
self.updateCertificateItem(selectEditItem, operation: "rename", rename: text)
}
}
} }
deinit { deinit {
removeNotify() removeNotify()
} }
@objc func didClickUploadBtn() {
}
func createUI() { func createUI() {
view.addSubview(uploadBtn)
view.addSubview(tableView) view.addSubview(tableView)
view.addSubview(blackMaskView) view.addSubview(blackMaskView)
view.addSubview(renameInputView) view.addSubview(renameInputView)
tableView.snp.makeConstraints { make in tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar) make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view) make.left.right.equalTo(view)
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom()) if uploadInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
make.bottom.equalToSuperview()
} else {
make.bottom.equalTo(uploadBtn.snp.top).offset(-34)
}
} }
uploadBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.height.equalTo(48.0)
make.bottom.equalToSuperview().offset(-8-k_Height_safeAreaInsetsBottom())
}
renameInputView.snp.makeConstraints { make in renameInputView.snp.makeConstraints { make in
make.left.right.equalTo(view) make.left.right.equalTo(view)
make.height.equalTo(YHFileRenameInputView.height) make.height.equalTo(YHFileRenameInputView.height)
...@@ -90,6 +132,7 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -90,6 +132,7 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
return 2 return 2
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 { if section == 0 {
return 1 return 1
...@@ -102,19 +145,44 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -102,19 +145,44 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
if indexPath.section == 0 { if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateTemplateCell.cellReuseIdentifier, for: indexPath) as! YHCertificateTemplateCell let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateTemplateCell.cellReuseIdentifier, for: indexPath) as! YHCertificateTemplateCell
cell.templateInfo = uploadInfo.templateInfo
return cell return cell
} }
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateNameCell.cellReuseIdentifier, for: indexPath) as! YHCertificateNameCell let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateNameCell.cellReuseIdentifier, for: indexPath) as! YHCertificateNameCell
if 0 <= indexPath.row && indexPath.row < items.count { if 0 <= indexPath.row && indexPath.row < items.count {
let item = items[indexPath.row] let item = items[indexPath.row]
cell.updateModel(item)
cell.editBlock = {
[weak self] contentItem in
guard let self = self else { return }
selectEditItem = contentItem
let items = [YHCertificateEditItem(type:.rename, title:"重命名"),
YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.delete, title:"删除"),
YHCertificateEditItem(type:.cancel, title:"取消")]
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
guard let self = self else { return }
print("editType:\(editType.rawValue)")
if editType == .rename {
IQKeyboardManager.shared.enable = false
renameInputView.textField.text = contentItem.name
renameInputView.textField.becomeFirstResponder()
}
}.show()
}
} }
return cell return cell
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 { if indexPath.section == 0 {
return UITableView.automaticDimension if uploadInfo.templateInfo.isNeedShowTemplate() {
return UITableView.automaticDimension
}
return 0.0
} }
return 55.0 return 55.0
} }
...@@ -137,7 +205,8 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -137,7 +205,8 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
titlelabel.textColor = UIColor.mainTextColor titlelabel.textColor = UIColor.mainTextColor
titlelabel.textAlignment = .left titlelabel.textAlignment = .left
titlelabel.font = UIFont.PFSC_M(ofSize:17) titlelabel.font = UIFont.PFSC_M(ofSize:17)
titlelabel.text = "身份证件" titlelabel.text = uploadInfo.name
titlelabel.numberOfLines = 0
view.addSubview(titlelabel) view.addSubview(titlelabel)
let statusLabel = UILabel() let statusLabel = UILabel()
...@@ -145,7 +214,7 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -145,7 +214,7 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
statusLabel.backgroundColor = .warnColor8 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 = "审核中" statusLabel.text = uploadInfo.getStatusName()
view.addSubview(statusLabel) view.addSubview(statusLabel)
let tipsLabel = UILabel() let tipsLabel = UILabel()
...@@ -153,18 +222,18 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -153,18 +222,18 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
tipsLabel.font = UIFont.PFSC_R(ofSize:12) tipsLabel.font = UIFont.PFSC_R(ofSize:12)
tipsLabel.textAlignment = .left tipsLabel.textAlignment = .left
tipsLabel.numberOfLines = 0 tipsLabel.numberOfLines = 0
tipsLabel.text = "被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因被驳回原因" tipsLabel.text = uploadInfo.auditContent
view.addSubview(tipsLabel) view.addSubview(tipsLabel)
titlelabel.snp.makeConstraints { make in titlelabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
make.height.equalTo(24.0)
make.top.equalToSuperview() make.top.equalToSuperview()
} }
statusLabel.snp.makeConstraints { make in statusLabel.snp.makeConstraints { make in
make.centerY.equalTo(titlelabel) make.centerY.equalTo(titlelabel)
make.left.equalTo(titlelabel.snp.right).offset(4) make.left.equalTo(titlelabel.snp.right).offset(4)
make.right.lessThanOrEqualTo(view).offset(-20)
make.height.equalTo(16) make.height.equalTo(16)
make.width.equalTo(38) make.width.equalTo(38)
} }
...@@ -204,22 +273,6 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -204,22 +273,6 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if true {
let items = [YHCertificateEditItem(type:.rename, title:"重命名"),
YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.delete, title:"删除"),
YHCertificateEditItem(type:.cancel, title:"取消")]
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
guard let self = self else { return }
print("editType:\(editType.rawValue)")
if editType == .rename {
IQKeyboardManager.shared.enable = false
renameInputView.textField.becomeFirstResponder()
}
}.show()
return
}
} }
@objc func dismissed() { @objc func dismissed() {
...@@ -266,35 +319,64 @@ extension YHUploadContentVC { ...@@ -266,35 +319,64 @@ extension YHUploadContentVC {
func requestList() { func requestList() {
let params = [ let params:[String:Any] = [
"order_id" : orderId ?? 0, "order_id" : orderId ?? 0,
"node": "1", "node": "1",
"state": "1", "state": "1",
"category_id": "20", "category_id": categoryInfo.categoryId,
"status_all": "", "supplement_ids": uploadInfo.id]
"keywork": "",
"template_cate_id": "", print(params)
"supplement_ids": []] as [String: Any] viewModel.getCertificateList(params: params) {
// state: 3:待上传 2:已驳回 1:已通过 0:审核中
// viewModel.getCertificateList(params: params) { [weak self] listInfo, error in
// guard let self = self else { return }
// [weak self] listInfo, error in
// guard let self = self else { return } items.removeAll()
// if let listInfo = listInfo {
// items.removeAll() let arr = listInfo.supplementList
// if let listInfo = listInfo { for item in arr {
// let arr = listInfo.supplementList items.append(contentsOf: item.contentUrl)
// if let info = arr.first { }
// let arr = info.contentUrl }
// items.append(contentsOf: arr) self.tableView.reloadData()
// }
// self.tableView.reloadData() if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
// } YHHUD.flash(message: errorMsg, duration:3)
// }
// if let errorMsg = error?.errorMsg, errorMsg.count > 0 { }
// YHHUD.flash(message: errorMsg, duration:3)
// }
// }
} }
// 更改证件
// operation参数必填,必须是:add(上传)、del(删除)、rename(重命名)
func updateCertificateItem(_ model: YHContentUrl, operation:String, rename:String) {
var name = model.name
if operation == "rename" {
name = rename
}
let dic:[String : Any] = [
"id" : uploadInfo.id,
"content_url": [
"name": name,
"url": model.url,
"suffix": model.suffix]]
let params: [String: Any] = [
"file_info" : [dic],
"operation" : operation,
]
self.viewModel.updateCertificates(params: params) {
success in
if operation == "del" {
YHHUD.flash(message: success ? "删除成功" : "删除失败")
} else if operation == "rename" {
YHHUD.flash(message: success ? "重命名成功" : "重命名失败")
}
}
}
} }
...@@ -68,7 +68,22 @@ class YHSupplementInfo: SmartCodable { ...@@ -68,7 +68,22 @@ class YHSupplementInfo: SmartCodable {
var applicantName: String = "" var applicantName: String = ""
var nameExtra: YHNameExtra = YHNameExtra() var nameExtra: YHNameExtra = YHNameExtra()
var templateInfo: YHTemplateInfo = YHTemplateInfo() var templateInfo: YHTemplateInfo = YHTemplateInfo()
var auditContent: String = ""
var uploadRequirement: String = ""
var contentUrl: [YHContentUrl] = [] var contentUrl: [YHContentUrl] = []
func getStatusName() -> String {
if checkStatus == YHCertificateUploadStatus.review.rawValue {
return "审核中".local
} else if checkStatus == YHCertificateUploadStatus.preUpload.rawValue {
return "待上传".local
} else if checkStatus == YHCertificateUploadStatus.finish.rawValue {
return "已通过".local
} else if checkStatus == YHCertificateUploadStatus.rejected.rawValue {
return "已驳回".local
}
return ""
}
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id = "id" case id = "id"
...@@ -81,6 +96,8 @@ class YHSupplementInfo: SmartCodable { ...@@ -81,6 +96,8 @@ class YHSupplementInfo: SmartCodable {
case applicantName = "applicant_name" case applicantName = "applicant_name"
case nameExtra = "name_extra" case nameExtra = "name_extra"
case templateInfo = "template_info" case templateInfo = "template_info"
case auditContent = "audit_content"
case uploadRequirement = "upload_requirement"
case contentUrl = "content_url" case contentUrl = "content_url"
} }
...@@ -165,6 +182,13 @@ class YHTemplateInfo: SmartCodable { ...@@ -165,6 +182,13 @@ class YHTemplateInfo: SmartCodable {
var description: String = "" var description: String = ""
var materialPath: [YHMaterialPath] = [] var materialPath: [YHMaterialPath] = []
func isNeedShowTemplate() -> Bool {
if self.description.isEmpty && self.materialPath.isEmpty {
return false
}
return true
}
required init() { required init() {
} }
......
...@@ -12,13 +12,16 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -12,13 +12,16 @@ class YHCertificateNameCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateNameCell" static let cellReuseIdentifier = "YHCertificateNameCell"
var editBlock:((YHContentUrl)->())?
var whiteView: UIView! var whiteView: UIView!
var iconImgV: UIImageView! var iconImgV: UIImageView!
var nameLabel: UILabel! var nameLabel: UILabel!
var timeLabel: UILabel! var timeLabel: UILabel!
var editBtn: UIButton! var editBtn: UIButton!
var contentItem: YHContentUrl!
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
} }
...@@ -29,10 +32,49 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -29,10 +32,49 @@ class YHCertificateNameCell: UITableViewCell {
} }
func updateModel(_ model: YHContentUrl) { func updateModel(_ model: YHContentUrl) {
contentItem = model
nameLabel.text = model.name nameLabel.text = model.name
timeLabel.text = "上传于\(model.updatedAt)" timeLabel.text = "上传于\(model.updatedAt)"
var suffix = ""
var iconImgName = ""
if !model.url.pathExtension.isEmpty {
suffix = model.url.pathExtension
} else {
suffix = model.suffix
}
if suffix == "jpeg" {
iconImgName = "my_cer_type_jpg"
} else if suffix == "jpg" {
iconImgName = "my_cer_type_jpg"
} else if suffix == "png" {
iconImgName = "my_cer_type_png"
} else if suffix == "pdf" {
iconImgName = "my_cer_type_pdf"
} else if suffix == "doc" || suffix == "docx" {
iconImgName = "my_cer_type_word"
} else if suffix == "ppt" || suffix == "pptx" {
iconImgName = "my_cer_type_ppt"
}
iconImgV.image = UIImage(named: iconImgName)
} }
@objc func didEditBtnClicked() {
if let editBlock = editBlock {
editBlock(contentItem)
}
}
func setupUI() { func setupUI() {
self.selectionStyle = .none self.selectionStyle = .none
...@@ -60,6 +102,8 @@ class YHCertificateNameCell: UITableViewCell { ...@@ -60,6 +102,8 @@ class YHCertificateNameCell: UITableViewCell {
editBtn = UIButton() editBtn = UIButton()
editBtn.setImage(UIImage(named:"my_cer_btn_edit"), for:.normal) editBtn.setImage(UIImage(named:"my_cer_btn_edit"), for:.normal)
editBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
editBtn.addTarget(self, action: #selector(didEditBtnClicked), for: .touchUpInside)
whiteView.addSubview(editBtn) whiteView.addSubview(editBtn)
whiteView.snp.makeConstraints { make in whiteView.snp.makeConstraints { make in
......
...@@ -11,14 +11,46 @@ import UIKit ...@@ -11,14 +11,46 @@ import UIKit
class YHCertificateTemplateCell: UITableViewCell { class YHCertificateTemplateCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateTemplateCell" static let cellReuseIdentifier = "YHCertificateTemplateCell"
var templateInfo: YHTemplateInfo? {
didSet {
guard let templateInfo = templateInfo else {
contentView.isHidden = true
return
}
if templateInfo.description.isEmpty && templateInfo.materialPath.isEmpty {
contentView.isHidden = true
return
}
contentView.isHidden = false
if !templateInfo.name.isEmpty {
templateTitleLabel.text = "\(templateInfo.name)示例模版"
} else {
templateTitleLabel.text = ""
}
if !templateInfo.description.isEmpty {
tipsLabel.text = "注意事项: \(templateInfo.description)"
} else {
tipsLabel.text = ""
}
let noTemplate = templateInfo.materialPath.isEmpty
templateView.isHidden = noTemplate
templateView.snp.updateConstraints { make in
make.height.equalTo(noTemplate ? 0.0 : 62.0)
make.bottom.equalToSuperview().offset(noTemplate ? 0.0 : -34.0)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
lazy var tipsLabel: UILabel = { lazy var tipsLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor.labelTextColor2 label.textColor = UIColor.labelTextColor2
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:12) label.font = UIFont.PFSC_R(ofSize:12)
label.numberOfLines = 0 label.numberOfLines = 0
label.text = "注意事项:这里是上传应该注意的事项这里是上传应该注意的事项这里是上传应该注意的事项。"
return label return label
}() }()
...@@ -27,7 +59,8 @@ class YHCertificateTemplateCell: UITableViewCell { ...@@ -27,7 +59,8 @@ class YHCertificateTemplateCell: UITableViewCell {
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:17) label.font = UIFont.PFSC_M(ofSize:17)
label.text = "身份证示例模版" label.text = "示例模版"
label.numberOfLines = 0
return label return label
}() }()
...@@ -49,6 +82,8 @@ class YHCertificateTemplateCell: UITableViewCell { ...@@ -49,6 +82,8 @@ class YHCertificateTemplateCell: UITableViewCell {
func createUI() { func createUI() {
self.selectionStyle = .none
contentView.addSubview(templateTitleLabel) contentView.addSubview(templateTitleLabel)
contentView.addSubview(tipsLabel) contentView.addSubview(tipsLabel)
contentView.addSubview(templateView) contentView.addSubview(templateView)
...@@ -57,7 +92,6 @@ class YHCertificateTemplateCell: UITableViewCell { ...@@ -57,7 +92,6 @@ class YHCertificateTemplateCell: UITableViewCell {
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.top.equalToSuperview().offset(16) make.top.equalToSuperview().offset(16)
make.height.equalTo(24.0)
} }
tipsLabel.snp.makeConstraints { make in tipsLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
......
...@@ -53,20 +53,20 @@ class YHCertificateTemplateView: UIView { ...@@ -53,20 +53,20 @@ class YHCertificateTemplateView: UIView {
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.equalToSuperview().offset(16)
make.left.right.equalToSuperview() make.left.equalToSuperview().offset(64)
make.height.equalTo(24) make.right.equalToSuperview().offset(-64)
make.bottom.equalToSuperview().offset(-12)
} }
closeBtn.snp.makeConstraints { make in closeBtn.snp.makeConstraints { make in
make.centerY.equalTo(titleLabel) make.top.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.width.height.equalTo(24) make.width.height.equalTo(24)
} }
closeBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) closeBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)
line.snp.makeConstraints { make in line.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.height.equalTo(1) make.height.equalTo(1)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
return view return view
...@@ -91,6 +91,7 @@ class YHCertificateTemplateView: UIView { ...@@ -91,6 +91,7 @@ class YHCertificateTemplateView: UIView {
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.textAlignment = .center label.textAlignment = .center
label.font = UIFont.PFSC_B(ofSize:17) label.font = UIFont.PFSC_B(ofSize:17)
label.numberOfLines = 0
label.text = "示例模版" label.text = "示例模版"
return label return label
}() }()
...@@ -151,9 +152,9 @@ class YHCertificateTemplateView: UIView { ...@@ -151,9 +152,9 @@ class YHCertificateTemplateView: UIView {
if !model.description.isEmpty { if !model.description.isEmpty {
tipsLabel.text = "注意事项:\(model.description)" tipsLabel.text = "注意事项:\(model.description)"
} }
templateView.isHidden = model.materialPath.isEmpty
let topMargin = model.description.isEmpty ? 0 : 20 let topMargin = model.description.isEmpty ? 0 : 20
templateView.snp.updateConstraints { make in templateView.snp.updateConstraints { make in
make.top.equalTo(tipsLabel.snp.bottom).offset(topMargin) make.top.equalTo(tipsLabel.snp.bottom).offset(topMargin)
} }
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
// //
/* /*
【Usage】 【Usage】
let view = YHFileRenameInputView.inputView(defalutText:"adfasfsf", editBlock: { let view = YHFileRenameInputView.inputView(defalutText:"adfasfsf")
text in view.editBlock = {
print("\(text)") text in
}) }
*/ */
import UIKit import UIKit
...@@ -18,7 +18,7 @@ import UIKit ...@@ -18,7 +18,7 @@ import UIKit
class YHFileRenameInputView: UIView { class YHFileRenameInputView: UIView {
static let height = 217.0 static let height = 217.0
var editBlock:((String?)->())? var editBlock:((String?)->Void)?
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds) let view = UIView(frame:UIScreen.main.bounds)
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5) view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
...@@ -66,7 +66,7 @@ class YHFileRenameInputView: UIView { ...@@ -66,7 +66,7 @@ class YHFileRenameInputView: UIView {
lazy var textField:UITextField = { lazy var textField:UITextField = {
let textField = UITextField() let textField = UITextField()
textField.backgroundColor = .clear textField.backgroundColor = .clear
textField.placeholder = "请输入文件名称" textField.attributedPlaceholder = NSAttributedString(string: "请输入文件名称", attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
textField.font = UIFont.PFSC_M(ofSize: 16) textField.font = UIFont.PFSC_M(ofSize: 16)
textField.tintColor = UIColor.brandMainColor textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor textField.textColor = UIColor.mainTextColor
...@@ -104,10 +104,9 @@ class YHFileRenameInputView: UIView { ...@@ -104,10 +104,9 @@ class YHFileRenameInputView: UIView {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
static func inputView(defalutText:String?, editBlock:((String?)->())?)-> YHFileRenameInputView { static func inputView(defalutText:String?)-> YHFileRenameInputView {
let view = YHFileRenameInputView(frame:CGRect(x: 0, y: 0, width:KScreenWidth, height:Self.height)) let view = YHFileRenameInputView(frame:CGRect(x: 0, y: 0, width:KScreenWidth, height:Self.height))
view.textField.text = defalutText view.textField.text = defalutText
view.editBlock = editBlock
return view return view
} }
...@@ -186,10 +185,15 @@ extension YHFileRenameInputView { ...@@ -186,10 +185,15 @@ extension YHFileRenameInputView {
} }
@objc func didClickConfirmBtn() { @objc func didClickConfirmBtn() {
dismiss() if isEmptyString(textField.text) {
YHHUD.flash(message: "重命名不可为空")
return
}
if let editBlock = editBlock { if let editBlock = editBlock {
editBlock(textField.text) editBlock(textField.text)
} }
dismiss()
} }
} }
......
...@@ -137,7 +137,7 @@ class YHCertificateViewModel: YHBaseViewModel { ...@@ -137,7 +137,7 @@ class YHCertificateViewModel: YHBaseViewModel {
} }
func uploadCertificates(params:[String : Any], isSilient:Bool = false, callBack:@escaping ((Bool)->())) { func updateCertificates(params:[String : Any], isSilient:Bool = false, callBack:@escaping ((Bool)->())) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.certificateUploadApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.certificateUploadApi
......
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