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

续签证件旅行UI

parent d04a5c24
...@@ -205,6 +205,10 @@ ...@@ -205,6 +205,10 @@
044EE2402C92E6C000A2FE3A /* YHResignCertificateDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE23F2C92E6C000A2FE3A /* YHResignCertificateDetailViewModel.swift */; }; 044EE2402C92E6C000A2FE3A /* YHResignCertificateDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE23F2C92E6C000A2FE3A /* YHResignCertificateDetailViewModel.swift */; };
044EE2422C92EF0C00A2FE3A /* YHResignCertificateDetailEVisaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2412C92EF0C00A2FE3A /* YHResignCertificateDetailEVisaViewController.swift */; }; 044EE2422C92EF0C00A2FE3A /* YHResignCertificateDetailEVisaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2412C92EF0C00A2FE3A /* YHResignCertificateDetailEVisaViewController.swift */; };
044EE2442C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2432C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift */; }; 044EE2442C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2432C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift */; };
044EE2462C93E22E00A2FE3A /* YHResignCertificateDetailHkViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2452C93E22E00A2FE3A /* YHResignCertificateDetailHkViewController.swift */; };
044EE2482C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2472C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift */; };
044EE24A2C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2492C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift */; };
044EE24C2C94396E00A2FE3A /* YHResignCertificatePassportTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE24B2C94396D00A2FE3A /* YHResignCertificatePassportTableViewCell.swift */; };
04506F552C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04506F542C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift */; }; 04506F552C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04506F542C6F57E600738EA1 /* YHFamilyMemberInfoCell.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 */; };
...@@ -1003,6 +1007,10 @@ ...@@ -1003,6 +1007,10 @@
044EE23F2C92E6C000A2FE3A /* YHResignCertificateDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateDetailViewModel.swift; sourceTree = "<group>"; }; 044EE23F2C92E6C000A2FE3A /* YHResignCertificateDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateDetailViewModel.swift; sourceTree = "<group>"; };
044EE2412C92EF0C00A2FE3A /* YHResignCertificateDetailEVisaViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateDetailEVisaViewController.swift; sourceTree = "<group>"; }; 044EE2412C92EF0C00A2FE3A /* YHResignCertificateDetailEVisaViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateDetailEVisaViewController.swift; sourceTree = "<group>"; };
044EE2432C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateEvisaTableViewCell.swift; sourceTree = "<group>"; }; 044EE2432C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateEvisaTableViewCell.swift; sourceTree = "<group>"; };
044EE2452C93E22E00A2FE3A /* YHResignCertificateDetailHkViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateDetailHkViewController.swift; sourceTree = "<group>"; };
044EE2472C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateHKTableViewCell.swift; sourceTree = "<group>"; };
044EE2492C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateDetailPassPortViewController.swift; sourceTree = "<group>"; };
044EE24B2C94396D00A2FE3A /* YHResignCertificatePassportTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificatePassportTableViewCell.swift; sourceTree = "<group>"; };
04506F542C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberInfoCell.swift; sourceTree = "<group>"; }; 04506F542C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberInfoCell.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>"; };
...@@ -2186,6 +2194,8 @@ ...@@ -2186,6 +2194,8 @@
children = ( children = (
044EE2372C92BBC500A2FE3A /* YHResignCertificateListTableViewCell.swift */, 044EE2372C92BBC500A2FE3A /* YHResignCertificateListTableViewCell.swift */,
044EE2432C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift */, 044EE2432C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift */,
044EE2472C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift */,
044EE24B2C94396D00A2FE3A /* YHResignCertificatePassportTableViewCell.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2204,6 +2214,8 @@ ...@@ -2204,6 +2214,8 @@
044EE2352C92916600A2FE3A /* YHResignCertificateListViewController.swift */, 044EE2352C92916600A2FE3A /* YHResignCertificateListViewController.swift */,
044EE23D2C92E27500A2FE3A /* YHResignCertificateDetailViewController.swift */, 044EE23D2C92E27500A2FE3A /* YHResignCertificateDetailViewController.swift */,
044EE2412C92EF0C00A2FE3A /* YHResignCertificateDetailEVisaViewController.swift */, 044EE2412C92EF0C00A2FE3A /* YHResignCertificateDetailEVisaViewController.swift */,
044EE2452C93E22E00A2FE3A /* YHResignCertificateDetailHkViewController.swift */,
044EE2492C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -4514,6 +4526,7 @@ ...@@ -4514,6 +4526,7 @@
044D0C182C22AB7300C5CF5E /* YHEditBaseInfoFootView.swift in Sources */, 044D0C182C22AB7300C5CF5E /* YHEditBaseInfoFootView.swift in Sources */,
047AA3F42C50E5C7009C4554 /* YHInvitationWithGiftsViewModel.swift in Sources */, 047AA3F42C50E5C7009C4554 /* YHInvitationWithGiftsViewModel.swift in Sources */,
04CE1AD52C2AD91F001CB80A /* YHActivityTravelViewController.swift in Sources */, 04CE1AD52C2AD91F001CB80A /* YHActivityTravelViewController.swift in Sources */,
044EE2482C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift in Sources */,
A5EF21372BA6E2D1005027E6 /* YHQuestionAndAnswerModel.swift in Sources */, A5EF21372BA6E2D1005027E6 /* YHQuestionAndAnswerModel.swift in Sources */,
A567E5A52BD7643D00D5D5A0 /* YHHomeCollectionLayout.swift in Sources */, A567E5A52BD7643D00D5D5A0 /* YHHomeCollectionLayout.swift in Sources */,
04A6715C2B9FE9EA00C1FB91 /* YHCertificateUploadContentListVC.swift in Sources */, 04A6715C2B9FE9EA00C1FB91 /* YHCertificateUploadContentListVC.swift in Sources */,
...@@ -4640,6 +4653,7 @@ ...@@ -4640,6 +4653,7 @@
04C85DE52C369AB5008B20D6 /* YHMyFileListCell.swift in Sources */, 04C85DE52C369AB5008B20D6 /* YHMyFileListCell.swift in Sources */,
045EEF132B9F171A0022A143 /* YHCountryMessage.swift in Sources */, 045EEF132B9F171A0022A143 /* YHCountryMessage.swift in Sources */,
04EC2F812C22888E002907D7 /* YHFriendRequestView.swift in Sources */, 04EC2F812C22888E002907D7 /* YHFriendRequestView.swift in Sources */,
044EE24C2C94396E00A2FE3A /* YHResignCertificatePassportTableViewCell.swift in Sources */,
041892242C91BCF100B9FB94 /* YHResignRoundCellType.swift in Sources */, 041892242C91BCF100B9FB94 /* YHResignRoundCellType.swift in Sources */,
0430E6722C749E74000511E2 /* YHAdopterBirthViewController.swift in Sources */, 0430E6722C749E74000511E2 /* YHAdopterBirthViewController.swift in Sources */,
048058392C7F289700502CAA /* YHTravelCertificateItemView.swift in Sources */, 048058392C7F289700502CAA /* YHTravelCertificateItemView.swift in Sources */,
...@@ -4738,12 +4752,14 @@ ...@@ -4738,12 +4752,14 @@
045EEEDF2B9F171A0022A143 /* YHCollegeSearchBar.swift in Sources */, 045EEEDF2B9F171A0022A143 /* YHCollegeSearchBar.swift in Sources */,
044D0BEE2C2019C100C5CF5E /* YHCommunityViewController.swift in Sources */, 044D0BEE2C2019C100C5CF5E /* YHCommunityViewController.swift in Sources */,
A567E5B52BD7643D00D5D5A0 /* YHSearchInfoBar.swift in Sources */, A567E5B52BD7643D00D5D5A0 /* YHSearchInfoBar.swift in Sources */,
044EE2462C93E22E00A2FE3A /* YHResignCertificateDetailHkViewController.swift in Sources */,
A5ACE94B2B4564F7002C94D2 /* YHHUDRotatingImageView.swift in Sources */, A5ACE94B2B4564F7002C94D2 /* YHHUDRotatingImageView.swift in Sources */,
A5ACE94F2B4564F7002C94D2 /* YhOverlayView.swift in Sources */, A5ACE94F2B4564F7002C94D2 /* YhOverlayView.swift in Sources */,
045EEEB92B9F171A0022A143 /* YHWorkMessageSelectTableViewCell.swift in Sources */, 045EEEB92B9F171A0022A143 /* YHWorkMessageSelectTableViewCell.swift in Sources */,
04FA8B302C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift in Sources */, 04FA8B302C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift in Sources */,
04256E112C75BD2700A37BA4 /* YHVisaPaymentListModel.swift in Sources */, 04256E112C75BD2700A37BA4 /* YHVisaPaymentListModel.swift in Sources */,
04A7BD0F2BA41C9800BD35A2 /* YHMyDocumentsModel.swift in Sources */, 04A7BD0F2BA41C9800BD35A2 /* YHMyDocumentsModel.swift in Sources */,
044EE24A2C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift in Sources */,
0449EEF02C902A4100A397FD /* YHResignMaterialUploadVC.swift in Sources */, 0449EEF02C902A4100A397FD /* YHResignMaterialUploadVC.swift in Sources */,
04174D642BCD52BD000BA46D /* YHDeviceInfoViewController.swift in Sources */, 04174D642BCD52BD000BA46D /* YHDeviceInfoViewController.swift in Sources */,
0472E25E2C534723008EAB6E /* YHLifeDetailViewController.swift in Sources */, 0472E25E2C534723008EAB6E /* YHLifeDetailViewController.swift in Sources */,
......
//
// YHResignCertificateDetailHkViewController.swift
// galaxy
//
// Created by EDY on 2024/9/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHResignCertificateDetailHkViewController: YHBaseViewController {
lazy var viewModel: YHResignCertificateDetailViewModel = {
let vm = YHResignCertificateDetailViewModel()
return vm
}()
//上个界面传递过来的数据对象
var dataModel : YHResignCertificateModel = YHResignCertificateModel()
var orderId: Int = 0
var tipsArr: [ASAttributedString] = []
var urls: [String] = ["",""]
var data: [YHItemModel] = []
var isShowPrompt = false
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 0.01
tableView.estimatedSectionFooterHeight = 14.0
tableView.contentInsetAdjustmentBehavior = .never
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor(hex: 0xF8F9FB)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHTravelCertificateTipsCell.self, forCellReuseIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier)
tableView.register(YHResignCertificateHKTableViewCell.self, forCellReuseIdentifier: YHResignCertificateHKTableViewCell.cellReuseIdentifier)
return tableView
}()
let bottomViewHeight = 98.0
lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(bottomBtn)
bottomBtn.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.height.equalTo(48)
}
return view
}()
lazy var bottomBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .brandMainColor
btn.setTitle("确认,保存", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
btn.addTarget(self, action: #selector(didSaveBtnClicked), for: .touchUpInside)
btn.layer.cornerRadius = kCornerRadius3
return btn
}()
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navTitle = "旅行证件准备"
self.view.backgroundColor = .white
self.view.addSubview(self.tableView)
self.view.addSubview(bottomView)
self.tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top)
}
self.bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(98)
}
self.bottomView.addSubview(bottomBtn)
self.bottomBtn.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.height.equalTo(48)
}
loadDetailInfo()
}
func getTextWithType(type: Int, date:String) -> ASAttributedString {
if type == 0 {
return .init("上传《港澳通行证》(需有效期≥\(date))", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
if type == 1 {
let a = ASAttributedString.init("若有效期不足,请至少在续签前3个月完成证件更新", .font(UIFont.PFSC_R(ofSize:14)), .foreground(UIColor.brandMainColor))
let b = ASAttributedString.init(",请提醒出入境办证人员", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor50))
let c = ASAttributedString.init("务必保留背面逗留D签注", .font(UIFont.PFSC_R(ofSize:14)),
.foreground(UIColor.brandMainColor))
let d = ASAttributedString.init(",避免影响入境香港及续期时长!", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor50))
return a+b+c+d
}
return .init("", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
func getTipsWithType(date: String) -> [ASAttributedString] {
return [self.getTextWithType(type: 0, date: date),
self.getTextWithType(type: 1, date: date)]
}
func updateData() {
// travel_cert_type 证件类型 0-未知 1-护照 3-港澳通行证
// nationality : Int = -1 国籍 1-中国 2-国外
self.viewModel.dataModel = dataModel
if dataModel.cert_info.img_front.count != 0 {
urls[0] = dataModel.cert_info.img_front
}
if dataModel.cert_info.img_back.count != 0 {
urls[1] = dataModel.cert_info.img_back
}
self.data = viewModel.getBaseDataSource(isShowPrompt)
// 头部提示
tipsArr = getTipsWithType(date: self.dataModel.valid_date)
tableView.reloadData()
}
@objc func didSaveBtnClicked() {
if !checkInfo() {
return
}
saveAllTravelCertificate()
}
func checkInfo() -> Bool {
var errorItemCount = 0
// if item.type == .certificate {
// var hasSubmitError = false
// var isDateValidate = true
// item.cerDetailModel.isNeedCheckCer = false
// item.cerDetailModel.isNeedCheckDate = false
//
// if item.cerDetailModel.isOCR_failed {
// // 无法识别不能当做无法提交的错误 所以 此处 hasError 不必设置为true
// item.cerDetailModel.isNeedCheckCer = true
// item.cerDetailModel.checkTips = "无法识别,请核查文件"
//
// } else {
// var noCerInfo = false
// if item.cerDetailModel.type == 3 { // 只有港澳通行证有正反面
// noCerInfo = (item.cerDetailModel.img_front.isEmpty || item.cerDetailModel.img_back.isEmpty)
// } else {
// noCerInfo = item.cerDetailModel.img_front.isEmpty
// }
//
// if noCerInfo {
// hasSubmitError = true
// item.cerDetailModel.isNeedCheckCer = true
// if item.cerDetailModel.type == 3 { // 港澳通行证
// item.cerDetailModel.checkTips = item.cerDetailModel.img_front.isEmpty ? "请上传港澳通行证正面" : "请上传港澳通行证反面"
//
// } else if item.cerDetailModel.type == 1 { // 中国护照
// item.cerDetailModel.checkTips = "请上传护照"
//
// } else if item.cerDetailModel.type == 2 { // 中国居留许可签证
// item.cerDetailModel.checkTips = "请上传中国居留许可签证"
// }
//
// } else {
// item.cerDetailModel.isNeedCheckDate = false
// if item.cerDetailModel.issue_start.isEmpty || item.cerDetailModel.issue_end.isEmpty {
// hasSubmitError = true
// item.cerDetailModel.isNeedCheckDate = true
//
// } else {
// let isValidCertificate = item.cerDetailModel.isValidCer()
// if !isValidCertificate {
// if item.cerDetailModel.type == 2, item.cerDetailModel.china_travel_latest_validaty_date.isEmpty {
// // 这个情况直接弹toast
// hasSubmitError = true
// YHHUD.flash(message: "赴港行程尚未成功预约,请前往检查")
//
// } else {
// // 有效期不足也能提交
// isDateValidate = false
// item.cerDetailModel.isNeedCheckCer = true
// let deadDate: String = (item.cerDetailModel.type == 2 ? item.cerDetailModel.china_travel_latest_validaty_date : item.cerDetailModel.latest_validaty_date)
// item.cerDetailModel.checkTips = "有效期不足,需要为\(deadDate)或以后"
// }
// }
// }
// }
// }
// if !hasSubmitError {
// // 无法识别或有效期不足也要可以提交
// if !item.cerDetailModel.isOCR_failed && isDateValidate {
// item.cerDetailModel.isNeedCheckCer = false
// item.cerDetailModel.isNeedCheckDate = false
// }
//
// } else {
// errorItemCount += 1
// }
// }
self.tableView.reloadData()
return true
}
}
private extension YHResignCertificateDetailHkViewController {
//1、获取详情信息
func loadDetailInfo() {
// let params = [
// "order_id": orderId,
// "user_id": dataModel.id,
// "user_type": dataModel.type
// ] as [String : Any]
//
// YHHUD.show(.progress(message: "加载中..."))
// viewModel.getTravelDocsDetailInfo(param: params) { success, error in
// YHHUD.hide()
// if success {
// // TODO: 杜宇哥 UI刷新
self.updateData()
//
// } else {
//
// }
// }
}
//2、保存旅行证件
func saveAllTravelCertificate() {
}
}
extension YHResignCertificateDetailHkViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier, for: indexPath) as! YHTravelCertificateTipsCell
cell.userName = self.dataModel.name
cell.tipsArr = tipsArr
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignCertificateHKTableViewCell.cellReuseIdentifier, for: indexPath) as! YHResignCertificateHKTableViewCell
cell.firstImageName = "service_adopter_card_travel_front"
cell.lastImageName = "service_adopter_card_travel_back"
cell.firstLabelName = "证件页1"
cell.lastLabelName = "证件页2"
cell.urls = urls
cell.data = data
cell.urlBlock = { [weak self] url, index in
guard let self = self else { return }
self.urls[index] = url
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
// self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
// guard let self = self else { return }
// self.data = viewModel.getBaseDataSource(isShowPrompt)
// self.tableView.reloadData()
// }
}
}
cell.deleteBlock = { [weak self] url, index in
guard let self = self else { return }
self.urls[index] = url
}
cell.block = {[weak self] model in
guard let self = self else { return }
// self.viewModel.updateModel(model)
// let id = model.id
// if id != .id2 && id != .id3 && id != .id4 {
// self.data = viewModel.getBaseDataSource(isShowPrompt)
// self.tableView.reloadData()
// }
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section != 0 {
if urls[0].count == 0 && urls[1].count == 0 {
return 243
} else {
var tatol = 0
for item in data {
let isShow = item.isShowPrompts ?? false
let message = item.message ?? ""
let isNeed = item.isNeed ?? false
if isShow && message.count == 0 && isNeed {
tatol = tatol + 20
}
}
return CGFloat(521 + tatol)
}
}
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 14.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
if section == 0 {
view.backgroundColor = .white
}
return view
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
}
}
//
// YHResignCertificateDetailPassPortViewController.swift
// galaxy
//
// Created by EDY on 2024/9/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
lazy var viewModel: YHResignCertificateDetailViewModel = {
let vm = YHResignCertificateDetailViewModel()
return vm
}()
//上个界面传递过来的数据对象
var dataModel : YHResignCertificateModel = YHResignCertificateModel()
var orderId: Int = 0
var tipsArr: [ASAttributedString] = []
var urls: [String] = [""]
var data: [YHItemModel] = []
var isShowPrompt = false
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 0.01
tableView.estimatedSectionFooterHeight = 14.0
tableView.contentInsetAdjustmentBehavior = .never
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor(hex: 0xF8F9FB)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHTravelCertificateTipsCell.self, forCellReuseIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier)
tableView.register(YHResignCertificatePassportTableViewCell.self, forCellReuseIdentifier: YHResignCertificatePassportTableViewCell.cellReuseIdentifier)
return tableView
}()
let bottomViewHeight = 98.0
lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(bottomBtn)
bottomBtn.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.height.equalTo(48)
}
return view
}()
lazy var bottomBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .brandMainColor
btn.setTitle("确认,保存", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
btn.addTarget(self, action: #selector(didSaveBtnClicked), for: .touchUpInside)
btn.layer.cornerRadius = kCornerRadius3
return btn
}()
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navTitle = "旅行证件准备"
self.view.backgroundColor = .white
self.view.addSubview(self.tableView)
self.view.addSubview(bottomView)
self.tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top)
}
self.bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(98)
}
self.bottomView.addSubview(bottomBtn)
self.bottomBtn.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.height.equalTo(48)
}
loadDetailInfo()
}
func getTextWithType(type: Int, date:String) -> ASAttributedString {
if type == 0 {
return .init("上传《护照》(有效期≥\(date))", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
if type == 1 {
let a = ASAttributedString.init("若有效期不足,请至少在续签前3个月完成证件更新", .font(UIFont.PFSC_R(ofSize:14)), .foreground(UIColor.brandMainColor))
let b = ASAttributedString.init(",避免影响续期时长!", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor50))
return a+b
}
return .init("", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
func getTipsWithType(date: String) -> [ASAttributedString] {
return [self.getTextWithType(type: 0, date: date),
self.getTextWithType(type: 1, date: date)]
}
func updateData() {
// travel_cert_type 证件类型 0-未知 1-护照 3-港澳通行证
// nationality : Int = -1 国籍 1-中国 2-国外
self.viewModel.dataModel = dataModel
if dataModel.cert_info.img_front.count != 0 {
urls[0] = dataModel.cert_info.img_front
}
self.data = viewModel.getPassPortDataSource(isShowPrompt)
// 头部提示
tipsArr = getTipsWithType(date: self.dataModel.valid_date)
tableView.reloadData()
}
@objc func didSaveBtnClicked() {
if !checkInfo() {
return
}
saveAllTravelCertificate()
}
func checkInfo() -> Bool {
var errorItemCount = 0
// if item.type == .certificate {
// var hasSubmitError = false
// var isDateValidate = true
// item.cerDetailModel.isNeedCheckCer = false
// item.cerDetailModel.isNeedCheckDate = false
//
// if item.cerDetailModel.isOCR_failed {
// // 无法识别不能当做无法提交的错误 所以 此处 hasError 不必设置为true
// item.cerDetailModel.isNeedCheckCer = true
// item.cerDetailModel.checkTips = "无法识别,请核查文件"
//
// } else {
// var noCerInfo = false
// if item.cerDetailModel.type == 3 { // 只有港澳通行证有正反面
// noCerInfo = (item.cerDetailModel.img_front.isEmpty || item.cerDetailModel.img_back.isEmpty)
// } else {
// noCerInfo = item.cerDetailModel.img_front.isEmpty
// }
//
// if noCerInfo {
// hasSubmitError = true
// item.cerDetailModel.isNeedCheckCer = true
// if item.cerDetailModel.type == 3 { // 港澳通行证
// item.cerDetailModel.checkTips = item.cerDetailModel.img_front.isEmpty ? "请上传港澳通行证正面" : "请上传港澳通行证反面"
//
// } else if item.cerDetailModel.type == 1 { // 中国护照
// item.cerDetailModel.checkTips = "请上传护照"
//
// } else if item.cerDetailModel.type == 2 { // 中国居留许可签证
// item.cerDetailModel.checkTips = "请上传中国居留许可签证"
// }
//
// } else {
// item.cerDetailModel.isNeedCheckDate = false
// if item.cerDetailModel.issue_start.isEmpty || item.cerDetailModel.issue_end.isEmpty {
// hasSubmitError = true
// item.cerDetailModel.isNeedCheckDate = true
//
// } else {
// let isValidCertificate = item.cerDetailModel.isValidCer()
// if !isValidCertificate {
// if item.cerDetailModel.type == 2, item.cerDetailModel.china_travel_latest_validaty_date.isEmpty {
// // 这个情况直接弹toast
// hasSubmitError = true
// YHHUD.flash(message: "赴港行程尚未成功预约,请前往检查")
//
// } else {
// // 有效期不足也能提交
// isDateValidate = false
// item.cerDetailModel.isNeedCheckCer = true
// let deadDate: String = (item.cerDetailModel.type == 2 ? item.cerDetailModel.china_travel_latest_validaty_date : item.cerDetailModel.latest_validaty_date)
// item.cerDetailModel.checkTips = "有效期不足,需要为\(deadDate)或以后"
// }
// }
// }
// }
// }
// if !hasSubmitError {
// // 无法识别或有效期不足也要可以提交
// if !item.cerDetailModel.isOCR_failed && isDateValidate {
// item.cerDetailModel.isNeedCheckCer = false
// item.cerDetailModel.isNeedCheckDate = false
// }
//
// } else {
// errorItemCount += 1
// }
// }
self.tableView.reloadData()
return true
}
}
private extension YHResignCertificateDetailPassPortViewController {
//1、获取详情信息
func loadDetailInfo() {
// let params = [
// "order_id": orderId,
// "user_id": dataModel.id,
// "user_type": dataModel.type
// ] as [String : Any]
//
// YHHUD.show(.progress(message: "加载中..."))
// viewModel.getTravelDocsDetailInfo(param: params) { success, error in
// YHHUD.hide()
// if success {
// // TODO: 杜宇哥 UI刷新
self.updateData()
//
// } else {
//
// }
// }
}
//2、保存旅行证件
func saveAllTravelCertificate() {
}
}
extension YHResignCertificateDetailPassPortViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier, for: indexPath) as! YHTravelCertificateTipsCell
cell.userName = self.dataModel.name
cell.tipsArr = tipsArr
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignCertificatePassportTableViewCell.cellReuseIdentifier, for: indexPath) as! YHResignCertificatePassportTableViewCell
cell.firstImageName = "service_adopter_card_china_travel_front"
cell.firstLabelName = "护照资料页"
cell.urls = urls
cell.data = data
cell.urlBlock = { [weak self] url, index in
guard let self = self else { return }
self.urls[index] = url
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
// self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
// guard let self = self else { return }
// self.data = viewModel.getBaseDataSource(isShowPrompt)
// self.tableView.reloadData()
// }
}
}
cell.deleteBlock = { [weak self] url, index in
guard let self = self else { return }
self.urls[index] = url
}
cell.block = {[weak self] model in
guard let self = self else { return }
// self.viewModel.updateModel(model)
// let id = model.id
// if id != .id2 && id != .id3 && id != .id4 {
// self.data = viewModel.getBaseDataSource(isShowPrompt)
// self.tableView.reloadData()
// }
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section != 0 {
if urls[0].count == 0 {
return 243
} else {
var tatol = 0
for item in data {
let isShow = item.isShowPrompts ?? false
let message = item.message ?? ""
let isNeed = item.isNeed ?? false
if isShow && message.count == 0 && isNeed {
tatol = tatol + 20
}
}
return CGFloat(345 + tatol)
}
}
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 14.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
if section == 0 {
view.backgroundColor = .white
}
return view
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
}
}
...@@ -85,7 +85,15 @@ extension YHResignCertificateListViewController: UITableViewDelegate, UITableVie ...@@ -85,7 +85,15 @@ extension YHResignCertificateListViewController: UITableViewDelegate, UITableVie
cell.clickBlock = { [weak self] model in cell.clickBlock = { [weak self] model in
guard let self = self else { return } guard let self = self else { return }
if indexPath.row == 0 { if indexPath.row == 0 {
if model.cert_type == "PASS_PORT" {
let vc = YHResignCertificateDetailPassPortViewController()
vc.dataModel = model
self.navigationController?.pushViewController(vc)
} else {
let vc = YHResignCertificateDetailHkViewController()
vc.dataModel = model
self.navigationController?.pushViewController(vc)
}
} }
if indexPath.row == 1 { if indexPath.row == 1 {
let vc = YHResignCertificateDetailEVisaViewController() let vc = YHResignCertificateDetailEVisaViewController()
......
//
// YHResignCertificateHK.swift
// galaxy
//
// Created by EDY on 2024/9/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHResignCertificateHKTableViewCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignCertificateHKTableViewCell"
typealias UrlBlock = (_ url: String, _ index: Int) -> ()
var urlBlock: UrlBlock?
var deleteBlock: UrlBlock?
typealias ItemBlock = (_ model: YHItemModel) -> ()
var block: ItemBlock?
var centerView: UIView!
var titleLabel: UILabel!
var exampleButton: UIButton!
var frontLabel: UILabel!
var backSurfaceLabel: UILabel!
var frontImageButton: YHCardButton!
var backSurfaceImageButton: YHCardButton!
var frontDeleteButton: UIButton!
var backSurfaceDeleteButton: UIButton!
var activityIndicator: UIActivityIndicatorView!
var showMessageLabel: UILabel!
var cardLabel: UILabel!
var signLabel: UILabel!
var cardBeginView: YHItemView!
var cardEndView: YHItemView!
var signBeginView: YHItemView!
var signEndView: YHItemView!
var viewModel: YHBaseViewModel = YHBaseViewModel()
var firstUrl: String = ""
var lastUrl: String = ""
var firstImageName: String = "" {
didSet {
frontImageButton.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
}
}
var lastImageName: String = "" {
didSet {
backSurfaceImageButton.setBackgroundImage(UIImage(named: lastImageName), for: .normal)
}
}
var firstLabelName: String = "" {
didSet {
frontLabel.text = firstLabelName
}
}
var lastLabelName: String = "" {
didSet {
backSurfaceLabel.text = lastLabelName
}
}
var urls: [String]? {
didSet {
guard let firstUrl = urls?.first, firstUrl.count != 0 else {
cardLabel.isHidden = true
signLabel.isHidden = true
cardBeginView.isHidden = true
cardEndView.isHidden = true
signBeginView.isHidden = true
signEndView.isHidden = true
return
}
cardLabel.isHidden = false
signLabel.isHidden = false
cardBeginView.isHidden = false
cardEndView.isHidden = false
signBeginView.isHidden = false
signEndView.isHidden = false
self.firstUrl = firstUrl
self.viewModel.getPublicImageUrl(firstUrl) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.frontImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in
self.frontDeleteButton.isHidden = false
})
self.frontImageButton.setContent("", "")
}
guard let lastUrl = urls?.last, lastUrl.count != 0 else { return }
self.lastUrl = lastUrl
self.viewModel.getPublicImageUrl(lastUrl) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.backSurfaceImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in
self.backSurfaceDeleteButton.isHidden = false
})
self.backSurfaceImageButton.setContent("", "")
}
}
}
var data: [YHItemModel] = [] {
didSet {
for item in data {
let isShow = item.isShowPrompts ?? false
let message = item.message ?? ""
let isNeed = item.isNeed ?? false
if item.id == .id1 {
cardBeginView.dataSource = item
if isShow && message.count == 0 && isNeed {
cardBeginView.snp.updateConstraints { make in
make.height.equalTo(72)
}
} else {
cardBeginView.snp.updateConstraints { make in
make.height.equalTo(52)
}
}
}
if item.id == .id2 {
cardEndView.dataSource = item
if isShow && message.count == 0 && isNeed {
cardEndView.snp.updateConstraints { make in
make.height.equalTo(72)
}
} else {
cardEndView.snp.updateConstraints { make in
make.height.equalTo(52)
}
}
}
if item.id == .id3 {
signBeginView.dataSource = item
if isShow && message.count == 0 && isNeed {
signBeginView.snp.updateConstraints { make in
make.height.equalTo(72)
}
} else {
signBeginView.snp.updateConstraints { make in
make.height.equalTo(52)
}
}
}
if item.id == .id4 {
signEndView.dataSource = item
if isShow && message.count == 0 && isNeed {
signEndView.snp.updateConstraints { make in
make.height.equalTo(72)
}
} else {
signEndView.snp.updateConstraints { make in
make.height.equalTo(52)
}
}
}
}
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(0)
make.bottom.equalTo(-16)
}
titleLabel = {
let label = UILabel()
// label.font = UIFont.PFSC_M(ofSize: 17)
let str = "* " + "港澳通行证 (逗留D签注)"
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_M(ofSize: 17),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 2)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr
// label.textColor = UIColor.mainTextColor
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(20)
}
exampleButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.08)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 10)
button.contentHorizontalAlignment = .center
button.setTitle("示例模板", for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
return button
}()
centerView.addSubview(exampleButton)
exampleButton.snp.makeConstraints { make in
make.left.equalTo(titleLabel.snp.right).offset(8)
make.centerY.equalTo(titleLabel.snp.centerY)
make.height.equalTo(14)
make.width.equalTo(48)
}
let lineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52)
make.height.equalTo(1)
make.right.equalTo(-18)
}
frontLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.mainTextColor50
label.text = "证件页1"
label.textAlignment = .center
return label
}()
centerView.addSubview(frontLabel)
frontLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(self.snp.centerX)
make.top.equalTo(64)
make.height.equalTo(20)
}
backSurfaceLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.mainTextColor50
label.textAlignment = .center
label.text = "证件页2"
return label
}()
centerView.addSubview(backSurfaceLabel)
backSurfaceLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(self.snp.centerX)
make.top.equalTo(64)
make.height.equalTo(20)
}
frontImageButton = {
let button = YHCardButton()
button.setContent("card_upload", "点击上传")
button.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
button.addTarget(self, action: #selector(frontImageClick), for: .touchUpInside)
button.layer.cornerRadius = 4
button.clipsToBounds = true
return button
}()
centerView.addSubview(frontImageButton)
frontImageButton.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(96)
make.height.equalTo(102)
make.width.equalTo(CGFloat(147).fix)
}
frontDeleteButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_delete"), for: .normal)
button.addTarget(self, action: #selector(frontDeleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
centerView.addSubview(frontDeleteButton)
frontDeleteButton.snp.makeConstraints { make in
make.centerX.equalTo(frontImageButton.snp.right)
make.centerY.equalTo(frontImageButton.snp.top)
make.height.equalTo(21)
make.width.equalTo(21)
}
backSurfaceImageButton = {
let button = YHCardButton()
button.setContent("card_upload", "点击上传")
button.setBackgroundImage(UIImage(named: lastImageName), for: .normal)
button.addTarget(self, action: #selector(backSurfaceImageClick), for: .touchUpInside)
button.layer.cornerRadius = 4
button.clipsToBounds = true
return button
}()
centerView.addSubview(backSurfaceImageButton)
backSurfaceImageButton.snp.makeConstraints { make in
make.right.equalTo(-8)
make.top.equalTo(96)
make.height.equalTo(102)
make.width.equalTo(CGFloat(147).fix)
}
backSurfaceDeleteButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_delete"), for: .normal)
button.addTarget(self, action: #selector(backSurfaceDeleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
centerView.addSubview(backSurfaceDeleteButton)
backSurfaceDeleteButton.snp.makeConstraints { make in
make.centerX.equalTo(backSurfaceImageButton.snp.right)
make.centerY.equalTo(backSurfaceImageButton.snp.top)
make.height.equalTo(21)
make.width.equalTo(21)
}
activityIndicator = {
let view = UIActivityIndicatorView()
view.style = .medium
return view
}()
centerView.addSubview(activityIndicator)
activityIndicator.snp.makeConstraints { make in
make.center.equalTo(backSurfaceImageButton.snp.center)
make.height.equalTo(25)
make.width.equalTo(25)
}
showMessageLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.failColor
label.text = "无法识别,请核查文件"
return label
}()
centerView.addSubview(showMessageLabel)
showMessageLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(201)
make.height.equalTo(20)
}
cardLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.text = "卡片有效期"
return label
}()
centerView.addSubview(cardLabel)
cardLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(229)
make.height.equalTo(20)
}
cardBeginView = {
let view = YHItemView()
return view
}()
cardBeginView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.block {
block(model)
}
}
centerView.addSubview(cardBeginView)
cardBeginView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(cardLabel.snp.bottom)
make.height.equalTo(52)
make.right.equalTo(-18)
}
cardEndView = {
let view = YHItemView()
return view
}()
cardEndView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.block {
block(model)
}
}
centerView.addSubview(cardEndView)
cardEndView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(cardBeginView.snp.bottom)
make.height.equalTo(52)
make.right.equalTo(-18)
}
signLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.text = "签注有效期"
return label
}()
centerView.addSubview(signLabel)
signLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(cardEndView.snp.bottom).offset(24)
make.height.equalTo(20)
make.right.equalTo(-18)
}
signBeginView = {
let view = YHItemView()
return view
}()
signBeginView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.block {
block(model)
}
}
centerView.addSubview(signBeginView)
signBeginView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(signLabel.snp.bottom)
make.height.equalTo(52)
make.right.equalTo(-18)
}
signEndView = {
let view = YHItemView()
return view
}()
signEndView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.block {
block(model)
}
}
centerView.addSubview(signEndView)
signEndView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(signBeginView.snp.bottom)
make.height.equalTo(52)
make.right.equalTo(-18)
}
}
@objc func exampleClick() {
YHAdopterCardExampleView.exampleView(type: .travel).show()
}
@objc func frontImageClick() {
if firstUrl.count != 0 {
let vc = YHImageViewController()
vc.imgString = firstUrl
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
self.frontImageButton.setContent("card_loading", "上传中")
self.frontImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
guard let url = success else { return }
self.frontImageButton.setBackgroundImage(image, for: .normal)
self.frontDeleteButton.isHidden = false
if let block = self.urlBlock {
block(url, 0)
}
}
}
}
@objc func backSurfaceImageClick() {
if lastUrl.count != 0 {
let vc = YHImageViewController()
vc.imgString = lastUrl
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
self.backSurfaceImageButton.setContent("card_loading", "上传中")
self.backSurfaceImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
guard let url = success else { return }
self.backSurfaceImageButton.setBackgroundImage(image, for: .normal)
self.backSurfaceDeleteButton.isHidden = false
if let block = self.urlBlock {
block(url, 1)
}
}
}
}
@objc func frontDeleteClick() {
firstUrl = ""
frontDeleteButton.isHidden = true
frontImageButton.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
frontImageButton.setContent("card_upload", "点击上传")
if let block = self.deleteBlock {
block("", 0)
}
}
@objc func backSurfaceDeleteClick() {
lastUrl = ""
backSurfaceDeleteButton.isHidden = true
backSurfaceImageButton.setBackgroundImage(UIImage(named: lastImageName), for: .normal)
backSurfaceImageButton.setContent("card_upload", "点击上传")
if let block = self.deleteBlock {
block("", 1)
}
}
}
//
// YHResignCertificatePassportTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/9/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignCertificatePassportTableViewCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignCertificatePassportTableViewCell"
typealias UrlBlock = (_ url: String, _ index: Int) -> ()
var urlBlock: UrlBlock?
var deleteBlock: UrlBlock?
typealias ItemBlock = (_ model: YHItemModel) -> ()
var block: ItemBlock?
var centerView: UIView!
var titleLabel: UILabel!
var exampleButton: UIButton!
var frontLabel: UILabel!
var frontImageButton: YHCardButton!
var frontDeleteButton: UIButton!
var activityIndicator: UIActivityIndicatorView!
var showMessageLabel: UILabel!
var cardLabel: UILabel!
var cardBeginView: YHItemView!
var cardEndView: YHItemView!
var viewModel: YHBaseViewModel = YHBaseViewModel()
var firstUrl: String = ""
var lastUrl: String = ""
var firstImageName: String = "" {
didSet {
frontImageButton.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
}
}
var firstLabelName: String = "" {
didSet {
frontLabel.text = firstLabelName
}
}
var urls: [String]? {
didSet {
guard let firstUrl = urls?.first, firstUrl.count != 0 else {
cardLabel.isHidden = true
cardBeginView.isHidden = true
cardEndView.isHidden = true
return
}
cardLabel.isHidden = false
cardBeginView.isHidden = false
cardEndView.isHidden = false
self.firstUrl = firstUrl
self.viewModel.getPublicImageUrl(firstUrl) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.frontImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in
self.frontDeleteButton.isHidden = false
})
self.frontImageButton.setContent("", "")
}
}
}
var data: [YHItemModel] = [] {
didSet {
for item in data {
let isShow = item.isShowPrompts ?? false
let message = item.message ?? ""
let isNeed = item.isNeed ?? false
if item.id == .id1 {
cardBeginView.dataSource = item
if isShow && message.count == 0 && isNeed {
cardBeginView.snp.updateConstraints { make in
make.height.equalTo(72)
}
} else {
cardBeginView.snp.updateConstraints { make in
make.height.equalTo(52)
}
}
}
if item.id == .id2 {
cardEndView.dataSource = item
if isShow && message.count == 0 && isNeed {
cardEndView.snp.updateConstraints { make in
make.height.equalTo(72)
}
} else {
cardEndView.snp.updateConstraints { make in
make.height.equalTo(52)
}
}
}
}
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(0)
make.bottom.equalTo(-16)
}
titleLabel = {
let label = UILabel()
// label.font = UIFont.PFSC_M(ofSize: 17)
let str = "* " + "港澳通行证 (逗留D签注)"
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_M(ofSize: 17),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 2)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr
// label.textColor = UIColor.mainTextColor
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(20)
}
exampleButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.08)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 10)
button.contentHorizontalAlignment = .center
button.setTitle("示例模板", for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
return button
}()
centerView.addSubview(exampleButton)
exampleButton.snp.makeConstraints { make in
make.left.equalTo(titleLabel.snp.right).offset(8)
make.centerY.equalTo(titleLabel.snp.centerY)
make.height.equalTo(14)
make.width.equalTo(48)
}
let lineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52)
make.height.equalTo(1)
make.right.equalTo(-18)
}
frontLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.mainTextColor50
label.text = "证件页1"
label.textAlignment = .center
return label
}()
centerView.addSubview(frontLabel)
frontLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(self.snp.centerX)
make.top.equalTo(64)
make.height.equalTo(20)
}
frontImageButton = {
let button = YHCardButton()
button.setContent("card_upload", "点击上传")
button.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
button.addTarget(self, action: #selector(frontImageClick), for: .touchUpInside)
button.layer.cornerRadius = 4
button.clipsToBounds = true
return button
}()
centerView.addSubview(frontImageButton)
frontImageButton.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(96)
make.height.equalTo(102)
make.width.equalTo(CGFloat(147).fix)
}
frontDeleteButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_delete"), for: .normal)
button.addTarget(self, action: #selector(frontDeleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
centerView.addSubview(frontDeleteButton)
frontDeleteButton.snp.makeConstraints { make in
make.centerX.equalTo(frontImageButton.snp.right)
make.centerY.equalTo(frontImageButton.snp.top)
make.height.equalTo(21)
make.width.equalTo(21)
}
activityIndicator = {
let view = UIActivityIndicatorView()
view.style = .medium
return view
}()
centerView.addSubview(activityIndicator)
activityIndicator.snp.makeConstraints { make in
make.center.equalTo(frontImageButton.snp.center)
make.height.equalTo(25)
make.width.equalTo(25)
}
showMessageLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.failColor
label.text = "无法识别,请核查文件"
return label
}()
centerView.addSubview(showMessageLabel)
showMessageLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(201)
make.height.equalTo(20)
}
cardLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.text = "卡片有效期"
return label
}()
centerView.addSubview(cardLabel)
cardLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(229)
make.height.equalTo(20)
}
cardBeginView = {
let view = YHItemView()
return view
}()
cardBeginView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.block {
block(model)
}
}
centerView.addSubview(cardBeginView)
cardBeginView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(cardLabel.snp.bottom)
make.height.equalTo(52)
make.right.equalTo(-18)
}
cardEndView = {
let view = YHItemView()
return view
}()
cardEndView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.block {
block(model)
}
}
centerView.addSubview(cardEndView)
cardEndView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(cardBeginView.snp.bottom)
make.height.equalTo(52)
make.right.equalTo(-18)
}
}
@objc func exampleClick() {
YHAdopterCardExampleView.exampleView(type: .chinaTravel).show()
}
@objc func frontImageClick() {
if firstUrl.count != 0 {
let vc = YHImageViewController()
vc.imgString = firstUrl
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
self.frontImageButton.setContent("card_loading", "上传中")
self.frontImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
guard let url = success else { return }
self.frontImageButton.setBackgroundImage(image, for: .normal)
self.frontDeleteButton.isHidden = false
if let block = self.urlBlock {
block(url, 0)
}
}
}
}
@objc func frontDeleteClick() {
firstUrl = ""
frontDeleteButton.isHidden = true
frontImageButton.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
frontImageButton.setContent("card_upload", "点击上传")
if let block = self.deleteBlock {
block("", 0)
}
}
}
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
import UIKit import UIKit
class YHResignCertificateDetailViewModel: YHBaseViewModel { class YHResignCertificateDetailViewModel: YHBaseViewModel {
var dataModel : YHResignCertificateModel = YHResignCertificateModel()
func submitResignCertificateUpdate(_ params: [String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func submitResignCertificateUpdate(_ params: [String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.ResignCertificate.update let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.ResignCertificate.update
let _ = YHNetRequest.postRequest(url: strUrl,params: params) { [weak self] json, code in let _ = YHNetRequest.postRequest(url: strUrl,params: params) { [weak self] json, code in
...@@ -26,4 +28,18 @@ class YHResignCertificateDetailViewModel: YHBaseViewModel { ...@@ -26,4 +28,18 @@ class YHResignCertificateDetailViewModel: YHBaseViewModel {
callBackBlock(false,err) callBackBlock(false,err)
} }
} }
func getBaseDataSource(_ isShowPrompt: Bool) -> [YHItemModel] {
let item1 = YHItemModel(id: .id1, isNeed: true, title: "开始时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_start, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择开始时间")
let item2 = YHItemModel(id: .id2, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
let item3 = YHItemModel(id: .id3, isNeed: true, title: "开始时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_start, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择开始时间")
let item4 = YHItemModel(id: .id4, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
return [item1, item2, item3, item4]
}
func getPassPortDataSource(_ isShowPrompt: Bool) -> [YHItemModel] {
let item1 = YHItemModel(id: .id1, isNeed: true, title: "开始时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_start, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择开始时间")
let item2 = YHItemModel(id: .id2, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
return [item1, item2]
}
} }
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