Commit f34e62b4 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  // 我的证件
  3月21产品走查问题修复
  // 我的证件
  // 我的证书
parents ea09b44f a155e964
......@@ -220,6 +220,7 @@
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; };
04A271232BABFF3200652B1B /* YHCertificateUploadTypeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */; };
04A271252BAC33BB00652B1B /* YHFilePreviewTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */; };
04A671592B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */; };
04A6715C2B9FE9EA00C1FB91 /* YHUploadContentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A6715B2B9FE9EA00C1FB91 /* YHUploadContentVC.swift */; };
04A6715E2B9FFCA700C1FB91 /* YHCertificateNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */; };
......@@ -603,6 +604,7 @@
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; };
04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadTypeCell.swift; sourceTree = "<group>"; };
04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFilePreviewTool.swift; sourceTree = "<group>"; };
04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadSheetView.swift; sourceTree = "<group>"; };
04A6715B2B9FE9EA00C1FB91 /* YHUploadContentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUploadContentVC.swift; sourceTree = "<group>"; };
04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateNameCell.swift; sourceTree = "<group>"; };
......@@ -1650,6 +1652,7 @@
isa = PBXGroup;
children = (
A592FE962BA6DB340062FACA /* YHCertificateViewModel.swift */,
04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */,
);
path = VM;
sourceTree = "<group>";
......@@ -2494,6 +2497,7 @@
045EEE922B9F171A0022A143 /* YHPreviewInfoNameAndSubNameItemView.swift in Sources */,
045EEEF92B9F171A0022A143 /* YHFormItemTitleCell.swift in Sources */,
0425E6482BA96B4100A5E763 /* YHSchemeHeadScoreItemView.swift in Sources */,
04A271252BAC33BB00652B1B /* YHFilePreviewTool.swift in Sources */,
045EEEC32B9F171A0022A143 /* YHOtherResidenceFillView.swift in Sources */,
045EEE792B9F171A0022A143 /* YHPreviewViewModel.swift in Sources */,
0493B3DE2BA80C2300AF9393 /* YHCertificateFilterButton.swift in Sources */,
......
......@@ -19,7 +19,11 @@ class YHCertificateResourceUploadVC: YHBaseViewController {
var items:[YHSupplementInfo] = []
var viewModel: YHCertificateViewModel = YHCertificateViewModel()
var categoryInfo: YHCategoryData!
lazy var previewFileTool:YHFilePreviewTool = {
let tool = YHFilePreviewTool(targetVC: self)
return tool
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
......@@ -107,10 +111,12 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
guard let self = self else { return }
let view = YHCertificateTemplateSheetView.templateView(item.templateInfo)
view.scanTemplateBlock = {
[weak self] temlateInfo in
[weak self] path in
guard let self = self else { return }
let vc = UIViewController()
self.navigationController?.pushViewController(vc)
if let url = path?.url, !url.isEmpty {
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
}
}
view.show()
}
......@@ -127,7 +133,7 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
if item.checkStatus == YHCertificateUploadStatus.preUpload { // 待上传
if item.checkStatus == YHCertificateUploadStatus.preUpload.rawValue { // 待上传
showUploadSheetView(item)
return
}
......@@ -293,10 +299,20 @@ extension YHCertificateResourceUploadVC {
}
}
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
func showUploadSheetView(_ supplementInfo: YHSupplementInfo?) {
let sheetView = YHCertificateUploadSheetView.sheetView
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
if let url = path?.url, !url.isEmpty {
guard let self = self else { return }
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
}
}
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
......
......@@ -13,7 +13,7 @@ class YHCertificateSearchViewController: YHBaseViewController {
var items:[YHSupplementInfo] = []
var viewModel: YHCertificateViewModel = YHCertificateViewModel()
var orderId : Int?
var categoryInfo: YHCategoryData = YHCategoryData()
var categoryInfo: YHCategoryData?
lazy var tableView: UITableView = {
......@@ -35,6 +35,11 @@ class YHCertificateSearchViewController: YHBaseViewController {
return tableView
}()
lazy var previewFileTool:YHFilePreviewTool = {
let tool = YHFilePreviewTool(targetVC: self)
return tool
}()
lazy var searchView:UIView = {
let view = UIView()
view.backgroundColor = .white
......@@ -93,6 +98,13 @@ class YHCertificateSearchViewController: YHBaseViewController {
createUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if let text = searchBar.textField.text, !text.isEmpty {
self.requestList(keyWord: text)
}
}
func createUI() {
view.addSubview(searchView)
view.addSubview(tableView)
......@@ -120,9 +132,26 @@ extension YHCertificateSearchViewController: UITableViewDelegate, UITableViewDat
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let item = items[indexPath.section]
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateInfoCell.cellReuseIdentifier, for: indexPath) as! YHCertificateInfoCell
cell.updateModel(item)
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
cell.updateModel(item)
cell.templateBlock = {
[weak self] in
guard let self = self else { return }
let view = YHCertificateTemplateSheetView.templateView(item.templateInfo)
view.scanTemplateBlock = {
[weak self] path in
guard let self = self else { return }
if let url = path?.url, !url.isEmpty {
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
}
}
view.show()
}
}
return cell
}
......@@ -131,9 +160,21 @@ extension YHCertificateSearchViewController: UITableViewDelegate, UITableViewDat
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHUploadContentVC()
self.navigationController?.pushViewController(vc)
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
if item.checkStatus == YHCertificateUploadStatus.preUpload.rawValue { // 待上传
showUploadSheetView(item)
return
}
// 非待上传的进入详情
let vc = YHUploadContentVC()
vc.orderId = orderId
vc.categoryInfo = categoryInfo
vc.supplementInfo = item
self.navigationController?.pushViewController(vc)
}
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
......@@ -173,7 +214,6 @@ extension YHCertificateSearchViewController {
"state": "1",
"supplement_ids": [],
"order_id" : orderId ?? 0,
"category_id": categoryInfo.categoryId,
"keyword": keywords]
print(params)
......@@ -185,6 +225,7 @@ extension YHCertificateSearchViewController {
items.removeAll()
if let listInfo = listInfo {
categoryInfo = listInfo.categoryData
let arr = listInfo.supplementList
items.append(contentsOf: arr)
}
......@@ -196,4 +237,102 @@ extension YHCertificateSearchViewController {
}
}
}
func uploadImage(_ img: UIImage, supplementInfo:YHSupplementInfo) {
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadImage(img) {
[weak self] url, error in
guard let self = self else { return }
YHHUD.hide()
if let url = url, !url.isEmpty {
let imgName = url.lastPathComponent
var suffix = "jpg"
let suffixName = url.pathExtension.lowercased()
if !suffixName.isEmpty {
suffix = suffixName
}
// 再调用业务接口
let model = YHContentUrl()
model.name = imgName
model.url = url
model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
self.requestList(keyWord: self.searchBar.textField.text)
}
return
}
//
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
}
}
func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo) {
if let fileData = try? Data(contentsOf: fileUrl) {
// 将文件数据上传到服务器
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)")
// 先OSS上传得到URL
self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in
guard let self = self else { return }
// 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty {
let fileName = successUrl.lastPathComponent
let suffixName = successUrl.pathExtension.lowercased()
let model = YHContentUrl()
model.name = fileName
model.url = successUrl
model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
self.requestList(keyWord: self.searchBar.textField.text)
}
return
}
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
}
} else {
YHHUD.flash(message: "识别文件失败")
}
}
func showUploadSheetView(_ supplementInfo: YHSupplementInfo?) {
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
if let url = path?.url, !url.isEmpty {
guard let self = self else { return }
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
}
}
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
uploadFile(fileUrl, supplementInfo: supplementInfo)
}
sheetView.uploadImageBlock = {
[weak self] image in
guard let self = self else { return }
uploadImage(image, supplementInfo: supplementInfo)
}
sheetView.show()
}
}
......@@ -39,6 +39,7 @@ class YHMaterialListViewController: YHBaseViewController {
static let segmentHeight = 53.0
var orderId : Int?
var filterDict : [String: Any] = [:]
var categoryInfo: YHCategoryData = YHCategoryData()
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
......@@ -54,7 +55,6 @@ class YHMaterialListViewController: YHBaseViewController {
guard let self = self else { return }
let vc = YHCertificateSearchViewController()
vc.orderId = orderId
vc.categoryInfo = categoryInfo
self.navigationController?.pushViewController(vc)
}
return bar
......@@ -117,6 +117,7 @@ class YHMaterialListViewController: YHBaseViewController {
[weak self] dict in
guard let self = self else { return }
self.segmentedView.selectItemAt(index: 0)
self.filterDict = dict
if let vc = itemVCs.first {
vc.requestList(status:vc.status, extra:dict)
}
......@@ -171,6 +172,14 @@ class YHMaterialListViewController: YHBaseViewController {
super.viewWillAppear(animated)
//处于第一个item的时候,才允许屏幕边缘手势返回
navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0)
if 0 <= segmentedView.selectedIndex && segmentedView.selectedIndex < itemVCs.count {
let vc = itemVCs[segmentedView.selectedIndex]
if segmentedView.selectedIndex == 0 {
vc.requestList(status: vc.status, extra:self.filterDict)
} else {
vc.requestList(status: vc.status)
}
}
}
override func viewWillDisappear(_ animated: Bool) {
......@@ -213,7 +222,10 @@ class YHMaterialListViewController: YHBaseViewController {
extension YHMaterialListViewController: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
NotificationCenter.default.post(name: Notification.Name(rawValue: "scrollViewDidEndDragging"), object: nil)
if 0 <= index && index < itemVCs.count {
let vc = itemVCs[index]
vc.requestList(status: vc.status, extra: self.filterDict)
}
}
/// 正在滚动中的回调
......@@ -224,7 +236,7 @@ extension YHMaterialListViewController: JXSegmentedViewDelegate {
/// - rightIndex: 正在滚动中,相对位置处于右边的index
/// - percent: 从左往右计算的百分比
func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
NotificationCenter.default.post(name: Notification.Name(rawValue: "scrollViewWillBeginDragging"), object: nil)
}
}
......
......@@ -16,6 +16,25 @@ class YHMineCertificateEntryViewController: YHBaseViewController {
var orderId : Int?
private let certificateReqVM : YHCertificateViewModel = YHCertificateViewModel()
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
bar.title = "我的证件".local
bar.showLeftSecondButtonType(.search)
bar.backBlock = {
[weak self] in
guard let self = self else { return }
self.navigationController?.popViewController(animated: true)
}
bar.leftSecondBtnClick = {
[weak self] in
guard let self = self else { return }
let vc = YHCertificateSearchViewController()
vc.orderId = orderId
self.navigationController?.pushViewController(vc)
}
return bar
}()
private lazy var topBkg : UIView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "service_center_head_bkg")
......@@ -68,10 +87,7 @@ extension YHMineCertificateEntryViewController {
}
func setupUI() {
gk_navTitle = "我的证件"
gk_navBarAlpha = 1.0
gk_navigationBar.isHidden = true
view.addSubview(topBkg)
topBkg.snp.makeConstraints { make in
......@@ -96,6 +112,14 @@ extension YHMineCertificateEntryViewController {
make.bottom.equalTo(bottomView.snp.top)
}
// 放在最上面
view.addSubview(navBar)
navBar.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_statusBar())
make.height.equalTo(k_Height_NavContentBar)
}
homeTableView.delegate = self
homeTableView.dataSource = self
......
......@@ -31,6 +31,10 @@ class YHUploadContentVC: YHBaseViewController {
var templateArr:[YHMaterialPath] = []
var items:[YHContentUrl] = []
var selectEditItem: YHContentUrl?
lazy var previewFileTool:YHFilePreviewTool = {
let tool = YHFilePreviewTool(targetVC: self)
return tool
}()
var renameInputView: YHFileRenameInputView = {
let view = YHFileRenameInputView.inputView(defalutText: "请输入名称")
......@@ -176,11 +180,6 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
cell.update(bottomMargin: 20)
if 0 <= indexPath.row && indexPath.row < templateArr.count {
cell.templatePath = templateArr[indexPath.row]
cell.templateClick = {
[weak self] path in
guard let self = self else { return }
// 查看模版 uploadInfo.templateInfo
}
}
return cell
}
......@@ -393,6 +392,10 @@ extension YHUploadContentVC: UITableViewDelegate, UITableViewDataSource {
if indexPath.section == 0 { // 模版列表
if 0 <= indexPath.row && indexPath.row < templateArr.count {
let path = templateArr[indexPath.row]
print(path.url)
if !path.url.isEmpty {
self.previewFileTool.openXLSXRemoteFile(urlString:path.url)
}
}
} else if indexPath.section == 1 { // 证件列表
......
......@@ -20,7 +20,8 @@ class YHCertificateInfoCell: UITableViewCell {
var whiteView: UIView!
var nameTextView: UITextView!
var infoLabel: UILabel!
var statusBtn: UIButton!
var statusLabel: UILabel!
var rightArrowImgV: UIImageView!
private lazy var templateLabel : UILabel = {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 48, height: 16))
......@@ -36,7 +37,6 @@ class YHCertificateInfoCell: UITableViewCell {
label.addGestureRecognizer(tap)
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
......@@ -69,8 +69,8 @@ class YHCertificateInfoCell: UITableViewCell {
case .all:
titleColor = .labelTextColor2
}
statusBtn.setTitleColor(titleColor, for:.normal)
statusBtn.setTitle(title, for: .normal)
statusLabel.text = title
statusLabel.textColor = titleColor
}
if model.templateInfo.materialPath.isEmpty && model.templateInfo.guideFilePath.isEmpty && model.templateInfo.description.isEmpty {
......@@ -113,26 +113,24 @@ class YHCertificateInfoCell: UITableViewCell {
whiteView.addSubview(nameTextView)
nameTextView.attributed.text = """
\("我是资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateLabel, .original(.center)))
\("资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateLabel, .original(.center)))
"""
infoLabel = UILabel()
infoLabel.textColor = UIColor.labelTextColor2
infoLabel.textAlignment = .left
infoLabel.font = UIFont.PFSC_R(ofSize:11)
infoLabel.text = "类型:证件资料 所属人:张康"
infoLabel.numberOfLines = 0
whiteView.addSubview(infoLabel)
statusBtn = UIButton()
statusBtn.titleLabel?.font = UIFont.PFSC_R(ofSize:14)
statusLabel = UILabel()
statusLabel.textColor = UIColor.labelTextColor2
statusLabel.textAlignment = .left
statusLabel.font = UIFont.PFSC_R(ofSize:14)
whiteView.addSubview(statusLabel)
let iconWidth = 16.0
let titleWidth = 42.0
statusBtn.titleEdgeInsets = UIEdgeInsets(top: 0, left: -iconWidth, bottom: 0, right: iconWidth)
statusBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: titleWidth, bottom: 0, right: -titleWidth)
statusBtn.setImage(UIImage(named:"my_cer_arrow_right"), for:.normal)
statusBtn.setTitleColor(.labelTextColor2, for:.normal)
whiteView.addSubview(statusBtn)
rightArrowImgV = UIImageView(image: UIImage(named: "service_center_right_next_icon"))
whiteView.addSubview(rightArrowImgV)
whiteView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
......@@ -143,7 +141,7 @@ class YHCertificateInfoCell: UITableViewCell {
nameTextView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(10)
make.top.equalToSuperview().offset(4)
make.right.equalTo(statusBtn.snp.left)
make.right.equalTo(statusLabel.snp.left).offset(-6)
}
infoLabel.snp.makeConstraints { make in
......@@ -154,11 +152,16 @@ class YHCertificateInfoCell: UITableViewCell {
make.height.equalTo(20)
}
statusBtn.snp.makeConstraints { make in
make.height.equalTo(60)
make.width.equalTo(92)
statusLabel.snp.makeConstraints { make in
make.right.equalTo(rightArrowImgV.snp.left).offset(-6)
make.size.equalTo(CGSize(width: 42, height: 20))
make.centerY.equalToSuperview()
}
rightArrowImgV.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-16)
make.size.equalTo(CGSize(width: 16, height: 16))
make.centerY.equalToSuperview()
make.right.equalToSuperview()
}
}
......
......@@ -72,21 +72,12 @@ class YHCertificateSampleTemplateView: UIView {
class YHCertificateTemplateCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateTemplateCell"
var templateClick:((YHMaterialPath?)->())?
var templatePath: YHMaterialPath?
lazy var templateView: YHCertificateSampleTemplateView = {
let view = YHCertificateSampleTemplateView(frame:CGRectZero)
let tap = UITapGestureRecognizer(target:self, action:#selector(didTemplateTap))
view.addGestureRecognizer(tap)
return view
}()
@objc func didTemplateTap() {
templateClick?(templatePath)
}
required init?(coder: NSCoder) {
super.init(coder: coder)
......
......@@ -28,7 +28,7 @@ class YHCertificateTemplateSheetView: UIView {
var templateArr: [YHMaterialPath] = []
var templateInfo: YHTemplateInfo?
var scanTemplateBlock: ((YHTemplateInfo?)->())?
var scanTemplateBlock: ((YHMaterialPath?)->())?
lazy var blackMaskView: UIView = {
let view = UIView()
......@@ -203,13 +203,6 @@ class YHCertificateTemplateSheetView: UIView {
self.removeFromSuperview()
}
@objc func didTemplateViewClicked() {
if let scanTemplateBlock = scanTemplateBlock {
scanTemplateBlock(templateInfo)
}
dismiss()
}
@objc func didClickKnownBtn() {
dismiss()
}
......@@ -232,9 +225,6 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
cell.update(bottomMargin: 20)
if 0 <= indexPath.row && indexPath.row < templateArr.count {
cell.templatePath = templateArr[indexPath.row]
cell.templateClick = {
[weak self] path in
}
}
return cell
}
......@@ -242,6 +232,8 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.row && indexPath.row < templateArr.count {
let path = templateArr[indexPath.row]
scanTemplateBlock?(path)
dismiss()
}
}
......
......@@ -58,6 +58,8 @@ class YHCertificateUploadSheetView: UIView {
var uploadFilesBlock:((URL)->())?
// 上传图片
var uploadImageBlock:((UIImage)->())?
// 点击模版
var clickTemplateBlock:((YHMaterialPath?)->())?
lazy var blackMaskView: UIView = {
let view = UIView()
......@@ -236,12 +238,8 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateTemplateCell.cellReuseIdentifier, for: indexPath) as! YHCertificateTemplateCell
cell.update(bottomMargin:20)
if 0 <= indexPath.row && indexPath.row < templateArr.count {
cell.templatePath = templateArr[indexPath.row]
cell.templateClick = {
[weak self] path in
}
}
return cell
}
......@@ -258,6 +256,8 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
if indexPath.section == 0 { // 模版列表
if 0 <= indexPath.row && indexPath.row < templateArr.count {
let path = templateArr[indexPath.row]
clickTemplateBlock?(path)
dismiss()
}
} else if indexPath.section == 1 { // 操作列表
......
......@@ -136,20 +136,11 @@ class YHCertificateViewModel: YHBaseViewModel {
}
}
func getCertificateList(params:[String: Any], isSilient:Bool = false, callBack:@escaping (_ listInfo: YHUploadCertificateInfo?, _ error:YHErrorModel?)->()) {
func getCertificateList(params:[String: Any], callBack:@escaping (_ listInfo: YHUploadCertificateInfo?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.certificateListApi
if !isSilient {
YHHUD.show(.progress(message: "数据加载中..."))
}
let _ = YHNetRequest.getRequest(url: strUrl, params:params) { json, code in
if !isSilient {
YHHUD.hide()
}
printLog("model 是 ==> \(json)")
let dic = json.data
......
//
// YHFilePreviewTool.swift
// galaxy
//
// Created by edy on 2024/3/21.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHFilePreviewTool: NSObject {
weak var targetVC: UIViewController!
init(targetVC: UIViewController!) {
self.targetVC = targetVC
}
func openXLSXRemoteFile(urlString: String) {
guard let url = URL(string: urlString) else { return }
let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration)
DispatchQueue.main.async {
YHHUD.show(.progress(message: "加载文件中..."))
}
let task = session.downloadTask(with: url) { (tempLocalUrl, response, error) in
DispatchQueue.main.async {
YHHUD.hide()
}
if let tempLocalUrl = tempLocalUrl, error == nil {
// 下载完成,尝试打开文件
let fileManager = FileManager.default
let destination = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(response?.suggestedFilename ?? UUID().uuidString)
try? fileManager.moveItem(at: tempLocalUrl, to: destination)
// 打开文件
self.openXLSXFile(at: destination)
} else {
print("Error downloading the file: \(error?.localizedDescription ?? "Unknown error")")
DispatchQueue.main.async {
YHHUD.flash(message: "加载文件失败")
}
}
}
task.resume()
}
func openXLSXFile(at fileURL: URL) {
let controller = UIDocumentInteractionController(url: fileURL)
controller.delegate = self
DispatchQueue.main.async {
controller.presentPreview(animated: true)
}
}
}
extension YHFilePreviewTool: UIDocumentInteractionControllerDelegate {
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
return targetVC
}
}
......@@ -184,14 +184,15 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
let data = array[i]
let isShow = data.isShowPrompts ?? false
let message = data.message ?? ""
let isNeed = data.isNeed ?? false
if data.id == .id3 || data.id == .id4 || data.id == .id32 || data.id == .id33 {
if isShow && message.count == 0 {
if isShow && message.count == 0 && isNeed {
h = h + 72 + 20
} else {
h = h + 72
}
} else {
if isShow && message.count == 0 {
if isShow && message.count == 0 && isNeed {
h = h + 52 + 20
} else {
h = h + 52
......
......@@ -260,10 +260,18 @@ class YHItemView: UIView {
leftButton.setTitle(dataSource.leftButtonString, for: .normal)
nextStepImageView.isHidden = true
messageTextField.isHidden = true
if dataSource.message == "0" {
buttonState(isLeft: false)
if dataSource.message == "0" || dataSource.message == "2" {
if dataSource.id == .id25 {
buttonState(isLeft: true)
} else {
buttonState(isLeft: false)
}
} else {
buttonState(isLeft: true)
if dataSource.id == .id25 {
buttonState(isLeft: false)
} else {
buttonState(isLeft: true)
}
}
} else {
......@@ -279,7 +287,7 @@ class YHItemView: UIView {
rightButton.isHidden = true
}
if dataSource.isShowPrompts ?? false {
if dataSource.isShowPrompts ?? false && dataSource.isNeed ?? false {
if dataSource.message?.count != 0 {
showPromptLabel.isHidden = true
......@@ -364,6 +372,10 @@ class YHItemView: UIView {
leftButton.layer.borderWidth = 0
dataSource?.message = "0"
dataSource?.value = ["0"]
if dataSource?.id == .id25 {
dataSource?.message = "1"
dataSource?.value = ["1"]
}
if let block = block {
block(dataSource ?? YHItemModel())
}
......@@ -382,6 +394,10 @@ class YHItemView: UIView {
rightButton.layer.borderWidth = 0
dataSource?.message = "1"
dataSource?.value = ["1"]
if dataSource?.id == .id25 {
dataSource?.message = "0"
dataSource?.value = ["0"]
}
if let block = block {
block(dataSource ?? YHItemModel())
}
......
......@@ -105,14 +105,15 @@ class YHMainInformationTableViewCell: UITableViewCell {
let data = dataSource?.models?[i] ?? YHItemModel()
let isShow = data.isShowPrompts ?? false
let message = data.message ?? ""
let isNeed = data.isNeed ?? false
if data.id == .id3 || data.id == .id4 || data.id == .id32 || data.id == .id33 {
if isShow && message.count == 0 {
if isShow && message.count == 0 && isNeed {
h = 71 + 20
} else {
h = 71
}
} else {
if isShow && message.count == 0 {
if isShow && message.count == 0 && isNeed {
h = 51 + 20
} else {
h = 51
......
......@@ -55,7 +55,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
func getDocumentInformation(_ isShowPrompt: Bool) -> [YHSectionItemModel] {
var flag = false
let nationality = mainModel.nationality
if nationality.contains("中国") {
if nationality.contains("China") {
flag = true
}
......@@ -63,7 +63,13 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let item1 = YHItemModel(id: .id9, isNeed: flag, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.cn_identity_card.issue_at, isShowPrompts: isShowPrompt, alertMessage:"请输入签发地")
let item2 = YHItemModel(id: .id10, isNeed: flag, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.cn_identity_card.issue_date_start_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择签发日期")
let item3 = YHItemModel(id: .id11, isNeed: flag, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.cn_identity_card.issue_date_end_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择届满日期")
let section = YHSectionItemModel(title: "中国身份证", models: [item, item1, item2, item3])
var section1String = ""
if flag {
section1String = "中国身份证"
} else {
section1String = "中国身份证(选填)"
}
let section = YHSectionItemModel(title: section1String, models: [item, item1, item2, item3])
let item10 = YHItemModel(id: .id12, isNeed: true, title: "证件号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.hk_macao_pass.number, isShowPrompts: isShowPrompt, alertMessage:"请输入旅行证件号码")
let item11 = YHItemModel(id: .id13, isNeed: true, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.hk_macao_pass.issue_at, isShowPrompts: isShowPrompt, alertMessage:"请输入签发地")
......@@ -95,7 +101,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let item1 = YHItemModel(id: .id22, isNeed: false, title: "曾用名", isUserKeyBoard: true, prompts: "请与户口本一致,若无则不填", message: mainModel.used_name, isShowPrompts: isShowPrompt)
let item2 = YHItemModel(id: .id23, isNeed: false, title: "婚前姓氏", isUserKeyBoard: true, prompts: "如有则填写,仅支持输入字母", message: mainModel.surname, isShowPrompts: isShowPrompt)
let item3 = YHItemModel(id: .id24, isNeed: true, title: "出生日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.birthday, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择出生日期")
let item4 = YHItemModel(id: .id25, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.birth_place_aboard )", leftButtonString: "国外", rightButtonString: "国内", isShowPrompts: isShowPrompt, alertMessage:"请选择出生国家/地区")
let item4 = YHItemModel(id: .id25, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.birth_place_aboard)", leftButtonString: "国内", rightButtonString: "国外", isShowPrompts: isShowPrompt, alertMessage:"请选择出生国家/地区")
var string = ""
let array = mainModel.birth_place.area
for item in array {
......@@ -584,7 +590,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
guard hk_macao_pass_issue_date_start_at.count > 0 else { return false }
guard hk_macao_pass_issue_date_end_at.count > 0 else { return false }
}
if nationality.contains("中国") {
if nationality.contains("China") {
guard cn_identity_card_number.count == 18 else { return false }
guard cn_identity_card_issue_at.count > 0 else { return false }
guard cn_identity_card_issue_date_start_at.count > 0 else { return false }
......
{
"images" : [
{
"filename" : "icon-展开.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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