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

续签补件 伪逻辑

parent 9717c59d
......@@ -269,6 +269,9 @@
045792172CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045792162CBD046E00EBD99B /* YHResignUploadTravelPassportTableViewCell.swift */; };
045792192CBE08BA00EBD99B /* YHLookResignResultViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045792182CBE08BA00EBD99B /* YHLookResignResultViewModel.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 */; };
045A08C22C37EB8B00BCBABA /* YHMyFileListNoneCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */; };
045A7E672C2ACB1A008F995B /* YHLoginOneLeadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A7E662C2ACB1A008F995B /* YHLoginOneLeadView.swift */; };
......@@ -1223,6 +1226,9 @@
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>"; };
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>"; };
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>"; };
......@@ -3898,6 +3904,7 @@
04CA2BFC2CB7C36D00F36DE7 /* YHResignUploadDocListCell.swift */,
04CA2BFE2CB7C9A000F36DE7 /* YHResignUploadSuccessDocListCell.swift */,
04CA2C022CB7D3C200F36DE7 /* YHFileExplainReasonInputView.swift */,
045792202CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -3915,6 +3922,7 @@
isa = PBXGroup;
children = (
04CA2C062CB8F9C800F36DE7 /* YHResignUploadDocListProgressModel.swift */,
0457921E2CBF62F300EBD99B /* YHResignUploadDetailModel.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -3923,6 +3931,7 @@
isa = PBXGroup;
children = (
04CA2C042CB8F75700F36DE7 /* YHResignUploadDocListViewModel.swift */,
0457921C2CBF626000EBD99B /* YHResignUploadDetailViewModel.swift */,
);
path = VM;
sourceTree = "<group>";
......@@ -5460,6 +5469,7 @@
044D0BFC2C21635B00C5CF5E /* YHInformationAuthorizationStepOneViewController.swift in Sources */,
045EEEBF2B9F171A0022A143 /* YHWorkFileItemView.swift in Sources */,
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */,
0457921F2CBF62F300EBD99B /* YHResignUploadDetailModel.swift in Sources */,
04F4A5282CB8D4270026D469 /* YHResignAppointScheduleListViewController.swift in Sources */,
A598E9E22C7CB32D00F84739 /* YHTravelDocsPreparationListModel.swift in Sources */,
A598E9D72C7C9EF300F84739 /* YHTravelDocsPreparationListViewController.swift in Sources */,
......@@ -5963,6 +5973,7 @@
04CE1AD12C2AD91F001CB80A /* YHActivityTravelModel.swift in Sources */,
044D0C202C22D37500C5CF5E /* YHEditHonorViewController.swift in Sources */,
04256DEC2C732F6900A37BA4 /* YHGrabingNumberListView.swift in Sources */,
0457921D2CBF626000EBD99B /* YHResignUploadDetailViewModel.swift in Sources */,
045EEEAC2B9F171A0022A143 /* YHWorkExperienceTableViewCell.swift in Sources */,
A5765B2A2C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift in Sources */,
A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */,
......@@ -6026,6 +6037,7 @@
A5FD63C12B62616D00D1D9DA /* YHInformationPerfectModel.swift in Sources */,
044F395C2CB8D58A007CA277 /* YHVisaRenewalPayInfoBaseCell.swift in Sources */,
A567E5A62BD7643D00D5D5A0 /* YHHomeSearchView.swift in Sources */,
045792212CBF8B3900EBD99B /* YHResignUploadDetailFileNameCell.swift in Sources */,
045EEE912B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemView.swift in Sources */,
04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */,
044867B62BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift in Sources */,
......
......@@ -14,10 +14,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
// 进入该页面以下三个参数必传
// 订单id
var orderId: Int = 0
// 批次id
var batchId: Int = 0
var materialId : Int = 0
var id: Int = 0
var materialModel: YHMaterialModel = YHMaterialModel() {
didSet {
......@@ -25,18 +22,18 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
}
}
var templateModel: YHResignTemplateDetail = YHResignTemplateDetail()
var templateModel: YHResignUploadDetailModel = YHResignUploadDetailModel()
var templateArr: [YHResignTemplateItemModel] = []
var categoryId: 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 = {
let tool = YHFilePreviewTool(targetVC: self)
return tool
......@@ -63,7 +60,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
let tableView = UITableView(frame:.zero, style: .grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
......@@ -74,19 +71,21 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
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
}()
lazy var uploadBtn:UIButton = {
let btn = UIButton()
btn.setTitle("继续上传".local, for: .normal)
btn.setTitle("确认".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor.brandMainColor
btn.layer.cornerRadius = kCornerRadius3
btn.addTarget(self, action: #selector(didClickUploadBtn), for: .touchUpInside)
btn.isHidden = true
return btn
}()
......@@ -105,23 +104,8 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
if let selectEditItem = selectEditItem, var text = text {
// 重命名
text = text + "." + selectEditItem.getFileSuffixName()
YHHUD.show(.progress(message: "重命名中..."))
selectEditItem.name = text
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()
}
tableView.reloadData()
}
}
}
......@@ -132,41 +116,7 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
@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() {
......@@ -178,7 +128,8 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.bottom.equalToSuperview()
make.left.right.equalToSuperview()
make.bottom.equalTo(-98)
}
uploadBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
......@@ -192,19 +143,81 @@ class YHResignUploadDocDetailViewController: YHBaseViewController {
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 {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
return 4
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return templateArr.count
}
return items.count
if section == 1 {
return items.count
}
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
......@@ -218,89 +231,158 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
}
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignMaterialNameCell.cellReuseIdentifier, for: indexPath) as! YHResignMaterialNameCell
if 0 <= indexPath.row && indexPath.row < items.count {
let item = items[indexPath.row]
cell.updateModel(item)
cell.editBlock = {
[weak self] contentItem in
guard let self = self else { return }
selectEditItem = contentItem
var items = [YHCertificateEditItem(type:.rename, title:"重命名"),
YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.delete, title:"删除"),
YHCertificateEditItem(type:.cancel, title:"取消")]
if self.materialModel.status == YHMaterialStatus.completed.rawValue {
items = [YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.cancel, title:"取消")]
}
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
if indexPath.section == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignUploadDetailFileNameCell.cellReuseIdentifier, for: indexPath) as! YHResignUploadDetailFileNameCell
if 0 <= indexPath.row && indexPath.row < items.count {
let item = items[indexPath.row]
cell.updateModel(item)
cell.editBlock = {
[weak self] contentItem in
guard let self = self else { return }
print("editType:\(editType.rawValue)")
selectEditItem = contentItem
var items = [YHCertificateEditItem(type:.rename, title:"重命名"),
YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.delete, title:"删除"),
YHCertificateEditItem(type:.cancel, title:"取消")]
if editType == .rename { // 重命名
IQKeyboardManager.shared.enable = false
if self.materialModel.status == YHMaterialStatus.completed.rawValue {
var name = contentItem.getFileNameWithoutSuffix()
if name.count > 30 {
name = name[safe: ..<30]!
}
renameInputView.textField.text = name
renameInputView.textField.becomeFirstResponder()
items = [YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.cancel, title:"取消")]
}
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
guard let self = self else { return }
print("editType:\(editType.rawValue)")
} else if editType == .delete { // 删除
let msg = "您确定要删除文档\(contentItem.name)吗?"
YHTwoOptionAlertView.showAlertView(message:msg) { sure in
if !sure { return }
// 删除
YHHUD.show(.progress(message: "删除中..."))
var deleteIndex = -1
for (index, item) in self.materialModel.info.enumerated() {
if contentItem.url == item.url {
deleteIndex = index
break
if editType == .rename { // 重命名
IQKeyboardManager.shared.enable = false
var name = contentItem.getFileNameWithoutSuffix()
if name.count > 30 {
name = name[safe: ..<30]!
}
renameInputView.textField.text = name
renameInputView.textField.becomeFirstResponder()
} else if editType == .delete { // 删除
let msg = "您确定要删除文档\(contentItem.name)吗?"
YHTwoOptionAlertView.showAlertView(message:msg) { sure in
if !sure { return }
// 删除
var deleteIndex = -1
for (index, item) in self.materialModel.info.enumerated() {
if contentItem.url == item.url {
deleteIndex = index
break
}
}
if deleteIndex == -1 { // 没有找到对应资料文件
YHHUD.flash(message: "删除成功")
return
}
self.materialModel.info.remove(at: deleteIndex)
self.tableView.reloadData()
}
if deleteIndex == -1 { // 没有找到对应资料文件
YHHUD.flash(message: "删除成功")
return
} else if editType == .preview { // 预览
print(contentItem.url)
self.viewModel.getPublicImageUrl(contentItem.url) { success, error in
if let success = success {
self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName:contentItem.name)
}
}
self.materialModel.info.remove(at: deleteIndex)
self.viewModel.updateMaterials(material: self.materialModel, addInfoArr: []) {
success, error in
YHHUD.hide()
}
}.show()
}
}
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 {
YHHUD.flash(message: "删除成功")
successArr.append(url)
} else {
var msg = "删除失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
failArr.append(item)
}
self.requestMaterialDetail()
group.leave()
}
}
} else if editType == .preview { // 预览
print(contentItem.url)
self.viewModel.getPublicImageUrl(contentItem.url) { success, error in
if let success = success {
self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName:contentItem.name)
}
// 等待所有任务完成
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)张照片上传失败")
}
}
}.show()
}
sheetView.show()
}
return cell
}
if indexPath.section == 3 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeFileCountTableViewCell.self)
cell.setContentData(self.items.count)
return cell
}
return cell
return UITableViewCell()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
......@@ -308,21 +390,30 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
if indexPath.section == 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 {
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? {
let view = UIView()
if section == 0 { // 证件示例模板
let titlelabel = UILabel()
titlelabel.textColor = UIColor.mainTextColor
titlelabel.textAlignment = .left
......@@ -336,15 +427,15 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
}
let tipsLabel = UILabel()
tipsLabel.textColor = UIColor.labelTextColor2
tipsLabel.textAlignment = .left
tipsLabel.font = UIFont.PFSC_R(ofSize:14)
tipsLabel.numberOfLines = 0
if !self.templateModel.remark.isEmpty {
tipsLabel.text = "注意事项:\(self.templateModel.remark)"
}
// if !self.templateModel.remark.isEmpty {
// tipsLabel.text = "注意事项:\(self.templateModel.remark)"
// }
view.addSubview(tipsLabel)
tipsLabel.snp.makeConstraints { make in
......@@ -352,143 +443,146 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.bottom.equalToSuperview().offset(-15)
}
return view
}
// 证件标题和状态
let titlelabel = UILabel()
titlelabel.textColor = UIColor.mainTextColor
titlelabel.textAlignment = .left
titlelabel.font = UIFont.PFSC_M(ofSize:17)
titlelabel.text = self.materialModel.getName()
titlelabel.numberOfLines = 0
view.addSubview(titlelabel)
let statusLabel = UILabel()
statusLabel.textAlignment = .center
statusLabel.font = UIFont.PFSC_M(ofSize:10)
statusLabel.layer.cornerRadius = kCornerRadius3
statusLabel.clipsToBounds = true
view.addSubview(statusLabel)
var text = ""
var textColor:UIColor = .clear
var bgColor:UIColor = .clear
if self.materialModel.status == YHMaterialStatus.review.rawValue {
text = "审核中".local
textColor = UIColor(hexString: "#FF9900")!
bgColor = UIColor(hexString: "#FF9900", transparency: 0.08)!
} else if self.materialModel.status == YHMaterialStatus.preUpload.rawValue {
text = "待上传".local
textColor = UIColor(hexString: "#2F7EF6")!
bgColor = UIColor(hexString: "#2F7EF6", transparency: 0.08)!
} else if self.materialModel.status == YHMaterialStatus.completed.rawValue {
text = "已完成".local
textColor = UIColor(hexString: "#49D2B1")!
bgColor = UIColor(hexString: "#49D2B1", transparency: 0.08)!
} else if self.materialModel.status == YHMaterialStatus.rejected.rawValue {
text = "已驳回".local
textColor = UIColor.failColor
bgColor = UIColor(hexString: "#F81D22", transparency: 0.08)!
}
statusLabel.text = text
statusLabel.textColor = textColor
statusLabel.backgroundColor = bgColor
let tipsLabel = UILabel()
tipsLabel.textColor = .labelTextColor2
tipsLabel.font = UIFont.PFSC_R(ofSize:14)
tipsLabel.textAlignment = .left
tipsLabel.numberOfLines = 0
tipsLabel.text = "支持的文件格式为jpg/jpeg、png、bmp、doc/docx、xls/xlsx、pdf,最多可上传99张图片或文件"
view.addSubview(tipsLabel)
titlelabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.top.equalToSuperview()
}
statusLabel.snp.makeConstraints { make in
make.centerY.equalTo(titlelabel)
make.left.equalTo(titlelabel.snp.right).offset(4)
make.right.lessThanOrEqualTo(view).offset(-20)
make.height.equalTo(16)
make.width.equalTo(38)
}
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titlelabel.snp.bottom).offset(7)
make.bottom.equalToSuperview().offset(-15)
}
if self.materialModel.status != YHMaterialStatus.rejected.rawValue {
}
return view
}
if self.materialModel.audit_remark.isEmpty { // 无驳回理由
if section == 1 {
// 证件标题和状态
let titlelabel = UILabel()
titlelabel.textColor = UIColor.mainTextColor
titlelabel.textAlignment = .left
titlelabel.font = UIFont.PFSC_M(ofSize:17)
titlelabel.text = self.materialModel.getName()
titlelabel.numberOfLines = 0
view.addSubview(titlelabel)
let statusLabel = UILabel()
statusLabel.textAlignment = .center
statusLabel.font = UIFont.PFSC_M(ofSize:10)
statusLabel.layer.cornerRadius = kCornerRadius3
statusLabel.clipsToBounds = true
view.addSubview(statusLabel)
var text = ""
var textColor:UIColor = .clear
var bgColor:UIColor = .clear
if self.materialModel.status == YHMaterialStatus.review.rawValue {
text = "审核中".local
textColor = UIColor(hexString: "#FF9900")!
bgColor = UIColor(hexString: "#FF9900", transparency: 0.08)!
} else if self.materialModel.status == YHMaterialStatus.preUpload.rawValue {
text = "待上传".local
textColor = UIColor(hexString: "#2F7EF6")!
bgColor = UIColor(hexString: "#2F7EF6", transparency: 0.08)!
} else if self.materialModel.status == YHMaterialStatus.completed.rawValue {
text = "已完成".local
textColor = UIColor(hexString: "#49D2B1")!
bgColor = UIColor(hexString: "#49D2B1", transparency: 0.08)!
} else if self.materialModel.status == YHMaterialStatus.rejected.rawValue {
text = "已驳回".local
textColor = UIColor.failColor
bgColor = UIColor(hexString: "#F81D22", transparency: 0.08)!
}
statusLabel.text = text
statusLabel.textColor = textColor
statusLabel.backgroundColor = bgColor
let tipsLabel = UILabel()
tipsLabel.textColor = .labelTextColor2
tipsLabel.font = UIFont.PFSC_R(ofSize:14)
tipsLabel.textAlignment = .left
tipsLabel.numberOfLines = 0
tipsLabel.text = "支持的文件格式为jpg/jpeg、png、bmp、doc/docx、xls/xlsx、pdf,最多可上传99张图片或文件"
view.addSubview(tipsLabel)
titlelabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.top.equalToSuperview()
}
statusLabel.snp.makeConstraints { make in
make.centerY.equalTo(titlelabel)
make.left.equalTo(titlelabel.snp.right).offset(4)
make.right.lessThanOrEqualTo(view).offset(-20)
make.height.equalTo(16)
make.width.equalTo(38)
}
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titlelabel.snp.bottom).offset(7)
make.bottom.equalToSuperview().offset(-15)
}
if self.materialModel.status != YHMaterialStatus.rejected.rawValue {
return view
}
if self.materialModel.audit_remark.isEmpty { // 无驳回理由
return view
}
// 有驳回理由
let rejectView = UIView()
view.addSubview(rejectView)
let warningImgV = UIImageView(image: UIImage(named: "my_cer_upload_warning"))
rejectView.addSubview(warningImgV)
let rejectTitleLabel = UILabel()
rejectTitleLabel.textColor = .failColor
rejectTitleLabel.font = UIFont.PFSC_R(ofSize:12)
rejectTitleLabel.textAlignment = .left
rejectTitleLabel.text = "驳回原因:"
rejectView.addSubview(rejectTitleLabel)
let rejectContentLabel = UILabel()
rejectContentLabel.textColor = .failColor
rejectContentLabel.font = UIFont.PFSC_R(ofSize:12)
rejectContentLabel.numberOfLines = 0
rejectContentLabel.textAlignment = .left
rejectContentLabel.text = self.materialModel.audit_remark
rejectView.addSubview(rejectContentLabel)
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titlelabel.snp.bottom).offset(7)
make.bottom.equalTo(rejectView.snp.top).offset(-20)
}
rejectView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.bottom.equalToSuperview().offset(-12)
}
warningImgV.snp.makeConstraints { make in
make.width.height.equalTo(14)
make.left.top.equalTo(0)
}
rejectTitleLabel.snp.makeConstraints { make in
make.centerY.equalTo(warningImgV)
make.left.equalTo(warningImgV.snp.right).offset(4)
}
rejectContentLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(warningImgV.snp.bottom).offset(7)
make.bottom.equalToSuperview()
}
return view
}
// 有驳回理由
let rejectView = UIView()
view.addSubview(rejectView)
let warningImgV = UIImageView(image: UIImage(named: "my_cer_upload_warning"))
rejectView.addSubview(warningImgV)
let rejectTitleLabel = UILabel()
rejectTitleLabel.textColor = .failColor
rejectTitleLabel.font = UIFont.PFSC_R(ofSize:12)
rejectTitleLabel.textAlignment = .left
rejectTitleLabel.text = "驳回原因:"
rejectView.addSubview(rejectTitleLabel)
let rejectContentLabel = UILabel()
rejectContentLabel.textColor = .failColor
rejectContentLabel.font = UIFont.PFSC_R(ofSize:12)
rejectContentLabel.numberOfLines = 0
rejectContentLabel.textAlignment = .left
rejectContentLabel.text = self.materialModel.audit_remark
rejectView.addSubview(rejectContentLabel)
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titlelabel.snp.bottom).offset(7)
make.bottom.equalTo(rejectView.snp.top).offset(-20)
}
rejectView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.bottom.equalToSuperview().offset(-12)
}
warningImgV.snp.makeConstraints { make in
make.width.height.equalTo(14)
make.left.top.equalTo(0)
}
rejectTitleLabel.snp.makeConstraints { make in
make.centerY.equalTo(warningImgV)
make.left.equalTo(warningImgV.snp.right).offset(4)
}
rejectContentLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(warningImgV.snp.bottom).offset(7)
make.bottom.equalToSuperview()
}
view.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 0.01)
return view
}
......@@ -496,35 +590,15 @@ extension YHResignUploadDocDetailViewController: UITableViewDelegate, UITableVie
if section == 0 {
return 20.0
}
return 60.0
if section == 1 {
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))
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
}
......@@ -596,51 +670,44 @@ extension YHResignUploadDocDetailViewController {
extension YHResignUploadDocDetailViewController {
func requestMaterialDetail() {
YHHUD.show(.progress(message: "加载中..."))
viewModel.getMaterialDeal(orderId: orderId, id: batchId, materialId: materialId) {
[weak self] success, error in
YHHUD.hide()
viewModel.getUploadDocDetail(id: id) {[weak self] success, err in
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)
}
}
// 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 {
tableView.dataSource = self
tableView.backgroundColor = .clear
tableView.register(YHResignUploadDocListCell.self, forCellReuseIdentifier: YHResignUploadDocListCell.cellReuseIdentifier)
tableView.register(YHTravelDocsPreparationTipsCell.self, forCellReuseIdentifier: YHTravelDocsPreparationTipsCell.cellReuseIdentifier)
tableView.register(YHResignUploadSuccessDocListCell.self, forCellReuseIdentifier: YHResignUploadSuccessDocListCell.cellReuseIdentifier)
return tableView
}()
......@@ -87,14 +84,30 @@ class YHResignUploadDocListViewController: YHBaseViewController {
private extension YHResignUploadDocListViewController {
func loadData() {
viewModel.getUploadDocProgress(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 }
viewModel.getUploadDocList(orderID: orderId, stepID: batchId) {[weak self] success, err in
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() {
......@@ -155,9 +168,8 @@ private extension YHResignUploadDocListViewController {
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.right.equalToSuperview()
make.bottom.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 160)
make.bottom.equalTo(-98)
}
}
}
......@@ -166,7 +178,10 @@ private extension YHResignUploadDocListViewController {
extension YHResignUploadDocListViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
if self.viewModel.mainModel.supplement_voucher_url.count == 0 {
return 2
}
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
......@@ -174,28 +189,47 @@ extension YHResignUploadDocListViewController: UITableViewDelegate, UITableViewD
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let approveCell = tableView.dequeueReusableCell(withIdentifier: YHResignUploadDocListCell.cellReuseIdentifier, for: indexPath) as! YHResignUploadDocListCell
approveCell.section = indexPath.section
if indexPath.section == 0 {
approveCell.title = "资料上传"
approveCell.dataSource = self.viewModel.mainModel.upload_list
} else {
approveCell.title = "文书确认"
approveCell.dataSource = self.viewModel.mainModel.doc_list
}
approveCell.clickBlock = { [weak self] model, section in
guard let self = self else { return }
if section == 0 {
// 跳转文件上传
if self.viewModel.mainModel.supplement_voucher_url.count == 0 {
let approveCell = tableView.dequeueReusableCell(withIdentifier: YHResignUploadDocListCell.cellReuseIdentifier, for: indexPath) as! YHResignUploadDocListCell
approveCell.section = indexPath.section
if indexPath.section == 0 {
approveCell.title = "资料上传"
approveCell.dataSource = self.viewModel.mainModel.upload_list
} else {
// 跳转列表
approveCell.title = "文书确认"
approveCell.dataSource = self.viewModel.mainModel.doc_list
}
approveCell.clickBlock = { [weak self] model, section in
guard let self = self else { return }
if section == 0 {
// 跳转文件上传
let vc = YHResignUploadDocDetailViewController()
vc.id = model.id
self.navigationController?.pushViewController(vc)
} else {
// 跳转列表
let vc = YHResignDocumentManagementVC(orderId: orderId, id: batchId)
self.navigationController?.pushViewController(vc)
}
}
return approveCell
} else {
let approveCell = tableView.dequeueReusableCell(withIdentifier: YHResignUploadSuccessDocListCell.cellReuseIdentifier, for: indexPath) as! YHResignUploadSuccessDocListCell
approveCell.dataSource = [self.viewModel.mainModel.supplement_voucher_url]
return approveCell
}
return approveCell
}
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) {
......
//
// 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 @@
import UIKit
import SmartCodable
class YHResignUploadDocListProgressModel: SmartCodable {
var progress : Int = -1 //电子签证有效期
var is_need_supplement : Bool = true
required init() {
}
}
class YHResignUploadDocListModel: SmartCodable {
var supplement_voucher_url : 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 {
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(14)
make.bottom.equalTo(-7)
make.top.bottom.equalToSuperview()
}
titleLabel = {
......@@ -75,7 +74,7 @@ class YHResignUploadDocListCell: UITableViewCell {
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(23)
make.top.equalTo(16)
make.height.equalTo(24)
make.right.equalTo(-20)
}
......@@ -88,7 +87,7 @@ class YHResignUploadDocListCell: UITableViewCell {
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(62.5)
make.top.equalTo(51.5)
make.height.equalTo(0.5)
}
......@@ -100,9 +99,8 @@ class YHResignUploadDocListCell: UITableViewCell {
}()
centerView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalTo(-63)
make.top.equalTo(63)
make.bottom.left.right.equalToSuperview()
make.top.equalTo(52)
}
}
......@@ -132,8 +130,6 @@ class YHResignUploadDocListCell: UITableViewCell {
block(model, self.section)
}
}
let model = dataSource[i]
itemView.tag = 4000 + i
if section == 0 {
itemView.dataSource = dataSource[i]
......@@ -195,7 +191,7 @@ class YHResignUploadDocItemView: UIView {
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.top.bottom.equalToSuperview()
make.right.equalTo(-30)
make.right.equalTo(-50)
}
explainLabel = {
......@@ -263,7 +259,7 @@ class YHResignUploadDocItemView: UIView {
}
func updateDocAllViews() {
guard let dataSource = dataSource else { return }
guard let dataSource = docDataSource else { return }
titleLabel.text = dataSource.name
if dataSource.status == 1 {
explainLabel.textColor = UIColor.brandMainColor
......
......@@ -10,11 +10,13 @@ import UIKit
class YHResignUploadSuccessDocListCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignUploadSuccessDocListCell"
typealias ExperienceListBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> ()
var experienceListBlock: ExperienceListBlock?
lazy var previewFileTool:YHFilePreviewTool = {
let tool = YHFilePreviewTool(targetVC: UIViewController.current)
return tool
}()
var mainItemView: UIView!
var dataSource: [YHWorkExperienceFileModel]?{
var dataSource: [String]?{
didSet {
updateAllViews()
}
......@@ -49,9 +51,10 @@ class YHResignUploadSuccessDocListCell: UITableViewCell {
}()
contentView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview()
make.bottom.equalToSuperview()
make.top.equalTo(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
}
......@@ -60,31 +63,36 @@ class YHResignUploadSuccessDocListCell: UITableViewCell {
for i in 0 ..< (dataSource?.count ?? 0) {
let itemView = YHResignUploadFileItemView()
itemView.dataSource = dataSource?[i]
itemView.block = {[weak self] model, type in
itemView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.experienceListBlock {
block(model, type)
let viewModel = YHBaseViewModel()
viewModel.getPublicImageUrl(model) { success, error in
if let success = success {
self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName:"")
} else {
YHHUD.flash(message: "链接不可用")
}
}
}
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(55 * i)
make.height.equalTo(55)
make.top.equalTo(67 * i)
make.height.equalTo(67)
}
}
}
}
class YHResignUploadFileItemView: UIView {
typealias ItemBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> ()
typealias ItemBlock = (_ model: String) -> ()
var block: ItemBlock?
var whiteView: UIButton!
var iconImgV: UIImageView!
var nameLabel: UILabel!
var timeLabel: UILabel!
var editBtn: UIButton!
var dataSource: YHWorkExperienceFileModel? {
var dataSource: String? {
didSet {
updateAllViews()
}
......@@ -114,19 +122,12 @@ class YHResignUploadFileItemView: UIView {
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.setTitle("查看", 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.YH_clickEdgeInsets = UIEdgeInsets(top: 30, left: 30, bottom: 30, right: 30)
editBtn.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
editBtn.layer.cornerRadius = 10
whiteView.addSubview(editBtn)
......@@ -134,7 +135,7 @@ class YHResignUploadFileItemView: UIView {
make.left.equalTo(18)
make.right.equalTo(-18)
make.centerY.equalToSuperview()
make.height.equalTo(55)
make.height.equalTo(67)
}
iconImgV.snp.makeConstraints { make in
......@@ -145,17 +146,10 @@ class YHResignUploadFileItemView: UIView {
nameLabel.snp.makeConstraints { make in
make.left.equalTo(iconImgV.snp.right).offset(18)
make.top.equalToSuperview().offset(7)
make.centerY.equalToSuperview()
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.equalTo(38)
make.height.equalTo(20)
......@@ -167,9 +161,7 @@ class YHResignUploadFileItemView: UIView {
func updateAllViews() {
guard let dataSource = dataSource else { return }
nameLabel.text = dataSource.fileName
timeLabel.text = "上传于\(dataSource.uploadedAt)"
let suffix = dataSource.fileUrl.pathExtension.lowercased()
let suffix = dataSource.pathExtension.lowercased()
var iconImgName = ""
if suffix == "jpeg" {
......@@ -196,19 +188,14 @@ class YHResignUploadFileItemView: UIView {
} else if suffix == "xls" || suffix == "xlsx" {
iconImgName = "my_cer_type_excel"
}
nameLabel.text = "补件递交凭证." + suffix
iconImgV.image = UIImage(named: iconImgName)
}
@objc func itemClick() {
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,36 +9,11 @@
import UIKit
class YHResignUploadDocListViewModel: YHBaseViewModel {
var progressModel : YHResignUploadDocListProgressModel = YHResignUploadDocListProgressModel()
//列表信息
var mainModel : YHResignUploadDocListModel = YHResignUploadDocListModel()
}
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?)->()) {
let params: [String : Any] = ["order_id": orderID, "renewal_id": stepID]
......
......@@ -77,7 +77,15 @@ class YHResignUploadTravelCardListViewController: YHBaseViewController {
}
@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 {
struct ResignUploadDoc {
static let progress = "super-app/renewal/supplement/progress"
static let list = "super-app/renewal/supplement/list"
static let detail = "super-app/renewal/supplement/upload/detail"
}
// 续签-电子签证缴费
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