Commit 065fded0 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '86f29b80' into xiezhaolin

# Conflicts:
#	galaxy/galaxy.xcodeproj/project.pbxproj
#	galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/VM/YHServiceCenterMainViewModel.swift
#	galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
parents 1c868ef2 86f29b80
This diff is collapsed.
......@@ -46,14 +46,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// YHAnalytics.analyticsStart(launchOptions: launchOptions)
// var i = 0
// for family: String in UIFont.familyNames {
// print("\(i)---项目字体---\(family)")
// for names: String in UIFont.fontNames(forFamilyName: family) {
// print("== \(names)")
// }
// i += 1
// }
// var i = 0
// for family: String in UIFont.familyNames {
// print("\(i)---项目字体---\(family)")
// for names: String in UIFont.fontNames(forFamilyName: family) {
// print("== \(names)")
// }
// i += 1
// }
return true
}
......@@ -81,13 +81,11 @@ extension AppDelegate {
//1.数据解析
#if DEBUG
// SmartConfig.debugMode = .verbose
SmartConfig.debugMode = .none //for test hjl
SmartConfig.debugMode = .none
#else
SmartConfig.debugMode = .none
#endif
//2.bugly参数设置
#if DEBUG
Bugly.start(withAppId: "3b10faa43e")
......@@ -133,17 +131,14 @@ extension AppDelegate {
private func setupRootVC() {
let tabBarController = YHTabBarViewController()
let v0 = YHNavigationController(rootVC:YHHomeViewController())
// let v0 = YHNavigationController(rootVC:YHPersonInformMainViewController())//for test hjl
let v1 = YHNavigationController(rootVC:YHServiceCenterMainViewController())
let v2 = YHNavigationController(rootVC:YHMyViewController())
v0.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "首页", image: UIImage(named: "photo"), selectedImage: UIImage(named: "photo_1"))
v1.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "服务中心", image: UIImage(named: "home"), selectedImage: UIImage(named: "home_1"))
v2.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "我的", image: UIImage(named: "find"), selectedImage: UIImage(named: "find_1"))
tabBarController.viewControllers = [v0,v1,v2]
// tabBarController.viewControllers = [v1,v2] for test hjl 配合测试同学做自动化测试 Moon 2023.03.12
// tabBarController.viewControllers = [v0,v1,v2]
tabBarController.viewControllers = [v1,v2] //for test hjl 配合测试同学做自动化测试 Moon 2023.03.12
tabBarController.tabBar.backgroundColor = .white
window = UIWindow(frame: UIScreen.main.bounds)
......
......@@ -8,12 +8,16 @@
import UIKit
import Alamofire
import SmartCodable
class YHBaseViewModel {
// 上传方法
func uploadImage(_ image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let size = imageSize(image: image)
YHHUD.flash(message: "\(size/1000)KB")
#if DEBUG
let size = image.imageSize()
YHHUD.flash(message: "\(Float(size/1024/1024))M")
#endif
let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.uploadApi
let boundary = UUID().uuidString
let headers: HTTPHeaders = [
......@@ -68,16 +72,4 @@ class YHBaseViewModel {
callBackBlock(nil,err)
}
}
func imageSize(image: UIImage) -> Int {
// 如果是JPEG格式,可以调整压缩质量来影响文件大小
if let jpegData = image.jpegData(compressionQuality: 1.0) {
return jpegData.count
}
// 如果是PNG格式
if let pngData = image.pngData() {
return pngData.count
}
return 0 // 如果转换失败,返回0
}
}
......@@ -137,13 +137,6 @@ class YHHomeViewController: YHBaseViewController {
//1.UI
initView()
//2.网络请求
// requestData()
//for test hjl
// testModelParse()//for test hjl 添加 数据类型 转换
}
......@@ -272,11 +265,11 @@ extension YHHomeViewController {
self.homeTableView.es.addPullToRefresh {
self.loadFirstItem()//for test hjl
self.loadFirstItem()
}
self.homeTableView.es.startPullToRefresh()
self.homeTableView.es.addInfiniteScrolling {
self.loadFakeData()//for test hjl
self.loadFakeData()
}
}
......@@ -312,9 +305,7 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource {
if section == 0 {
return 6
}
return 1//for test hjl
// return 0 //for test hjl
return 1
}
......
......@@ -444,7 +444,8 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource
let vc = YHOtherInfoFillViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
} else {
}
else {
}
}
......
......@@ -174,8 +174,10 @@ extension YHServiceCenterSecondViewController : UITableViewDelegate,UITableViewD
let vc = YHInformationPerfectListVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
} else if model.type == 2 {
YHHUD.flash(message: "下个版本完善")
} else if model.type == 2 {
let vc = YHMineCertificateEntryViewController()
navigationController?.pushViewController(vc)
} else if model.type == 3 {
let vc = YHScoreDetailViewController()
vc.orderId = orderId
......@@ -190,7 +192,11 @@ extension YHServiceCenterSecondViewController : UITableViewDelegate,UITableViewD
let vc = YHMySignatureListViewController()
vc.orderId = orderId ?? 0
navigationController?.pushViewController(vc)
} else {
} else if model.type == 6 {
let vc = YHMineSchemeViewController()
navigationController?.pushViewController(vc)
}
else {
}
}
......
......@@ -27,6 +27,14 @@ class YHContactMainItemStatusModel {
} else if type == 5 {
iconName = "service_center_sfsq_wdpf_icon"
itemName = "我的签字"
} else if type == 6 {
iconName = "service_center_sfsq_wdpf_icon"
itemName = "我的方案"
} else {
iconName = "service_center_sfsq_wdpf_icon"
itemName = "--"
}
}
}
......
......@@ -7,6 +7,9 @@
//
import UIKit
import JXSegmentedView
import UniformTypeIdentifiers
import IQKeyboardManagerSwift
class YHCertificateResourceUploadVC: YHBaseViewController {
......@@ -31,45 +34,18 @@ class YHCertificateResourceUploadVC: YHBaseViewController {
return tableView
}()
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))
return bar
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
self.gk_navTitle = "资料上传"
self.gk_navigationBar.backgroundColor = .white
self.gk_navigationBar.isHidden = true
createUI()
}
func createUI() {
view.addSubview(tableView)
view.addSubview(searchView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
}
searchView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(YHCertificateSearchBar.height+32)
make.top.left.right.equalToSuperview()
make.height.equalTo(KScreenHeight - k_Height_NavigationtBarAndStatuBar - YHMaterialListViewController.segmentHeight)
}
}
}
......@@ -97,6 +73,22 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// if true {
//
// selectUploadFileFromICouldDrive()
// return
// }
if true {
YHCertificateUploadSheetView.sheetView.show {
[weak self] actionType in
guard let self = self else { return }
print("%d", actionType.rawValue)
}
return
}
YHCertificateFilterView.sheetView.show()
return
......@@ -123,3 +115,10 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
return UIView()
}
}
// MARK: - JXSegmentedListContainerViewListDelegate
extension YHCertificateResourceUploadVC: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
//
// YHFileListVC.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
/*
文件清单
*/
class YHFileListViewController: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
//
// 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 YHCertificateCategoryItem {
var type : YHCertificateUploadStatus = .unknown
var title : String = ""
}
class YHMaterialListViewController: YHBaseViewController {
static let segmentHeight = 53.0
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
bar.title = "资料上传".local
bar.showLeftSecondButtonType(.search)
bar.backBlock = {
self.navigationController?.popViewController(animated: true)
}
bar.leftSecondBtnClick = {
print("点击搜索")
}
return bar
}()
let categoryItems = ["全部".local, "待上传".local, "已驳回".local, "审核中".local, "已通过".local]
var itemVCs:[YHCertificateResourceUploadVC] = []
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.indicatorColor = .brandMainColor
segview.indicators = [indicator]
segview.backgroundColor = .clear
segview.listContainer = listContainerView
return segview
}()
lazy var segmentedDataSource: JXSegmentedBaseDataSource = {
let dataSource = JXSegmentedTitleDataSource()
dataSource.isTitleColorGradientEnabled = true
dataSource.titles = categoryItems
dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 14)
dataSource.titleNormalColor = .labelTextColor2
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 16)
dataSource.titleSelectedColor = .brandMainColor
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 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))
return bar
}()
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navigationBar.isHidden = true
for _ in categoryItems {
let vc = YHCertificateResourceUploadVC()
itemVCs.append(vc)
}
view.addSubview(navBar)
view.addSubview(segmentedView)
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)
}
segmentedView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(Self.segmentHeight)
}
listContainerView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(segmentedView.snp.bottom)
make.bottom.equalToSuperview()
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//处于第一个item的时候,才允许屏幕边缘手势返回
navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
//离开页面的时候,需要恢复屏幕边缘手势,不能影响其他页面
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
}
extension YHMaterialListViewController: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
NotificationCenter.default.post(name: Notification.Name(rawValue: "scrollViewDidEndDragging"), object: nil)
}
/// 正在滚动中的回调
///
/// - Parameters:
/// - segmentedView: JXSegmentedView
/// - leftIndex: 正在滚动中,相对位置处于左边的index
/// - rightIndex: 正在滚动中,相对位置处于右边的index
/// - percent: 从左往右计算的百分比
func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
NotificationCenter.default.post(name: Notification.Name(rawValue: "scrollViewWillBeginDragging"), object: nil)
}
}
extension YHMaterialListViewController: 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]
}
}
//
// YHMainCertificateEntryVC.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
/*
我的证件 主入口页
*/
class YHMineCertificateEntryViewController: YHBaseViewController {
private let certificateReqVM : YHCertificateViewModel = YHCertificateViewModel()
private lazy var topBkg : UIView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "service_center_head_bkg")
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 YHMineCertificateEntryViewController {
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let param = ["order_id":orderID,"node":"1","state":"1"]
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()
}
} else {
printLog("error : orderID 为空")
}
}
func setupUI() {
gk_navTitle = "我的证件"
gk_navBarAlpha = 1.0
view.addSubview(topBkg)
topBkg.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(216)
}
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)
}
homeTableView.delegate = self
homeTableView.dataSource = self
bottomView.block = { flag in
if flag == 0 {
//问题答疑
let vc = YHQuestionAndAnswerViewController()
self.navigationController?.pushViewController(vc)
} else {
//生成清单
}
}
}
}
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHMineCertificateEntryViewController : UITableViewDelegate,UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
// guard let model = certificateReqVM.certificateEntryModel else { return 0 }
// return model.category_data.count
return 3
}
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
// if indexPath.section < self.serviceCenterMainReqVM.arrContactList.count {
// cell0.dataModel = self.serviceCenterMainReqVM.arrContactList[indexPath.section]
// }
return cell0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.section)")
// //获取订单号
// let orderId = serviceCenterMainReqVM.arrContactList[indexPath.section].id
// UserDefaults.standard.set(orderId, forKey: "orderIdForPreview")
// UserDefaults.standard.synchronize()
//
// let vc = YHServiceCenterSecondViewController()
// vc.orderId = orderId
// self.navigationController?.pushViewController(vc)
}
}
//
// YHMineSchemeVC.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
/*
我的方案
*/
class YHMineSchemeViewController: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
//
// YHQuestionAndAnswerViewController.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
/*
问题答疑列表
*/
class YHQuestionAndAnswerViewController: YHBaseViewController {
private let certificateReqVM : YHCertificateViewModel = YHCertificateViewModel()
private lazy var topBkg : UIView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "service_center_head_bkg")
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(YHQuestionAndAnswerCell.self,forCellReuseIdentifier: YHQuestionAndAnswerCell.cellReuseIdentifier)
return tableView
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
}
}
extension YHQuestionAndAnswerViewController {
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let param = ["order_id":orderID,"node":"1","state":"1"]
certificateReqVM.getQuestionAndAnserList(params: param) { success, error in
if success == true {
} else {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
self.homeTableView.reloadData()
}
} else {
printLog("error : orderID 为空")
}
}
func setupUI() {
gk_navTitle = "问题答疑"
gk_navBarAlpha = 1.0
view.addSubview(homeTableView)
homeTableView.snp.makeConstraints { make in
make.edges.equalTo(0)
}
homeTableView.delegate = self
homeTableView.dataSource = self
}
}
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHQuestionAndAnswerViewController : UITableViewDelegate,UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return certificateReqVM.arrQuestionAndAnswer.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 UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell0 = tableView.dequeueReusableCell(withClass: YHQuestionAndAnswerCell.self)
cell0.selectionStyle = .none
if indexPath.row < certificateReqVM.arrQuestionAndAnswer.count {
cell0.dataModel = certificateReqVM.arrQuestionAndAnswer[indexPath.row]
}
return cell0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.section)")
}
}
//
// YHCertificateEntryModel.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHCertificateEntryModel: SmartCodable {
var pass_num : Int = 0 //通过
var reject_num : Int = 0 //驳回
var to_be_audit_num : Int = 0 //待审核
var to_be_submit_num : Int = 0 //待提交
var category_data : [YHCategoryData] = []
required init() {
}
}
//
// YHCertificateModel.swift
// galaxy
//
// Created by edy on 2024/3/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHUploadCertificateInfo: SmartCodable {
var categoryData: YHCategoryData = YHCategoryData()
var supplementList: [YHSupplementInfo] = []
enum CodingKeys: String, CodingKey {
case categoryData = "category_data"
case supplementList = "supplement_list"
}
required init() {
}
init(categoryData: YHCategoryData, supplementList: [YHSupplementInfo]) {
self.categoryData = categoryData
self.supplementList = supplementList
}
}
// MARK: - YHCategoryData
class YHCategoryData: SmartCodable {
var applicantName: String = ""
var categoryId: Int = 0
var checkStatus: Int = 0
enum CodingKeys: String, CodingKey {
case applicantName = "applicant_name"
case categoryId = "category_id"
case checkStatus = "check_status"
}
required init() {
}
init(applicantName: String = "", categoryId: Int = 0, checkStatus: Int = 0) {
self.applicantName = applicantName
self.categoryId = categoryId
self.checkStatus = checkStatus
}
}
// MARK: - YHSupplementList
class YHSupplementInfo: SmartCodable {
var id: Int = 0
var name: String = ""
var typeName: String = ""
var checkStatus: Int = 0
var templateCateName: String = ""
var templateCateShortName: String = ""
var templateCateShortColor: String = ""
var applicantName: String = ""
var nameExtra: YHNameExtra = YHNameExtra()
var templateInfo: YHTemplateInfo = YHTemplateInfo()
var contentUrl: [YHContentUrl] = []
enum CodingKeys: String, CodingKey {
case id = "id"
case name = "name"
case typeName = "type_name"
case checkStatus = "check_status"
case templateCateName = "template_cate_name"
case templateCateShortName = "template_cate_short_name"
case templateCateShortColor = "template_cate_short_color"
case applicantName = "applicant_name"
case nameExtra = "name_extra"
case templateInfo = "template_info"
case contentUrl = "content_url"
}
required init() {
}
init(id: Int = 0, name: String = "", typeName: String = "", checkStatus: Int = 0, templateCateName: String = "", templateCateShortName: String = "", templateCateShortColor: String = "", applicantName: String = "", nameExtra: YHNameExtra = YHNameExtra(), templateInfo: YHTemplateInfo = YHTemplateInfo(), contentUrl: [YHContentUrl] = []) {
self.id = id
self.name = name
self.typeName = typeName
self.checkStatus = checkStatus
self.templateCateName = templateCateName
self.templateCateShortName = templateCateShortName
self.templateCateShortColor = templateCateShortColor
self.applicantName = applicantName
self.nameExtra = nameExtra
self.templateInfo = templateInfo
self.contentUrl = contentUrl
}
}
// MARK: - YHContentUrl
class YHContentUrl: SmartCodable {
var url: String = ""
var name: String = ""
var type: Int = 0
var recognitionType: Int = 0
var suffix: String = ""
var updatedAt: String = ""
enum CodingKeys: String, CodingKey {
case url = "url"
case name = "name"
case type = "type"
case recognitionType = "recognition_type"
case suffix = "suffix"
case updatedAt = "updated_at"
}
required init() {
}
init(url: String = "", name: String = "", type: Int = 0, recognitionType: Int = 0, suffix: String = "", updatedAt: String = "") {
self.url = url
self.name = name
self.type = type
self.recognitionType = recognitionType
self.suffix = suffix
self.updatedAt = updatedAt
}
}
// MARK: - YHNameExtra
class YHNameExtra: SmartCodable {
var applicant: String = ""
var userName: String = ""
var organization: String = ""
enum CodingKeys: String, CodingKey {
case applicant = "applicant"
case userName = "userName"
case organization = "organization"
}
required init() {
}
init(applicant: String = "", userName: String = "", organization: String = "") {
self.applicant = applicant
self.userName = userName
self.organization = organization
}
}
// MARK: - YHTemplateInfo
class YHTemplateInfo: SmartCodable {
var id: Int = 0
var name: String = ""
var description: String = ""
var materialPath: [YHMaterialPath] = []
required init() {
}
enum CodingKeys: String, CodingKey {
case id = "id"
case name = "name"
case description = "description"
case materialPath = "material_path"
}
init(id: Int = 0, name: String = "", description: String = "", materialPath: [YHMaterialPath] = []) {
self.id = id
self.name = name
self.description = description
self.materialPath = materialPath
}
}
// MARK: - YHMaterialPath
class YHMaterialPath: SmartCodable {
var name: String = ""
var url: String = ""
enum CodingKeys: String, CodingKey {
case name = "name"
case url = "url"
}
required init() {
}
init(name: String = "", url: String = "") {
self.name = name
self.url = url
}
}
//
// YHQuestionAndAnswerModel.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHQuestionAndAnswerModel: SmartCodable {
var index : Int = 0 //通过
var question : String = ""
var answer : String = ""
required init() {
}
}
//
// YHCertificateEntryBottomView.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateEntryBottomView: UIView {
static let viewH : CGFloat = 92.0
override init(frame: CGRect) {
super.init(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: YHBasicInfoFillBottomView.viewH))
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
typealias Block = (Int) -> ()
var block: Block?
var saveButton: UIButton!
var nextButton: UIButton!
}
private extension YHCertificateEntryBottomView {
func setupUI() {
backgroundColor = .white
saveButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.contentBkgColor
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.contentHorizontalAlignment = .center
button.setTitle("问题答疑", for: .normal)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.layer.cornerRadius = kCornerRadius6
button.addTarget(self, action: #selector(save), for: .touchUpInside)
return button
}()
addSubview(saveButton)
saveButton.snp.makeConstraints { make in
make.left.equalTo(kMargin)
make.top.equalTo(12)
make.height.equalTo(44)
make.width.equalTo(86)
}
nextButton = {
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 = kCornerRadius6
button.clipsToBounds = true
button.addTarget(self, action: #selector(submit), for: .touchUpInside)
return button
}()
addSubview(nextButton)
nextButton.snp.makeConstraints { make in
make.right.equalTo(-kMargin)
make.top.equalTo(12)
make.height.equalTo(44)
make.left.equalTo(saveButton.snp.right).offset(10)
}
nextButton.layoutIfNeeded()
nextButton.addYinHeGradualLayer()
}
@objc func save() {
block?(0)
}
@objc func submit() {
block?(1)
}
}
//
// YHCertificateEntryCell.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateEntryCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateEntryCell"
static let cellH : CGFloat = 68.0
var dataModel : YHCategoryData? {
didSet {
updateUI()
}
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
lazy var contractNameLable = {
let lable = UILabel()
lable.textColor = UIColor.mainTextColor
lable.font = UIFont.PFSC_M(ofSize: 16)
lable.text = "主申请人(张三)"
return lable
}()
lazy var contractIdLable = {
let lable = UILabel()
lable.textColor = UIColor.labelTextColor2
lable.font = UIFont.PFSC_R(ofSize: 14)
lable.text = "已完成"
lable.textAlignment = .right
return lable
}()
}
extension YHCertificateEntryCell {
func updateUI() {
guard let dataModel = dataModel else { return }
contractNameLable.text = dataModel.applicantName
contractIdLable.text = String(dataModel.checkStatus)
}
func setupUI() {
let holdView = UIView()
holdView.backgroundColor = .white
holdView.layer.cornerRadius = kCornerRadius6
holdView.clipsToBounds = true
backgroundColor = .clear
contentView.backgroundColor = .clear
contentView.addSubview(holdView)
holdView.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalTo(kMargin)
make.right.equalTo(-kMargin)
}
let nextImgV = UIImageView()
nextImgV.image = UIImage(named: "service_center_right_next_icon")
nextImgV.contentMode = .scaleAspectFill
holdView.addSubview(nextImgV)
nextImgV.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(-26)
make.width.height.equalTo(kMargin)
}
holdView.addSubview(contractIdLable)
contractIdLable.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(nextImgV.snp.left).offset(-2)
make.width.equalTo(50)
make.height.equalTo(20)
}
holdView.addSubview(contractNameLable)
contractNameLable.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(21)
make.right.equalTo(contractIdLable.snp.left).offset(-10)
make.height.equalTo(24)
}
}
}
//
// YHCertificateEntryHeadView.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHCertificateEntryHeadView: UIView {
static let viewH : CGFloat = 77.0 + 17.0
var dataModel : YHCertificateEntryModel? {
didSet {
updateUI()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
initView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private lazy var nameLable : UILabel = {
let titleLable = UILabel(text: "您好,李先生")
titleLable.font = UIFont.PFSC_B(ofSize: 21)
titleLable.textColor = UIColor.mainTextColor
return titleLable
}()
private lazy var statiticLable : UILabel = {
let titleLable = UILabel(text: "待上传2件,已驳回3件,审核中4件,已通过10件")
titleLable.font = UIFont.PFSC_R(ofSize: 13)
titleLable.textColor = UIColor.mainTextColor
return titleLable
}()
}
private extension YHCertificateEntryHeadView {
func initView() {
addSubview(nameLable)
nameLable.snp.makeConstraints { make in
make.top.equalTo(21)
make.height.equalTo(30)
make.left.equalTo(21)
make.right.equalTo(-21)
}
addSubview(statiticLable)
statiticLable.snp.makeConstraints { make in
make.top.equalTo(nameLable.snp.bottom).offset(6)
make.height.equalTo(20)
make.left.equalTo(nameLable.snp.left)
make.right.equalTo(nameLable.snp.right)
}
let a: ASAttributedString = .init("待上传", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let aa: ASAttributedString = .init("0", .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let b: ASAttributedString = .init("件,已驳回", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("0", .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let c: ASAttributedString = .init("件,审核中", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let cc: ASAttributedString = .init("0", .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let d: ASAttributedString = .init("件,已通过", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let dd: ASAttributedString = .init("0", .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let e: ASAttributedString = .init("件", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
statiticLable.attributed.text = a + aa + b + bb + c + cc + d + dd + e
}
func updateUI() {
}
}
......@@ -9,10 +9,20 @@
import UIKit
import AttributedString
enum YHCertificateUploadStatus : Int {
case unknown = 0
case preUpload = 1
case review = 2
case rejected = 3
case finish = 4
}
class YHCertificateInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateNameCell"
var status : YHCertificateUploadStatus = .unknown
var whiteView: UIView!
var nameTextView: UITextView!
var infoLabel: UILabel!
......@@ -40,6 +50,21 @@ class YHCertificateInfoCell: UITableViewCell {
setupUI()
}
func update() {
var titleColor: UIColor = .labelTextColor2
switch status {
case .preUpload:
titleColor = .brandMainColor
case .rejected:
titleColor = .failColor
case .review, .finish:
titleColor = .labelTextColor2
case .unknown:
titleColor = .labelTextColor2
}
}
func setupUI() {
self.selectionStyle = .none
......
......@@ -17,6 +17,7 @@
*/
import UIKit
import Photos
enum YHCertificateUploadType: Int {
......@@ -182,6 +183,7 @@ class YHCertificateUploadSheetView: UIView {
static let sheetView = YHCertificateUploadSheetView(frame:UIScreen.main.bounds)
var action:((YHCertificateUploadType)->())?
lazy var blackMaskView: UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
......@@ -259,6 +261,32 @@ class YHCertificateUploadSheetView: UIView {
return view
}()
lazy var documentPickerVC: UIDocumentPickerViewController = {
let docTypes = [ "public.image",
"com.adobe.pdf",
"com.microsoft.word.doc",
"org.openxmlformats.wordprocessingml.document",
"com.microsoft.powerpoint.ppt",
"org.openxmlformats.presentationml.presentation",]
if #available(iOS 14.0, *) {
var arr:[UTType] = []
for docStr in docTypes {
if let type = UTType(docStr) {
arr.append(type)
}
}
let docPickerVC = UIDocumentPickerViewController(forOpeningContentTypes: arr)
docPickerVC.delegate = self
return docPickerVC
}
let docPickerVC = UIDocumentPickerViewController(documentTypes: docTypes, in: .open)
docPickerVC.delegate = self
return docPickerVC
}()
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
......@@ -345,9 +373,140 @@ extension YHCertificateUploadSheetView {
if let targetView = sender.view {
let tag = targetView.tag
if let type = YHCertificateUploadType(rawValue:tag), let action = action {
action(type)
if type == .photo {
selectPhoto()
} else if type == .camera {
takePhoto()
} else if type == .phoneFile {
selectFile()
}
}
}
}
}
extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINavigationControllerDelegate) {
private func getPhotoLibraryAuthorization() -> Bool {
let authorizationStatus = PHPhotoLibrary.authorizationStatus()
switch authorizationStatus {
case .authorized:
print("已经授权")
return true
case .notDetermined:
print("不确定是否授权")
// 请求授权
PHPhotoLibrary.requestAuthorization({ (status) in })
case .denied:
print("拒绝授权")
case .restricted:
print("限制授权")
break
case .limited: break
@unknown default:
break
}
return false
}
func takePhoto() {
guard getPhotoLibraryAuthorization() else { return }
if UIImagePickerController.isSourceTypeAvailable(.camera){
//创建图片控制器
let imagePicker = UIImagePickerController()
//设置代理
imagePicker.delegate = self
//设置来源
imagePicker.sourceType = .camera
//打开相机
UIViewController.current?.present(imagePicker, animated: true, completion: { () -> Void in
})
} else {
printLog("找不到相机")
}
}
func selectPhoto() {
guard getPhotoLibraryAuthorization() else { return }
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .photoLibrary
// 这一句,开始调用图库
UIViewController.current?.present(imagePicker,animated: true)
}
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
// if let block = backImage {
// block(image)
self.dismiss()
// }
} else {
printLog("pick image wrong")
}
// 收回图库选择界面
picker.dismiss(animated: true, completion: nil)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
}
}
extension YHCertificateUploadSheetView: UIDocumentPickerDelegate {
func selectFile() {
UIViewController.current?.present(documentPickerVC, animated: true, completion: nil)
}
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
guard let url = urls.first, let fileName = url.lastPathComponent.removingPercentEncoding else {
return
}
print("\(url)")
// 读取文件数据
// 获取授权
let fileUrlAuthozied = url.startAccessingSecurityScopedResource()
if fileUrlAuthozied {
// 通过文件协调工具来得到新的文件地址,以此得到文件保护功能
let fileCoordinator = NSFileCoordinator()
var error: NSError?
fileCoordinator.coordinate(readingItemAt: url, options:[.forUploading], error: &error) {
newFileUrl in
if let fileData = try? Data(contentsOf: newFileUrl) {
// 将文件数据上传到服务器
uploadFile(fileData)
dismiss()
}
}
url.stopAccessingSecurityScopedResource()
if let error = error {
}
} else {
print("授权失败")
dismiss()
}
}
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
}
func uploadFile(_ data: Data) {
let format = String(format: "%.2fM", Double(data.count)/(1024.0 * 1024.0))
print("\(format)")
}
}
//
// YHCustomNavigationBar.swift
// galaxy
//
// Created by edy on 2024/3/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHNavLeftSecondBtnType: Int {
case none = 0
case search = 1
}
class YHCustomNavigationBar: UIView {
static let searchLeftIcon = ""
var title: String? {
didSet {
titleLabel.text = title
}
}
var backBlock:(()->())?
var leftSecondBtnClick:(()->())?
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .navTitleColor
label.textAlignment = .center
label.font = UIFont.PFSC_M(ofSize:17)
label.text = "默认标题"
return label
}()
private lazy var backButton: UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "nav_back_icon"), for: .normal)
btn.addTarget(self, action: #selector(didBackBtnClicked), for: .touchUpInside)
return btn
}()
private lazy var leftSecondButton: UIButton = {
let btn = UIButton()
btn.addTarget(self, action: #selector(didleftSecondButtonClicked), for: .touchUpInside)
return btn
}()
static func navBar()-> YHCustomNavigationBar {
let bar = YHCustomNavigationBar(frame:CGRect(x: 0, y: 0, width: KScreenWidth, height: k_Height_NavContentBar))
return bar
}
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func showLeftSecondButtonType(_ type: YHNavLeftSecondBtnType) {
if type == .search {
leftSecondButton.setImage(UIImage(named: "nav_search_icon"), for: .normal)
}
}
func createUI() {
self.addSubview(titleLabel)
self.addSubview(backButton)
self.addSubview(leftSecondButton)
titleLabel.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
backButton.snp.makeConstraints { make in
make.width.height.equalTo(30)
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(12)
}
leftSecondButton.snp.makeConstraints { make in
make.width.height.equalTo(30)
make.centerY.equalToSuperview()
make.left.equalTo(backButton.snp.right).offset(5)
}
}
}
extension YHCustomNavigationBar {
@objc func didBackBtnClicked() {
if let backBlock = backBlock {
backBlock()
}
}
@objc func didleftSecondButtonClicked() {
if let leftSecondBtnClick = leftSecondBtnClick {
leftSecondBtnClick()
}
}
}
//
// YHQuestionAndAnswerCell.swift
// galaxy
//
// Created by davidhuangA on 2024/3/17.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHQuestionAndAnswerCell: UITableViewCell {
static let cellReuseIdentifier = "YHQuestionAndAnswerCell"
var dataModel : YHQuestionAndAnswerModel? {
didSet {
updateUI()
}
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
lazy var contractNameLable = {
let lable = UILabel()
lable.textColor = UIColor.mainTextColor
lable.font = UIFont.PFSC_M(ofSize: 16)
lable.text = "--"
lable.numberOfLines = 0
lable.lineBreakMode = .byCharWrapping
return lable
}()
lazy var contractIdLable = {
let lable = UILabel()
lable.textColor = UIColor.labelTextColor2
lable.font = UIFont.PFSC_R(ofSize: 14)
lable.text = "--"
lable.numberOfLines = 0
lable.lineBreakMode = .byCharWrapping
return lable
}()
}
extension YHQuestionAndAnswerCell {
func updateUI() {
guard let dataModel = dataModel else { return }
contractNameLable.text = dataModel.question
contractIdLable.text = dataModel.answer
}
func setupUI() {
let holdView = UIView()
holdView.backgroundColor = .white
holdView.layer.cornerRadius = kCornerRadius6
holdView.clipsToBounds = true
backgroundColor = .clear
contentView.backgroundColor = .clear
contentView.addSubview(holdView)
holdView.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalTo(kMargin)
make.right.equalTo(-kMargin)
}
holdView.addSubview(contractNameLable)
contractNameLable.snp.makeConstraints { make in
make.top.equalToSuperview().offset(kMargin)
make.left.equalToSuperview().offset(44)
make.right.equalTo(-kMargin)
}
let nextImgV = UIImageView()
nextImgV.image = UIImage(named: "my_cer_question_icon")
nextImgV.contentMode = .scaleAspectFill
holdView.addSubview(nextImgV)
nextImgV.snp.makeConstraints { make in
make.top.equalTo(contractNameLable.snp.top)
make.left.equalTo(kMargin)
make.width.height.equalTo(21)
}
holdView.addSubview(contractIdLable)
contractIdLable.snp.makeConstraints { make in
make.top.equalTo(contractNameLable.snp.bottom).offset(12)
make.right.equalTo(-kMargin)
make.left.equalTo(kMargin)
make.height.greaterThanOrEqualTo(20)
make.bottom.equalTo(-kMargin)
}
}
}
//
// YHCertificateViewModel.swift
// galaxy
//
// Created by edy on 2024/3/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHCertificateViewModel: YHBaseViewModel {
var certificateEntryModel : YHCertificateEntryModel?
var arrQuestionAndAnswer : [YHQuestionAndAnswerModel?] = []
//获取问答列表
func getQuestionAndAnserList( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.questionAndAnswerApi
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data
guard let resultModel = [YHQuestionAndAnswerModel].deserialize(array: dic as? [Any]) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,err)
return
}
self.arrQuestionAndAnswer = resultModel
callBackBlock(true,nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
//我的证件 状态数据统计
func getCertificateStatisticData( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.statisticApi
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data
guard let resultModel = YHCertificateEntryModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,err)
return
}
self.certificateEntryModel = resultModel
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
func getUploadCertificateList(isSilient:Bool = false, callBack:@escaping (_ listInfo: YHUploadCertificateInfo?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
if !isSilient {
YHHUD.show(.progress(message: "数据加载中..."))
}
let params = ["id": 0]
let _ = YHNetRequest.getRequest(url: strUrl, params:params) { json, code in
if !isSilient {
YHHUD.hide()
}
printLog("model 是 ==> \(json)")
let dic = json.data
if code == NetWorkCode.success.rawValue {
guard let result = YHUploadCertificateInfo.deserialize(dict: dic as? Dictionary ) else {
callBack(nil, YHErrorModel(errorCode:Int32(json.code), errorMsg:"解析失败".local))
return
}
callBack(result, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBack(nil, error)
}
} failBlock: { err in
callBack(nil, err)
}
}
}
......@@ -255,7 +255,7 @@ extension YHFamilyMemberInfoListVC {
"step":0,
"next":false,
"info":["subset_name":"",
"not_fill_num":"",
"not_fill_number":-1,
"follow":0]]
self.familyRequest.addOrSaveFamilyMember(params: dict) { [weak self] success, error in
......@@ -376,6 +376,7 @@ extension YHFamilyMemberInfoListVC : UITableViewDelegate, UITableViewDataSource
let detailItem = item as! YHFamilyMember
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.isNeedTopLineNoGap = (indexPath.row == 1)
cell.title = detailItem.getTitle()
// cell.detailLabel.textColor = (isNeedShowError && detailItem.notFillNumber != 0 ? .failColor : .labelTextColor2)
......@@ -498,6 +499,23 @@ extension YHFamilyMemberInfoListVC : UITableViewDelegate, UITableViewDataSource
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = formItem.getTitle()
cell.isNeedTopLineNoGap = true
if formItem.type == .addChild {
var hiddenTopLine = false
if let childs = familyMemberInfo?.child, !childs.isEmpty {
hiddenTopLine = true
}
cell.isHiddenTopLine = hiddenTopLine
} else if formItem.type == .addBrother {
var hiddenTopLine = false
if let brothers = familyMemberInfo?.brother, !brothers.isEmpty {
hiddenTopLine = true
}
cell.isHiddenTopLine = hiddenTopLine
}
cell.clickBlock = { [weak self] in
guard let self = self else { return }
if formItem.type == .addBrother {
......
......@@ -14,6 +14,8 @@ class YHFormItemAddCell: UITableViewCell {
let btnTitleColor:UIColor = .brandMainColor
let cornerRadius = 4.0
let horizonalGap = 18.0
let btnSize = CGSize(width: (KScreenWidth-(18+16)*2), height: 44)
var clickBlock:(()->Void)?
......@@ -35,6 +37,32 @@ class YHFormItemAddCell: UITableViewCell {
return btn
}()
private lazy var topLine:UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
view.isHidden = true
return view
}()
var isNeedTopLineNoGap:Bool = false {
didSet {
let margin = isNeedTopLineNoGap ? 0 : horizonalGap
topLine.snp.updateConstraints { make in
make.left.equalToSuperview().offset(margin)
make.right.equalToSuperview().offset(-margin)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
// 是否隐藏顶部分割线
var isHiddenTopLine:Bool = true {
didSet {
topLine.isHidden = isHiddenTopLine
}
}
lazy var dotLineLayer:CAShapeLayer = {
let borderLayer = CAShapeLayer()
......@@ -67,13 +95,21 @@ class YHFormItemAddCell: UITableViewCell {
contentView.addSubview(addBtn)
addBtn.layer.addSublayer(dotLineLayer)
contentView.addSubview(topLine)
addBtn.snp.makeConstraints { make in
make.top.equalToSuperview().offset(18)
make.bottom.equalToSuperview().offset(-18)
make.top.equalToSuperview().offset(horizonalGap)
make.bottom.equalToSuperview().offset(-horizonalGap)
make.size.equalTo(btnSize)
make.centerX.equalToSuperview()
}
topLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.height.equalTo(1.0)
make.top.equalToSuperview()
}
}
@objc func didClickAddBtn() {
......
......@@ -52,6 +52,18 @@ class YHFormItemEnterDetailCell: UITableViewCell {
}
}
}
var isNeedTopLineNoGap:Bool = false {
didSet {
let margin = isNeedTopLineNoGap ? 0 : horizonalGap
topLine.snp.updateConstraints { make in
make.left.equalToSuperview().offset(margin)
make.right.equalToSuperview().offset(-margin)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
private lazy var titleLabel: UILabel = {
let label = UILabel()
......
......@@ -133,11 +133,12 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
}()
view.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalTo(view)
make.left.right.bottom.equalToSuperview()
make.height.equalTo(k_Height_safeAreaInsetsBottom() + 64)
}
bottomView.layoutIfNeeded()
bottomView.nextButton.addYinHeGradualLayer()
}
}
extension YHMainApplicantInformationViewController: UITableViewDelegate, UITableViewDataSource {
......
......@@ -54,8 +54,6 @@ class YHBottomNextView: UIView {
button.layer.cornerRadius = kCornerRadius6
button.clipsToBounds = true
button.addTarget(self, action: #selector(goNext), for: .touchUpInside)
button.backgroundColor = .brandMainColor //for test hjl
return button
}()
addSubview(nextButton)
......@@ -65,9 +63,6 @@ class YHBottomNextView: UIView {
make.height.equalTo(44)
make.left.equalTo(saveButton.snp.right).offset(10)
}
nextButton.layoutIfNeeded()
nextButton.addYinHeGradualLayer()//for test hjl
}
......
......@@ -228,7 +228,6 @@ extension YHImagePickerView: UIGestureRecognizerDelegate {
extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
// uploadImage(image: image)
if let block = backImage {
block(image)
self.dismiss()
......@@ -244,74 +243,88 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
picker.dismiss(animated: true, completion: nil)
}
//原生上传
func uploadImage(imageURL: URL) {
let url = URL(string: "https://test-comserver.galaxy-immi.com/oss/upload/storage")! // 设置上传接口地址
var request = URLRequest(url: url)
request.httpMethod = "POST"
do {
let imageData = try Data(contentsOf: imageURL) // 读取要上传的图片数据
let boundary = UUID().uuidString // 生成随机边界字符串
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
request.addValue("4001001", forHTTPHeaderField: "businessCode")
// //原生上传
// func uploadImage(imageURL: URL) {
// let url = URL(string: "https://test-comserver.galaxy-immi.com/oss/upload/storage")! // 设置上传接口地址
//
// var request = URLRequest(url: url)
// request.httpMethod = "POST"
//
// do {
// let imageData = try Data(contentsOf: imageURL) // 读取要上传的图片数据
//
// let boundary = UUID().uuidString // 生成随机边界字符串
// request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
// request.addValue("4001001", forHTTPHeaderField: "businessCode")
//
// var body = ""
// body += "--\(boundary)\r\n"
// body += "Content-Disposition: form-data; name=\"file\"; filename=\"image.jpg\"\r\n" // 根据需求修改文件名称
// body += "Content-Type: image/jpeg\r\n\r\n" // 根据实际情况指定正确的MIME类型
// if let data = imageData.base64EncodedString(options: .lineLength76Characters).addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics) {
// let encodedBody = body + "\r\n" + data + "\r\n" + "--" + boundary + "--"
// guard let postData = encodedBody.data(using: String.Encoding.utf8) else { return }
//
// request.httpBody = postData
//
// let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
// if let error = error {
// print("Error: \(error)")
// } else if let httpResponse = response as? HTTPURLResponse {
// switch httpResponse.statusCode {
// case 200..<300:
// if let data = data {
// let string = String(data: data, encoding: .utf8)
//
// }
// print("Upload successful.")
// default:
// print("Failed to upload the image with status code: \(httpResponse.statusCode)")
// }
// }
// }
// task.resume()
// }
// } catch {
// print("Error reading image file: \(error)")
// }
// }
// // Alamofire上传
// func uploadImage(image: UIImage) {
// // 获取图片的二进制数据
// guard let imageData = image.jpegData(compressionQuality: 1) else { return }
// let boundary = UUID().uuidString
// let headers: HTTPHeaders = [
// "Content-type": "multipart/form-data; boundary=\(boundary)",
// "businessCode": "4001001"
// ]
// // 创建MultipartFormData对象
// let multipartFormData = MultipartFormData()
//
// // 将图片添加到multipartFormData中
// multipartFormData.append(imageData, withName: "file", fileName: "image.jpg", mimeType: "image/jpeg")
//
// // 发送POST请求
// let uploadRequest = AF.upload(multipartFormData: multipartFormData, to: "https://test-comserver.galaxy-immi.com/oss/upload/storage", headers: headers)
//
// uploadRequest.responseString(completionHandler: { string in
// printLog("\n网络请求已返回 string=\(string)")
// })
// }
}
var body = ""
body += "--\(boundary)\r\n"
body += "Content-Disposition: form-data; name=\"file\"; filename=\"image.jpg\"\r\n" // 根据需求修改文件名称
body += "Content-Type: image/jpeg\r\n\r\n" // 根据实际情况指定正确的MIME类型
if let data = imageData.base64EncodedString(options: .lineLength76Characters).addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics) {
let encodedBody = body + "\r\n" + data + "\r\n" + "--" + boundary + "--"
guard let postData = encodedBody.data(using: String.Encoding.utf8) else { return }
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
if let error = error {
print("Error: \(error)")
} else if let httpResponse = response as? HTTPURLResponse {
switch httpResponse.statusCode {
case 200..<300:
if let data = data {
let string = String(data: data, encoding: .utf8)
}
print("Upload successful.")
default:
print("Failed to upload the image with status code: \(httpResponse.statusCode)")
}
}
}
task.resume()
}
} catch {
print("Error reading image file: \(error)")
extension YHImagePickerView {
func checkImage( _image : UIImage) -> UIImage? {
let size = _image.imageSize()
if size > 4 * 1024 * 1024 {
// let data = _image.compressOriginalImage(toKb: 4 * 1024)
if let data = _image.compressOriginalImage(4 * 1024 * 1024), let ttt = UIImage(data: data) {
return ttt
}
}
// Alamofire上传
func uploadImage(image: UIImage) {
// 获取图片的二进制数据
guard let imageData = image.jpegData(compressionQuality: 1) else { return }
let boundary = UUID().uuidString
let headers: HTTPHeaders = [
"Content-type": "multipart/form-data; boundary=\(boundary)",
"businessCode": "4001001"
]
// 创建MultipartFormData对象
let multipartFormData = MultipartFormData()
// 将图片添加到multipartFormData中
multipartFormData.append(imageData, withName: "file", fileName: "image.jpg", mimeType: "image/jpeg")
// 发送POST请求
let uploadRequest = AF.upload(multipartFormData: multipartFormData, to: "https://test-comserver.galaxy-immi.com/oss/upload/storage", headers: headers)
uploadRequest.responseString(completionHandler: { string in
printLog("\n网络请求已返回 string=\(string)")
})
}
return _image
}
}
......@@ -20,12 +20,6 @@ class YHOtherPickerView: UIView {
var arrData : [YHOtherPickerViewItemData] = []
private var selectType:YHFormPickerViewSubType?
// private var selectTitle:String? {
// didSet {
// let type:YHFormPickerViewSubType = getSubType(selectTitle)
// selectType = type
// }
// }
private var selectBlock:((YHOtherPickerViewItemData)->Void)? //回调
private var userSelectedItem : YHOtherPickerViewItemData? //用户选择的item
......@@ -62,15 +56,33 @@ class YHOtherPickerView: UIView {
view.addSubview(cancelBtn)
view.addSubview(confirmBtn)
titleLabel.snp.makeConstraints { make in
make.edges.equalToSuperview()
make.top.equalTo(kMargin)
make.height.equalTo(24)
make.centerX.equalToSuperview()
}
cancelBtn.snp.makeConstraints { make in
make.left.top.bottom.equalToSuperview()
make.width.equalTo(60)
make.left.equalTo(kMargin)
make.width.height.equalTo(44)
make.centerY.equalTo(titleLabel.snp.centerY)
}
cancelBtn.titleLabel?.textAlignment = .left
confirmBtn.snp.makeConstraints { make in
make.right.top.bottom.equalToSuperview()
make.width.equalTo(60)
make.right.equalToSuperview().offset(-kMargin)
make.width.height.equalTo(44)
make.centerY.equalTo(titleLabel.snp.centerY)
}
confirmBtn.titleLabel?.textAlignment = .right
let line = UIView()
line.backgroundColor = .separatorColor
view.addSubview(line)
line.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.height.equalTo(1)
make.bottom.equalToSuperview()
}
return view
}()
......@@ -79,7 +91,7 @@ class YHOtherPickerView: UIView {
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize: 16)
label.font = UIFont.PFSC_M(ofSize: 17)
label.text = "请选择"
return label
}()
......@@ -87,7 +99,7 @@ class YHOtherPickerView: UIView {
lazy var cancelBtn: UIButton = {
let btn = UIButton()
btn.setTitle("取消".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(UIColor.mainTextColor, for: .normal)
btn.addTarget(self, action: #selector(didClickCancelButton), for: .touchUpInside)
return btn
......@@ -96,8 +108,8 @@ class YHOtherPickerView: UIView {
lazy var confirmBtn: UIButton = {
let btn = UIButton()
btn.setTitle("确定".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(UIColor(hex: 0x4487F9), for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(UIColor.brandMainColor, for: .normal)
btn.addTarget(self, action: #selector(didClickConfirmButton), for: .touchUpInside)
return btn
}()
......@@ -119,16 +131,12 @@ class YHOtherPickerView: UIView {
}
func show() {
// showSelectType(&selectType)
UIApplication.shared.yhKeyWindow()?.addSubview(self)
}
static func show(type:YHOtherPickerViewType, selectType:YHFormPickerViewSubType? = nil, callBack: @escaping ((YHOtherPickerViewItemData)->Void)) {
let picker = YHOtherPickerView(type: type)
// picker.selectType = selectType
picker.selectBlock = callBack
picker.show()
}
......@@ -138,8 +146,8 @@ class YHOtherPickerView: UIView {
func createUI() {
self.addSubview(blackMaskView)
self.addSubview(whiteContentView)
addSubview(blackMaskView)
addSubview(whiteContentView)
whiteContentView.addSubview(topView)
whiteContentView.addSubview(pickerView)
......@@ -162,7 +170,7 @@ class YHOtherPickerView: UIView {
whiteContentView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalToSuperview().offset(KScreenHeight*2/3.0)
make.height.equalTo(412)
}
topView.snp.makeConstraints { make in
......@@ -187,31 +195,6 @@ class YHOtherPickerView: UIView {
dismiss()
}
func showSelectType(_ selectType: inout YHFormPickerViewSubType?) {
// 处理从外部传入的选中第几行的参数
// 是否找到选中行数据
// var selectIndex:Int = -1
// if let selectType = selectType, let arr = dataDict[type], !arr.isEmpty {
// for (index, item) in arr.enumerated() {
// if selectType.index == item.type.index {
// selectIndex = index
// break
// }
// }
// }
//
// if selectIndex != -1 { // 找到了选择行
// pickerView.selectRow(selectIndex, inComponent: 0, animated: true)
// } else { // 未找到选中行数据则滚动至第一行
// if dataDict[type]?.isEmpty == true { return }
// if let arr = dataDict[type], !arr.isEmpty {
// let item = arr[0]
// selectType = item.type
// pickerView.selectRow(0, inComponent: 0, animated: true)
// }
// }
}
func getTitle(type: YHOtherPickerViewType)-> String {
switch type {
case .language:
......@@ -249,14 +232,6 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
return arrData.count
}
// func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
// if 0 <= row && row < arrData.count {
// let item :YHOtherPickerViewItemData = arrData[row]
// return item.title
// }
// return ""
// }
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if 0 <= row && row < arrData.count {
let item :YHOtherPickerViewItemData = arrData[row]
......
......@@ -251,9 +251,11 @@ private extension YHPreviewFamilyMemberViewController {
}
}
}
button.setTitleColor(.black, for: .normal)
}
sender.addYinHeGradualLayer()
sender.layoutIfNeeded()
sender.setTitleColor(.white, for: .normal)
if sender == parentButton {
previewVM.arrDataForMainApplicationInfo = previewVM.arrDataForParents
......
......@@ -43,6 +43,7 @@ class YHPreviewMainViewController: YHBaseViewController {
var myHeadView : UIView = {
let view = UIView(frame: CGRect(x: kMargin, y: 0, width: KScreenWidth - kMargin * 2, height: 131))
view.backgroundColor = .white
return view
}()
......
......@@ -62,7 +62,7 @@ extension YHPreviewInfoCertificateInformationItemsView {
if index == 0 {
//第一个
cellView.snp.makeConstraints { make in
make.top.equalTo(tmp.snp.bottom).offset(10) //for test hjl
make.top.equalTo(tmp.snp.bottom).offset(10)
make.right.equalToSuperview().offset(-18)
make.left.equalToSuperview().offset(18)
}
......
......@@ -67,7 +67,7 @@ extension YHPreviewInfoProjectItemView {
}
let tagView : UIView = UIView()
tagView.backgroundColor = .failColor //for test hjl
tagView.backgroundColor = .failColor
holdView.addSubview(tagView)
if lastTagView == nil {
tagView.snp.makeConstraints { make in
......
......@@ -153,6 +153,8 @@ class YHWorkExperienceViewController: YHBaseViewController {
make.left.right.bottom.equalTo(view)
make.height.equalTo(k_Height_safeAreaInsetsBottom() + 64)
}
bottomView.layoutIfNeeded()
bottomView.nextButton.addYinHeGradualLayer()
}
@objc func keyboardWillShow(_ notification: Notification) {
......
......@@ -41,8 +41,8 @@ class YHInformationFillTipsAlertView: UIView {
let tableView = UITableView(frame: .zero, style: .plain)
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.showsHorizontalScrollIndicator = true
tableView.showsVerticalScrollIndicator = false
tableView.showsHorizontalScrollIndicator = false
tableView.showsVerticalScrollIndicator = true
tableView.rowHeight = UITableView.automaticDimension
// tableView.estimatedRowHeight = 100
tableView.register(YHInformationFillTipsCell.self,forCellReuseIdentifier: YHInformationFillTipsCell.cellReuseIdentifier)
......@@ -121,6 +121,7 @@ class YHInformationFillTipsAlertView: UIView {
let lable00 = UILabel(text: "我确认我所提供的材料真实有效,并知悉其中内容。")
lable00.font = UIFont.PFSC_R(ofSize: 12)
lable00.textColor = UIColor.labelTextColor2
......@@ -148,6 +149,7 @@ class YHInformationFillTipsAlertView: UIView {
make.height.width.equalTo(12)
}
agreeButton = selectedBtn
agreeButton.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
let topView = UIView()
......
......@@ -30,14 +30,6 @@ class YHInformationFillTipsCell: UITableViewCell {
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension YHInformationFillTipsCell {
......@@ -102,7 +94,6 @@ extension YHInformationFillTipsCell {
lable2.snp.makeConstraints { make in
make.top.equalTo(lable1.snp.bottom).offset(12)
make.left.right.equalToSuperview()
// make.bottom.equalToSuperview().offset(-16)//for test hjl
}
let holdView2 = UIView()
......@@ -242,11 +233,15 @@ extension YHInformationFillTipsCell {
make.top.equalTo(holdView2.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-8)
make.height.equalTo(120)
}
let tImageV : UIImageView = UIImageView(image: UIImage(named: "entry_bkg"))
tImageV.contentMode = .scaleAspectFill
holdView3.addSubview(tImageV)
tImageV.snp.makeConstraints { make in
make.edges.equalTo(0)
}
let imageV4 = UIImageView()
......@@ -284,7 +279,6 @@ extension YHInformationFillTipsCell {
make.right.equalToSuperview().offset(-16)
}
let lable10 = UILabel(text: "* 申请过程中有任何疑问,请随时联系专属服务群内的专业文案老师为您解答护航。")
lable10.numberOfLines = 0
lable10.lineBreakMode = .byWordWrapping
......@@ -295,7 +289,6 @@ extension YHInformationFillTipsCell {
make.top.equalTo(lable9.snp.bottom).offset(7)
make.left.equalTo(lable9.snp.left)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-18)
}
holdView3.layoutIfNeeded()
......@@ -305,8 +298,5 @@ extension YHInformationFillTipsCell {
imageV44.contentMode = .scaleAspectFill
imageV44.layer.zPosition = -1
holdView3.addSubview(imageV44)
// imageV44.snp.makeConstraints { make in
// make.edges.equalTo(0)
// }
}
}
......@@ -151,7 +151,7 @@ extension YHInformationPerfectCell {
if dataModel?.isLastestCell == true {
bottomImagV.isHidden = true
} else {
bottomImagV.isHidden = false
if dataModel?.isFinished == true {
bottomImagV.image = UIImage(named: "top_image")
} else {
......
......@@ -131,7 +131,7 @@ class YHSubmintAllInfoSuccessTipView: UIView {
label.numberOfLines = 1
return label
}()
messageLabel.backgroundColor = .clear//for test hjl
messageLabel.backgroundColor = .clear
centerView.addSubview(messageLabel)
messageLabel.snp.makeConstraints { make in
make.top.equalTo(lable2.snp.bottom).offset(10)
......
......@@ -135,7 +135,9 @@ extension YHServiceCenterMainViewModel {
model.isFinished = true
arrContactStausItmes.append(model)
if resultModel.supplement_not_submit_num > 0 {
if true || resultModel.supplement_not_submit_num > 0 { //for test hjl
let model2 = YHContactMainItemStatusModel()
model2.type = 2
model2.isFinished = false
......@@ -163,11 +165,22 @@ extension YHServiceCenterMainViewModel {
// }
// if resultModel.my_signature {
//我的签字
let model5 = YHContactMainItemStatusModel()
model5.type = 5
model5.isFinished = true
arrContactStausItmes.append(model5)
// }
if resultModel.scheme_position_switch == 1 {
//我的方案
let model5 = YHContactMainItemStatusModel()
model5.type = 6
model5.isFinished = true
arrContactStausItmes.append(model5)
}
} else {
let model = YHContactMainItemStatusModel()
......
......@@ -43,7 +43,7 @@ class YHAboutUsViewController: YHBaseViewController {
collectinoView.register(YHAboutUsAdvantageCell.self, forCellWithReuseIdentifier:YHAboutUsAdvantageCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
collectinoView.backgroundColor = .clear //for test hjl
collectinoView.backgroundColor = .clear
return collectinoView
}()
......
......@@ -160,7 +160,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
if (indexPath.row >= items.count) { return }
// if true {
if true {
// YHCertificateUploadFailTipsView.tipsView().show()
......@@ -168,10 +168,11 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
// let vc = YHUploadContentVC()
// self.navigationController?.pushViewController(vc)
// let vc = YHCertificateResourceUploadVC()
// self.navigationController?.pushViewController(vc)
// return
// }
let vc = YHMaterialListViewController()
self.navigationController?.pushViewController(vc)
return
}
......
......@@ -66,6 +66,9 @@ extension UIColor {
// 分割线颜色
static let separatorColor: UIColor = UIColor(hexString: "#F0F0F0")!
// 导航栏标题颜色
static let navTitleColor: UIColor = UIColor(hexString: "#0F1214")!
public convenience init(r : CGFloat, g : CGFloat, b : CGFloat,alpha:CGFloat = 1.0) {
......
......@@ -142,4 +142,111 @@ extension UIImage {
UIGraphicsEndImageContext()
return newImage
}
/// 直接使用data进行压缩
/// - Parameter toKb: 指定data最大的体积
/// - Returns: data
func compressOriginalImage(_ toKb: Int = 4 * 1024 * 1024) -> Data?{
var compression: CGFloat = 1
let minCompression: CGFloat = 0.1
var imageData = self.jpegData(compressionQuality: compression)
if imageData!.count < toKb {
return imageData
}
while imageData!.count > toKb, compression > minCompression {
compression -= 0.1
imageData = self.jpegData(compressionQuality: compression)
}
if imageData!.count > toKb {
return nil
}
return imageData
}
func imageSize() -> Int {
// 如果是JPEG格式,可以调整压缩质量来影响文件大小
if let jpegData = self.jpegData(compressionQuality: 1.0) {
return jpegData.count
}
// 如果是PNG格式
if let pngData = self.pngData() {
return pngData.count
}
return 0 // 如果转换失败,返回0
}
}
enum ImageCopmpressSize {
//压缩到100KB(1024*100字节)以内
case one
//压缩到200KB(1024*100字节)以内
case two
//压缩到300KB(1024*100字节)以内
case three
//压缩到4M(1024*1024*4)
case four
}
//extension UIImage {
// func compressImage(size:ImageCopmpressSize) -> Data{
// switch size {
// case .one:
// return compressImage(maxLength: 1024*100)
// case .two:
// return compressImage(maxLength: 1024*200)
// case .three:
// return compressImage(maxLength: 1024*300)
// case .four:
// return compressImage(maxLength: 4 * 1024 * 1024)
// }
// }
//
//
// // 图片压缩 byte
// func compressImage(maxLength: Int) -> Data {
// // let tempMaxLength: Int = maxLength / 8
// let tempMaxLength: Int = maxLength
// var compression: CGFloat = 1
// guard var data = self.jpegData(compressionQuality: compression), data.count > tempMaxLength else { return self.jpegData(compressionQuality: compression)! }
//
// // 压缩大小
// var max: CGFloat = 1
// var min: CGFloat = 0
// for _ in 0..<6 {
// compression = (max + min) / 2
// data = self.jpegData(compressionQuality: compression)!
// if CGFloat(data.count) < CGFloat(tempMaxLength) * 0.9 {
// min = compression
// } else if data.count > tempMaxLength {
// max = compression
// } else {
// break
// }
// }
// var resultImage: UIImage = UIImage(data: data)!
// if data.count < tempMaxLength { return data }
//
// // 压缩大小
// var lastDataLength: Int = 0
// while data.count > tempMaxLength && data.count != lastDataLength {
// lastDataLength = data.count
// let ratio: CGFloat = CGFloat(tempMaxLength) / CGFloat(data.count)
// print("Ratio =", ratio)
// let size: CGSize = CGSize(width: Int(resultImage.size.width * sqrt(ratio)),
// height: Int(resultImage.size.height * sqrt(ratio)))
// UIGraphicsBeginImageContext(size)
// resultImage.draw(in: CGRect(x: 0, y: 0, width: size.width, height: size.height))
// resultImage = UIGraphicsGetImageFromCurrentImageContext()!
// UIGraphicsEndImageContext()
// data = resultImage.jpegData(compressionQuality: compression)!
// }
// return data
// }
//}
......@@ -19,16 +19,13 @@ class YHAllApiName {
//order 模块
struct Order {
//合同列表
// static let contractListApi = "frontend/order/list"
static let contractListApi = "infoflow/order/list"
//合同填写进度
// static let contractStatusApi = "frontend/order/progress"
static let contractStatusApi = "infoflow/order/progress"
//信息表的填写进度
// static let informationStepApi = "frontend/order/information/step"
static let informationStepApi = "infoflow/order/information/step"
//提交订单信息
......@@ -40,10 +37,8 @@ class YHAllApiName {
//获取其他资料填写信息
// static let otherInfoFillApi = "frontend/order/getOrderOtherInformation"
static let otherInfoFillApi = "infoflow/order/getOrderOtherInformation"
//保存其他资料信息
// static let updateOtherInfoApi = "frontend/order/updateOrderOtherInformation"
static let updateOtherInfoApi = "infoflow/order/updateOrderOtherInformation"
}
......@@ -88,7 +83,6 @@ class YHAllApiName {
//Users
struct Users {
//提交 温馨提示信息
// static let submitSweetNotifyApi = "frontend/users/sweet-notify/submit"
static let submitSweetNotifyApi = "infoflow/users/sweet-notify/submit"
}
......@@ -97,11 +91,9 @@ class YHAllApiName {
//Basics
struct Basics {
//获取 基本资料信息
// static let basicInfoApi = "frontend/basics/get_basics"
static let basicInfoApi = "infoflow/basics/get_basics"
//保存基本资料信息
// static let updateBasicInfoApi = "frontend/basics/update_basics"
static let updateBasicInfoApi = "infoflow/basics/update_basics"
}
......@@ -177,6 +169,7 @@ class YHAllApiName {
static let getPublicUrlsApi = "oss/storage/batchConvertToPublicURL"
}
//我的签字和文书
struct Signature {
// 签字列表
static let list = "infoflow/my-sign/list"
......@@ -197,6 +190,14 @@ class YHAllApiName {
static let detail = "infoflow/my-doc/doc-details"
// 腾讯文档编辑
static let temporaryUrl = "infoflow/my-doc/get_temporaryUrl"
}
//我的证件
struct Certificate {
// 我的证件-状态数量统计
static let statisticApi = "infoflow/certificate/statistic"
//获取问答列表
static let questionAndAnswerApi = "infoflow/answer-question/getAnswerQuestion"
}
}
......@@ -78,11 +78,6 @@ class YHNetRequest: NSObject {
requestHeader.add(name:"Conatent-Type",value:"application/json")
requestHeader.add(name:"Accept",value:"application/json")
/*
以下是测试数据 for test hjl
*/
requestHeader.add(name:"appid",value:"1")
let dateStr = String(Date().timeIntervalSince1970)
requestHeader.add(name:"timestamp",value:dateStr)
......@@ -98,11 +93,6 @@ class YHNetRequest: NSObject {
headers = requestHeader
}
// private func testToken(_ requestHeader:inout HTTPHeaders) {
// //金龙的账号
// requestHeader.add(name: "token", value: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTE2MDcwNjQsImkiOjE0NDg0MTczMjc0MjE2LCJ1Ijoi6ZO25rKz6ZuG5ZuiIiwiciI6InN1cGVyX2FwcCJ9.KwTWdaLy5UG4LLs6i-D9ne0RflRTT5v4zvu-66yihDE")
// }
///  链式语法
func url(_ url:String?) -> Self{
self.url = url ?? ""
......@@ -177,7 +167,16 @@ class YHNetRequest: NSObject {
YHHUD.flash(message: "网络异常")
return httpRequest
}
guard let imageData = image.jpegData(compressionQuality: 1) else { return httpRequest }
// guard let imageData = image.jpegData(compressionQuality: 1) else { return httpRequest }
guard let imageData = image.compressOriginalImage(4 * 1024 * 1024) else { return httpRequest }
let tttt = Double(imageData.count)/1024.0/1024.0
#if DEBUG
let ssss = String(format: "%.2f", tttt)
YHHUD.flash(message: "实际大小:" + ssss + " M")
#endif
let multipartFormData = MultipartFormData()
// 将图片添加到multipartFormData中
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 3398@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 3398@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Rectangle 2461@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Rectangle 2461@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon-问题@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon-问题@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -15,5 +15,73 @@
<string>cameraDesciption</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>
<key>NSFileProviderDomainUsageDescription</key>
<string>需要访问您的文件以选择和上传</string>
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF Document</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
<key>LSHandlerRank</key>
<string>Default</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>JPEG Image</string>
<key>LSItemContentTypes</key>
<array>
<string>public.jpeg</string>
</array>
<key>LSHandlerRank</key>
<string>Default</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PNG Image</string>
<key>LSItemContentTypes</key>
<array>
<string>public.png</string>
</array>
<key>LSHandlerRank</key>
<string>Default</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft Word Document</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openxmlformats.wordprocessingml.document</string>
<string>com.microsoft.word.doc</string>
</array>
<key>LSHandlerRank</key>
<string>Default</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft PowerPoint Presentation</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openxmlformats.presentationml.presentation</string>
<string>com.microsoft.powerpoint.ppt</string>
</array>
<key>LSHandlerRank</key>
<string>Default</string>
</dict>
</array>
</dict>
</plist>
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