Commit a10e6c06 authored by pete谢兆麟's avatar pete谢兆麟

续签补件 伪逻辑

parent 9717c59d
...@@ -269,6 +269,9 @@ ...@@ -269,6 +269,9 @@
045792172CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045792162CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift */; }; 045792172CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045792162CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift */; };
045792192CBE08BA00EBD99B /* YHLookResignResultViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045792182CBE08BA00EBD99B /* YHLookResignResultViewModel.swift */; }; 045792192CBE08BA00EBD99B /* YHLookResignResultViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045792182CBE08BA00EBD99B /* YHLookResignResultViewModel.swift */; };
0457921B2CBE0C3F00EBD99B /* YHLookResignResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0457921A2CBE0C3F00EBD99B /* YHLookResignResultModel.swift */; }; 0457921B2CBE0C3F00EBD99B /* YHLookResignResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0457921A2CBE0C3F00EBD99B /* YHLookResignResultModel.swift */; };
0457921D2CBF626000EBD99B /* YHResignUploadDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0457921C2CBF626000EBD99B /* YHResignUploadDetailViewModel.swift */; };
0457921F2CBF62F300EBD99B /* YHResignUploadDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0457921E2CBF62F300EBD99B /* YHResignUploadDetailModel.swift */; };
045792212CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045792202CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift */; };
045A08C02C37ABF500BCBABA /* YHSegmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08BF2C37ABF500BCBABA /* YHSegmentView.swift */; }; 045A08C02C37ABF500BCBABA /* YHSegmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08BF2C37ABF500BCBABA /* YHSegmentView.swift */; };
045A08C22C37EB8B00BCBABA /* YHMyFileListNoneCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */; }; 045A08C22C37EB8B00BCBABA /* YHMyFileListNoneCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */; };
045A7E672C2ACB1A008F995B /* YHLoginOneLeadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A7E662C2ACB1A008F995B /* YHLoginOneLeadView.swift */; }; 045A7E672C2ACB1A008F995B /* YHLoginOneLeadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A7E662C2ACB1A008F995B /* YHLoginOneLeadView.swift */; };
...@@ -1223,6 +1226,9 @@ ...@@ -1223,6 +1226,9 @@
045792162CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignUploadTravelPassportTableViewCell.swift; sourceTree = "<group>"; }; 045792162CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignUploadTravelPassportTableViewCell.swift; sourceTree = "<group>"; };
045792182CBE08BA00EBD99B /* YHLookResignResultViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLookResignResultViewModel.swift; sourceTree = "<group>"; }; 045792182CBE08BA00EBD99B /* YHLookResignResultViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLookResignResultViewModel.swift; sourceTree = "<group>"; };
0457921A2CBE0C3F00EBD99B /* YHLookResignResultModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLookResignResultModel.swift; sourceTree = "<group>"; }; 0457921A2CBE0C3F00EBD99B /* YHLookResignResultModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLookResignResultModel.swift; sourceTree = "<group>"; };
0457921C2CBF626000EBD99B /* YHResignUploadDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignUploadDetailViewModel.swift; sourceTree = "<group>"; };
0457921E2CBF62F300EBD99B /* YHResignUploadDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignUploadDetailModel.swift; sourceTree = "<group>"; };
045792202CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignUploadDetailFileNameCell.swift; sourceTree = "<group>"; };
045A08BF2C37ABF500BCBABA /* YHSegmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSegmentView.swift; sourceTree = "<group>"; }; 045A08BF2C37ABF500BCBABA /* YHSegmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSegmentView.swift; sourceTree = "<group>"; };
045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFileListNoneCell.swift; sourceTree = "<group>"; }; 045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFileListNoneCell.swift; sourceTree = "<group>"; };
045A7E662C2ACB1A008F995B /* YHLoginOneLeadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginOneLeadView.swift; sourceTree = "<group>"; }; 045A7E662C2ACB1A008F995B /* YHLoginOneLeadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginOneLeadView.swift; sourceTree = "<group>"; };
...@@ -3898,6 +3904,7 @@ ...@@ -3898,6 +3904,7 @@
04CA2BFC2CB7C36D00F36DE7 /* YHResignUploadDocListCell.swift */, 04CA2BFC2CB7C36D00F36DE7 /* YHResignUploadDocListCell.swift */,
04CA2BFE2CB7C9A000F36DE7 /* YHResignUploadSuccessDocListCell.swift */, 04CA2BFE2CB7C9A000F36DE7 /* YHResignUploadSuccessDocListCell.swift */,
04CA2C022CB7D3C200F36DE7 /* YHFileExplainReasonInputView.swift */, 04CA2C022CB7D3C200F36DE7 /* YHFileExplainReasonInputView.swift */,
045792202CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3915,6 +3922,7 @@ ...@@ -3915,6 +3922,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04CA2C062CB8F9C800F36DE7 /* YHResignUploadDocListProgressModel.swift */, 04CA2C062CB8F9C800F36DE7 /* YHResignUploadDocListProgressModel.swift */,
0457921E2CBF62F300EBD99B /* YHResignUploadDetailModel.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3923,6 +3931,7 @@ ...@@ -3923,6 +3931,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04CA2C042CB8F75700F36DE7 /* YHResignUploadDocListViewModel.swift */, 04CA2C042CB8F75700F36DE7 /* YHResignUploadDocListViewModel.swift */,
0457921C2CBF626000EBD99B /* YHResignUploadDetailViewModel.swift */,
); );
path = VM; path = VM;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -5460,6 +5469,7 @@ ...@@ -5460,6 +5469,7 @@
044D0BFC2C21635B00C5CF5E /* YHInformationAuthorizationStepOneViewController.swift in Sources */, 044D0BFC2C21635B00C5CF5E /* YHInformationAuthorizationStepOneViewController.swift in Sources */,
045EEEBF2B9F171A0022A143 /* YHWorkFileItemView.swift in Sources */, 045EEEBF2B9F171A0022A143 /* YHWorkFileItemView.swift in Sources */,
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */, 04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */,
0457921F2CBF62F300EBD99B /* YHResignUploadDetailModel.swift in Sources */,
04F4A5282CB8D4270026D469 /* YHResignAppointScheduleListViewController.swift in Sources */, 04F4A5282CB8D4270026D469 /* YHResignAppointScheduleListViewController.swift in Sources */,
A598E9E22C7CB32D00F84739 /* YHTravelDocsPreparationListModel.swift in Sources */, A598E9E22C7CB32D00F84739 /* YHTravelDocsPreparationListModel.swift in Sources */,
A598E9D72C7C9EF300F84739 /* YHTravelDocsPreparationListViewController.swift in Sources */, A598E9D72C7C9EF300F84739 /* YHTravelDocsPreparationListViewController.swift in Sources */,
...@@ -5963,6 +5973,7 @@ ...@@ -5963,6 +5973,7 @@
04CE1AD12C2AD91F001CB80A /* YHActivityTravelModel.swift in Sources */, 04CE1AD12C2AD91F001CB80A /* YHActivityTravelModel.swift in Sources */,
044D0C202C22D37500C5CF5E /* YHEditHonorViewController.swift in Sources */, 044D0C202C22D37500C5CF5E /* YHEditHonorViewController.swift in Sources */,
04256DEC2C732F6900A37BA4 /* YHGrabingNumberListView.swift in Sources */, 04256DEC2C732F6900A37BA4 /* YHGrabingNumberListView.swift in Sources */,
0457921D2CBF626000EBD99B /* YHResignUploadDetailViewModel.swift in Sources */,
045EEEAC2B9F171A0022A143 /* YHWorkExperienceTableViewCell.swift in Sources */, 045EEEAC2B9F171A0022A143 /* YHWorkExperienceTableViewCell.swift in Sources */,
A5765B2A2C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift in Sources */, A5765B2A2C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift in Sources */,
A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */, A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */,
...@@ -6026,6 +6037,7 @@ ...@@ -6026,6 +6037,7 @@
A5FD63C12B62616D00D1D9DA /* YHInformationPerfectModel.swift in Sources */, A5FD63C12B62616D00D1D9DA /* YHInformationPerfectModel.swift in Sources */,
044F395C2CB8D58A007CA277 /* YHVisaRenewalPayInfoBaseCell.swift in Sources */, 044F395C2CB8D58A007CA277 /* YHVisaRenewalPayInfoBaseCell.swift in Sources */,
A567E5A62BD7643D00D5D5A0 /* YHHomeSearchView.swift in Sources */, A567E5A62BD7643D00D5D5A0 /* YHHomeSearchView.swift in Sources */,
045792212CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift in Sources */,
045EEE912B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemView.swift in Sources */, 045EEE912B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemView.swift in Sources */,
04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */, 04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */,
044867B62BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift in Sources */, 044867B62BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift in Sources */,
......
...@@ -14,10 +14,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController { ...@@ -14,10 +14,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
// 进入该页面以下三个参数必传 // 进入该页面以下三个参数必传
// 订单id // 订单id
var orderId: Int = 0 var id: Int = 0
// 批次id
var batchId: Int = 0
var materialId : Int = 0
var materialModel: YHMaterialModel = YHMaterialModel() { var materialModel: YHMaterialModel = YHMaterialModel() {
didSet { didSet {
...@@ -25,18 +22,18 @@ class YHResignUploadDocDetailViewController: YHBaseViewController { ...@@ -25,18 +22,18 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
} }
} }
var templateModel: YHResignTemplateDetail = YHResignTemplateDetail() var templateModel: YHResignUploadDetailModel = YHResignUploadDetailModel()
var templateArr: [YHResignTemplateItemModel] = [] var templateArr: [YHResignTemplateItemModel] = []
var categoryId: Int = 0 var categoryId: Int = 0
var supplementId: Int = 0 var supplementId: Int = 0
var viewModel: YHResignMaterialViewModel = YHResignMaterialViewModel() var viewModel: YHResignUploadDetailViewModel = YHResignUploadDetailViewModel()
var items:[YHMaterialModelItemModel] = [] var items:[YHResignUploadDetailFileListModel] = []
var selectEditItem: YHMaterialModelItemModel? var selectEditItem: YHResignUploadDetailFileListModel?
lazy var previewFileTool:YHFilePreviewTool = { lazy var previewFileTool:YHFilePreviewTool = {
let tool = YHFilePreviewTool(targetVC: self) let tool = YHFilePreviewTool(targetVC: self)
return tool return tool
...@@ -63,7 +60,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController { ...@@ -63,7 +60,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style: .grouped)
if #available(iOS 11.0, *) { if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never tableView.contentInsetAdjustmentBehavior = .never
} }
...@@ -74,19 +71,21 @@ class YHResignUploadDocDetailViewController: YHBaseViewController { ...@@ -74,19 +71,21 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
tableView.dataSource = self tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell") tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHResignMaterialNameCell.self, forCellReuseIdentifier: YHResignMaterialNameCell.cellReuseIdentifier) tableView.register(YHResignMaterialNameCell.self, forCellReuseIdentifier: YHResignMaterialNameCell.cellReuseIdentifier)
tableView.register(YHCertificateTemplateCell.self, forCellReuseIdentifier: YHCertificateTemplateCell.cellReuseIdentifier) tableView.register(YHResignUploadDetailFileNameCell.self, forCellReuseIdentifier: YHResignUploadDetailFileNameCell.cellReuseIdentifier)
tableView.register(cellWithClass: YHAdopterUploadTableViewCell.self)
tableView.register(cellWithClass: YHAdopterIncomeFileCountTableViewCell.self)
return tableView return tableView
}() }()
lazy var uploadBtn:UIButton = { lazy var uploadBtn:UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setTitle("继续上传".local, for: .normal) btn.setTitle("确认".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16) btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
btn.setTitleColor(.white, for: .normal) btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor.brandMainColor btn.backgroundColor = UIColor.brandMainColor
btn.layer.cornerRadius = kCornerRadius3 btn.layer.cornerRadius = kCornerRadius3
btn.addTarget(self, action: #selector(didClickUploadBtn), for: .touchUpInside) btn.addTarget(self, action: #selector(didClickUploadBtn), for: .touchUpInside)
btn.isHidden = true
return btn return btn
}() }()
...@@ -105,23 +104,8 @@ class YHResignUploadDocDetailViewController: YHBaseViewController { ...@@ -105,23 +104,8 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
if let selectEditItem = selectEditItem, var text = text { if let selectEditItem = selectEditItem, var text = text {
// 重命名 // 重命名
text = text + "." + selectEditItem.getFileSuffixName() text = text + "." + selectEditItem.getFileSuffixName()
YHHUD.show(.progress(message: "重命名中..."))
selectEditItem.name = text selectEditItem.name = text
tableView.reloadData()
self.viewModel.updateMaterials(material: self.materialModel, addInfoArr: []) {
success, error in
YHHUD.hide()
if success {
YHHUD.flash(message: "重命名成功")
} else {
var msg = "重命名失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
self.requestMaterialDetail()
}
} }
} }
} }
...@@ -132,41 +116,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController { ...@@ -132,41 +116,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
@objc func didClickUploadBtn() { @objc func didClickUploadBtn() {
if items.count >= 99 {
YHHUD.flash(message: "已达上限\n最多上传99张图片或文件")
return
}
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectImageCount = 99-items.count
sheetView.tips = "支持的文件格式为jpg/jpeg、png、bmp、doc/docx、xls/xlsx、pdf,最多可上传99张图片或文件"
sheetView.fileTypes = [ "public.image",
"com.adobe.pdf",
"com.microsoft.word.doc",
"org.openxmlformats.wordprocessingml.document",
"org.openxmlformats.spreadsheetml.sheet",
"com.microsoft.excel.xls",]
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
self.viewModel.uploadFilesWithMaterial(material:self.materialModel, fileUrl: fileUrl) {
[weak self] in
guard let self = self else { return }
self.requestMaterialDetail()
}
}
sheetView.uploadImageBlock = {
[weak self] targetImgArr in
guard let self = self else { return }
self.viewModel.uploadImageArr(targetImgArr, material: self.materialModel) {
[weak self] in
guard let self = self else { return }
self.requestMaterialDetail()
}
}
sheetView.show()
} }
func createUI() { func createUI() {
...@@ -178,7 +128,8 @@ class YHResignUploadDocDetailViewController: YHBaseViewController { ...@@ -178,7 +128,8 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
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.bottom.equalToSuperview() make.left.right.equalToSuperview()
make.bottom.equalTo(-98)
} }
uploadBtn.snp.makeConstraints { make in uploadBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
...@@ -192,20 +143,82 @@ class YHResignUploadDocDetailViewController: YHBaseViewController { ...@@ -192,20 +143,82 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
make.bottom.equalToSuperview().offset(YHFileRenameInputView.height) make.bottom.equalToSuperview().offset(YHFileRenameInputView.height)
} }
} }
func uploadImage(_ img: UIImage, imageName:String, callBack:((Bool, String)->())?) {
// 先OSS上传得到URL
self.viewModel.uploadImage(img) {
[weak self] url, error in
guard self != nil else { return }
if let url = url, !url.isEmpty {
callBack?(true, url)
return
}
callBack?(false, "")
}
}
func uploadFile(_ fileUrl:URL) {
if let fileData = try? Data(contentsOf: fileUrl) {
// 将文件数据上传到服务器
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
// print("\(size)")
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in
YHHUD.hide()
guard let self = self else { return }
// 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty {
var fileName = fileUrl.lastPathComponent
if fileName.isEmpty {
fileName = successUrl.lastPathComponent
}
let suffixName = successUrl.pathExtension.lowercased()
let timestamp = Date().timeIntervalSince1970
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy.MM.dd HH:mm:ss"
let currentDate = Date()
let formattedDate = dateFormatter.string(from: currentDate)
let model = YHResignUploadDetailFileListModel()
model.url = successUrl
model.name = fileName
model.uploadedAt = formattedDate
self.items.append(model)
self.tableView.reloadData()
YHHUD.flash(message: "上传成功")
return
}
var msg = "上传文件失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
}
} else {
YHHUD.flash(message: "识别文件失败")
}
}
} }
extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableViewDataSource { extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
return 2 return 4
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 { if section == 0 {
return templateArr.count return templateArr.count
} }
if section == 1 {
return items.count return items.count
} }
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
...@@ -218,8 +231,8 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie ...@@ -218,8 +231,8 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
} }
return cell return cell
} }
if indexPath.section == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignMaterialNameCell.cellReuseIdentifier, for: indexPath) as! YHResignMaterialNameCell let cell = tableView.dequeueReusableCell(withIdentifier: YHResignUploadDetailFileNameCell.cellReuseIdentifier, for: indexPath) as! YHResignUploadDetailFileNameCell
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.updateModel(item)
...@@ -259,7 +272,6 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie ...@@ -259,7 +272,6 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
YHTwoOptionAlertView.showAlertView(message:msg) { sure in YHTwoOptionAlertView.showAlertView(message:msg) { sure in
if !sure { return } if !sure { return }
// 删除 // 删除
YHHUD.show(.progress(message: "删除中..."))
var deleteIndex = -1 var deleteIndex = -1
for (index, item) in self.materialModel.info.enumerated() { for (index, item) in self.materialModel.info.enumerated() {
if contentItem.url == item.url { if contentItem.url == item.url {
...@@ -273,20 +285,7 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie ...@@ -273,20 +285,7 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
return return
} }
self.materialModel.info.remove(at: deleteIndex) self.materialModel.info.remove(at: deleteIndex)
self.viewModel.updateMaterials(material: self.materialModel, addInfoArr: []) { self.tableView.reloadData()
success, error in
YHHUD.hide()
if success {
YHHUD.flash(message: "删除成功")
} else {
var msg = "删除失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
self.requestMaterialDetail()
}
} }
} else if editType == .preview { // 预览 } else if editType == .preview { // 预览
...@@ -302,20 +301,112 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie ...@@ -302,20 +301,112 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
} }
return cell return cell
} }
if indexPath.section == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterUploadTableViewCell.self)
cell.newFileBlock = {[weak self] in
guard let self = self else { return }
let count = self.items.count
if count >= 10 {
YHHUD.flash(message: "最多上传10个图片或文件")
return
}
var maxCount = 10 - count
if maxCount > 9 {
maxCount = 9
}
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.tips = "支持的文件格式为jpg/jpeg、png、pdf,最多可上传10张图片或文件"
sheetView.maxSelectImageCount = maxCount
sheetView.fileTypes = [ "public.image",
"com.adobe.pdf"]
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
uploadFile(fileUrl)
}
sheetView.uploadImageBlock = {
[weak self] imgArr in
guard let self = self else { return }
let group = DispatchGroup()
var successArr:[String] = []
var failArr:[YHSelectImageItem] = []
YHHUD.show(.progress(message: "上传中..."))
for item in imgArr {
if let image = item.data {
group.enter()
uploadImage(image, imageName:item.name) {
success, url in
if success {
successArr.append(url)
} else {
failArr.append(item)
}
group.leave()
}
}
}
// 等待所有任务完成
group.notify(queue: .main) {
YHHUD.hide()
// 所有任务完成,回到主线程继续执行
if imgArr.count == successArr.count {
YHHUD.flash(message: "上传成功")
for item in successArr {
let timestamp = Date().timeIntervalSince1970
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy.MM.dd HH:mm:ss"
let currentDate = Date()
let formattedDate = dateFormatter.string(from: currentDate)
let model = YHResignUploadDetailFileListModel()
model.url = item
model.name = "\(UInt64(timestamp))" + ".jpg"
// model.uploadedAt = formattedDate
self.items.append(model)
}
self.tableView.reloadData()
} else {
YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
}
}
}
sheetView.show()
}
return cell
}
if indexPath.section == 3 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeFileCountTableViewCell.self)
cell.setContentData(self.items.count)
return cell
}
return UITableViewCell()
}
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 77.0 return 77.0
} }
return UITableView.automaticDimension if indexPath.section == 2 {
return 61
}
if indexPath.section == 3 {
return 45
}
return 55.0
} }
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
if section == 0 { if section == 0 {
return UITableView.automaticDimension return 56
}
if section == 1 {
return 96
} }
return UITableView.automaticDimension return 0.01
} }
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
...@@ -342,9 +433,9 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie ...@@ -342,9 +433,9 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
tipsLabel.textAlignment = .left tipsLabel.textAlignment = .left
tipsLabel.font = UIFont.PFSC_R(ofSize:14) tipsLabel.font = UIFont.PFSC_R(ofSize:14)
tipsLabel.numberOfLines = 0 tipsLabel.numberOfLines = 0
if !self.templateModel.remark.isEmpty { // if !self.templateModel.remark.isEmpty {
tipsLabel.text = "注意事项:\(self.templateModel.remark)" // tipsLabel.text = "注意事项:\(self.templateModel.remark)"
} // }
view.addSubview(tipsLabel) view.addSubview(tipsLabel)
tipsLabel.snp.makeConstraints { make in tipsLabel.snp.makeConstraints { make in
...@@ -355,7 +446,7 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie ...@@ -355,7 +446,7 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
} }
return view return view
} }
if section == 1 {
// 证件标题和状态 // 证件标题和状态
let titlelabel = UILabel() let titlelabel = UILabel()
titlelabel.textColor = UIColor.mainTextColor titlelabel.textColor = UIColor.mainTextColor
...@@ -491,40 +582,23 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie ...@@ -491,40 +582,23 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
} }
return view return view
} }
view.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 0.01)
return view
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
if section == 0 { if section == 0 {
return 20.0 return 20.0
} }
if section == 1 {
return 60.0 return 60.0
} }
return 0.01
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
if section == 0 {
return view
} }
let label = UILabel(frame: CGRect(x: 0, y: 20, width:KScreenWidth, height:20)) func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
label.textColor = UIColor.labelTextColor2
label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize:12)
let tipsFont = UIFont.PFSC_R(ofSize: 12)
let a: ASAttributedString = .init("已上传", .font(tipsFont),.foreground(UIColor.labelTextColor2))
let b: ASAttributedString = .init(" \(items.count)/99 ", .font(UIFont.PFSC_M(ofSize: 12)), .foreground(UIColor.init(hexString:"#2F2F2F")!))
let c: ASAttributedString = .init("张图片或文件", .font(tipsFont), .foreground(UIColor.labelTextColor2))
label.attributed.text = a+b+c
view.addSubview(label)
label.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.bottom.equalToSuperview().offset(-20)
}
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 0.01))
return view return view
} }
...@@ -596,51 +670,44 @@ extension YHResignUploadDocDetailViewController { ...@@ -596,51 +670,44 @@ extension YHResignUploadDocDetailViewController {
extension YHResignUploadDocDetailViewController { extension YHResignUploadDocDetailViewController {
func requestMaterialDetail() { func requestMaterialDetail() {
viewModel.getUploadDocDetail(id: id) {[weak self] success, err in
YHHUD.show(.progress(message: "加载中..."))
viewModel.getMaterialDeal(orderId: orderId, id: batchId, materialId: materialId) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
self.materialModel = self.viewModel.materialDeal
self.items = self.materialModel.info
if self.materialModel.status == YHMaterialStatus.completed.rawValue {
self.uploadBtn.isHidden = true
} else {
self.uploadBtn.isHidden = false
self.uploadBtn.alpha = (items.count >= 99 ? 0.5 : 1.0)
}
self.tableView.snp.remakeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalToSuperview()
if self.materialModel.status == YHMaterialStatus.completed.rawValue {
make.bottom.equalToSuperview()
} else {
make.bottom.equalTo(self.uploadBtn.snp.top).offset(-34)
}
}
self.tableView.reloadData() self.tableView.reloadData()
self.requestTemplate()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg, duration:3)
}
} }
// YHHUD.show(.progress(message: "加载中..."))
// viewModel.getMaterialDeal(orderId: orderId, id: batchId, materialId: materialId) {
// [weak self] success, error in
// YHHUD.hide()
// guard let self = self else { return }
//
// self.materialModel = self.viewModel.materialDeal
// self.items = self.materialModel.info
//
// if self.materialModel.status == YHMaterialStatus.completed.rawValue {
// self.uploadBtn.isHidden = true
// } else {
// self.uploadBtn.isHidden = false
// self.uploadBtn.alpha = (items.count >= 99 ? 0.5 : 1.0)
// }
//
// self.tableView.snp.remakeConstraints { make in
// make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
// make.left.right.equalToSuperview()
// if self.materialModel.status == YHMaterialStatus.completed.rawValue {
// make.bottom.equalToSuperview()
// } else {
// make.bottom.equalTo(self.uploadBtn.snp.top).offset(-34)
// }
// }
// self.tableView.reloadData()
// self.requestTemplate()
//
// if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
// YHHUD.flash(message: errorMsg, duration:3)
// }
// }
} }
func requestTemplate() {
viewModel.getTemplateInfo(templateId: self.materialModel.template_id) {
[weak self] success, error in
guard let self = self else { return }
self.templateModel = self.viewModel.templateDeail
self.templateArr = self.templateModel.file_url
self.tableView.reloadData()
}
}
} }
...@@ -33,10 +33,7 @@ class YHResignUploadDocListViewController: YHBaseViewController { ...@@ -33,10 +33,7 @@ class YHResignUploadDocListViewController: YHBaseViewController {
tableView.dataSource = self tableView.dataSource = self
tableView.backgroundColor = .clear tableView.backgroundColor = .clear
tableView.register(YHResignUploadDocListCell.self, forCellReuseIdentifier: YHResignUploadDocListCell.cellReuseIdentifier) tableView.register(YHResignUploadDocListCell.self, forCellReuseIdentifier: YHResignUploadDocListCell.cellReuseIdentifier)
tableView.register(YHResignUploadSuccessDocListCell.self, forCellReuseIdentifier: YHResignUploadSuccessDocListCell.cellReuseIdentifier)
tableView.register(YHTravelDocsPreparationTipsCell.self, forCellReuseIdentifier: YHTravelDocsPreparationTipsCell.cellReuseIdentifier)
return tableView return tableView
}() }()
...@@ -87,14 +84,30 @@ class YHResignUploadDocListViewController: YHBaseViewController { ...@@ -87,14 +84,30 @@ class YHResignUploadDocListViewController: YHBaseViewController {
private extension YHResignUploadDocListViewController { private extension YHResignUploadDocListViewController {
func loadData() { func loadData() {
viewModel.getUploadDocProgress(orderID: orderId, stepID: batchId) {[weak self] success, err in
guard let self = self else { return }
viewModel.getUploadDocList(orderID: orderId, stepID: batchId) {[weak self] success, err in viewModel.getUploadDocList(orderID: orderId, stepID: batchId) {[weak self] success, err in
guard let self = self else { return } guard let self = self else { return }
self.tableView.reloadData() if self.viewModel.mainModel.supplement_voucher_url.count == 0 {
self.bottomView.isHidden = true
let a = ASAttributedString.init("请您于", .font(UIFont.PFSC_M(ofSize:14)), .foreground(UIColor.mainTextColor50))
let b = ASAttributedString.init("\(self.viewModel.mainModel.supplement_deadline)前", .font(UIFont.PFSC_M(ofSize:14)),.foreground(UIColor.brandMainColor))
let c = ASAttributedString.init("根据补件清单上传资料递交至港府;如无及时递交,可能导致身份失效!", .font(UIFont.PFSC_M(ofSize:14)), .foreground(UIColor.mainTextColor50))
messageLabel.attributed.text = a+b+c
} else {
let a = ASAttributedString.init("您申请的【优才入境计划】续签,", .font(UIFont.PFSC_M(ofSize:17)), .foreground(UIColor.mainTextColor50))
let b = ASAttributedString.init("补件资料已递交至港府!", .font(UIFont.PFSC_M(ofSize:17)),.foreground(UIColor.yhOrangeColor))
let c = ASAttributedString.init("请耐心等待港府审批~", .font(UIFont.PFSC_M(ofSize:17)), .foreground(UIColor.mainTextColor50))
titleLabel.attributed.text = a+b+c
self.bottomView.isHidden = false
self.messageLabel.isHidden = true
tableView.snp.remakeConstraints { make in
make.left.equalToSuperview()
make.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 100)
make.bottom.equalTo(-98)
} }
} }
self.tableView.reloadData()
}
} }
func setupUI() { func setupUI() {
...@@ -155,9 +168,8 @@ private extension YHResignUploadDocListViewController { ...@@ -155,9 +168,8 @@ private extension YHResignUploadDocListViewController {
view.addSubview(tableView) view.addSubview(tableView)
tableView.snp.makeConstraints { make in tableView.snp.makeConstraints { make in
make.left.equalToSuperview() make.left.equalToSuperview()
make.right.equalToSuperview() make.bottom.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 160) make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 160)
make.bottom.equalTo(-98)
} }
} }
} }
...@@ -166,14 +178,18 @@ private extension YHResignUploadDocListViewController { ...@@ -166,14 +178,18 @@ private extension YHResignUploadDocListViewController {
extension YHResignUploadDocListViewController: UITableViewDelegate, UITableViewDataSource { extension YHResignUploadDocListViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
if self.viewModel.mainModel.supplement_voucher_url.count == 0 {
return 2 return 2
} }
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1 return 1
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if self.viewModel.mainModel.supplement_voucher_url.count == 0 {
let approveCell = tableView.dequeueReusableCell(withIdentifier: YHResignUploadDocListCell.cellReuseIdentifier, for: indexPath) as! YHResignUploadDocListCell let approveCell = tableView.dequeueReusableCell(withIdentifier: YHResignUploadDocListCell.cellReuseIdentifier, for: indexPath) as! YHResignUploadDocListCell
approveCell.section = indexPath.section approveCell.section = indexPath.section
if indexPath.section == 0 { if indexPath.section == 0 {
...@@ -187,15 +203,33 @@ extension YHResignUploadDocListViewController: UITableViewDelegate, UITableViewD ...@@ -187,15 +203,33 @@ extension YHResignUploadDocListViewController: UITableViewDelegate, UITableViewD
guard let self = self else { return } guard let self = self else { return }
if section == 0 { if section == 0 {
// 跳转文件上传 // 跳转文件上传
let vc = YHResignUploadDocDetailViewController()
vc.id = model.id
self.navigationController?.pushViewController(vc)
} else { } else {
// 跳转列表 // 跳转列表
let vc = YHResignDocumentManagementVC(orderId: orderId, id: batchId)
self.navigationController?.pushViewController(vc)
} }
} }
return approveCell return approveCell
} else {
let approveCell = tableView.dequeueReusableCell(withIdentifier: YHResignUploadSuccessDocListCell.cellReuseIdentifier, for: indexPath) as! YHResignUploadSuccessDocListCell
approveCell.dataSource = [self.viewModel.mainModel.supplement_voucher_url]
return approveCell
} }
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return YHTravelDocsPreparationListCell.cellH if self.viewModel.mainModel.supplement_voucher_url.count == 0 {
if indexPath.section == 0 {
return CGFloat(52 * (self.viewModel.mainModel.upload_list.count + 1))
} else {
return CGFloat(52 * (self.viewModel.mainModel.doc_list.count + 1))
}
}
return 67
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......
//
// YHResignUploadDetailModel.swift
// galaxy
//
// Created by EDY on 2024/10/16.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHResignUploadDetailModel: SmartCodable {
var is_required : Bool = false //是否必需
var name : String = "" //文书名称
var status : Int = 0 //状态 0:审核中;1:已完成;2:已驳回;3:待上传
var description : String = ""
var template_list : [YHResignUploadDetailTemplateListModel] = []
var file_list : [YHResignUploadDetailFileListModel] = []
required init() {
}
}
class YHResignUploadDetailTemplateListModel: SmartCodable {
var name : String = ""
var url : String = ""
required init() {
}
}
class YHResignUploadDetailFileListModel: SmartCodable {
var name : String = ""
var url : String = ""
var uploadedAt : String = ""
required init() {
}
// 获取文件后缀名 eg:123.pdf -> pdf
func getFileSuffixName() -> String {
let res1 = url.pathExtension.lowercased()
if !res1.isEmpty {
return res1
}
let res2 = name.pathExtension.lowercased()
if !res2.isEmpty {
return res2
}
return ""
}
func getFileNameWithoutSuffix() -> String {
if name.isEmpty {
return name
}
if !name.contains(".") {
return name
}
if !name.pathExtension.isEmpty {
let fileName = (name as NSString).deletingPathExtension
return fileName
}
return ""
}
}
...@@ -9,15 +9,6 @@ ...@@ -9,15 +9,6 @@
import UIKit import UIKit
import SmartCodable import SmartCodable
class YHResignUploadDocListProgressModel: SmartCodable {
var progress : Int = -1 //电子签证有效期
var is_need_supplement : Bool = true
required init() {
}
}
class YHResignUploadDocListModel: SmartCodable { class YHResignUploadDocListModel: SmartCodable {
var supplement_voucher_url : String = "" var supplement_voucher_url : String = ""
var supplement_deadline : String = "" var supplement_deadline : String = ""
......
//
// YHResignUploadDetailFileNameCell.swift
// galaxy
//
// Created by EDY on 2024/10/16.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignUploadDetailFileNameCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignUploadDetailFileNameCell"
var editBlock:((YHResignUploadDetailFileListModel)->())?
var whiteView: UIView!
var iconImgV: UIImageView!
var nameLabel: UILabel!
var timeLabel: UILabel!
var editBtn: UIButton!
var contentItem: YHResignUploadDetailFileListModel!
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func updateModel(_ model: YHResignUploadDetailFileListModel) {
contentItem = model
nameLabel.text = model.name
timeLabel.text = "上传于\(model.uploadedAt)"
let suffix = model.getFileSuffixName()
var iconImgName = ""
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"
} else if suffix == "bmp" {
iconImgName = "my_cer_type_bmp"
} else if suffix == "tiff" {
iconImgName = "my_cer_type_tiff"
} else if suffix == "xls" || suffix == "xlsx" {
iconImgName = "my_cer_type_excel"
}
iconImgV.image = UIImage(named: iconImgName)
}
@objc func didEditBtnClicked() {
if let editBlock = editBlock {
editBlock(contentItem)
}
}
func setupUI() {
self.selectionStyle = .none
contentView.backgroundColor = .white
whiteView = UIView()
contentView.addSubview(whiteView)
iconImgV = UIImageView(image:UIImage(named:"my_cer_type_jpg"))
whiteView.addSubview(iconImgV)
nameLabel = UILabel()
nameLabel.textColor = UIColor.mainTextColor
nameLabel.textAlignment = .left
nameLabel.numberOfLines = 0
nameLabel.font = UIFont.PFSC_M(ofSize:14)
whiteView.addSubview(nameLabel)
timeLabel = UILabel()
timeLabel.textColor = UIColor.labelTextColor2
timeLabel.textAlignment = .left
timeLabel.font = UIFont.PFSC_R(ofSize:11)
whiteView.addSubview(timeLabel)
editBtn = UIButton()
editBtn.setImage(UIImage(named:"my_cer_btn_edit"), for:.normal)
editBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 30, left: 30, bottom: 30, right: 30)
editBtn.addTarget(self, action: #selector(didEditBtnClicked), for: .touchUpInside)
whiteView.addSubview(editBtn)
whiteView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview()
make.top.equalToSuperview()
make.bottom.equalToSuperview()
}
iconImgV.snp.makeConstraints { make in
make.width.height.equalTo(31)
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(6)
}
nameLabel.snp.makeConstraints { make in
make.left.equalTo(iconImgV.snp.right).offset(18)
make.top.equalToSuperview().offset(7)
make.right.equalTo(editBtn.snp.left)
}
timeLabel.snp.makeConstraints { make in
make.left.right.equalTo(nameLabel)
make.top.equalTo(nameLabel.snp.bottom).offset(2)
make.bottom.equalToSuperview().offset(-7)
make.height.equalTo(20)
}
editBtn.snp.makeConstraints { make in
make.width.height.equalTo(16)
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-20-6)
}
}
}
...@@ -61,8 +61,7 @@ class YHResignUploadDocListCell: UITableViewCell { ...@@ -61,8 +61,7 @@ class YHResignUploadDocListCell: UITableViewCell {
centerView.snp.makeConstraints { make in centerView.snp.makeConstraints { make in
make.left.equalTo(16) make.left.equalTo(16)
make.right.equalTo(-16) make.right.equalTo(-16)
make.top.equalTo(14) make.top.bottom.equalToSuperview()
make.bottom.equalTo(-7)
} }
titleLabel = { titleLabel = {
...@@ -75,7 +74,7 @@ class YHResignUploadDocListCell: UITableViewCell { ...@@ -75,7 +74,7 @@ class YHResignUploadDocListCell: UITableViewCell {
centerView.addSubview(titleLabel) centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.top.equalTo(23) make.top.equalTo(16)
make.height.equalTo(24) make.height.equalTo(24)
make.right.equalTo(-20) make.right.equalTo(-20)
} }
...@@ -88,7 +87,7 @@ class YHResignUploadDocListCell: UITableViewCell { ...@@ -88,7 +87,7 @@ class YHResignUploadDocListCell: UITableViewCell {
centerView.addSubview(lineView) centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in lineView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.top.equalTo(62.5) make.top.equalTo(51.5)
make.height.equalTo(0.5) make.height.equalTo(0.5)
} }
...@@ -100,9 +99,8 @@ class YHResignUploadDocListCell: UITableViewCell { ...@@ -100,9 +99,8 @@ class YHResignUploadDocListCell: UITableViewCell {
}() }()
centerView.addSubview(mainItemView) centerView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.bottom.left.right.equalToSuperview()
make.bottom.equalTo(-63) make.top.equalTo(52)
make.top.equalTo(63)
} }
} }
...@@ -132,8 +130,6 @@ class YHResignUploadDocListCell: UITableViewCell { ...@@ -132,8 +130,6 @@ class YHResignUploadDocListCell: UITableViewCell {
block(model, self.section) block(model, self.section)
} }
} }
let model = dataSource[i]
itemView.tag = 4000 + i itemView.tag = 4000 + i
if section == 0 { if section == 0 {
itemView.dataSource = dataSource[i] itemView.dataSource = dataSource[i]
...@@ -195,7 +191,7 @@ class YHResignUploadDocItemView: UIView { ...@@ -195,7 +191,7 @@ class YHResignUploadDocItemView: UIView {
addSubview(titleLabel) addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.left.top.bottom.equalToSuperview() make.left.top.bottom.equalToSuperview()
make.right.equalTo(-30) make.right.equalTo(-50)
} }
explainLabel = { explainLabel = {
...@@ -263,7 +259,7 @@ class YHResignUploadDocItemView: UIView { ...@@ -263,7 +259,7 @@ class YHResignUploadDocItemView: UIView {
} }
func updateDocAllViews() { func updateDocAllViews() {
guard let dataSource = dataSource else { return } guard let dataSource = docDataSource else { return }
titleLabel.text = dataSource.name titleLabel.text = dataSource.name
if dataSource.status == 1 { if dataSource.status == 1 {
explainLabel.textColor = UIColor.brandMainColor explainLabel.textColor = UIColor.brandMainColor
......
...@@ -11,10 +11,12 @@ import UIKit ...@@ -11,10 +11,12 @@ import UIKit
class YHResignUploadSuccessDocListCell: UITableViewCell { class YHResignUploadSuccessDocListCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignUploadSuccessDocListCell" static let cellReuseIdentifier = "YHResignUploadSuccessDocListCell"
typealias ExperienceListBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> () lazy var previewFileTool:YHFilePreviewTool = {
var experienceListBlock: ExperienceListBlock? let tool = YHFilePreviewTool(targetVC: UIViewController.current)
return tool
}()
var mainItemView: UIView! var mainItemView: UIView!
var dataSource: [YHWorkExperienceFileModel]?{ var dataSource: [String]?{
didSet { didSet {
updateAllViews() updateAllViews()
} }
...@@ -49,9 +51,10 @@ class YHResignUploadSuccessDocListCell: UITableViewCell { ...@@ -49,9 +51,10 @@ class YHResignUploadSuccessDocListCell: UITableViewCell {
}() }()
contentView.addSubview(mainItemView) contentView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.top.equalToSuperview()
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
make.top.equalTo(16) make.left.equalTo(16)
make.right.equalTo(-16)
} }
} }
...@@ -60,31 +63,36 @@ class YHResignUploadSuccessDocListCell: UITableViewCell { ...@@ -60,31 +63,36 @@ class YHResignUploadSuccessDocListCell: UITableViewCell {
for i in 0 ..< (dataSource?.count ?? 0) { for i in 0 ..< (dataSource?.count ?? 0) {
let itemView = YHResignUploadFileItemView() let itemView = YHResignUploadFileItemView()
itemView.dataSource = dataSource?[i] itemView.dataSource = dataSource?[i]
itemView.block = {[weak self] model, type in itemView.block = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
if let block = self.experienceListBlock { let viewModel = YHBaseViewModel()
block(model, type) viewModel.getPublicImageUrl(model) { success, error in
if let success = success {
self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName:"")
} else {
YHHUD.flash(message: "链接不可用")
}
} }
} }
mainItemView.addSubview(itemView) mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in itemView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.top.equalTo(55 * i) make.top.equalTo(67 * i)
make.height.equalTo(55) make.height.equalTo(67)
} }
} }
} }
} }
class YHResignUploadFileItemView: UIView { class YHResignUploadFileItemView: UIView {
typealias ItemBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> () typealias ItemBlock = (_ model: String) -> ()
var block: ItemBlock? var block: ItemBlock?
var whiteView: UIButton! var whiteView: UIButton!
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 dataSource: YHWorkExperienceFileModel? { var dataSource: String? {
didSet { didSet {
updateAllViews() updateAllViews()
} }
...@@ -114,19 +122,12 @@ class YHResignUploadFileItemView: UIView { ...@@ -114,19 +122,12 @@ class YHResignUploadFileItemView: UIView {
nameLabel.font = UIFont.PFSC_M(ofSize:14) nameLabel.font = UIFont.PFSC_M(ofSize:14)
whiteView.addSubview(nameLabel) whiteView.addSubview(nameLabel)
timeLabel = UILabel()
timeLabel.textColor = UIColor.labelTextColor2
timeLabel.textAlignment = .left
timeLabel.font = UIFont.PFSC_R(ofSize:11)
whiteView.addSubview(timeLabel)
editBtn = UIButton() editBtn = UIButton()
editBtn.setImage(UIImage(named:"my_cer_btn_edit"), for:.normal)
editBtn.setTitle("查看", for: .normal) editBtn.setTitle("查看", for: .normal)
editBtn.setTitleColor(UIColor.mainTextColor, for: .normal) editBtn.setTitleColor(UIColor.mainTextColor, for: .normal)
editBtn.titleLabel?.font = UIFont.PFSC_M(ofSize: 11)
editBtn.setBackgroundColor(color: UIColor(hex: 0xf4f6fa), forState: .normal) editBtn.setBackgroundColor(color: UIColor(hex: 0xf4f6fa), forState: .normal)
editBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 30, left: 30, bottom: 30, right: 30) editBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 30, left: 30, bottom: 30, right: 30)
editBtn.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
editBtn.layer.cornerRadius = 10 editBtn.layer.cornerRadius = 10
whiteView.addSubview(editBtn) whiteView.addSubview(editBtn)
...@@ -134,7 +135,7 @@ class YHResignUploadFileItemView: UIView { ...@@ -134,7 +135,7 @@ class YHResignUploadFileItemView: UIView {
make.left.equalTo(18) make.left.equalTo(18)
make.right.equalTo(-18) make.right.equalTo(-18)
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
make.height.equalTo(55) make.height.equalTo(67)
} }
iconImgV.snp.makeConstraints { make in iconImgV.snp.makeConstraints { make in
...@@ -145,17 +146,10 @@ class YHResignUploadFileItemView: UIView { ...@@ -145,17 +146,10 @@ class YHResignUploadFileItemView: UIView {
nameLabel.snp.makeConstraints { make in nameLabel.snp.makeConstraints { make in
make.left.equalTo(iconImgV.snp.right).offset(18) make.left.equalTo(iconImgV.snp.right).offset(18)
make.top.equalToSuperview().offset(7) make.centerY.equalToSuperview()
make.right.equalTo(editBtn.snp.left) make.right.equalTo(editBtn.snp.left)
} }
timeLabel.snp.makeConstraints { make in
make.left.right.equalTo(nameLabel)
make.top.equalTo(nameLabel.snp.bottom).offset(2)
make.bottom.equalToSuperview().offset(-7)
make.height.equalTo(20)
}
editBtn.snp.makeConstraints { make in editBtn.snp.makeConstraints { make in
make.width.equalTo(38) make.width.equalTo(38)
make.height.equalTo(20) make.height.equalTo(20)
...@@ -167,9 +161,7 @@ class YHResignUploadFileItemView: UIView { ...@@ -167,9 +161,7 @@ class YHResignUploadFileItemView: UIView {
func updateAllViews() { func updateAllViews() {
guard let dataSource = dataSource else { return } guard let dataSource = dataSource else { return }
nameLabel.text = dataSource.fileName let suffix = dataSource.pathExtension.lowercased()
timeLabel.text = "上传于\(dataSource.uploadedAt)"
let suffix = dataSource.fileUrl.pathExtension.lowercased()
var iconImgName = "" var iconImgName = ""
if suffix == "jpeg" { if suffix == "jpeg" {
...@@ -196,19 +188,14 @@ class YHResignUploadFileItemView: UIView { ...@@ -196,19 +188,14 @@ class YHResignUploadFileItemView: UIView {
} else if suffix == "xls" || suffix == "xlsx" { } else if suffix == "xls" || suffix == "xlsx" {
iconImgName = "my_cer_type_excel" iconImgName = "my_cer_type_excel"
} }
nameLabel.text = "补件递交凭证." + suffix
iconImgV.image = UIImage(named: iconImgName) iconImgV.image = UIImage(named: iconImgName)
} }
@objc func itemClick() { @objc func itemClick() {
if let block = block, let dataSource = dataSource { if let block = block, let dataSource = dataSource {
block(dataSource, .click) block(dataSource)
} }
} }
@objc func deleteClick() {
if let block = block, let dataSource = dataSource {
block(dataSource, .click)
}
}
} }
//
// YHResignUploadDetailViewModel.swift
// galaxy
//
// Created by EDY on 2024/10/16.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignUploadDetailViewModel: YHBaseViewModel {
//列表信息
var mainModel : YHResignUploadDetailModel = YHResignUploadDetailModel()
}
extension YHResignUploadDetailViewModel {
func getUploadDocDetail(id: Int, callBackBlock:@escaping (_ success: Bool,_ err:YHErrorModel?)->()) {
let params: [String : Any] = ["id": id]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.ResignUploadDoc.detail
let _ = YHNetRequest.getRequest(url: strUrl, params:params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [String : Any], let resultModel = YHResignUploadDetailModel.deserialize(from: dic) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false, err)
return
}
self.mainModel = resultModel
callBackBlock(true, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
...@@ -9,37 +9,12 @@ ...@@ -9,37 +9,12 @@
import UIKit import UIKit
class YHResignUploadDocListViewModel: YHBaseViewModel { class YHResignUploadDocListViewModel: YHBaseViewModel {
var progressModel : YHResignUploadDocListProgressModel = YHResignUploadDocListProgressModel()
//列表信息 //列表信息
var mainModel : YHResignUploadDocListModel = YHResignUploadDocListModel() var mainModel : YHResignUploadDocListModel = YHResignUploadDocListModel()
} }
extension YHResignUploadDocListViewModel { extension YHResignUploadDocListViewModel {
func getUploadDocProgress(orderID: Int, stepID: Int, callBackBlock:@escaping (_ success: Bool,_ err:YHErrorModel?)->()) {
let params: [String : Any] = ["order_id": orderID, "renewal_id": stepID]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.ResignUploadDoc.progress
let _ = YHNetRequest.getRequest(url: strUrl, params:params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [String : Any], let resultModel = YHResignUploadDocListProgressModel.deserialize(from: dic) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false, err)
return
}
self.progressModel = resultModel
callBackBlock(true, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
func getUploadDocList(orderID: Int, stepID: Int, callBackBlock:@escaping (_ success: Bool,_ err:YHErrorModel?)->()) { func getUploadDocList(orderID: Int, stepID: Int, callBackBlock:@escaping (_ success: Bool,_ err:YHErrorModel?)->()) {
let params: [String : Any] = ["order_id": orderID, "renewal_id": stepID] let params: [String : Any] = ["order_id": orderID, "renewal_id": stepID]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.ResignUploadDoc.list let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.ResignUploadDoc.list
......
...@@ -77,7 +77,15 @@ class YHResignUploadTravelCardListViewController: YHBaseViewController { ...@@ -77,7 +77,15 @@ class YHResignUploadTravelCardListViewController: YHBaseViewController {
} }
@objc func clickNextBtn() { @objc func clickNextBtn() {
if let param = YHLoginManager.shared.userModel?.token, param.count>5 {
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/report/program"
url = url + "?param=" + YHLoginManager.shared.h5Token + "&batchID=\(batchId)" + "&order_id=\(orderId)"
let vc = YHH5WebViewVC()
vc.navTitle = "我的续签方案"
vc.url = url
vc.isSupportWebviewInterBackFlag = true
self.navigationController?.pushViewController(vc)
}
} }
} }
......
...@@ -597,7 +597,7 @@ class YHAllApiName { ...@@ -597,7 +597,7 @@ class YHAllApiName {
struct ResignUploadDoc { struct ResignUploadDoc {
static let progress = "super-app/renewal/supplement/progress" static let progress = "super-app/renewal/supplement/progress"
static let list = "super-app/renewal/supplement/list" static let list = "super-app/renewal/supplement/list"
static let detail = "super-app/renewal/supplement/upload/detail"
} }
// 续签-电子签证缴费 // 续签-电子签证缴费
struct ResignVisa { struct ResignVisa {
......
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