Commit b7352795 authored by Steven杜宇's avatar Steven杜宇

// 高才

parent de0d8a96
......@@ -1126,6 +1126,14 @@
04AE203D2D13C14900891D24 /* YHGCEducationDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE203C2D13C14900891D24 /* YHGCEducationDetailVC.swift */; };
04AE203F2D13C36500891D24 /* YHGCQualificationDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE203E2D13C36500891D24 /* YHGCQualificationDetailVC.swift */; };
04AE20432D1907E300891D24 /* YHGCEducationCerUploadCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20422D1907E300891D24 /* YHGCEducationCerUploadCell.swift */; };
04AE204E2D1941FC00891D24 /* YHGCCertificateListContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE204D2D1941FC00891D24 /* YHGCCertificateListContainerVC.swift */; };
04AE20502D19425900891D24 /* YHGCCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE204F2D19425900891D24 /* YHGCCertificateListVC.swift */; };
04AE20522D1942E400891D24 /* YHGCCertificateSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20512D1942E400891D24 /* YHGCCertificateSearchViewController.swift */; };
04AE20542D19434500891D24 /* YHGCCertificateUploadContentListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20532D19434400891D24 /* YHGCCertificateUploadContentListVC.swift */; };
04AE20562D1943EF00891D24 /* YHGCMineCertificateEntryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20552D1943EF00891D24 /* YHGCMineCertificateEntryViewController.swift */; };
04AE205A2D1944D600891D24 /* YHGCMyFileListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20592D1944D600891D24 /* YHGCMyFileListViewController.swift */; };
04AE205E2D19474300891D24 /* YHGCImproveSchemeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE205D2D19474300891D24 /* YHGCImproveSchemeViewController.swift */; };
04AE20602D1947DF00891D24 /* YHGCMyNewSchemeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE205F2D1947DF00891D24 /* YHGCMyNewSchemeViewController.swift */; };
04EA376D2BEA06EF00DBAF64 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376C2BEA06EF00DBAF64 /* WebKit.framework */; };
04EA376F2BEA071600DBAF64 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376E2BEA070500DBAF64 /* libc++.tbd */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
......@@ -2290,6 +2298,14 @@
04AE203C2D13C14900891D24 /* YHGCEducationDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCEducationDetailVC.swift; sourceTree = "<group>"; };
04AE203E2D13C36500891D24 /* YHGCQualificationDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCQualificationDetailVC.swift; sourceTree = "<group>"; };
04AE20422D1907E300891D24 /* YHGCEducationCerUploadCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCEducationCerUploadCell.swift; sourceTree = "<group>"; };
04AE204D2D1941FC00891D24 /* YHGCCertificateListContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateListContainerVC.swift; sourceTree = "<group>"; };
04AE204F2D19425900891D24 /* YHGCCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateListVC.swift; sourceTree = "<group>"; };
04AE20512D1942E400891D24 /* YHGCCertificateSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateSearchViewController.swift; sourceTree = "<group>"; };
04AE20532D19434400891D24 /* YHGCCertificateUploadContentListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateUploadContentListVC.swift; sourceTree = "<group>"; };
04AE20552D1943EF00891D24 /* YHGCMineCertificateEntryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMineCertificateEntryViewController.swift; sourceTree = "<group>"; };
04AE20592D1944D600891D24 /* YHGCMyFileListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMyFileListViewController.swift; sourceTree = "<group>"; };
04AE205D2D19474300891D24 /* YHGCImproveSchemeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCImproveSchemeViewController.swift; sourceTree = "<group>"; };
04AE205F2D1947DF00891D24 /* YHGCMyNewSchemeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMyNewSchemeViewController.swift; sourceTree = "<group>"; };
04EA376C2BEA06EF00DBAF64 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
04EA376E2BEA070500DBAF64 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = ATAuthSDK.bundle; path = "galaxy/Classes/Modules/AutoLogin(一键登录)/framework/ATAuthSDK_D.framework/ATAuthSDK.bundle"; sourceTree = "<group>"; };
......@@ -6032,6 +6048,9 @@
04AE200E2D12CFAF00891D24 /* TTPS(高才) */ = {
isa = PBXGroup;
children = (
04AE205B2D19470900891D24 /* MyNewScheme(我的方案) */,
04AE20572D19448800891D24 /* FileList(文件清单) */,
04AE20442D1940C700891D24 /* MyCertificates(我的证书) */,
04AE1FFC2D12CFAF00891D24 /* MyScheme(我的方案) */,
04AE200D2D12CFAF00891D24 /* ServiceProcess(我的信息流程) */,
);
......@@ -6137,6 +6156,75 @@
path = V;
sourceTree = "<group>";
};
04AE20442D1940C700891D24 /* MyCertificates(我的证书) */ = {
isa = PBXGroup;
children = (
04AE20482D19413F00891D24 /* V */,
04AE20462D19412700891D24 /* C */,
04AE20452D19411700891D24 /* M */,
);
path = "MyCertificates(我的证书)";
sourceTree = "<group>";
};
04AE20452D19411700891D24 /* M */ = {
isa = PBXGroup;
children = (
);
path = M;
sourceTree = "<group>";
};
04AE20462D19412700891D24 /* C */ = {
isa = PBXGroup;
children = (
04AE204D2D1941FC00891D24 /* YHGCCertificateListContainerVC.swift */,
04AE204F2D19425900891D24 /* YHGCCertificateListVC.swift */,
04AE20512D1942E400891D24 /* YHGCCertificateSearchViewController.swift */,
04AE20532D19434400891D24 /* YHGCCertificateUploadContentListVC.swift */,
04AE20552D1943EF00891D24 /* YHGCMineCertificateEntryViewController.swift */,
);
path = C;
sourceTree = "<group>";
};
04AE20482D19413F00891D24 /* V */ = {
isa = PBXGroup;
children = (
);
path = V;
sourceTree = "<group>";
};
04AE20572D19448800891D24 /* FileList(文件清单) */ = {
isa = PBXGroup;
children = (
04AE20582D1944A400891D24 /* C */,
);
path = "FileList(文件清单)";
sourceTree = "<group>";
};
04AE20582D1944A400891D24 /* C */ = {
isa = PBXGroup;
children = (
04AE20592D1944D600891D24 /* YHGCMyFileListViewController.swift */,
);
path = C;
sourceTree = "<group>";
};
04AE205B2D19470900891D24 /* MyNewScheme(我的方案) */ = {
isa = PBXGroup;
children = (
04AE205C2D19472F00891D24 /* C */,
);
path = "MyNewScheme(我的方案)";
sourceTree = "<group>";
};
04AE205C2D19472F00891D24 /* C */ = {
isa = PBXGroup;
children = (
04AE205D2D19474300891D24 /* YHGCImproveSchemeViewController.swift */,
04AE205F2D1947DF00891D24 /* YHGCMyNewSchemeViewController.swift */,
);
path = C;
sourceTree = "<group>";
};
04E86E212B81E9FA00A35F4B /* Recovered References */ = {
isa = PBXGroup;
children = (
......@@ -6697,6 +6785,7 @@
045C10912D12CA5F00BD2DC0 /* YHDocumentFileItemView.swift in Sources */,
045C10922D12CA5F00BD2DC0 /* YHPreviewInfoHoldView.swift in Sources */,
045C10932D12CA5F00BD2DC0 /* YHResignAppointGuideLineView.swift in Sources */,
04AE205A2D1944D600891D24 /* YHGCMyFileListViewController.swift in Sources */,
045C10942D12CA5F00BD2DC0 /* YHWorkItemListViewModel.swift in Sources */,
045C10952D12CA5F00BD2DC0 /* YHHomeInfoSectionCell.swift in Sources */,
045C10962D12CA5F00BD2DC0 /* YHShareViewOnTablebarView.swift in Sources */,
......@@ -6780,6 +6869,7 @@
045C10E32D12CA5F00BD2DC0 /* YHRiskWarningCell.swift in Sources */,
045C10E42D12CA5F00BD2DC0 /* YHFileRenameInputView.swift in Sources */,
045C10E52D12CA5F00BD2DC0 /* YHLookResignResultFootView.swift in Sources */,
04AE204E2D1941FC00891D24 /* YHGCCertificateListContainerVC.swift in Sources */,
045C10E62D12CA5F00BD2DC0 /* YHInvitationWithGiftsViewController.swift in Sources */,
045C10E72D12CA5F00BD2DC0 /* YHContractMainItemStatusCell.swift in Sources */,
045C10E82D12CA5F00BD2DC0 /* YHMessageDetailListVC.swift in Sources */,
......@@ -6867,6 +6957,7 @@
045C113A2D12CA5F00BD2DC0 /* YHAIViewModel.swift in Sources */,
045C113B2D12CA5F00BD2DC0 /* YHButlerServiceMessageHandler.swift in Sources */,
045C113C2D12CA5F00BD2DC0 /* YHResignScheduleLineCollectCell.swift in Sources */,
04AE20502D19425900891D24 /* YHGCCertificateListVC.swift in Sources */,
045C113D2D12CA5F00BD2DC0 /* YHMyFileListCell.swift in Sources */,
045C113E2D12CA5F00BD2DC0 /* YHLookResignResultModel.swift in Sources */,
045C113F2D12CA5F00BD2DC0 /* YHIncomeTypeSelectCell.swift in Sources */,
......@@ -7081,6 +7172,7 @@
045C120A2D12CA5F00BD2DC0 /* YHScoreResultBaseModel.swift in Sources */,
045C120B2D12CA5F00BD2DC0 /* YHCancelAppointAlertView.swift in Sources */,
045C120C2D12CA5F00BD2DC0 /* YHOneKeyLoginManager.swift in Sources */,
04AE20542D19434500891D24 /* YHGCCertificateUploadContentListVC.swift in Sources */,
045C120D2D12CA5F00BD2DC0 /* YHResignDocumentStage.swift in Sources */,
045C120E2D12CA5F00BD2DC0 /* YHResignDocumentManagementVC.swift in Sources */,
045C120F2D12CA5F00BD2DC0 /* YHLocalizable.swift in Sources */,
......@@ -7162,6 +7254,7 @@
045C125A2D12CA5F00BD2DC0 /* YHVisaRenewalGuideParagraphCell.swift in Sources */,
045C125B2D12CA5F00BD2DC0 /* YHMyWorkExperienceCell.swift in Sources */,
045C125C2D12CA5F00BD2DC0 /* YHAdopterCardTableViewCell.swift in Sources */,
04AE205E2D19474300891D24 /* YHGCImproveSchemeViewController.swift in Sources */,
045C125D2D12CA5F00BD2DC0 /* YHAIRequestManager.swift in Sources */,
045C125E2D12CA5F00BD2DC0 /* YHPreviewInfoQuestionAndAnswerItemsView2.swift in Sources */,
045C125F2D12CA5F00BD2DC0 /* YHVisaRenewalPayInfoCell.swift in Sources */,
......@@ -7174,6 +7267,7 @@
045C12662D12CA5F00BD2DC0 /* YHScorePersonInfoCell.swift in Sources */,
045C12672D12CA5F00BD2DC0 /* YHServiceOrderTipsView.swift in Sources */,
045C12682D12CA5F00BD2DC0 /* YHWorkExampleMessageView.swift in Sources */,
04AE20522D1942E400891D24 /* YHGCCertificateSearchViewController.swift in Sources */,
045C12692D12CA5F00BD2DC0 /* YHResignGuidelinesExampleViewController.swift in Sources */,
045C126A2D12CA5F00BD2DC0 /* YHPlayerTransitionAnimator.swift in Sources */,
045C126B2D12CA5F00BD2DC0 /* YHLookResignResultViewController.swift in Sources */,
......@@ -7244,6 +7338,7 @@
045C12AC2D12CA5F00BD2DC0 /* YHSearchInfomationVC.swift in Sources */,
045C12AD2D12CA5F00BD2DC0 /* YHResignUploadTravelCardFootViewController.swift in Sources */,
045C12AE2D12CA5F00BD2DC0 /* YHOffivialApprovalSuccessCheckView.swift in Sources */,
04AE20562D1943EF00891D24 /* YHGCMineCertificateEntryViewController.swift in Sources */,
045C12AF2D12CA5F00BD2DC0 /* YHFamilyMemberInfoCell.swift in Sources */,
045C12B02D12CA5F00BD2DC0 /* YHAdopterAddNewTableViewCell.swift in Sources */,
045C12B12D12CA5F00BD2DC0 /* YHMyDocumentsDetailViewController.swift in Sources */,
......@@ -7461,6 +7556,7 @@
045C137F2D12CA5F00BD2DC0 /* YHHomeWebViewBottomForSavePicView.swift in Sources */,
045C13802D12CA5F00BD2DC0 /* YHLifeViewController.swift in Sources */,
045C13812D12CA5F00BD2DC0 /* YHParentInfoVC.swift in Sources */,
04AE20602D1947DF00891D24 /* YHGCMyNewSchemeViewController.swift in Sources */,
045C13822D12CA5F00BD2DC0 /* YHResignMaterialUploadVC.swift in Sources */,
045C13832D12CA5F00BD2DC0 /* YHVisaRenewalGuideIndentCell.swift in Sources */,
045C13842D12CA5F00BD2DC0 /* YHOtherInfoFillModel.swift in Sources */,
......
......@@ -283,8 +283,14 @@ class YHServiceOrderListViewController: YHBaseViewController {
} else if type == 202 {
//高才我的方案
YHGCMyNewSchemeViewController.shared.goToSchemePage()
} else if type == 203 {
//高才我的证件
let vc = YHGCMineCertificateEntryViewController()
vc.orderId = orderId
UIViewController.current?.navigationController?.pushViewController(vc)
} else if type == 204 {
//高才我的签字
}
......
//
// YHMyFileListViewController.swift
// galaxy
//
// Created by edy on 2024/7/4.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
import JXSegmentedView
import Photos
import GKNavigationBarSwift
import TYSnapshotScroll
class YHGCMyFileListViewController: YHBaseViewController {
let topSegmentHeight = 48.0
var orderId : Int = 0
var items:[YHFileListModel] = []
lazy var titles:[String] = []
let viewModel: YHCertificateViewModel = YHCertificateViewModel()
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
bar.backgroundColor = .clear
bar.titleColor = .mainTextColor
bar.title = "待完善清单"
bar.backBlock = {
[weak self] in
guard let self = self else { return }
self.navigationController?.popViewController(animated: true)
}
return bar
}()
lazy var navStatusBar:UIView = {
let view = UIView()
view.addSubview(self.navBar)
self.navBar.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_statusBar())
make.height.equalTo(k_Height_NavContentBar)
}
view.clipsToBounds = true
return view
}()
let consentInsetTop = 140+k_Height_NavigationtBarAndStatuBar
lazy var tableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style:.grouped)
tableView.contentInsetAdjustmentBehavior = .never
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = UIColor.init(hex: 0xDCE4F1)
tableView.separatorStyle = .none
tableView.register(YHMyFileListCell.self, forCellReuseIdentifier: YHMyFileListCell.cellReuseIdentifier)
tableView.register(YHMyFileListNoneCell.self, forCellReuseIdentifier: YHMyFileListNoneCell.cellReuseIdentifier)
tableView.delegate = self
tableView.dataSource = self
tableView.tableHeaderView = self.headerView
return tableView
}()
lazy var fakeTableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style:.grouped)
tableView.contentInsetAdjustmentBehavior = .never
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = UIColor.init(hex: 0xDCE4F1)
tableView.separatorStyle = .none
tableView.register(YHMyFileListCell.self, forCellReuseIdentifier: YHMyFileListCell.cellReuseIdentifier)
tableView.register(YHMyFileListNoneCell.self, forCellReuseIdentifier: YHMyFileListNoneCell.cellReuseIdentifier)
tableView.delegate = self
tableView.dataSource = self
let view = UIView(frame: self.headerView.frame)
tableView.tableHeaderView = view
return tableView
}()
lazy var bgImgView:UIImageView = {
let bgView = UIImageView(image: UIImage(named: "my_filelist_bg"))
return bgView
}()
lazy var totalLabel: UILabel = {
let label = UILabel()
return label
}()
let originHeaderHeight: CGFloat = 274.0-(88-k_Height_NavigationtBarAndStatuBar)
lazy var headerView:UIView = {
// 是否为刘海屏
let isNotchScreen = GKDevice.isNotchedScreen
let top = 88-k_Height_NavigationtBarAndStatuBar
let myView = UIView(frame: CGRectMake(0, 0, KScreenWidth, originHeaderHeight))
myView.clipsToBounds = true
bgImgView.frame = CGRectMake(0, -top, KScreenWidth, 264)
myView.addSubview(bgImgView)
self.totalLabel.frame = CGRectMake(26.0, 100+k_Height_NavigationtBarAndStatuBar+top, KScreenWidth-26*2, 20)
bgImgView.addSubview(self.totalLabel)
// 选择器背景
let view = UIView(frame: CGRectMake(16, self.consentInsetTop, KScreenWidth-16.0*2, 46))
view.clipsToBounds = true
myView.addSubview(view)
let whiteView = UIView(frame: CGRectMake(0, 0, KScreenWidth-16.0*2, 46.0+7.0))
whiteView.backgroundColor = .white
whiteView.layer.cornerRadius = 7.0
whiteView.clipsToBounds = true
view.addSubview(whiteView)
let grayView = UIView(frame: CGRectMake(1, 1, KScreenWidth-16.0*2-2, 46.0-2.0+6.0))
grayView.backgroundColor = UIColor.init(hex: 0xE5E9F2)
grayView.layer.cornerRadius = 6.0
view.addSubview(grayView)
view.addSubview(self.segmentView)
return myView
}()
lazy var segmentView:YHSegmentView = {
let view = YHSegmentView(frame: CGRect(x: 0, y: 0, width: KScreenWidth-16.0*2, height: 46))
view.items = titles
view.selectBlock = {
[weak self] index in
guard let self = self else { return }
self.scrollToSection(index)
}
return view
}()
lazy var topSegmentView:YHSegmentView = {
let view = YHSegmentView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: self.topSegmentHeight))
view.items = titles
view.isHidden = true
view.selectBlock = {
[weak self] index in
guard let self = self else { return }
self.scrollToSection(index)
}
return view
}()
lazy var bottomView = {
let view = UIView(frame: CGRectMake(0, 0, KScreenWidth, k_Height_safeAreaInsetsBottom()+64))
view.backgroundColor = .white
view.addSubview(self.saveBtn)
self.saveBtn.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.height.equalTo(48)
}
return view
}()
lazy var saveBtn:UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.contentHorizontalAlignment = .center
button.setTitle("保存清单图", for: .normal)
button.setTitleColor(.white, for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.clipsToBounds = true
button.backgroundColor = .brandMainColor
button.isUserInteractionEnabled = false
button.layer.opacity = 0.3
button.addTarget(self, action: #selector(clickSaveBtn), for: .touchUpInside)
return button
}()
lazy var emptyView: YHFileListEmptyView = {
let view = YHFileListEmptyView()
view.isHidden = true
view.bottomBtnClick = {
[weak self] in
guard let self = self else { return }
NotificationCenter.default.post(name: YhConstant.YhNotification.didClickFileListBackToServiceTabNotifiction, object: nil)
}
return view
}()
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if self.tableView.contentSize != self.fakeTableView.contentSize {
self.tableView.contentSize = self.fakeTableView.contentSize
}
}
override func viewDidLoad() {
super.viewDidLoad()
gk_navigationBar.isHidden = true
self.view.backgroundColor = UIColor.init(hex: 0xDCE4F1)
self.view.addSubview(self.fakeTableView)
self.view.addSubview(self.tableView)
self.view.addSubview(self.bottomView)
self.view.addSubview(self.navStatusBar)
self.view.addSubview(self.topSegmentView)
self.view.addSubview(self.emptyView)
updateCount()
self.navStatusBar.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(k_Height_NavigationtBarAndStatuBar)
}
self.topSegmentView.snp.makeConstraints { make in
make.top.equalTo(self.navStatusBar.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(self.topSegmentHeight)
}
tableView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
make.bottom.equalTo(self.bottomView.snp.top)
}
fakeTableView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
make.bottom.equalTo(self.bottomView.snp.top)
}
bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(k_Height_safeAreaInsetsBottom()+64.0)
}
emptyView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
loadData2()
}
func updateCount() {
let submitCount = self.viewModel.certificateEntryModel?.to_be_submit_num ?? 0
let reuploadCount = self.viewModel.certificateEntryModel?.reject_num ?? 0
let textColor = UIColor.mainTextColor70
let countColor = UIColor.brandMainColor
let textFont = UIFont.PFSC_R(ofSize: 14)
let countFont = UIFont.PFSC_B(ofSize: 16)
let a: ASAttributedString = .init("您有 ", .font(textFont),.foreground(textColor))
let b: ASAttributedString = .init(NSAttributedString(string: String(submitCount)), .font(countFont),.foreground(countColor))
let c: ASAttributedString = .init(" 项待提交,", .font(textFont),.foreground(textColor))
let d: ASAttributedString = .init(NSAttributedString(string: String(reuploadCount)), .font(countFont),.foreground(countColor))
let e: ASAttributedString = .init(" 项需重传", .font(textFont),.foreground(textColor))
totalLabel.attributed.text = a+b+c+d+e
}
func scrollToSection(_ section:Int) {
if 0 <= section && section < self.items.count {
// 自定义布局contentSize计算不准导致setContentOffset失效故采用此方法
// fakeTableView 设计目的 1、每次刷新数据自动滚动到底部才能算完contentSize 2、scrollToRow后更正偏移会有抖动
printLog("fakeTableView.contentSize \(self.fakeTableView.contentSize)")
if self.tableView.contentSize != self.fakeTableView.contentSize {
self.tableView.contentSize = self.fakeTableView.contentSize
}
self.fakeTableView.scrollToRow(at: IndexPath(row: 0, section: section), at: .top, animated: false)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
var gap = 0.0
// 此处处理内容总长度不够滚到相应tab的差距
let sectionRect = self.fakeTableView.rectForHeader(inSection: section)
if self.fakeTableView.contentOffset.y >= 0.0, sectionRect.origin.y > self.fakeTableView.contentOffset.y {
gap = sectionRect.origin.y - self.fakeTableView.contentOffset.y
}
let offsetY = self.fakeTableView.contentOffset.y-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight+gap
self.tableView.setContentOffset(CGPointMake(0, offsetY+4), animated: true)
})
}
}
}
extension YHGCMyFileListViewController : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if 0 <= section && section < items.count {
let model = items[section]
if model.supplement_list.count > 0 {
return model.supplement_list.count
}
return 1
}
return 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let noneCell = tableView.dequeueReusableCell(withIdentifier: YHMyFileListNoneCell.cellReuseIdentifier, for: indexPath) as! YHMyFileListNoneCell
if 0 <= indexPath.section && indexPath.section < items.count {
let model = items[indexPath.section]
if model.supplement_list.count > 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyFileListCell.cellReuseIdentifier, for: indexPath) as! YHMyFileListCell
if 0 <= indexPath.row && indexPath.row < model.supplement_list.count {
cell.indexLabel.text = "\(indexPath.row+1)"
cell.model = model.supplement_list[indexPath.row]
cell.isLastCell = indexPath.row == model.supplement_list.count-1
}
return cell
}
}
return noneCell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if 0 <= indexPath.section && indexPath.section < items.count {
let model = items[indexPath.section]
if model.supplement_list.count > 0 {
return UITableView.automaticDimension
}
}
return 72.0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.section && indexPath.section < items.count {
let model = items[indexPath.section]
if model.supplement_list.count > 0 {
let supplement = model.supplement_list[indexPath.row]
if supplement.checkStatus == YHCertificateUploadStatus.preUpload.rawValue { // 待上传
self.viewModel.showUploadSheetView(supplementId: supplement.id) {
[weak self] in
guard let self = self else { return }
DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryId = model.category_id
vc.supplementId = supplement.id
self.navigationController?.pushViewController(vc)
}
}
return
}
// 非待上传的进入详情
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryId = model.category_id
vc.supplementId = supplement.id
self.navigationController?.pushViewController(vc)
}
}
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = YHMyFileListHeaderView(frame: .zero)
view.headerView.isHidden = true
view.isShowCorner = items.count <= 1
if 0 <= section && section < items.count {
let model = items[section]
view.titleLabel.text = model.ApplicantName
if model.supplement_list.count > 0 {
view.headerView.isHidden = false
}
}
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if 0 <= section && section < items.count {
let model = items[section]
if model.supplement_list.count > 0 {
return 103.0
}
}
return 68.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if section == items.count-1 {
let view = YHMyFileListFooterView(frame: .zero)
return view
}
let view = UIView()
let view1 = UIView()
view1.backgroundColor = .white
view.addSubview(view1)
view1.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.bottom.equalToSuperview()
}
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == items.count-1 {
return UITableView.automaticDimension
}
return 0.01
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView == self.fakeTableView {
return
}
printLog("offset: \(scrollView.contentOffset.y)")
let segmentHeight = self.items.count <= 1 ? 0.0 : 46.0
let gap = self.consentInsetTop-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight+segmentHeight
self.navStatusBar.backgroundColor = scrollView.contentOffset.y > gap ? UIColor.white : UIColor.clear
self.topSegmentView.backgroundColor = scrollView.contentOffset.y > gap ? UIColor.white : UIColor.clear
self.topSegmentView.isHidden = scrollView.contentOffset.y < gap
var find:Bool = false
if items.count > 0 {
for index in 0..<items.count {
let rect = self.tableView.rectForHeader(inSection: index)
// section 到顶部选择tab的距离
let y = rect.origin.y-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight+24.0-self.tableView.contentOffset.y
if 0.0 <= y, y < self.tableView.height-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight {
find = true
self.topSegmentView.updateSelectIndex(index)
self.segmentView.updateSelectIndex(index)
break
}
}
}
// section 没有在可见区域出现
if !find {
if let arr = self.tableView.indexPathsForVisibleRows, let lastIndexPath = arr.last {
self.topSegmentView.updateSelectIndex(lastIndexPath.section)
self.segmentView.updateSelectIndex(lastIndexPath.section)
}
}
}
}
extension YHGCMyFileListViewController {
@objc func clickSaveBtn() {
YHHUD.show(.progress(message: "正在生成图片"))
let originY = self.tableView.contentOffset.y
if self.tableView.contentSize != self.fakeTableView.contentSize {
self.tableView.contentSize = self.fakeTableView.contentSize
}
self.tableView.snp.remakeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
make.height.equalTo(self.tableView.contentSize.height)
}
self.tableView.setNeedsLayout()
self.tableView.layoutIfNeeded()
TYSnapshotScroll.screenSnapshot(self.tableView, addMaskAfter: nil) {
[weak self] image in
YHHUD.hide()
guard let self = self else { return }
self.tableView.snp.remakeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
make.bottom.equalTo(self.bottomView.snp.top)
}
self.tableView.setNeedsLayout()
self.tableView.layoutIfNeeded()
if let img = image {
// 裁剪
let targetFrame = CGRectMake(0, k_Height_NavigationtBarAndStatuBar-30, img.size.width, img.size.height-k_Height_NavigationtBarAndStatuBar+30)
let croppedImage = img.cropped(to: targetFrame)
self.saveImage(croppedImage)
DispatchQueue.main.async {
self.tableView.setContentOffset(CGPoint(x: 0, y: originY), animated: false)
}
} else {
YHHUD.flash(message: "生成图片失败")
}
}
}
func saveImage(_ image: UIImage) {
// 确保应用有权访问相册
PHPhotoLibrary.requestAuthorization { status in
if status == .authorized {
// 保存图片到相册
DispatchQueue.main.async {
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil)
}
} else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限")
}
}
}
}
@objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) {
if didFinishSavingWithError != nil {
YHHUD.flash(message: "保存失败")
return
}
YHHUD.flash(message: "保存成功")
}
func showEmptyView(_ show:Bool) {
self.emptyView.isHidden = !show
self.navStatusBar.backgroundColor = show ? UIColor.white : UIColor.clear
}
}
extension YHGCMyFileListViewController {
func loadData() {
let param = ["order_id":orderId,
"node":"1",
"state":"1"] as [String : Any]
viewModel.getCertificateFileListData(params: param) { success, error in
self.items.removeAll()
self.titles.removeAll()
var isHaveData = false
if success == true {
for (_, item) in self.viewModel.arrFileListData.enumerated() {
let arr = item?.supplement_list.filter { (item) -> Bool in
return item.checkStatus == 2 || item.checkStatus == 3
}
if let array = arr, array.count > 0 {
isHaveData = true
}
}
for (index, model) in self.viewModel.arrFileListData.enumerated() {
if let model = model {
self.items.append(model)
self.titles.append(model.ApplicantName)
}
}
self.topSegmentView.items = self.titles
self.segmentView.items = self.titles
self.saveBtn.isUserInteractionEnabled = true
self.saveBtn.layer.opacity = 1.0
self.showEmptyView(!isHaveData)
} else {
self.saveBtn.isUserInteractionEnabled = false
self.saveBtn.layer.opacity = 0.3
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
self.segmentView.isHidden = self.items.count <= 1
self.headerView.height = self.items.count > 1 ? self.originHeaderHeight : self.originHeaderHeight-self.topSegmentHeight
self.tableView.reloadData()
self.fakeTableView.tableHeaderView?.height = self.headerView.height
self.fakeTableView.reloadData {
let lastSection = self.items.count-1
if 0 <= lastSection && lastSection < self.items.count {
let model = self.items[lastSection]
var lastRow = model.supplement_list.count-1
if lastRow < 0 {
lastRow = 0
}
self.tableView.setContentOffset(CGPointZero, animated: true)
self.fakeTableView.setContentOffset(CGPoint.zero, animated: false)
self.fakeTableView.scrollToRow(at: IndexPath(row: lastRow, section: lastSection), at: .top, animated: true)
}
}
}
}
func loadData2() {
let param = ["order_id": orderId,
"node": "1",
"state":"1"] as [String : Any]
viewModel.getCertificateStatisticData(params: param) { success, error in
if !success {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
self.updateCount()
}
}
}
//
// YHMaterialListViewController.swift
// galaxy
//
// Created by edy on 2024/3/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHGCCertificateListContainerVC: YHBaseViewController {
static let segmentHeight = 49.0
var orderId : Int?
var filterDict : [String: String] = [:]
var categoryInfo: YHCategoryData = YHCategoryData()
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
bar.backgroundColor = .white
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
}()
var titles = ["全部", "待上传(0)", "已驳回(0)", "审核中(0)", "已完成(0)"]
let categoryItems = [ YHCertificateCategoryItem(type: .all),
YHCertificateCategoryItem(type: .preUpload),
YHCertificateCategoryItem(type: .rejected),
YHCertificateCategoryItem(type: .review),
YHCertificateCategoryItem(type: .finish)]
var itemVCs:[YHGCCertificateListVC] = []
lazy var segmentContainerView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
lazy var segmentedView : JXSegmentedView = {
let segview = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: Self.segmentHeight))
segview.dataSource = segmentedDataSource
segview.delegate = self
//配置指示器
let indicator = JXSegmentedIndicatorLineView()
indicator.indicatorWidth = 16
indicator.indicatorHeight = 4.0
indicator.indicatorColor = .brandMainColor
segview.indicators = [indicator]
segview.backgroundColor = .clear
segview.listContainer = listContainerView
segview.backgroundColor = .white
return segview
}()
lazy var segmentedDataSource: JXSegmentedTitleDataSource = {
let dataSource = JXSegmentedTitleDataSource()
dataSource.isTitleColorGradientEnabled = true
dataSource.titles = titles
dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 14)
dataSource.titleNormalColor = .labelTextColor2
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 16)
dataSource.titleSelectedColor = UIColor(hexString: "#000000")!
dataSource.isItemSpacingAverageEnabled = false
dataSource.itemWidth = JXSegmentedViewAutomaticDimension
dataSource.itemSpacing = 24
return dataSource
}()
//分类title 所对应的VC
lazy var listContainerView: JXSegmentedListContainerView! = {
return JXSegmentedListContainerView(dataSource: self, type: .collectionView)
}()
lazy var filterBtn: YHCertificateFilterButton = {
let btn = YHCertificateFilterButton.filterBtn()
btn.clickBlock = {
[weak self] select in
guard let self = self else { return }
filterSheetView.show()
}
return btn
}()
lazy var filterSheetView: YHCertificateFilterView = {
let view = YHCertificateFilterView.sheetView()
view.confirmBlock = {
[weak self] dict in
guard let self = self else { return }
self.filterDict = dict
let allValues = Array(dict.values)
var isNoFilterCondition = true
for value in allValues {
if !value.isEmpty {
isNoFilterCondition = false
}
}
self.filterBtn.isSelect = !isNoFilterCondition
if let vc = itemVCs.first {
vc.requestList(status:vc.status, extra:dict)
}
self.segmentedView.selectItemAt(index: 0)
}
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navigationBar.isHidden = true
self.view.backgroundColor = .white
self.navBar.title = "资料".local
if categoryInfo.categoryId == YHCertificateCategoryId.mainApplicant.rawValue {
self.navBar.title = "主申请人资料".local
} else if categoryInfo.categoryId == YHCertificateCategoryId.spouse.rawValue {
self.navBar.title = "配偶资料".local
} else if categoryInfo.categoryId == YHCertificateCategoryId.child.rawValue {
self.navBar.title = "子女资料".local
}
NotificationCenter.default.addObserver(self, selector: #selector(didCertificateCountStatistics(_:)), name:countStatisticsNotify , object: nil)
for item in categoryItems {
let vc = YHGCCertificateListVC()
vc.orderId = orderId
vc.status = item.type
vc.categoryInfo = categoryInfo
itemVCs.append(vc)
}
view.addSubview(navBar)
view.addSubview(segmentContainerView)
segmentContainerView.addSubview(segmentedView)
segmentContainerView.addSubview(filterBtn)
view.addSubview(listContainerView)
navBar.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_statusBar())
make.height.equalTo(k_Height_NavContentBar)
}
segmentContainerView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(Self.segmentHeight+4)
}
segmentedView.snp.makeConstraints { make in
make.top.left.equalToSuperview()
make.right.equalToSuperview().offset(-21-18)
make.height.equalTo(Self.segmentHeight)
}
filterBtn.snp.makeConstraints { make in
make.width.height.equalTo(YHCertificateFilterButton.width)
make.centerY.equalToSuperview().offset(-2)
make.right.equalToSuperview().offset(-18)
}
listContainerView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(segmentContainerView.snp.bottom)
make.bottom.equalToSuperview()
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//处于第一个item的时候,才允许屏幕边缘手势返回
navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0)
// 请求每个tab列表数据计算数量
for (index, vc) in itemVCs.enumerated() {
if index == 0 {
vc.requestList(status: vc.status, extra:self.filterDict)
} else {
vc.requestList(status: vc.status)
}
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
//离开页面的时候,需要恢复屏幕边缘手势,不能影响其他页面
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
@objc func didCertificateCountStatistics(_ notification: Notification) {
guard let dic = notification.object as? [YHCertificateUploadStatus: Int] else { return }
print(dic)
if let count = dic[YHCertificateUploadStatus.preUpload] {
titles[1] = "待上传(\(count))"
} else if let count = dic[YHCertificateUploadStatus.rejected] {
titles[2] = "已驳回(\(count))"
} else if let count = dic[YHCertificateUploadStatus.review] {
titles[3] = "审核中(\(count))"
} else if let count = dic[YHCertificateUploadStatus.finish] {
titles[4] = "已完成(\(count))"
}
DispatchQueue.main.async {
self.segmentedDataSource.titles = self.titles
self.segmentedView.reloadData()
}
}
deinit {
NotificationCenter.default.removeObserver(self)
}
}
extension YHGCCertificateListContainerVC: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
if 0 <= index && index < itemVCs.count {
let vc = itemVCs[index]
if index == 0 {
vc.requestList(status: vc.status, extra: self.filterDict)
} else {
vc.requestList(status: vc.status)
}
}
}
/// 正在滚动中的回调
///
/// - Parameters:
/// - segmentedView: JXSegmentedView
/// - leftIndex: 正在滚动中,相对位置处于左边的index
/// - rightIndex: 正在滚动中,相对位置处于右边的index
/// - percent: 从左往右计算的百分比
func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
}
}
extension YHGCCertificateListContainerVC: JXSegmentedListContainerViewDataSource {
func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
return titleDataSource.dataSource.count
}
return 0
}
func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
return itemVCs[index]
}
}
//
// YHCertificateResourceUploadVC.swift
// galaxy
//
// Created by edy on 2024/3/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
import UniformTypeIdentifiers
import IQKeyboardManagerSwift
import SwifterSwift
class YHGCCertificateListVC: YHBaseViewController {
var orderId : Int?
var status: YHCertificateUploadStatus = .all
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)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.estimatedSectionHeaderHeight = 14.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor(hexString:"#F8F8F8")
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHCertificateInfoCell.self, forCellReuseIdentifier: YHCertificateInfoCell.cellReuseIdentifier)
tableView.backgroundView = emptyDataTipsView
return tableView
}()
lazy var emptyDataTipsView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("没有找到相关资料哦~", kEmptyCommonBgName)
view.topMargin = 130
view.isHidden = false
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
self.gk_navigationBar.isHidden = true
createUI()
requestList(status: status)
}
func createUI() {
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(KScreenHeight - k_Height_NavigationtBarAndStatuBar - YHCertificateListContainerVC.segmentHeight)
}
}
}
extension YHGCCertificateListVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateInfoCell.cellReuseIdentifier, for: indexPath) as! YHCertificateInfoCell
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, fileName:"预览")
}
}
view.show()
}
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
if item.checkStatus == YHCertificateUploadStatus.preUpload.rawValue { // 待上传
showUploadSheetView(supplementId:item.id)
return
}
// 非待上传的进入详情
let vc = YHGCCertificateUploadContentListVC()
vc.orderId = orderId ?? 0
vc.categoryId = categoryInfo.categoryId
vc.supplementId = item.id
self.navigationController?.pushViewController(vc)
}
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 14.0
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
}
// MARK: - JXSegmentedListContainerViewListDelegate
extension YHGCCertificateListVC: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
extension YHGCCertificateListVC {
func requestList(status: YHCertificateUploadStatus, extra:[String:Any] = [:]) {
/*
// 状态
"status_all": "",
// 类型
"template_cate_id": "",
// 搜索
"keywork": "",
*/
var params:[String:Any] = [
"order_id" : orderId ?? 0,
"node": "1",
"state": "1",
"category_id": categoryInfo.categoryId,
"supplement_ids": []]
if !extra.isEmpty {
params += extra
}
print(params)
// state: 3:待上传 2:已驳回 1:已完成 0:审核中
viewModel.getCertificateList(params: params) {
[weak self] listInfo, error in
guard let self = self else { return }
items.removeAll()
if let listInfo = listInfo {
let arr = listInfo.supplementList
var results: [YHSupplementInfo] = []
if status == .all {
results.append(contentsOf:arr)
} else {
for item in arr {
if item.checkStatus == status.rawValue {
results.append(item)
}
}
}
items.append(contentsOf: results)
}
// 数量统计
NotificationCenter.default.post(name: countStatisticsNotify, object: [self.status: items.count])
emptyDataTipsView.isHidden = items.count > 0
self.tableView.reloadData()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg, duration:3)
}
}
}
func showUploadSheetView(supplementId: Int) {
let orderID = self.orderId ?? 0
self.viewModel.showUploadSheetView(supplementId: supplementId) {
[weak self] in
guard let self = self else { return }
DispatchQueue.main.async {
let vc = YHGCCertificateUploadContentListVC()
vc.orderId = orderID
vc.categoryId = self.categoryInfo.categoryId
vc.supplementId = supplementId
self.navigationController?.pushViewController(vc)
}
}
}
}
//
// YHCertificateSearchViewController.swift
// galaxy
//
// Created by edy on 2024/3/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGCCertificateSearchViewController: YHBaseViewController {
var items:[YHSupplementInfo] = []
var viewModel: YHCertificateViewModel = YHCertificateViewModel()
var orderId : Int?
var categoryInfo: YHCategoryData?
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.estimatedSectionHeaderHeight = 14.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor(hexString:"#F8F8F8")
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHCertificateInfoCell.self, forCellReuseIdentifier: YHCertificateInfoCell.cellReuseIdentifier)
tableView.backgroundView = emptyDataTipsView
return tableView
}()
lazy var previewFileTool:YHFilePreviewTool = {
let tool = YHFilePreviewTool(targetVC: self)
return tool
}()
lazy var searchView:UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(searchBar)
searchBar.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.size.equalTo(CGSize(width: KScreenWidth-32.0, height:YHCertificateSearchBar.height))
}
return view
}()
lazy var searchBar: YHCertificateSearchBar = {
let bar = YHCertificateSearchBar(frame:CGRect(x: 0, y: 0, width:KScreenWidth-32, height:YHCertificateSearchBar.height))
bar.searchBlock = {
[weak self] text in
guard let self = self else { return }
requestList(keyWord: text)
}
bar.textChange = {
[weak self] text in
guard let self = self else { return }
if isEmptyString(text) {
requestList(keyWord: "")
}
}
return bar
}()
lazy var emptyDataTipsView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("没有找到相关资料哦~", kEmptySearchBgName)
view.topMargin = 130
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
self.gk_navTitle = "资料搜索".local
createUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.requestList(keyWord: searchBar.textField.text)
}
func createUI() {
view.addSubview(searchView)
view.addSubview(tableView)
searchView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(32+YHCertificateSearchBar.height)
}
tableView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(searchView.snp.bottom)
}
}
}
extension YHGCCertificateSearchViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateInfoCell.cellReuseIdentifier, for: indexPath) as! YHCertificateInfoCell
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, fileName: "预览")
}
}
view.show()
}
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.section && indexPath.section < items.count {
let item = items[indexPath.section]
if item.checkStatus == YHCertificateUploadStatus.preUpload.rawValue { // 待上传
showUploadSheetView(supplementId: item.id)
return
}
// 非待上传的进入详情
let vc = YHGCCertificateUploadContentListVC()
vc.orderId = orderId ?? 0
vc.categoryId = self.categoryInfo?.categoryId ?? 0
vc.supplementId = item.id
self.navigationController?.pushViewController(vc)
}
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 14.0
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
}
extension YHGCCertificateSearchViewController {
func requestList(keyWord:String?) {
/*
// 状态
"status_all": "",
// 类型
"template_cate_id": "",
// 搜索
"keyword": "",
*/
let keywords = keyWord ?? ""
let params:[String:Any] = [
"node": "1",
"state": "1",
"supplement_ids": [],
"order_id" : orderId ?? 0,
"keyword": keywords]
print(params)
// state: 3:待上传 2:已驳回 1:已完成 0:审核中
viewModel.getCertificateList(params: params) {
[weak self] listInfo, error in
guard let self = self else { return }
items.removeAll()
if let listInfo = listInfo {
categoryInfo = listInfo.categoryData
let arr = listInfo.supplementList
items.append(contentsOf: arr)
}
emptyDataTipsView.isHidden = items.count > 0
self.tableView.reloadData()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg, duration:3)
}
}
}
func showUploadSheetView(supplementId: Int) {
let orderID = self.orderId ?? 0
let categoryId = self.categoryInfo?.categoryId ?? 0
self.viewModel.showUploadSheetView(supplementId: supplementId) {
[weak self] in
guard let self = self else { return }
DispatchQueue.main.async {
let vc = YHGCCertificateUploadContentListVC()
vc.orderId = orderID
vc.categoryId = categoryId
vc.supplementId = supplementId
self.navigationController?.pushViewController(vc)
}
}
}
}
//
// YHUploadContentVC.swift
// galaxy
//
// Created by edy on 2024/3/12.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import IQKeyboardManagerSwift
import AttributedString
class YHGCCertificateUploadContentListVC: YHBaseViewController {
// 进入该页面以下三个参数必传
var orderId : Int = 0
var categoryId: Int = 0
var supplementId: Int = 0
private var categoryInfo = YHCategoryData()
private var supplementInfo = YHSupplementInfo() {
didSet {
templateArr.removeAll()
if supplementInfo.templateInfo.materialPath.count > 0 {
let template = supplementInfo.templateInfo.materialPath[0]
template.type = 0
templateArr.append(template)
}
if supplementInfo.templateInfo.guideFilePath.count > 0 {
let guide = supplementInfo.templateInfo.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
}
self.tableView.reloadData()
}
}
var viewModel: YHCertificateViewModel = YHCertificateViewModel()
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: "请输入名称")
return view
}()
lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds)
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
let tap = UITapGestureRecognizer(target: self, action: #selector(dismissed))
view.addGestureRecognizer(tap)
view.isHidden = true
return view
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .white
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHCertificateNameCell.self, forCellReuseIdentifier: YHCertificateNameCell.cellReuseIdentifier)
tableView.register(YHCertificateTemplateCell.self, forCellReuseIdentifier: YHCertificateTemplateCell.cellReuseIdentifier)
return tableView
}()
lazy var uploadBtn:UIButton = {
let btn = UIButton()
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)
return btn
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
self.gk_navTitle = "上传内容"
addKeyBoardNotify()
createUI()
items.removeAll()
if supplementInfo.contentUrl.count > 0 {
items.append(contentsOf: supplementInfo.contentUrl)
}
tableView.reloadData()
requestList()
renameInputView.editBlock = {
[weak self] text in
guard let self = self else { return }
if let selectEditItem = selectEditItem, var text = text {
// 重命名
text = text + "." + selectEditItem.getFileSuffixName()
YHHUD.show(.progress(message: "重命名中..."))
self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModels:[selectEditItem], operation: "rename", rename: text) {
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.requestList()
}
}
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
NotificationCenter.default.post(name: YhConstant.YhNotification.refreshCertificateFileListNotifiction, object: nil)
}
deinit {
removeNotify()
}
@objc func didClickUploadBtn() {
if items.count >= 99 {
YHHUD.flash(message: "已达上限\n最多上传99张图片或文件")
return
}
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.uploadTypeArr = [ YHCertificateUploadItem(type:.camera, title:"拍照上传"),
YHCertificateUploadItem(type:.photo, title:"相册上传"),
YHCertificateUploadItem(type:.phoneFile, title:"手机文件上传", subtitle:"从手机文件管理中上传"),
YHCertificateUploadItem(type:.wechatUpload, title:"微信上传"),
YHCertificateUploadItem(type:.cancel, title:"取消")]
sheetView.maxSelectImageCount = 99-items.count
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
self.viewModel.uploadFile(fileUrl, supplementId: supplementId) {
[weak self] in
guard let self = self else { return }
self.requestList()
}
}
sheetView.uploadImageBlock = {
[weak self] targetImgArr in
guard let self = self else { return }
self.viewModel.uploadImageArr(targetImgArr, supplementId: supplementId) {
[weak self] in
guard let self = self else { return }
self.requestList()
}
}
sheetView.wechatUploadBlock = {
[weak self] in
guard let self = self else { return }
let token = YHLoginManager.shared.h5Token
let path = "/superApp/pages/wxUpload/wxUpload?param=\(token)&id=\(self.supplementId)&type=my_certificate"
YHShareManager.shared.openMiniProgram(path:path, title: "微信上传")
}
sheetView.show()
}
func createUI() {
view.addSubview(uploadBtn)
view.addSubview(tableView)
view.addSubview(blackMaskView)
view.addSubview(renameInputView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
if supplementInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
make.bottom.equalToSuperview()
} else {
make.bottom.equalTo(uploadBtn.snp.top).offset(-34)
}
}
uploadBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.height.equalTo(48.0)
make.bottom.equalToSuperview().offset(-8-k_Height_safeAreaInsetsBottom())
}
renameInputView.snp.makeConstraints { make in
make.left.right.equalTo(view)
make.height.equalTo(YHFileRenameInputView.height)
make.bottom.equalToSuperview().offset(YHFileRenameInputView.height)
}
}
}
extension YHGCCertificateUploadContentListVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return templateArr.count
}
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateTemplateCell.cellReuseIdentifier, for: indexPath) as! YHCertificateTemplateCell
cell.update(bottomMargin: 15)
if 0 <= indexPath.row && indexPath.row < templateArr.count {
cell.templatePath = templateArr[indexPath.row]
}
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateNameCell.cellReuseIdentifier, for: indexPath) as! YHCertificateNameCell
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 supplementInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
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)")
if editType == .rename { // 重命名
IQKeyboardManager.shared.isEnabled = 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 }
// 删除
YHHUD.show(.progress(message: "删除中..."))
self.viewModel.updateCertificateItem(supplementsId:self.supplementInfo.id, urlModels:[contentItem], operation: "del", rename:"") {
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.requestList()
}
}
} 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)
}
}
}
}.show()
}
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
return 77.0
}
return UITableView.automaticDimension
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
if section == 0 {
if supplementInfo.templateInfo.isNeedShowTemplate() {
return UITableView.automaticDimension
}
return 0.0
}
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
if section == 0 { // 证件示例模板
if !supplementInfo.templateInfo.isNeedShowTemplate() {
return view
}
let titlelabel = UILabel()
titlelabel.textColor = UIColor.mainTextColor
titlelabel.textAlignment = .left
titlelabel.font = UIFont.PFSC_M(ofSize:17)
titlelabel.text = "\(supplementInfo.name)示例模板"
titlelabel.numberOfLines = 0
view.addSubview(titlelabel)
titlelabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16)
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 !supplementInfo.templateInfo.description.isEmpty {
tipsLabel.text = "注意事项:\n\(supplementInfo.templateInfo.description)"
}
view.addSubview(tipsLabel)
tipsLabel.snp.makeConstraints { make in
make.top.equalTo(titlelabel.snp.bottom).offset(5)
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 = supplementInfo.name
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 supplementInfo.checkStatus == YHCertificateUploadStatus.review.rawValue {
text = "审核中".local
textColor = UIColor(hexString: "#FF9900")!
bgColor = UIColor(hexString: "#FF9900", transparency: 0.08)!
} else if supplementInfo.checkStatus == YHCertificateUploadStatus.preUpload.rawValue {
text = "待上传".local
textColor = UIColor(hexString: "#2F7EF6")!
bgColor = UIColor(hexString: "#2F7EF6", transparency: 0.08)!
} else if supplementInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
text = "已完成".local
textColor = UIColor(hexString: "#49D2B1")!
bgColor = UIColor(hexString: "#49D2B1", transparency: 0.08)!
} else if supplementInfo.checkStatus == YHCertificateUploadStatus.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:12)
tipsLabel.textAlignment = .left
tipsLabel.numberOfLines = 0
tipsLabel.text = "支持的文件格式为jpg/jpeg、png、doc/docx、pptx、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 supplementInfo.checkStatus != YHCertificateUploadStatus.rejected.rawValue {
return view
}
if supplementInfo.auditContent.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 = supplementInfo.auditContent
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
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
if section == 0 {
return 20.0
}
return 60.0
}
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)
}
return view
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
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, fileName:"预览")
}
}
} else if indexPath.section == 1 { // 证件列表
if 0 <= indexPath.row && indexPath.row < items.count {
let cer = items[indexPath.row]
if !cer.url.isEmpty {
print(cer.url)
self.viewModel.getPublicImageUrl(cer.url) { success, error in
if let success = success {
self.previewFileTool.openXLSXRemoteFile(urlString: success, fileName:cer.name)
}
}
}
}
}
}
@objc func dismissed() {
renameInputView.textField.resignFirstResponder()
}
}
extension YHGCCertificateUploadContentListVC {
func addKeyBoardNotify() {
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didRefreshData), name: YhConstant.YhNotification.didMyCertificateWeChatFileUploadCallBackNotification, object: nil)
}
@objc func didRefreshData() {
requestList()
}
func removeNotify() {
NotificationCenter.default.removeObserver(self)
}
@objc func handleKeyboardNotification(_ notification: Notification) {
if notification.userInfo != nil {
guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue else {return }
let isKeyboardShow = notification.name == UIResponder.keyboardWillShowNotification
self.blackMaskView.isHidden = !isKeyboardShow
let bottomMargin = (isKeyboardShow ? -keyboardFrame.height : YHFileRenameInputView.height)
if !isKeyboardShow {
IQKeyboardManager.shared.isEnabled = true
}
self.renameInputView.snp.updateConstraints { make in
make.bottom.equalToSuperview().offset(bottomMargin)
}
self.view.setNeedsLayout()
self.view.layoutIfNeeded()
}
}
}
extension YHGCCertificateUploadContentListVC {
func requestList() {
let params:[String:Any] = [
"order_id" : orderId,
"node": "1",
"state": "1",
"category_id": categoryId,
"supplement_ids": supplementId]
print(params)
viewModel.getCertificateList(params: params) {
[weak self] listInfo, error in
guard let self = self else { return }
items.removeAll()
if let listInfo = listInfo {
categoryInfo = listInfo.categoryData
let arr = listInfo.supplementList
if arr.count > 0 {
supplementInfo = arr[0]
}
for item in arr {
items.append(contentsOf: item.contentUrl)
}
}
if categoryInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
self.uploadBtn.isHidden = true
} else {
self.uploadBtn.isHidden = false
self.uploadBtn.alpha = (items.count >= 99 ? 0.5 : 1.0)
}
self.tableView.reloadData()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg, duration:3)
}
}
}
}
//
// YHMainCertificateEntryVC.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
/*
我的证件 主入口页
*/
class YHGCMineCertificateEntryViewController: YHBaseViewController {
var orderId : Int = 0
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 = YHGCCertificateSearchViewController()
vc.orderId = orderId
self.navigationController?.pushViewController(vc)
}
return bar
}()
private lazy var topBkg : UIView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "service_center_head_bkg3")
imagV.contentMode = .scaleAspectFill
return imagV
}()
var homeTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.showsHorizontalScrollIndicator = false
tableView.showsVerticalScrollIndicator = false
tableView.rowHeight = UITableView.automaticDimension
tableView.register(YHCertificateEntryCell.self,forCellReuseIdentifier: YHCertificateEntryCell.cellReuseIdentifier)
return tableView
}()
let headerView : YHCertificateEntryHeadView = YHCertificateEntryHeadView()
let bottomView : YHCertificateEntryBottomView = YHCertificateEntryBottomView()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
}
}
extension YHGCMineCertificateEntryViewController {
func loadData() {
if orderId != 0 {
let param = ["order_id":orderId,"node":"1","state":"1"] as [String : Any]
certificateReqVM.getCertificateStatisticData(params: param) { success, error in
if success == true {
self.headerView.dataModel = self.certificateReqVM.certificateEntryModel
} else {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
self.homeTableView.reloadData()
}
}
}
func setupUI() {
gk_navigationBar.isHidden = true
view.addSubview(topBkg)
topBkg.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(240)
}
view.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(YHCertificateEntryBottomView.viewH)
}
headerView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: YHCertificateEntryHeadView.viewH)
homeTableView.tableHeaderView = headerView
view.addSubview(homeTableView)
homeTableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
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
bottomView.block = { flag in
if flag == 0 {
//问题答疑
let vc = YHQuestionAndAnswerViewController()
self.navigationController?.pushViewController(vc)
} else {
//生成清单
let vc = YHGCMyFileListViewController()
vc.orderId = self.orderId
self.navigationController?.pushViewController(vc)
}
}
}
}
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHGCMineCertificateEntryViewController : UITableViewDelegate,UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
guard let model = certificateReqVM.certificateEntryModel else { return 0 }
return model.category_data.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return kMargin
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: kMargin))
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return YHCertificateEntryCell.cellH
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell0 = tableView.dequeueReusableCell(withClass: YHCertificateEntryCell.self)
cell0.selectionStyle = .none
guard let model = certificateReqVM.certificateEntryModel else { return cell0 }
if indexPath.section < model.category_data.count {
cell0.dataModel = model.category_data[indexPath.section]
}
return cell0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.section)")
guard let model = certificateReqVM.certificateEntryModel else { return }
let vc = YHGCCertificateListContainerVC()
vc.orderId = orderId
if indexPath.section < model.category_data.count {
vc.categoryInfo = model.category_data[indexPath.section]
}
self.navigationController?.pushViewController(vc)
}
}
//
// YHImproveSchemeViewController.swift
// galaxy
//
// Created by Dufet on 2024/11/16.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import Photos
class YHGCImproveSchemeViewController: YHBaseViewController {
var orderId: Int = 0
let viewModel = YHSchemeViewModel()
var items:[YHImproveDetailModel] = []
var isPass: Bool = false
lazy var bgImgView: UIImageView = {
let view = UIImageView(image: UIImage(named: "my_scheme_improve_list_bg"))
view.frame = CGRectMake(0, 0, KScreenWidth, 528)
return view
}()
lazy var headerView: UIView = {
let view = UIView()
view.addSubview(greetLabel)
let tipsLabel = UILabel()
tipsLabel.numberOfLines = 0
tipsLabel.font = UIFont.PFSC_R(ofSize: 14)
tipsLabel.textColor = .white
tipsLabel.text = "您好,根据您的信息,这是我们为您定制的提升方案,方案详情如下:"
view.addSubview(tipsLabel)
let leftImgV = UIImageView(image: UIImage(named: "my_scheme_improve_wheatear_left"))
let rightImgV = UIImageView(image: UIImage(named: "my_scheme_improve_wheatear_right"))
view.addSubview(leftImgV)
view.addSubview(rightImgV)
greetLabel.snp.makeConstraints { make in
make.top.equalTo(32+k_Height_NavigationtBarAndStatuBar)
make.left.equalTo(leftImgV.snp.right).offset(8)
make.right.equalTo(rightImgV.snp.left).offset(-8)
make.height.equalTo(34)
}
leftImgV.snp.makeConstraints { make in
make.width.equalTo(14)
make.height.equalTo(24)
make.left.equalTo(24)
make.centerY.equalTo(greetLabel)
}
rightImgV.snp.makeConstraints { make in
make.width.equalTo(14)
make.height.equalTo(24)
make.centerY.equalTo(greetLabel)
make.right.lessThanOrEqualTo(-24)
}
tipsLabel.snp.makeConstraints { make in
make.left.equalTo(24)
make.right.equalTo(-24)
make.top.equalTo(greetLabel.snp.bottom).offset(12)
make.bottom.equalTo(-32)
}
return view
}()
lazy var greetLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_B(ofSize: 24)
label.textColor = .init(hex: 0xFFDEC8)
label.text = "尊敬的先生"
// label.lineBreakMode = .byTruncatingMiddle
return label
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHImproveTargetListCell.self, forCellReuseIdentifier: YHImproveTargetListCell.cellReuseIdentifier)
tableView.register(YHIHKIdentityPlanCell.self, forCellReuseIdentifier: YHIHKIdentityPlanCell.cellReuseIdentifier)
tableView.bounces = false
tableView.backgroundView = self.bgView
return tableView
}()
lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(leftBtn)
view.addSubview(rightBtn)
leftBtn.snp.makeConstraints { make in
make.top.equalTo(8)
make.left.equalTo(16)
make.width.equalTo(rightBtn)
make.right.equalTo(rightBtn.snp.left).offset(-10)
make.height.equalTo(46)
}
rightBtn.snp.makeConstraints { make in
make.top.equalTo(8)
make.right.equalTo(-16)
make.height.equalTo(46)
}
return view
}()
lazy var bgView: UIView = {
let v = UIView()
v.backgroundColor = .white
v.addSubview(bgImgView)
bgImgView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(528)
}
return v
}()
lazy var rightBtn: 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(didRightBtnClicked), for: .touchUpInside)
btn.layer.cornerRadius = kCornerRadius3
return btn
}()
lazy var leftBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .white
btn.layer.borderColor = UIColor.brandMainColor.cgColor
btn.layer.borderWidth = 1.0
btn.setTitle("修改信息", for: .normal)
btn.setTitleColor(.brandMainColor, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
btn.addTarget(self, action: #selector(didLeftBtnClicked), for: .touchUpInside)
btn.layer.cornerRadius = kCornerRadius3
return btn
}()
@objc func didLeftBtnClicked() {
self.modifyInfo()
}
@objc func didRightBtnClicked() {
self.navigationController?.popViewController(animated: true)
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .init(hex: 0xF6F7FA)
gk_navTitle = "提升方案"
gk_navTitleColor = .white
gk_backImage = UIImage(named: "back_icon_white")
gk_navigationBar.backgroundColor = .clear
self.view.addSubview(bgImgView)
self.view.addSubview(tableView)
self.view.addSubview(bottomView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(0)
make.bottom.equalTo(bottomView.snp.top)
}
bottomView.isHidden = isPass
bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(isPass ? 0.0 : 64+k_Height_safeAreaInsetsBottom())
}
view.bringSubviewToFront(gk_navigationBar)
tableView.reloadData()
tableView.isHidden = true
bottomView.isHidden = true
requestData()
}
override func backItemClick(_ sender: Any) {
if isPass {
// 进入上级我的方案界面
self.navigationController?.popViewController(animated: true)
} else { // 进入服务tab页
self.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .service)
}
}
func requestData() {
YHHUD.show(.progress(message: "加载中..."))
viewModel.getImproveDetail(orderId: orderId) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
items.removeAll()
items.append(contentsOf: viewModel.improveDetailModel.improvePlanItem)
tableView.reloadData()
tableView.isHidden = false
bottomView.isHidden = false
var name = viewModel.improveDetailModel.username
if name.count > 5 {
name = String(name.prefix(5)) + "..."
}
greetLabel.text = "尊敬的\(name)\(viewModel.improveDetailModel.sex)"
}
}
func modifyInfo() {
YHHUD.show(.progress(message: "修改中..."))
viewModel.modifyInfo(orderId: orderId) {
[weak self] success, error in
guard let self = self else { return }
YHHUD.hide()
if success {
let vc = YHInformationPerfectListVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
return
}
YHHUD.flash(message: error?.errorMsg ?? "修改失败")
}
}
}
extension YHGCImproveSchemeViewController : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHIHKIdentityPlanCell.cellReuseIdentifier, for: indexPath) as! YHIHKIdentityPlanCell
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHImproveTargetListCell.cellReuseIdentifier, for: indexPath) as! YHImproveTargetListCell
cell.arr = self.items
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 1 {
UIViewController.current?.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .home)
NotificationCenter.default.post(name: YhConstant.YhNotification.didJumpToHomePageIdentityTabNotification, object: nil)
}
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return self.headerView
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.1
}
}
extension YHGCImproveSchemeViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let scrollY = scrollView.contentOffset.y
if scrollY >= 44.0 {
gk_navigationBar.backgroundColor = .init(hex: 0x082F84)
} else {
gk_navigationBar.backgroundColor = .clear
}
}
}
extension YHGCImproveSchemeViewController {
@objc func clickSaveBtn() {
YHHUD.show(.progress(message: "正在生成图片"))
let originY = self.tableView.contentOffset.y
self.tableView.scrollToRow(at: IndexPath(row: 1, section: 0), at: .bottom, animated: true)
sleep(1)
self.tableView.snp.remakeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
make.height.equalTo(self.tableView.contentSize.height)
}
self.tableView.setNeedsLayout()
self.tableView.layoutIfNeeded()
TYSnapshotScroll.screenSnapshot(self.tableView, addMaskAfter: nil) {
[weak self] image in
YHHUD.hide()
guard let self = self else { return }
self.tableView.snp.remakeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(0)
make.bottom.equalTo(self.bottomView.snp.top)
}
self.tableView.setNeedsLayout()
self.tableView.layoutIfNeeded()
if let img = image {
let targetFrame = CGRectMake(0, k_Height_NavigationtBarAndStatuBar, img.size.width, img.size.height-k_Height_NavigationtBarAndStatuBar)
let croppedImage = img.cropped(to: targetFrame)
self.saveImage(croppedImage)
DispatchQueue.main.async {
self.tableView.setContentOffset(CGPoint(x: 0, y: originY), animated: false)
}
} else {
YHHUD.flash(message: "生成图片失败")
}
}
}
func saveImage(_ image: UIImage) {
// 确保应用有权访问相册
PHPhotoLibrary.requestAuthorization { status in
if status == .authorized {
// 保存图片到相册
DispatchQueue.main.async {
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil)
}
} else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限")
}
}
}
}
@objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) {
if didFinishSavingWithError != nil {
YHHUD.flash(message: "保存失败")
return
}
YHHUD.flash(message: "保存成功")
}
}
//
// YHGCMyNewSchemeViewController.swift
// galaxy
//
// Created by Dufet on 2024/11/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGCMyNewSchemeViewController: YHBaseViewController {
var orderId: Int = 0
// 通过的至少要求数量
let passMinCount: Int = 6
var tipsType = YHSchemeTipsType.none
var items: [[YHSchemeItem]] = []
var passArr: [YHComprehensiveEevaluationModel] = []
var unpassArr: [YHComprehensiveEevaluationModel] = []
var isPass: Bool = false
let viewModel = YHSchemeViewModel()
static let shared = YHGCMyNewSchemeViewController()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHComprehensiveEvaluationCell.self, forCellReuseIdentifier: YHComprehensiveEvaluationCell.cellReuseIdentifier)
tableView.register(YHHKRequiredItemListCell.self, forCellReuseIdentifier: YHHKRequiredItemListCell.cellReuseIdentifier)
tableView.register(YHIndustryLocationCell.self, forCellReuseIdentifier: YHIndustryLocationCell.cellReuseIdentifier)
tableView.register(YHMaterialListCell.self, forCellReuseIdentifier: YHMaterialListCell.cellReuseIdentifier)
tableView.register(YHDocumentListCell.self, forCellReuseIdentifier: YHDocumentListCell.cellReuseIdentifier)
tableView.register(YHImproveSchemeCell.self, forCellReuseIdentifier: YHImproveSchemeCell.cellReuseIdentifier)
tableView.register(YHImproveTargetCell.self, forCellReuseIdentifier: YHImproveTargetCell.cellReuseIdentifier)
tableView.register(YHModifySchemeInfoCell.self, forCellReuseIdentifier: YHModifySchemeInfoCell.cellReuseIdentifier)
tableView.bounces = false
tableView.tableFooterView = bottomLogoView
tableView.isHidden = true
return tableView
}()
lazy var bgView: UIView = {
let view = UIView()
view.isHidden = true
let bgImgView = UIImageView(image: UIImage(named: "my_scheme_head_img"))
view.addSubview(bgImgView)
let leftWheatearImgV = UIImageView(image: UIImage(named: "my_scheme_wheatear_left"))
view.addSubview(leftWheatearImgV)
let rightWheatearImgV = UIImageView(image: UIImage(named: "my_scheme_wheatear_right"))
view.addSubview(rightWheatearImgV)
view.addSubview(titleLabel)
view.addSubview(subTitleLabel)
bgImgView.snp.makeConstraints { make in
make.left.equalTo(-0)
make.right.equalTo(0)
make.top.equalToSuperview()
make.height.equalTo(416.0)
}
leftWheatearImgV.snp.makeConstraints { make in
make.left.equalTo(35)
make.top.equalTo(27)
make.width.equalTo(65)
make.height.equalTo(80)
}
rightWheatearImgV.snp.makeConstraints { make in
make.right.equalTo(-35)
make.top.equalTo(27)
make.width.equalTo(65)
make.height.equalTo(80)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(27)
make.height.equalTo(34)
make.left.equalTo(subTitleLabel)
make.right.equalTo(subTitleLabel)
}
subTitleLabel.snp.makeConstraints { make in
make.left.equalTo(leftWheatearImgV.snp.left).offset(38)
make.right.equalTo(rightWheatearImgV.snp.right).offset(-38)
make.top.equalTo(titleLabel.snp.bottom).offset(8)
}
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_B(ofSize: 24)
label.textColor = .white
label.text = "尊敬的先生"
label.textAlignment = .center
label.lineBreakMode = .byTruncatingMiddle
return label
}()
lazy var subTitleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = .white
label.textAlignment = .center
label.text = "您好,根据您的信息,这是我们为您定制的申请方案,方案详情如下:"
return label
}()
lazy var bottomLogoView: UIView = {
let view = UIView(frame: CGRectMake(0, 0, KScreenWidth, 66+k_Height_safeAreaInsetsBottom()))
let leftImgV = UIImageView(image: UIImage(named: "my_scheme_logo_line_left"))
let rightImgV = UIImageView(image: UIImage(named: "my_scheme_logo_line_right"))
let logoImgV = UIImageView(image: UIImage(named: "my_scheme_logo"))
view.addSubview(leftImgV)
view.addSubview(rightImgV)
view.addSubview(logoImgV)
logoImgV.snp.makeConstraints { make in
make.width.equalTo(90)
make.height.equalTo(17)
make.top.equalTo(32)
make.bottom.equalTo(-16-k_Height_safeAreaInsetsBottom())
make.centerX.equalToSuperview()
}
leftImgV.snp.makeConstraints { make in
make.height.equalTo(2.75)
make.left.equalTo(11)
make.right.equalTo(logoImgV.snp.left).offset(-10)
make.bottom.equalTo(logoImgV.snp.bottom).offset(-3)
}
rightImgV.snp.makeConstraints { make in
make.height.equalTo(2.75)
make.right.equalTo(-11)
make.left.equalTo(logoImgV.snp.right).offset(10)
make.bottom.equalTo(logoImgV.snp.bottom).offset(-3)
}
return view
}()
func goToSchemePage() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") as? Int {
orderId = orderID
}
YHHUD.show(.progress(message: "加载中..."))
viewModel.getMySchemeData(orderId: orderId) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
passArr = self.viewModel.schemeModel.comprehensive_evaluation.filter {
$0.isPass == true
}
if passArr.count >= passMinCount { // 满足至少6项
let vc = YHGCMyNewSchemeViewController()
UIViewController.current?.navigationController?.pushViewController(vc)
} else { // 不满足条件
if self.viewModel.schemeModel.comprehensive_evaluation_selected.count > 0 {
// 进入提升方案界面
let vc1 = YHGCMyNewSchemeViewController()
let vc2 = YHGCImproveSchemeViewController()
vc2.isPass = false
vc2.orderId = orderId
UIViewController.current?.navigationController?.pushViewController(vc1, animated: false)
UIViewController.current?.navigationController?.pushViewController(vc2, animated: false)
} else {
let vc = YHGCMyNewSchemeViewController()
UIViewController.current?.navigationController?.pushViewController(vc)
}
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "我的方案"
gk_navTitleColor = .white
gk_navBarAlpha = 1
gk_navBackgroundImage = UIImage(named: "my_scheme_nav")
gk_backImage = UIImage(named: "back_icon_white")
view.backgroundColor = .init(hex: 0x090B26)
self.view.addSubview(bgView)
self.view.addSubview(tableView)
bgView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(415)
}
tableView.snp.makeConstraints { make in
make.left.equalTo(8.3)
make.right.equalTo(-8.5)
make.bottom.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
}
tableView.reloadData()
requestData()
}
func requestData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") as? Int {
orderId = orderID
}
YHHUD.show(.progress(message: "加载中..."))
viewModel.getMySchemeData(orderId: orderId) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
titleLabel.text = "尊敬的\(viewModel.schemeModel.username)\(viewModel.schemeModel.sex)"
passArr = self.viewModel.schemeModel.comprehensive_evaluation.filter {
$0.isPass == true
}
unpassArr = self.viewModel.schemeModel.comprehensive_evaluation.filter {
$0.isPass == false
}
for item in unpassArr {
if self.viewModel.schemeModel.comprehensive_evaluation_selected.contains(item.standardKey) {
item.is_select = true
} else {
item.is_select = false
}
}
items.removeAll()
// 至少满足6项才通过
isPass = passArr.count >= passMinCount
var arr1 = [YHSchemeItem]()
if passArr.count == 0 { // 一项都不满足 不通过
tipsType = .neverPass
let item1 = YHSchemeItem(type: .evaluate)
let item2 = YHSchemeItem(type: .modifyInfo)
arr1 = [item1, item2]
} else if 1 <= passArr.count, passArr.count < passMinCount { // 不满足至少通过数 不通过
tipsType = .partPass
let item1 = YHSchemeItem(type: .evaluate)
let item2 = YHSchemeItem(type: .hkRequireList)
let item3 = YHSchemeItem(type: .modifyInfo)
arr1 = [item1, item2, item3]
} else if passArr.count >= passMinCount { // 满足至少通过数
tipsType = .pass
let item1 = YHSchemeItem(type: .evaluate)
arr1.append(item1)
let item2 = YHSchemeItem(type: .hkRequireList)
arr1.append(item2)
let item3 = YHSchemeItem(type: .industryLocation)
arr1.append(item3)
let item4 = YHSchemeItem(type: .materialList)
arr1.append(item4)
let item5 = YHSchemeItem(type: .documentList)
arr1.append(item5)
if passArr.count < self.viewModel.schemeModel.comprehensive_evaluation.count { // 不是全满足则显示提升方案
let item6 = YHSchemeItem(type: .improveScheme)
arr1.append(item6)
}
}
items.append(arr1)
if !isPass {
let item11 = YHSchemeItem(type: .improveTarget)
let arr2: [YHSchemeItem] = [item11]
items.append(arr2)
}
self.tableView.reloadData()
self.tableView.isHidden = false
self.bgView.isHidden = false
}
}
func submitTargets() {
let selectTargets: [YHComprehensiveEevaluationModel] = unpassArr.filter {
return $0.is_select
}
let selectKeys: [String] = selectTargets.map {
return $0.standardKey
}
if selectKeys.count <= 0 {
YHHUD.flash(message: "请选择提升目标")
return
}
YHHUD.show(.progress(message: "提交中..."))
viewModel.postSelectImproveTargets(orderId: orderId, targets: selectKeys) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
if success {
let vc = YHGCImproveSchemeViewController()
vc.orderId = orderId
vc.isPass = self.isPass
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
YHHUD.flash(message: error?.errorMsg ?? "提交失败")
}
}
func modifyInfo() {
YHHUD.show(.progress(message: "修改中..."))
viewModel.modifyInfo(orderId: orderId) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
if success {
let vc = YHInformationPerfectListVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
return
}
YHHUD.flash(message: error?.errorMsg ?? "修改失败")
}
}
func getIndustryDetail() -> String {
let target = viewModel.schemeModel.industry_positioning
if target == "15" {
return "其他(\(viewModel.schemeModel.industry_positioning_other))"
}
for(_, item) in YHConstantArrayData.arrSkill.enumerated() {
if target == item["value"] {
return item["title"] ?? ""
}
}
return ""
}
}
extension YHGCMyNewSchemeViewController : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if 0 <= section, section < items.count {
let arr = items[section]
return arr.count
}
return 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if 0 <= indexPath.section, indexPath.section < items.count {
let arr = items[indexPath.section]
var targetCell: UITableViewCell? = nil
if 0 <= indexPath.row && indexPath.row < arr.count {
let item = arr[indexPath.row]
if item.type == .evaluate {
let cell = tableView.dequeueReusableCell(withIdentifier: YHComprehensiveEvaluationCell.cellReuseIdentifier, for: indexPath) as! YHComprehensiveEvaluationCell
cell.tipsType = self.tipsType
targetCell = cell
}
if item.type == .hkRequireList {
let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRequiredItemListCell.cellReuseIdentifier, for: indexPath) as! YHHKRequiredItemListCell
cell.passArr = self.passArr
targetCell = cell
}
if item.type == .industryLocation {
let cell = tableView.dequeueReusableCell(withIdentifier: YHIndustryLocationCell.cellReuseIdentifier, for: indexPath) as! YHIndustryLocationCell
cell.industry = self.getIndustryDetail()
targetCell = cell
}
if item.type == .materialList {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMaterialListCell.cellReuseIdentifier, for: indexPath) as! YHMaterialListCell
cell.rightBtnClick = {
[weak self] in
guard let self = self else { return }
if !self.viewModel.schemeModel.certificate_skip_status {
YHHUD.flash(message: "您的资料清单正在准备中,请耐心等待")
return
}
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let vc = YHGCMineCertificateEntryViewController()
vc.orderId = orderID as? Int ?? 0
UIViewController.current?.navigationController?.pushViewController(vc)
} else {
YHHUD.flash(message: "订单号为空")
}
}
targetCell = cell
}
if item.type == .documentList {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDocumentListCell.cellReuseIdentifier, for: indexPath) as! YHDocumentListCell
cell.rightBtnClick = {
[weak self] in
guard let self = self else { return }
if !self.viewModel.schemeModel.supplement_skip_status {
YHHUD.flash(message: "您的文书正在制作中,请耐心等待")
return
}
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let vc = YHMyDocumentsListViewController()
vc.orderId = orderID as? Int ?? 0
UIViewController.current?.navigationController?.pushViewController(vc)
} else {
YHHUD.flash(message: "订单号为空")
}
}
targetCell = cell
}
if item.type == .improveScheme {
let cell = tableView.dequeueReusableCell(withIdentifier: YHImproveSchemeCell.cellReuseIdentifier, for: indexPath) as! YHImproveSchemeCell
cell.rightBtnClick = {
[weak self] in
guard let self = self else { return }
if !self.viewModel.schemeModel.plan_skip_status {
YHHUD.flash(message: "您的提升方案正在制作中,请耐心等待")
return
}
let vc = YHGCImproveSchemeViewController()
vc.orderId = orderId
vc.isPass = self.isPass
UIViewController.current?.navigationController?.pushViewController(vc)
}
targetCell = cell
}
if item.type == .modifyInfo {
let cell = tableView.dequeueReusableCell(withIdentifier: YHModifySchemeInfoCell.cellReuseIdentifier, for: indexPath) as! YHModifySchemeInfoCell
cell.modifyBlock = {
[weak self] in
guard let self = self else { return }
self.modifyInfo()
}
targetCell = cell
}
if item.type == .improveTarget {
let cell = tableView.dequeueReusableCell(withIdentifier: YHImproveTargetCell.cellReuseIdentifier, for: indexPath) as! YHImproveTargetCell
cell.unpassArr = unpassArr
cell.submitClick = {
[weak self] in
guard let self = self else { return }
self.submitTargets()
}
targetCell = cell
}
if let targetCell = targetCell {
return targetCell
}
}
}
let defaultCell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
return defaultCell
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if 0 <= indexPath.section, indexPath.section < items.count {
let arr = items[indexPath.section]
if 0 <= indexPath.row && indexPath.row < arr.count {
// 最后一个cell切底部圆角
self.createCorner(cell: cell, isLastCell: indexPath.row == arr.count-1)
}
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 12.0
}
func createCorner(cell:UITableViewCell, isLastCell:Bool) {
if (isLastCell) {
let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue)
cell.createCorner(CGSizeMake(6.0, 6.0), corner)
} else {
cell.layer.mask = nil
}
}
}
extension YHGCMyNewSchemeViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let scrollY = scrollView.contentOffset.y
if scrollY >= 0.0 {
bgView.frame.origin.y = k_Height_NavigationtBarAndStatuBar-scrollY
} else {
bgView.frame.origin.y = k_Height_NavigationtBarAndStatuBar
}
}
}
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