Commit 22e0f9ac authored by Steven杜宇's avatar Steven杜宇

// 高才

parent b7352795
......@@ -1132,8 +1132,6 @@
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 */; };
......@@ -2304,8 +2302,6 @@
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>"; };
......@@ -6048,7 +6044,6 @@
04AE200E2D12CFAF00891D24 /* TTPS(高才) */ = {
isa = PBXGroup;
children = (
04AE205B2D19470900891D24 /* MyNewScheme(我的方案) */,
04AE20572D19448800891D24 /* FileList(文件清单) */,
04AE20442D1940C700891D24 /* MyCertificates(我的证书) */,
04AE1FFC2D12CFAF00891D24 /* MyScheme(我的方案) */,
......@@ -6208,23 +6203,6 @@
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 = (
......@@ -7254,7 +7232,6 @@
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 */,
......@@ -7556,7 +7533,6 @@
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,7 +283,6 @@ class YHServiceOrderListViewController: YHBaseViewController {
} else if type == 202 {
//高才我的方案
YHGCMyNewSchemeViewController.shared.goToSchemePage()
} else if type == 203 {
//高才我的证件
......
//
// 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