Commit 162975a9 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '3214f962' into xiezhaolin

parents b3d999a1 3214f962
...@@ -332,6 +332,7 @@ ...@@ -332,6 +332,7 @@
A5C5B3292B57CCBE00A7C5D1 /* YHDavidCell4.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B3282B57CCBE00A7C5D1 /* YHDavidCell4.swift */; }; A5C5B3292B57CCBE00A7C5D1 /* YHDavidCell4.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B3282B57CCBE00A7C5D1 /* YHDavidCell4.swift */; };
A5C5B32B2B57D17600A7C5D1 /* YHDavidCell5.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B32A2B57D17600A7C5D1 /* YHDavidCell5.swift */; }; A5C5B32B2B57D17600A7C5D1 /* YHDavidCell5.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B32A2B57D17600A7C5D1 /* YHDavidCell5.swift */; };
A5C5B32D2B57D66000A7C5D1 /* YHBbxCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B32C2B57D66000A7C5D1 /* YHBbxCollectionViewCell.swift */; }; A5C5B32D2B57D66000A7C5D1 /* YHBbxCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B32C2B57D66000A7C5D1 /* YHBbxCollectionViewCell.swift */; };
A5D001212BAA9D99001F003C /* YHChoiceButtonHoldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D001202BAA9D99001F003C /* YHChoiceButtonHoldView.swift */; };
A5D6AB1B2B46A1CC001C10A5 /* YHHomeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */; }; A5D6AB1B2B46A1CC001C10A5 /* YHHomeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */; };
A5D6AB1D2B46AAFB001C10A5 /* YHHomePageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */; }; A5D6AB1D2B46AAFB001C10A5 /* YHHomePageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */; };
A5E69D512BA304D400411932 /* DIN Alternate Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */; }; A5E69D512BA304D400411932 /* DIN Alternate Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */; };
...@@ -713,6 +714,7 @@ ...@@ -713,6 +714,7 @@
A5C5B3282B57CCBE00A7C5D1 /* YHDavidCell4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHDavidCell4.swift; sourceTree = "<group>"; }; A5C5B3282B57CCBE00A7C5D1 /* YHDavidCell4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHDavidCell4.swift; sourceTree = "<group>"; };
A5C5B32A2B57D17600A7C5D1 /* YHDavidCell5.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHDavidCell5.swift; sourceTree = "<group>"; }; A5C5B32A2B57D17600A7C5D1 /* YHDavidCell5.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHDavidCell5.swift; sourceTree = "<group>"; };
A5C5B32C2B57D66000A7C5D1 /* YHBbxCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBbxCollectionViewCell.swift; sourceTree = "<group>"; }; A5C5B32C2B57D66000A7C5D1 /* YHBbxCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBbxCollectionViewCell.swift; sourceTree = "<group>"; };
A5D001202BAA9D99001F003C /* YHChoiceButtonHoldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChoiceButtonHoldView.swift; sourceTree = "<group>"; };
A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeModel.swift; sourceTree = "<group>"; }; A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeModel.swift; sourceTree = "<group>"; };
A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomePageViewModel.swift; sourceTree = "<group>"; }; A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomePageViewModel.swift; sourceTree = "<group>"; };
A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "DIN Alternate Bold.ttf"; sourceTree = "<group>"; }; A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "DIN Alternate Bold.ttf"; sourceTree = "<group>"; };
...@@ -1299,6 +1301,7 @@ ...@@ -1299,6 +1301,7 @@
045EEE592B9F171A0022A143 /* YHBasicInfoFillBottomView.swift */, 045EEE592B9F171A0022A143 /* YHBasicInfoFillBottomView.swift */,
045EEE5A2B9F171A0022A143 /* YHBasicInfoFillCell.swift */, 045EEE5A2B9F171A0022A143 /* YHBasicInfoFillCell.swift */,
045EEE5B2B9F171A0022A143 /* YHBasicInfoFillView.swift */, 045EEE5B2B9F171A0022A143 /* YHBasicInfoFillView.swift */,
A5D001202BAA9D99001F003C /* YHChoiceButtonHoldView.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2191,6 +2194,7 @@ ...@@ -2191,6 +2194,7 @@
04A6715C2B9FE9EA00C1FB91 /* YHUploadContentVC.swift in Sources */, 04A6715C2B9FE9EA00C1FB91 /* YHUploadContentVC.swift in Sources */,
A592FE972BA6DB340062FACA /* YHCertificateViewModel.swift in Sources */, A592FE972BA6DB340062FACA /* YHCertificateViewModel.swift in Sources */,
045EEEF02B9F171A0022A143 /* YHChildPrimaryInfoVC.swift in Sources */, 045EEEF02B9F171A0022A143 /* YHChildPrimaryInfoVC.swift in Sources */,
A5D001212BAA9D99001F003C /* YHChoiceButtonHoldView.swift in Sources */,
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */, 0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */,
045EEEF62B9F171A0022A143 /* YHSpousePrimaryInfoVC.swift in Sources */, 045EEEF62B9F171A0022A143 /* YHSpousePrimaryInfoVC.swift in Sources */,
044867B82BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift in Sources */, 044867B82BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift in Sources */,
...@@ -2671,7 +2675,7 @@ ...@@ -2671,7 +2675,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 6; CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
...@@ -2713,7 +2717,7 @@ ...@@ -2713,7 +2717,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 6; CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
......
...@@ -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)
} }
......
...@@ -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
......
...@@ -300,15 +300,12 @@ private extension YHBasicInfoFillView { ...@@ -300,15 +300,12 @@ private extension YHBasicInfoFillView {
make.right.equalTo(-12) make.right.equalTo(-12)
} }
guard let subModel = model.model else { guard let subModel = model.model else {
printLog("errorr: 数据有问题") printLog("errorr: 数据有问题")
title = model.question title = model.question
if model.answer == "Y" { if model.answer == "Y" {
didClickResponseBtn(btn: answer2Btn) didClickResponseBtn(btn: answer2Btn)
} else { } else {
if model.answer == "N" { if model.answer == "N" {
didClickResponseBtn(btn: answer1Btn) didClickResponseBtn(btn: answer1Btn)
} else { } else {
...@@ -318,55 +315,21 @@ private extension YHBasicInfoFillView { ...@@ -318,55 +315,21 @@ private extension YHBasicInfoFillView {
return return
} }
let tmpHoldView : YHChoiceButtonHoldView = YHChoiceButtonHoldView()
var targetView : UIView = lable tmpHoldView.targetId = Int(subModel.background_member?.info ?? "0") ?? 0
tmpHoldView.dataModel = subModel.subset
let targetId = Int(subModel.background_member?.info ?? "0") tmpHoldView.callBackBlock = { tag in
for (index,item) in subModel.subset.enumerated() { self.model?.info = tag
let name = item.subset_name.count > 0 ? item.subset_name : "--"
let btn = UIButton(type: .custom)
btn.setTitle(name, for: .normal)
btn.setTitle(name, for: .selected)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(UIColor.mainTextColor, for: .normal)
btn.setTitleColor(UIColor.brandMainColor, for: .selected)
btn.setImage(UIImage(named: "basic_info_radio_0"), for: .normal)
btn.setImage(UIImage(named: "basic_info_radio_1"), for: .selected)
btn.iconInLeft(spacing: 6)
btn.tag = item.id
btn.addTarget(self, action: #selector(clickCheckBtn(sender:)), for: .touchUpInside)
mutilChoiceHoldView.addSubview(btn)
if targetId == item.id {
btn.isSelected = true
} else {
btn.isSelected = false
}
if index == subModel.subset.count - 1 {
btn.snp.makeConstraints { make in
make.top.equalTo(targetView.snp.bottom).offset(kMargin)
make.left.equalTo(16)
make.height.equalTo(30)
make.bottom.equalToSuperview().offset(-kMargin)
}
} else {
btn.snp.makeConstraints { make in
make.top.equalTo(targetView.snp.bottom).offset(kMargin)
make.left.equalTo(16)
make.height.equalTo(30)
}
}
targetView = btn
arrCheckBtns.append(btn)
} }
mutilChoiceHoldView.addSubview(tmpHoldView)
tmpHoldView.snp.makeConstraints { make in
make.top.equalTo(lable.snp.bottom).offset(kMargin)
make.left.equalTo(lable.snp.left)
make.right.equalTo(lable.snp.right)
make.bottom.equalToSuperview().offset(-kMargin)
}
title = model.question title = model.question
if model.answer == "Y" { if model.answer == "Y" {
...@@ -451,18 +414,18 @@ extension YHBasicInfoFillView : UITextFieldDelegate { ...@@ -451,18 +414,18 @@ extension YHBasicInfoFillView : UITextFieldDelegate {
@objc func clickCheckBtn(sender : UIButton) { // @objc func clickCheckBtn(sender : UIButton) {
//修改成单选逻辑 // //修改成单选逻辑
if sender.isSelected != true { // if sender.isSelected != true {
for item in arrCheckBtns { // for item in arrCheckBtns {
item.isSelected = false // item.isSelected = false
} // }
sender.isSelected = true // sender.isSelected = true
model?.info = String(sender.tag) // model?.info = String(sender.tag)
} // }
//
layoutForYES() // layoutForYES()
} // }
} }
...@@ -531,7 +494,6 @@ private extension YHBasicInfoFillView { ...@@ -531,7 +494,6 @@ private extension YHBasicInfoFillView {
} }
else { else {
//需要展示提示的情况 //需要展示提示的情况
if model.type == 0 { if model.type == 0 {
additionHoldView.isHidden = false additionHoldView.isHidden = false
bottomLine.isHidden = false bottomLine.isHidden = false
......
//
// YHChoiceButtonHoldView.swift
// galaxy
//
// Created by davidhuangA on 2024/3/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHChoiceButtonHoldView: UIView {
typealias block = (_ index: String) -> ()
var callBackBlock: block?
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .clear
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private var arrCheckBtns : [UIButton] = []
var targetId : Int = -1
var dataModel : [subsetModel] = [] {
didSet {
updateView()
}
}
private func updateView() {
var x : CGFloat = 0
var y = 0
arrCheckBtns.removeAll()
for (index,item) in dataModel.enumerated() {
let string = item.subset_name.isEmpty == false ? item.subset_name : "--"
let font = UIFont.PFSC_M(ofSize: 14)// 设置字体样式及大小
let maxWidth : CGFloat = KScreenWidth - 28 * 2 // label最大宽度限制
let butGap : CGFloat = 25
var boundingBox = CGRect()
boundingBox = NSString(string: string).boundingRect(with: CGSize(width: KScreenWidth, height: .greatestFiniteMagnitude), options: [.usesLineFragmentOrigin], attributes: [.font : font], context: nil)
let width = boundingBox.size.width
if CGFloat(x) + width + 18.0 + butGap > maxWidth {
x = 0
y = y + 1
}
let btn = UIButton(type: .custom)
btn.setTitle(string, for: .normal)
btn.setTitle(string, for: .selected)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(UIColor.mainTextColor, for: .normal)
btn.setTitleColor(UIColor.brandMainColor, for: .selected)
btn.setImage(UIImage(named: "basic_info_radio_0"), for: .normal)
btn.setImage(UIImage(named: "basic_info_radio_1"), for: .selected)
btn.iconInLeft(spacing: 6)
btn.tag = item.id
btn.addTarget(self, action: #selector(clickCheckBtn(sender:)), for: .touchUpInside)
addSubview(btn)
let offy = y * 36
if dataModel.count - 1 == index {
//最后一个控件
btn.snp.makeConstraints { make in
make.left.equalTo(x)
make.top.equalTo(offy)
make.height.equalTo(20)
make.width.equalTo(width + 18 + butGap)
make.bottom.equalToSuperview()
}
} else {
btn.snp.makeConstraints { make in
make.left.equalTo(x)
make.top.equalTo(offy)
make.height.equalTo(20)
make.width.equalTo(width + 18 + butGap)
}
}
if targetId == item.id {
btn.isSelected = true
} else {
btn.isSelected = false
}
x = x + width + 18.0 + butGap
arrCheckBtns.append(btn)
}
}
@objc func clickCheckBtn(sender : UIButton) {
//修改成单选逻辑
if sender.isSelected != true {
for item in arrCheckBtns {
item.isSelected = false
}
sender.isSelected = true
// model?.info = String(sender.tag)
// block?(String(sender.tag))
callBackBlock?(String(sender.tag))
}
}
}
...@@ -49,6 +49,12 @@ class YHOtherResidenceFillView: UIView { ...@@ -49,6 +49,12 @@ class YHOtherResidenceFillView: UIView {
guard let self = self else { return } guard let self = self else { return }
self.endView.updateKeyName(name: "结束时间", keyValue: "") self.endView.updateKeyName(name: "结束时间", keyValue: "")
self.dataModel?.end_time = text self.dataModel?.end_time = text
if flag {
self.dataModel?.end_time_checked = true
} else {
self.dataModel?.end_time_checked = false
}
self.layoutIfNeeded() self.layoutIfNeeded()
} }
endView.snp.makeConstraints { make in endView.snp.makeConstraints { make in
......
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