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

// 高才

parent de0d8a96
This diff is collapsed.
......@@ -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 {
//高才我的签字
}
......
//
// 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)
}
}
}
}
//
// 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)
}
}
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