Commit 0dc1b7bb authored by pete谢兆麟's avatar pete谢兆麟

Merge commit 'a218cef7' into xiezhaolin

parents eeb298aa a218cef7
...@@ -219,6 +219,7 @@ ...@@ -219,6 +219,7 @@
049537852BA9B28500AF7E59 /* YHCertificateTemplateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */; }; 049537852BA9B28500AF7E59 /* YHCertificateTemplateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; }; 049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; }; 049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; };
04A271232BABFF3200652B1B /* YHCertificateUploadTypeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */; };
04A671592B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */; }; 04A671592B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */; };
04A6715C2B9FE9EA00C1FB91 /* YHUploadContentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A6715B2B9FE9EA00C1FB91 /* YHUploadContentVC.swift */; }; 04A6715C2B9FE9EA00C1FB91 /* YHUploadContentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A6715B2B9FE9EA00C1FB91 /* YHUploadContentVC.swift */; };
04A6715E2B9FFCA700C1FB91 /* YHCertificateNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */; }; 04A6715E2B9FFCA700C1FB91 /* YHCertificateNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */; };
...@@ -240,7 +241,7 @@ ...@@ -240,7 +241,7 @@
04E86E0B2B70C13300A35F4B /* YHCodeSueecssViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E0A2B70C13300A35F4B /* YHCodeSueecssViewController.swift */; }; 04E86E0B2B70C13300A35F4B /* YHCodeSueecssViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E0A2B70C13300A35F4B /* YHCodeSueecssViewController.swift */; };
04E86E0D2B70D51D00A35F4B /* YHWebViewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */; }; 04E86E0D2B70D51D00A35F4B /* YHWebViewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */; };
04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */; }; 04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */; };
04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateView.swift */; }; 04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; }; 6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; }; A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; };
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; }; A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; };
...@@ -599,6 +600,7 @@ ...@@ -599,6 +600,7 @@
049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateCell.swift; sourceTree = "<group>"; }; 049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateCell.swift; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; }; 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; }; 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; };
04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadTypeCell.swift; sourceTree = "<group>"; };
04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadSheetView.swift; sourceTree = "<group>"; }; 04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadSheetView.swift; sourceTree = "<group>"; };
04A6715B2B9FE9EA00C1FB91 /* YHUploadContentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUploadContentVC.swift; sourceTree = "<group>"; }; 04A6715B2B9FE9EA00C1FB91 /* YHUploadContentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUploadContentVC.swift; sourceTree = "<group>"; };
04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateNameCell.swift; sourceTree = "<group>"; }; 04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateNameCell.swift; sourceTree = "<group>"; };
...@@ -620,7 +622,7 @@ ...@@ -620,7 +622,7 @@
04E86E0A2B70C13300A35F4B /* YHCodeSueecssViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeSueecssViewController.swift; sourceTree = "<group>"; }; 04E86E0A2B70C13300A35F4B /* YHCodeSueecssViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeSueecssViewController.swift; sourceTree = "<group>"; };
04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWebViewViewController.swift; sourceTree = "<group>"; }; 04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWebViewViewController.swift; sourceTree = "<group>"; };
04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginManager.swift; sourceTree = "<group>"; }; 04E86E652B86EB6F00A35F4B /* YHLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginManager.swift; sourceTree = "<group>"; };
04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateView.swift; sourceTree = "<group>"; }; 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; };
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; }; 58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; };
987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; }; A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
...@@ -1453,12 +1455,13 @@ ...@@ -1453,12 +1455,13 @@
048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */, 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */,
044867B32BA1953B00DFAD4A /* YHCertificateFilterView.swift */, 044867B32BA1953B00DFAD4A /* YHCertificateFilterView.swift */,
044867B72BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift */, 044867B72BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift */,
04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateView.swift */, 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */,
04A6715F2BA0280800C1FB91 /* YHFileRenameInputView.swift */, 04A6715F2BA0280800C1FB91 /* YHFileRenameInputView.swift */,
04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */, 04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */,
0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */, 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */,
044867B52BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift */, 044867B52BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift */,
049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */, 049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */,
04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */,
0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */, 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */,
A592FE902BA6CC010062FACA /* YHCertificateEntryHeadView.swift */, A592FE902BA6CC010062FACA /* YHCertificateEntryHeadView.swift */,
A592FE922BA6CFFC0062FACA /* YHCertificateEntryBottomView.swift */, A592FE922BA6CFFC0062FACA /* YHCertificateEntryBottomView.swift */,
...@@ -2288,6 +2291,7 @@ ...@@ -2288,6 +2291,7 @@
045EEE982B9F171A0022A143 /* YHPreviewInfoQuestionAndAnswerItemsView.swift in Sources */, 045EEE982B9F171A0022A143 /* YHPreviewInfoQuestionAndAnswerItemsView.swift in Sources */,
045EEE7A2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift in Sources */, 045EEE7A2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift in Sources */,
A5ACE94A2B4564F7002C94D2 /* YHHUDProgressView.swift in Sources */, A5ACE94A2B4564F7002C94D2 /* YHHUDProgressView.swift in Sources */,
04A271232BABFF3200652B1B /* YHCertificateUploadTypeCell.swift in Sources */,
A5D0012C2BABC84A001F003C /* YHFileListBottomView.swift in Sources */, A5D0012C2BABC84A001F003C /* YHFileListBottomView.swift in Sources */,
A5FD63C52B637EE000D1D9DA /* YHSubmitAllInfoCheckView.swift in Sources */, A5FD63C52B637EE000D1D9DA /* YHSubmitAllInfoCheckView.swift in Sources */,
045EEF222B9F171A0022A143 /* YHImagePickerView.swift in Sources */, 045EEF222B9F171A0022A143 /* YHImagePickerView.swift in Sources */,
...@@ -2507,7 +2511,7 @@ ...@@ -2507,7 +2511,7 @@
A5C5B32B2B57D17600A7C5D1 /* YHDavidCell5.swift in Sources */, A5C5B32B2B57D17600A7C5D1 /* YHDavidCell5.swift in Sources */,
A58A8C942BA6C7C600632765 /* YHCertificateEntryModel.swift in Sources */, A58A8C942BA6C7C600632765 /* YHCertificateEntryModel.swift in Sources */,
045EEEB82B9F171A0022A143 /* YHWorkExampleMessageView.swift in Sources */, 045EEEB82B9F171A0022A143 /* YHWorkExampleMessageView.swift in Sources */,
04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateView.swift in Sources */, 04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */,
045EEEA22B9F171A0022A143 /* YHWorkExperienceProjectModel.swift in Sources */, 045EEEA22B9F171A0022A143 /* YHWorkExperienceProjectModel.swift in Sources */,
0435FA832BA2DEB100024EAE /* YHCardButton.swift in Sources */, 0435FA832BA2DEB100024EAE /* YHCardButton.swift in Sources */,
045EEECA2B9F171A0022A143 /* YHMyDocumentsListViewController.swift in Sources */, 045EEECA2B9F171A0022A143 /* YHMyDocumentsListViewController.swift in Sources */,
......
...@@ -105,7 +105,7 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou ...@@ -105,7 +105,7 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
cell.templateBlock = { cell.templateBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
let view = YHCertificateTemplateView.templateView(item.templateInfo) let view = YHCertificateTemplateSheetView.templateView(item.templateInfo)
view.scanTemplateBlock = { view.scanTemplateBlock = {
[weak self] temlateInfo in [weak self] temlateInfo in
guard let self = self else { return } guard let self = self else { return }
...@@ -124,15 +124,21 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou ...@@ -124,15 +124,21 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
// if item.checkStatus == YHCertificateUploadStatus.preUpload { // 待上传
showUploadSheetView(item.templateInfo)
return
// }
// 非待上传的进入详情
let vc = YHUploadContentVC() let vc = YHUploadContentVC()
vc.orderId = orderId vc.orderId = orderId
vc.categoryInfo = categoryInfo vc.categoryInfo = categoryInfo
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
vc.uploadInfo = item vc.uploadInfo = item
}
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 14.0 return 14.0
...@@ -216,4 +222,30 @@ extension YHCertificateResourceUploadVC { ...@@ -216,4 +222,30 @@ extension YHCertificateResourceUploadVC {
} }
} }
} }
func showUploadSheetView(_ template: YHTemplateInfo) {
let sheetView = YHCertificateUploadSheetView.sheetView
sheetView.templateInfo = template
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
if let fileData = try? Data(contentsOf: fileUrl) {
// 将文件数据上传到服务器
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)")
self.viewModel.uploadFile(fileUrl.absoluteString) {[weak self] success, error in
guard let self = self else { return }
}
}
}
sheetView.uploadImageBlock = {
[weak self] image in
guard let self = self else { return }
// uploadImage(image)
}
sheetView.show()
}
} }
...@@ -164,9 +164,9 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -164,9 +164,9 @@ 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 // cell.templateInfo = uploadInfo.templateInfo
cell.templateClick = { cell.templateClick = {
[weak self] in [weak self] path in
guard let self = self else { return } guard let self = self else { return }
// 查看模版 uploadInfo.templateInfo // 查看模版 uploadInfo.templateInfo
......
...@@ -181,6 +181,7 @@ class YHTemplateInfo: SmartCodable { ...@@ -181,6 +181,7 @@ class YHTemplateInfo: SmartCodable {
var name: String = "" var name: String = ""
var description: String = "" var description: String = ""
var materialPath: [YHMaterialPath] = [] var materialPath: [YHMaterialPath] = []
var guideFilePath: [YHMaterialPath] = []
func isNeedShowTemplate() -> Bool { func isNeedShowTemplate() -> Bool {
if self.description.isEmpty && self.materialPath.isEmpty { if self.description.isEmpty && self.materialPath.isEmpty {
...@@ -198,9 +199,10 @@ class YHTemplateInfo: SmartCodable { ...@@ -198,9 +199,10 @@ class YHTemplateInfo: SmartCodable {
case name = "name" case name = "name"
case description = "description" case description = "description"
case materialPath = "material_path" case materialPath = "material_path"
case guideFilePath = "guide_file_path"
} }
init(id: Int = 0, name: String = "", description: String = "", materialPath: [YHMaterialPath] = []) { init(id: Int = 0, name: String = "", description: String = "", materialPath: [YHMaterialPath] = [], guideFilePath: [YHMaterialPath] = []) {
self.id = id self.id = id
self.name = name self.name = name
self.description = description self.description = description
......
...@@ -73,7 +73,7 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -73,7 +73,7 @@ class YHCertificateInfoCell: UITableViewCell {
statusBtn.setTitle(title, for: .normal) statusBtn.setTitle(title, for: .normal)
} }
if model.templateInfo.materialPath.isEmpty && model.templateInfo.description.isEmpty { if model.templateInfo.materialPath.isEmpty && model.templateInfo.guideFilePath.isEmpty && model.templateInfo.description.isEmpty {
nameTextView.attributed.text = """ nameTextView.attributed.text = """
\(model.name, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(model.name, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16)))
......
...@@ -8,64 +8,74 @@ ...@@ -8,64 +8,74 @@
import UIKit import UIKit
class YHCertificateTemplateCell: UITableViewCell { class YHCertificateSampleTemplateView: UIView {
static let cellReuseIdentifier = "YHCertificateTemplateCell" lazy var iconImgV: UIImageView = {
let imgView = UIImageView(image:UIImage(named:"my_cer_template"))
return imgView
}()
var templateClick:(()->())? lazy var arrowImgV: UIImageView = {
let imgView = UIImageView(image:UIImage(named:"form_right_arrow"))
return imgView
}()
var templateInfo: YHTemplateInfo? { lazy var titleLabel: UILabel = {
didSet { let label = UILabel()
guard let templateInfo = templateInfo else { label.text = "查看证件示例模版".local
contentView.isHidden = true label.textColor = UIColor.mainTextColor
return label.textAlignment = .left
label.font = UIFont.PFSC_B(ofSize:14)
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
} }
if templateInfo.description.isEmpty && templateInfo.materialPath.isEmpty { required init?(coder: NSCoder) {
contentView.isHidden = true fatalError("init(coder:) has not been implemented")
return
} }
contentView.isHidden = false func createUI() {
if !templateInfo.name.isEmpty { self.backgroundColor = .contentBkgColor
templateTitleLabel.text = "\(templateInfo.name)示例模版" self.layer.cornerRadius = 6.0
} else { self.clipsToBounds = true
templateTitleLabel.text = ""
} self.addSubview(iconImgV)
if !templateInfo.description.isEmpty { self.addSubview(titleLabel)
tipsLabel.text = "注意事项: \(templateInfo.description)" self.addSubview(arrowImgV)
} else {
tipsLabel.text = "" iconImgV.snp.makeConstraints { make in
make.width.height.equalTo(24)
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(16)
} }
let noTemplate = templateInfo.materialPath.isEmpty
templateView.isHidden = noTemplate titleLabel.snp.makeConstraints { make in
templateView.snp.updateConstraints { make in make.height.equalTo(20)
make.height.equalTo(noTemplate ? 0.0 : 62.0) make.centerY.equalToSuperview()
make.bottom.equalToSuperview().offset(noTemplate ? 0.0 : -34.0) make.left.equalTo(iconImgV.snp.right).offset(12)
make.right.equalTo(arrowImgV.snp.left).offset(-5)
} }
self.setNeedsLayout()
self.layoutIfNeeded() arrowImgV.snp.makeConstraints { make in
make.width.height.equalTo(20)
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-13)
} }
} }
lazy var tipsLabel: UILabel = { }
let label = UILabel()
label.textColor = UIColor.labelTextColor2
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:12)
label.numberOfLines = 0
return label
}()
lazy var templateTitleLabel: UILabel = { class YHCertificateTemplateCell: UITableViewCell {
let label = UILabel()
label.textColor = UIColor.mainTextColor static let cellReuseIdentifier = "YHCertificateTemplateCell"
label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:17) var templateClick:((YHMaterialPath?)->())?
label.text = "示例模版"
label.numberOfLines = 0 var templatePath: YHMaterialPath?
return label
}()
lazy var templateView: YHCertificateSampleTemplateView = { lazy var templateView: YHCertificateSampleTemplateView = {
let view = YHCertificateSampleTemplateView(frame:CGRectZero) let view = YHCertificateSampleTemplateView(frame:CGRectZero)
...@@ -75,9 +85,7 @@ class YHCertificateTemplateCell: UITableViewCell { ...@@ -75,9 +85,7 @@ class YHCertificateTemplateCell: UITableViewCell {
}() }()
@objc func didTemplateTap() { @objc func didTemplateTap() {
if let templateClick = templateClick { templateClick?(templatePath)
templateClick()
}
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
...@@ -93,26 +101,17 @@ class YHCertificateTemplateCell: UITableViewCell { ...@@ -93,26 +101,17 @@ class YHCertificateTemplateCell: UITableViewCell {
self.selectionStyle = .none self.selectionStyle = .none
contentView.addSubview(templateTitleLabel)
contentView.addSubview(tipsLabel)
contentView.addSubview(templateView) contentView.addSubview(templateView)
templateView.snp.makeConstraints { make in
templateTitleLabel.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.top.equalToSuperview().offset(16) make.top.bottom.equalToSuperview()
} }
tipsLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(templateTitleLabel.snp.bottom).offset(5)
} }
templateView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20) func update(bottomMargin:CGFloat) {
make.right.equalToSuperview().offset(-20) templateView.snp.updateConstraints { make in
make.top.equalTo(tipsLabel.snp.bottom).offset(15) make.bottom.equalToSuperview().offset(-bottomMargin)
make.height.equalTo(62.0)
make.bottom.equalToSuperview().offset(-34)
} }
} }
......
...@@ -17,15 +17,17 @@ ...@@ -17,15 +17,17 @@
import UIKit import UIKit
class YHCertificateTemplateView: UIView { class YHCertificateTemplateSheetView: UIView {
static func templateView(_ model: YHTemplateInfo) -> YHCertificateTemplateView { static func templateView(_ model: YHTemplateInfo) -> YHCertificateTemplateSheetView {
let sheetView = YHCertificateTemplateView(frame:UIScreen.main.bounds) let sheetView = YHCertificateTemplateSheetView(frame:UIScreen.main.bounds)
sheetView.updateModel(model) sheetView.updateModel(model)
return sheetView return sheetView
} }
var templateArr: [YHMaterialPath] = []
var templateInfo: YHTemplateInfo? var templateInfo: YHTemplateInfo?
var scanTemplateBlock: ((YHTemplateInfo?)->())? var scanTemplateBlock: ((YHTemplateInfo?)->())?
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
...@@ -72,19 +74,25 @@ class YHCertificateTemplateView: UIView { ...@@ -72,19 +74,25 @@ class YHCertificateTemplateView: UIView {
return view return view
}() }()
lazy var scrollView: UIScrollView = { lazy var tableView: UITableView = {
let view = UIScrollView()
view.addSubview(scrollContentView) let tableView = UITableView(frame:.zero, style:.grouped)
scrollContentView.snp.makeConstraints { make in
make.edges.equalToSuperview() if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
} }
return view tableView.estimatedSectionHeaderHeight = 20.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = .white
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHCertificateTemplateCell.self, forCellReuseIdentifier: YHCertificateTemplateCell.cellReuseIdentifier)
return tableView
}() }()
lazy var scrollContentView: UIView = {
let view = UIView()
return view
}()
lazy var titleLabel: UILabel = { lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
...@@ -103,24 +111,6 @@ class YHCertificateTemplateView: UIView { ...@@ -103,24 +111,6 @@ class YHCertificateTemplateView: UIView {
return btn return btn
}() }()
lazy var tipsLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = ""
return label
}()
lazy var templateView: YHCertificateSampleTemplateView = {
let view = YHCertificateSampleTemplateView(frame:CGRectZero)
view.tag = YHCertificateUploadType.sample.rawValue
let tap = UITapGestureRecognizer(target:self, action:#selector(didTemplateViewClicked))
view.addGestureRecognizer(tap)
return view
}()
lazy var knowBtn:UIButton = { lazy var knowBtn:UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setTitle("知道了".local, for: .normal) btn.setTitle("知道了".local, for: .normal)
...@@ -149,15 +139,16 @@ class YHCertificateTemplateView: UIView { ...@@ -149,15 +139,16 @@ class YHCertificateTemplateView: UIView {
titleLabel.text = "\(model.name)示例模版" titleLabel.text = "\(model.name)示例模版"
} }
if !model.description.isEmpty { templateArr.removeAll()
tipsLabel.text = "注意事项:\(model.description)"
}
templateView.isHidden = model.materialPath.isEmpty
let topMargin = model.description.isEmpty ? 0 : 20 if model.materialPath.count > 0 {
templateView.snp.updateConstraints { make in templateArr.append(model.materialPath[0])
make.top.equalTo(tipsLabel.snp.bottom).offset(topMargin)
} }
if model.guideFilePath.count > 0 {
templateArr.append(model.guideFilePath[0])
}
self.tableView.reloadData()
self.setNeedsLayout() self.setNeedsLayout()
self.layoutIfNeeded() self.layoutIfNeeded()
} }
...@@ -167,11 +158,8 @@ class YHCertificateTemplateView: UIView { ...@@ -167,11 +158,8 @@ class YHCertificateTemplateView: UIView {
self.addSubview(blackMaskView) self.addSubview(blackMaskView)
self.addSubview(whiteContentView) self.addSubview(whiteContentView)
whiteContentView.addSubview(topView) whiteContentView.addSubview(topView)
whiteContentView.addSubview(scrollView)
whiteContentView.addSubview(knowBtn) whiteContentView.addSubview(knowBtn)
whiteContentView.addSubview(tableView)
scrollContentView.addSubview(tipsLabel)
scrollContentView.addSubview(templateView)
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue) 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(16.0, 16.0));
...@@ -192,30 +180,12 @@ class YHCertificateTemplateView: UIView { ...@@ -192,30 +180,12 @@ class YHCertificateTemplateView: UIView {
make.top.left.right.equalToSuperview() make.top.left.right.equalToSuperview()
} }
scrollView.snp.makeConstraints { make in tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.top.equalTo(topView.snp.bottom).offset(20) make.top.equalTo(topView.snp.bottom).offset(20)
make.bottom.equalTo(knowBtn.snp.top).offset(-8) make.bottom.equalTo(knowBtn.snp.top).offset(-8)
} }
tipsLabel.snp.makeConstraints { make in
let gap = 20.0
make.left.equalToSuperview().offset(gap)
make.right.equalToSuperview().offset(-gap)
make.width.equalTo(KScreenWidth-gap*2.0)
make.top.equalToSuperview()
}
templateView.snp.makeConstraints { make in
let gap = 20.0
make.left.equalToSuperview().offset(gap)
make.right.equalToSuperview().offset(-gap)
make.width.equalTo(KScreenWidth-gap*2.0)
make.height.equalTo(62.0)
make.top.equalTo(tipsLabel.snp.bottom).offset(20)
make.bottom.equalToSuperview().offset(-20)
}
knowBtn.snp.makeConstraints { make in knowBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16) make.right.equalToSuperview().offset(-16)
...@@ -224,7 +194,7 @@ class YHCertificateTemplateView: UIView { ...@@ -224,7 +194,7 @@ class YHCertificateTemplateView: UIView {
} }
} }
func show() -> YHCertificateTemplateView { func show() -> YHCertificateTemplateSheetView {
UIApplication.shared.yhKeyWindow()?.addSubview(self) UIApplication.shared.yhKeyWindow()?.addSubview(self)
return self return self
} }
...@@ -244,3 +214,72 @@ class YHCertificateTemplateView: UIView { ...@@ -244,3 +214,72 @@ class YHCertificateTemplateView: UIView {
dismiss() dismiss()
} }
} }
extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return templateArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateTemplateCell.cellReuseIdentifier, for: indexPath) as! YHCertificateTemplateCell
if 0 <= indexPath.row && indexPath.row < templateArr.count {
cell.templatePath = templateArr[indexPath.row]
cell.templateClick = {
[weak self] path in
}
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 62.0
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
if let desc = templateInfo?.description, !desc.isEmpty {
return UITableView.automaticDimension
}
return 0.0
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 20.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
if section == 0, let desc = templateInfo?.description, !desc.isEmpty {
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = "注意事项:\(desc)"
view.addSubview(label)
label.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.bottom.equalToSuperview().offset(-20)
}
}
return view
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
}
//
// YHCertificateUploadTypeCell.swift
// galaxy
//
// Created by edy on 2024/3/21.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateUploadItem {
var type: YHCertificateUploadType
var title: String
var subtitle: String
init(type:YHCertificateUploadType, title: String, subtitle: String = "") {
self.type = type
self.title = title
self.subtitle = subtitle
}
}
class YHCertificateUploadItemView: UIView {
var item: YHCertificateUploadItem {
didSet {
updateUI()
}
}
lazy var topLine:UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_M(ofSize:14)
return label
}()
lazy var subTitleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.labelTextColor2
label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize:11)
return label
}()
init(_ item: YHCertificateUploadItem) {
self.item = item
super.init(frame:CGRect(x: 0, y: 0, width: KScreenWidth, height: 52.0))
self.createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createUI() {
self.tag = self.item.type.rawValue
self.addSubview(titleLabel)
self.addSubview(subTitleLabel)
self.addSubview(topLine)
updateUI()
}
func updateUI() {
self.tag = self.item.type.rawValue
titleLabel.text = item.title
subTitleLabel.text = item.subtitle
subTitleLabel.isHidden = item.subtitle.isEmpty
if item.type == .cancel {
titleLabel.textColor = UIColor(hexString:"#909090")
}
titleLabel.snp.remakeConstraints { make in
make.height.equalTo(20)
make.left.right.equalToSuperview()
if item.subtitle.isEmpty {
make.centerY.equalToSuperview()
} else {
make.bottom.equalTo(self.snp.centerY)
}
}
subTitleLabel.snp.remakeConstraints { make in
make.height.equalTo(16)
make.left.right.equalToSuperview()
make.top.equalTo(titleLabel.snp.bottom)
}
topLine.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalToSuperview()
make.height.equalTo(1)
}
}
}
class YHCertificateUploadTypeCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateUploadTypeCell"
lazy var itemView: YHCertificateUploadItemView = {
let view = YHCertificateUploadItemView(YHCertificateUploadItem(type:.camera, title:"拍照上传"))
return view
}()
var item: YHCertificateUploadItem! {
didSet {
itemView.item = item
}
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
createUI()
}
func createUI() {
self.selectionStyle = .none
contentView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
}
}
...@@ -194,7 +194,10 @@ class YHCollegeInfo: SmartCodable { ...@@ -194,7 +194,10 @@ class YHCollegeInfo: SmartCodable {
} else if mainNameType == 2 { } else if mainNameType == 2 {
return enName return enName
} }
return "" if !zhName.isEmpty {
return zhName
}
return enName
} }
required init() { required init() {
......
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