Commit 410a8f2b authored by David黄金龙's avatar David黄金龙

Merge branch 'develop'

* develop: (121 commits)
  修改版本号 0.2.8.1
  处理 展示 bug
  1、修改版本号  0.2.8.0 2、处理一处bug
  添加 一处优化
  修改 几处体验
  修改一处 提示
  修改一处 UI 展示
  删除多余代码
  修改 一处bug
  我的文书预览
  no message
  赴港计划书 展示 UI调整
  修改一处字段
  处理 pdf的 sendEmail 问题
  // toast 显示
  发送邮箱 添加提示
  删除不使用的代码
  state 状态
  赴港计划书
  已签署状态的签署逻辑
  ...

# Conflicts:
#	galaxy/galaxy.xcodeproj/project.pbxproj
#	galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/VM/YHServiceCenterMainViewModel.swift
#	galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyViewController.swift
parents aa766604 cc0d41d7
......@@ -67,6 +67,9 @@ target 'galaxy' do
pod 'LookinServer','1.2.6',:subspecs => ['Swift'], :configurations => ['Debug']
#阿里云OOS
pod 'AliyunOSSiOS','2.10.18'
#极光推送
pod 'JPush', '5.2.0'
pod 'JCore', '4.6.0-noidfa'
############# 网易云信 IM相关 start #############
#A 基础Kit库
......
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573EE32B317C0100D98EC0"
BuildableName = "galaxyTests.xctest"
BlueprintName = "galaxyTests"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573EED2B317C0100D98EC0"
BuildableName = "galaxyUITests.xctest"
BlueprintName = "galaxyUITests"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5573ECD2B317BFF00D98EC0"
BuildableName = "galaxy.app"
BlueprintName = "galaxy"
ReferencedContainer = "container:galaxy.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "TestEnv"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
......@@ -27,6 +27,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// JPush服务注册
registerJPushService(launchOptions)
//全局导航栏、返回事件/手势
setupNavBar()
......@@ -119,7 +122,7 @@ extension AppDelegate {
UITextView.appearance().tintColor = .brandMainColor
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.enableAutoToolbar = true
IQKeyboardManager.shared.enableAutoToolbar = false
IQKeyboardManager.shared.resignOnTouchOutside = true //控制点击背景是否收起键盘
}
}
......
//
// Applegate(JPush).swift
// galaxy
//
// Created by edy on 2024/3/27.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
extension AppDelegate: JPUSHRegisterDelegate {
// 注册JPush服务
func registerJPushService(_ launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
let entity: JPUSHRegisterEntity = JPUSHRegisterEntity()
entity.types = Int(JPAuthorizationOptions.alert.rawValue |
JPAuthorizationOptions.badge.rawValue |
JPAuthorizationOptions.sound.rawValue |
JPAuthorizationOptions.providesAppNotificationSettings.rawValue)
JPUSHService.register(forRemoteNotificationConfig: entity, delegate: self)
// Required
// init Push
// notice: 2.1.5 版本的 SDK 新增的注册方法,改成可上报 IDFA,如果没有使用 IDFA 直接传 nil
//初始化极光推送服务,调用了本 API 后,开启 JPush 推送服务,将会开始收集上报 SDK 业务功能所必要的用户个人信息
// [JPUSHService setupWithOption:launchOptions appKey:appKey
// channel:channel
// apsForProduction:isProduction
// advertisingIdentifier:advertisingId];
let isProduction = false
JPUSHService.setup(withOption:launchOptions,
appKey:"c6a9e10575b85ee90f3e8afe",
channel:"",
apsForProduction: isProduction)
}
//系统获取Token
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let deviceTokenStr = deviceToken.map{String(format:"%02.2hhx", arguments: [$0]) }.joined()
print("deviceToken:\(deviceTokenStr)")
JPUSHService.registerDeviceToken(deviceToken)
}
//获取token 失败
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { //可选
print("did Fail To Register For Remote Notifications With Error: \(error)")
}
//点推送进来执行这个方法
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
JPUSHService.handleRemoteNotification(userInfo)
completionHandler(UIBackgroundFetchResult.newData)
}
//后台进前台
func applicationDidEnterBackground(_ application: UIApplication) {
//销毁通知红点
UIApplication.shared.applicationIconBadgeNumber = 0
JPUSHService.setBadge(0)
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
}
@available(iOS 10.0, *)
func jpushNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: ((Int) -> Void)) {
let userInfo = notification.request.content.userInfo
if notification.request.trigger is UNPushNotificationTrigger {
JPUSHService.handleRemoteNotification(userInfo)
}
// 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
completionHandler(Int(UNNotificationPresentationOptions.alert.rawValue))
}
@available(iOS 10.0, *)
func jpushNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: (() -> Void)) {
let userInfo = response.notification.request.content.userInfo
if response.notification.request.trigger is UNPushNotificationTrigger {
JPUSHService.handleRemoteNotification(userInfo)
}
// 系统要求执行这个方法
completionHandler()
}
func jpushNotificationCenter(_ center: UNUserNotificationCenter, openSettingsFor notification: UNNotification) {
}
func jpushNotificationAuthorization(_ status: JPAuthorizationStatus, withInfo info: [AnyHashable : Any]?) {
}
}
......@@ -22,6 +22,9 @@ class YHBaseViewController: UIViewController {
gk_navLineHidden = true
gk_navBarAlpha = 0
gk_backImage = UIImage(named: "nav_icon_back_back")
#if DEBUG
IQKeyboardManager.shared.enable = true
#endif
......
......@@ -8,7 +8,7 @@
import UIKit
import Alamofire
import SmartCodable
//import SmartCodable
class YHBaseViewModel {
// 上传方法
......
......@@ -7,6 +7,7 @@
//
import UIKit
import Photos
/*
文件清单
*/
......@@ -16,7 +17,7 @@ class YHFileListViewController: YHBaseViewController {
var orderId : Int?
private let certificateReqVM : YHCertificateViewModel = YHCertificateViewModel()
private lazy var headView : YHFileListHeaerView = {
let view = YHFileListHeaerView()
......@@ -34,13 +35,18 @@ class YHFileListViewController: YHBaseViewController {
private lazy var myContentView : YHFileListContentView = {
let view = YHFileListContentView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
view.layer.cornerRadius = kCornerRadius12
view.clipsToBounds = true
return view
}()
let bottomView : YHFileListBottomView = YHFileListBottomView()
private lazy var bottomView : YHFileListBottomView = {
var bottomView : YHFileListBottomView = YHFileListBottomView()
bottomView.nextButton.isEnabled = false
bottomView.layer.opacity = 0.8
return bottomView
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -50,17 +56,20 @@ class YHFileListViewController: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
loadData2()
}
private lazy var footLable : UILabel = {
let footLable = UILabel()
footLable.text = "*感谢您对银河移民的信赖,以上信息均用于香港优才签证申 请银河移民承诺对您所提供的信息将绝对保密"
footLable.textColor = .white
footLable.textAlignment = .center
footLable.font = UIFont.PFSC_R(ofSize: 12)
footLable.numberOfLines = 0
footLable.lineBreakMode = .byWordWrapping
return footLable
}()
}
......@@ -68,13 +77,24 @@ class YHFileListViewController: YHBaseViewController {
extension YHFileListViewController {
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let tttt = "11758" //for test hjl
let param = ["order_id":tttt,"node":"1","state":"1"]
let param = ["order_id":orderID,"node":"1","state":"1"]
// let param = ["order_id":"11758","node":"1","state":"1"] //for test hjl
certificateReqVM.getCertificateFileListData(params: param) { success, error in
if success == true {
self.myContentView.dataModel = self.certificateReqVM.arrFileListData
self.layoutMyUI()
self.myContentView.layoutIfNeeded()
let r = self.myContentView.bounds
self.myContentView.frame = CGRect(x: kMargin, y: 217, width: KScreenWidth - 2*kMargin, height: r.height)
self.footLable.frame = CGRect(x: 28, y: 217 + r.height + 29, width: KScreenWidth - 2*28, height: 36)
self.myScrollView.contentSize = CGSize(width: KScreenWidth, height: r.height + 217 + 29 + 36 + 41)
self.bottomView.nextButton.isEnabled = true
self.bottomView.layer.opacity = 1.0
} else {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
......@@ -84,6 +104,22 @@ extension YHFileListViewController {
}
}
func loadData2() {
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.headView.dataModel = self.certificateReqVM.certificateEntryModel
} else {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
}
} else {
printLog("error : orderID 为空")
}
}
func setupUI() {
gk_navTitle = "文件清单"
gk_navBarAlpha = 1.0
......@@ -96,26 +132,30 @@ extension YHFileListViewController {
make.left.right.bottom.equalToSuperview()
make.height.equalTo(YHFileListBottomView.viewH)
}
bottomView.block = { flag in
bottomView.block = { [self] flag in
if flag == 1 {
printLog("生成清单")
YHHUD.show(.progress(message: "正在生成图片"))
if let image = self.captureScrollView(scrollView: self.myScrollView) {
YHHUD.hide()
saveImageToPhotosAlbum(image: image)
} else {
YHHUD.hide()
YHHUD.flash(message: "生成图片失败")
}
}
}
myScrollView.backgroundColor = UIColor(hex:0x0D37C7, alpha: 1.0)
view.addSubview(myScrollView)
myScrollView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalToSuperview()
make.bottom.equalTo(bottomView.snp.top)
}
myScrollView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: KScreenHeight - k_Height_NavigationtBarAndStatuBar - YHFileListBottomView.viewH)
myScrollView.contentSize = CGSize(width: KScreenWidth, height: 2000)
myScrollView.addSubview(headView)
headView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(YHFileListHeaerView.viewH)
}
headView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: YHFileListHeaerView.viewH)
myScrollView.addSubview(myContentView)
myContentView.snp.makeConstraints { make in
......@@ -124,44 +164,50 @@ extension YHFileListViewController {
make.width.equalTo(KScreenWidth - 2*kMargin)
}
myScrollView.addSubview(footLable)
footLable.snp.makeConstraints { make in
make.top.equalTo(myContentView.snp.bottom).offset(29)
make.left.equalTo(28)
make.width.equalTo(KScreenWidth - 2*28)
make.bottom.equalToSuperview().offset(-41)
}
myScrollView.layoutIfNeeded()
printLog(myScrollView.contentSize)
return
}
func layoutMyUI() {
myContentView.snp.removeConstraints()
myContentView.snp.remakeConstraints { make in
make.top.equalTo(217)
make.left.equalTo(kMargin)
make.width.equalTo(KScreenWidth - 2*kMargin)
// make.height.equalTo(2700) //for test hjl
}
myContentView.backgroundColor = .yellow//for test hjl
func captureScrollView(scrollView : UIScrollView) -> UIImage? {
scrollView.showsVerticalScrollIndicator = false
UIGraphicsBeginImageContextWithOptions(scrollView.contentSize, false, UIScreen.main.scale)
let savedContentOffset = scrollView.contentOffset
let savedFrame = scrollView.frame
footLable.snp.removeConstraints()
footLable.snp.remakeConstraints { make in
make.top.equalTo(myContentView.snp.bottom).offset(29)
make.left.equalTo(28)
make.width.equalTo(KScreenWidth - 2*28)
make.bottom.equalToSuperview().offset(-41)
}
scrollView.contentOffset = CGPoint.zero
scrollView.frame = CGRect(x: 0, y: 0, width: scrollView.contentSize.width, height: scrollView.contentSize.height)
myScrollView.layoutIfNeeded()
scrollView.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
scrollView.contentOffset = savedContentOffset
scrollView.frame = savedFrame
UIGraphicsEndImageContext()
printLog("============")
scrollView.showsVerticalScrollIndicator = true
return image
}
func saveImageToPhotosAlbum(image: UIImage) {
// 确保应用有权访问相册
PHPhotoLibrary.requestAuthorization { status in
if status == .authorized {
// 保存图片到相册
DispatchQueue.main.sync {
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil)
}
} else {
YHHUD.flash(message: "没有访问图库权限")
}
}
}
@objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) {
if didFinishSavingWithError != nil {
YHHUD.flash(message: "保存失败")
return
}
YHHUD.flash(message: "保存成功")
}
}
......@@ -15,6 +15,9 @@ class YHFileListModel: SmartCodable {
var checks_tatus : Int = -1
var supplement_list : [YHFileListSubModel] = []
var type : Int = 0 //0-数据来自服务端 1-客户端自己添加的
var arrTxt : [String] = [] //type=1时使用的内容
required init() {
}
}
......@@ -23,7 +26,7 @@ class YHFileListModel: SmartCodable {
class YHFileListSubModel: SmartCodable {
var name : String = ""
var type_name : String = ""
var checks_tatus : Int = -1
var check_status : Int = -1
required init() {
}
......
......@@ -24,7 +24,7 @@ class YHFileListBottomView: UIView {
typealias Block = (Int) -> ()
var block: Block?
var saveButton: UIButton!
// var saveButton: UIButton!
var nextButton: UIButton!
}
......
......@@ -25,25 +25,28 @@ class YHFileListContentView: UIView {
}
}
private extension YHFileListContentView {
func initView() {
backgroundColor = .clear
}
}
extension YHFileListContentView {
func updataUI() {
guard let arrData = dataModel,arrData.count > 0 else { return }
removeSubviews()
let sessionBkgImageV : UIImageView = UIImageView(image: UIImage(named: "file_list_head_bkg"))
sessionBkgImageV.contentMode = .scaleAspectFill
addSubview(sessionBkgImageV)
sessionBkgImageV.clipsToBounds = true
sessionBkgImageV.roundCorners([.topLeft,.topRight], radius: kCornerRadius12)
// sessionBkgImageV.roundCorners(.topRight, radius: kCornerRadius12)
addSubview(sessionBkgImageV)
if arrData.isEmpty {
sessionBkgImageV.snp.makeConstraints { make in
make.top.equalToSuperview().offset(2)
......@@ -55,51 +58,59 @@ extension YHFileListContentView {
}
} else {
sessionBkgImageV.snp.makeConstraints { make in
make.top.equalToSuperview().offset(2)
make.left.equalToSuperview().offset(2)
make.right.equalToSuperview().offset(-2)
make.height.equalTo(70)
}
}
sessionBkgImageV.layoutIfNeeded()
var lastView : UIView?
for (index,item) in arrData.enumerated() {
let view = YHFileListItemsView()
view.dataModel = item
addSubview(view)
if let lastView = lastView {
if index == arrData.count - 1 {
view.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom)
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-20)
}
} else {
view.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom)
make.left.right.equalToSuperview()
}
if let iii = item {
var view : UIView = YHFileListItemsView()
if iii.type == 0 {
(view as! YHFileListItemsView).dataModel = item
} else {
//if item?.type == 1
view = YHFileListItemsView2()
(view as! YHFileListItemsView2).dataModel = item
}
} else {
if index == arrData.count - 1 {
view.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-20)
addSubview(view)
if let tttttt = lastView {
if index == arrData.count - 1 {
view.snp.makeConstraints { make in
make.top.equalTo(tttttt.snp.bottom)
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-20)
}
} else {
view.snp.makeConstraints { make in
make.top.equalTo(tttttt.snp.bottom)
make.left.right.equalToSuperview()
}
}
} else {
view.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
if index == arrData.count - 1 {
view.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-20)
}
} else {
view.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.right.equalToSuperview()
}
}
}
lastView = view
}
lastView = view
}
layoutIfNeeded()
}
}
......@@ -7,6 +7,7 @@
//
import UIKit
import AttributedString
class YHFileListHeaerView: UIView {
static let viewH : CGFloat = 312
......@@ -46,7 +47,7 @@ class YHFileListHeaerView: UIView {
//待提交
private lazy var waitSubmitLable : UILabel = {
let imagV = UILabel()
imagV.text = "您有 - 项待提交"
imagV.text = "您有 项待提交"
imagV.font = UIFont.PFSC_R(ofSize: 14)
imagV.textColor = UIColor.white
return imagV
......@@ -55,26 +56,17 @@ class YHFileListHeaerView: UIView {
//重传
private lazy var reuploadLable : UILabel = {
let imagV = UILabel()
imagV.text = "您有 - 项需重传"
imagV.text = "您有 项需重传"
imagV.font = UIFont.PFSC_R(ofSize: 14)
imagV.textColor = UIColor.white
return imagV
}()
var dataModel : YHCertificateEntryModel? {
didSet {
updateUI()
}
}
}
......@@ -171,4 +163,19 @@ private extension YHFileListHeaerView {
}
}
func updateUI() {
guard let dataModel = dataModel else { return }
let a: ASAttributedString = .init("您有 ", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.white))
let aa: ASAttributedString = .init(NSAttributedString(string: String(dataModel.to_be_submit_num)), .font(UIFont.PFSC_B(ofSize: 15)),.foreground(UIColor(hex: 0xFFE6B5, alpha: 1.0)))
let aaa: ASAttributedString = .init(" 项待提交", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.white))
waitSubmitLable.attributed.text = a + aa + aaa
let bb: ASAttributedString = .init(NSAttributedString(string: String(dataModel.reject_num)), .font(UIFont.PFSC_B(ofSize: 15)),.foreground(UIColor(hex: 0xFFE6B5, alpha: 1.0)))
let bbb: ASAttributedString = .init(" 项需重传", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.white))
reuploadLable.attributed.text = a + bb + bbb
}
}
......@@ -22,34 +22,36 @@ class YHFileListItemView: UIView {
//index
private lazy var indexLable : UILabel = {
let lable0 = UILabel(text: "index")
lable0.textColor = UIColor.labelTextColor2
lable0.textColor = UIColor.mainTextColor
lable0.font = UIFont.PFSC_B(ofSize: 19)
lable0.textAlignment = .center
return lable0
}()
//title
private lazy var titleLable : UILabel = {
let lable0 = UILabel(text: "title")
lable0.textColor = UIColor.labelTextColor2
lable0.textColor = UIColor.mainTextColor
lable0.font = UIFont.PFSC_R(ofSize: 15)
lable0.numberOfLines = 0
lable0.lineBreakMode = .byWordWrapping
return lable0
}()
//subtitle
private lazy var subtitleLable : UILabel = {
let lable0 = UILabel(text: "subtitle")
lable0.textColor = UIColor.mainTextColor
lable0.textColor = UIColor.labelTextColor2
lable0.font = UIFont.PFSC_R(ofSize: 12)
lable0.numberOfLines = 0
lable0.lineBreakMode = .byWordWrapping
lable0.textAlignment = .right
return lable0
}()
//status
private lazy var statusLable : UILabel = {
let lable0 = UILabel(text: "状态")
lable0.textColor = UIColor.mainTextColor
lable0.textColor = UIColor.brandMainColor
lable0.font = UIFont.PFSC_R(ofSize: 12)
lable0.numberOfLines = 0
lable0.lineBreakMode = .byWordWrapping
......@@ -71,6 +73,12 @@ class YHFileListItemView: UIView {
updateUI()
}
}
var myIndex : Int = -1 {
didSet {
updateIndex()
}
}
}
private extension YHFileListItemView {
......@@ -79,6 +87,7 @@ private extension YHFileListItemView {
indexLable.snp.makeConstraints { make in
make.left.equalTo(8)
make.width.equalTo(26)
make.height.equalTo(20)
make.centerY.equalToSuperview()
}
......@@ -86,7 +95,8 @@ private extension YHFileListItemView {
statusLable.snp.makeConstraints { make in
make.right.equalTo(-26)
make.centerY.equalToSuperview()
make.height.equalTo(18)
make.height.equalTo(20)
make.width.equalTo(60)
}
......@@ -94,7 +104,7 @@ private extension YHFileListItemView {
titleLable.snp.makeConstraints { make in
make.top.equalTo(kMargin)
make.left.equalTo(40)
make.right.equalTo(statusLable.snp.left).offset(6)
make.right.equalTo(statusLable.snp.left).offset(-12)
}
......@@ -125,18 +135,26 @@ extension YHFileListItemView {
var color : UIColor = .failColor
if dataModel.checks_tatus == 2 {
if dataModel.check_status == 2 {
text = "需重传"
color = .failColor
} else if dataModel.checks_tatus == 3 {
} else if dataModel.check_status == 3 {
text = "待提交"
color = .brandMainColor
} else {
text = "需过滤" + String(dataModel.checks_tatus)
text = "需过滤" + String(dataModel.check_status)
color = UIColor.purple
}
statusLable.text = text
statusLable.textColor = color
}
func updateIndex() {
let index = String(myIndex + 1)
indexLable.text = index.defaultStringIfEmpty(detaultValue: "-")
}
}
......@@ -36,6 +36,7 @@ class YHFileListItemsView: UIView {
let lable0 = UILabel(text: "title")
lable0.textColor = UIColor.mainTextColor
lable0.font = UIFont.PFSC_R(ofSize: 18)
lable0.textAlignment = .center
return lable0
}()
......@@ -48,9 +49,7 @@ class YHFileListItemsView: UIView {
private extension YHFileListItemsView {
func updateUI() {
removeSubviews()
guard let dataModel = dataModel else { return }
addSubview(topBkg)
topBkg.snp.makeConstraints { make in
make.top.equalTo(22)
......@@ -78,25 +77,23 @@ private extension YHFileListItemsView {
addSubview(holdView)
holdView.snp.makeConstraints { make in
make.top.equalTo(titleLable.snp.bottom).offset(14)
make.left.right.equalToSuperview()
make.left.equalToSuperview().offset(kMargin)
make.right.equalToSuperview().offset(-kMargin)
make.bottom.equalToSuperview()
}
let sessionView : UIView = UIView()
sessionView.backgroundColor = UIColor(hex: 0xD9E4FD, alpha: 1.0)
holdView.addSubview(sessionView)
if dataModel.supplement_list.isEmpty {
sessionView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(38)
make.bottom.equalToSuperview()
}
} else {
sessionView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(38)
......@@ -104,10 +101,37 @@ private extension YHFileListItemsView {
}
let leftLabel : UILabel = UILabel()
leftLabel.text = "内容"
leftLabel.font = UIFont.PFSC_R(ofSize: 12)
leftLabel.textColor = UIColor.labelTextColor2
holdView.addSubview(leftLabel)
leftLabel.snp.makeConstraints { make in
make.left.equalTo(40)
make.top.equalToSuperview()
make.height.equalTo(38)
}
let rightLabel : UILabel = UILabel()
rightLabel.text = "状态"
rightLabel.font = UIFont.PFSC_R(ofSize: 12)
rightLabel.textColor = UIColor.labelTextColor2
holdView.addSubview(rightLabel)
rightLabel.snp.makeConstraints { make in
make.right.equalTo(-34)
make.top.equalToSuperview()
make.height.equalTo(38)
}
var lastView : UIView = sessionView
for (index,item) in dataModel.supplement_list.enumerated() {
let view = YHFileListItemView()
view.myIndex = index
view.dataModel = item
holdView.addSubview(view)
......@@ -115,25 +139,20 @@ private extension YHFileListItemsView {
view.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(72) //for test hjl
make.bottom.equalToSuperview()
}
} else {
view.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(72)
}
}
lastView = view
}
holdView.layer.cornerRadius = kCornerRadius6
holdView.clipsToBounds = true
holdView.layer.borderWidth = 1
holdView.layer.borderColor = UIColor(hex: 0xDEE5F1, alpha: 1.0).cgColor
}
}
//
// YHFileListItemsView2.swift
// galaxy
//
// Created by davidhuangA on 2024/3/25.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHFileListItemsView2: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var dataModel : YHFileListModel? {
didSet {
updateUI()
}
}
private lazy var topBkg : UIView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "file_list_session_bkg")
imagV.contentMode = .scaleAspectFill
return imagV
}()
private lazy var titleLable : UILabel = {
let lable0 = UILabel(text: "title")
lable0.textColor = UIColor.mainTextColor
lable0.font = UIFont.PFSC_R(ofSize: 18)
lable0.textAlignment = .center
return lable0
}()
}
private extension YHFileListItemsView2 {
func updateUI() {
removeSubviews()
guard let dataModel = dataModel else { return }
addSubview(topBkg)
topBkg.snp.makeConstraints { make in
make.top.equalTo(22)
make.centerX.equalToSuperview()
make.width.equalTo(146)
make.height.equalTo(28)
}
titleLable.text = dataModel.ApplicantName.defaultStringIfEmpty(detaultValue: "--")
addSubview(titleLable)
titleLable.snp.makeConstraints { make in
make.top.equalTo(22)
make.centerX.equalToSuperview()
make.left.right.equalToSuperview()
make.height.equalTo(28)
}
var lastView : UIView = topBkg
for (index,item) in dataModel.arrTxt.enumerated() {
let view = UILabel()
view.text = item
view.textColor = UIColor(hex: 0x333333, alpha: 1.0)
view.numberOfLines = 0
view.lineBreakMode = .byWordWrapping
view.font = UIFont.PFSC_R(ofSize: 12)
addSubview(view)
if index == dataModel.arrTxt.count - 1 {
view.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(kMargin)
make.left.equalTo(kMargin)
make.right.equalToSuperview().offset(-kMargin)
make.bottom.equalToSuperview()
}
} else {
var offset = kMargin
if index == 0 {
offset = 20
}
view.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(offset)
make.left.equalTo(kMargin)
make.right.equalToSuperview().offset(-kMargin)
}
}
lastView = view
}
}
}
......@@ -22,10 +22,10 @@ class YHContactMainItemStatusModel {
iconName = "service_center_sfsq_wdpf_icon"
itemName = "我的评分"
} else if type == 4 {
iconName = "service_center_sfsq_wdpf_icon"
iconName = "service_center_sfsq_wdws_icon"
itemName = "我的文书"
} else if type == 5 {
iconName = "service_center_sfsq_wdpf_icon"
iconName = "service_center_sfsq_wdqz_icon"
itemName = "我的签字"
} else if type == 6 {
iconName = "service_center_sfsq_wdpf_icon"
......
......@@ -25,7 +25,7 @@ class YHCertificateCategoryItem {
case .preUpload:
return "待上传".local
case .finish:
return "已通过".local
return "已完成".local
}
}
......@@ -39,11 +39,11 @@ class YHCertificateListContainerVC: YHBaseViewController {
static let segmentHeight = 53.0
var orderId : Int?
var filterDict : [String: Any] = [:]
var filterDict : [String: String] = [:]
var categoryInfo: YHCategoryData = YHCategoryData()
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
bar.title = "资料上传".local
bar.backgroundColor = .white
bar.showLeftSecondButtonType(.search)
bar.backBlock = {
[weak self] in
......@@ -60,7 +60,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
return bar
}()
var titles = ["全部(0)", "待上传(0)", "已驳回(0)", "审核中(0)", "已通过(0)"]
var titles = ["全部", "待上传(0)", "已驳回(0)", "审核中(0)", "已完成(0)"]
let categoryItems = [ YHCertificateCategoryItem(type: .all),
YHCertificateCategoryItem(type: .preUpload),
YHCertificateCategoryItem(type: .rejected),
......@@ -79,6 +79,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
segview.indicators = [indicator]
segview.backgroundColor = .clear
segview.listContainer = listContainerView
segview.backgroundColor = .white
return segview
}()
......@@ -112,15 +113,25 @@ class YHCertificateListContainerVC: YHBaseViewController {
}()
lazy var filterSheetView: YHCertificateFilterView = {
let view = YHCertificateFilterView.sheetView
let view = YHCertificateFilterView.sheetView()
view.confirmBlock = {
[weak self] dict in
guard let self = self else { return }
self.segmentedView.selectItemAt(index: 0)
self.filterDict = dict
let allValues = Array(dict.values)
var isNoFilterCondition = true
for value in allValues {
if !value.isEmpty {
isNoFilterCondition = false
}
}
self.filterBtn.isSelect = !isNoFilterCondition
if let vc = itemVCs.first {
vc.requestList(status:vc.status, extra:dict)
}
self.segmentedView.selectItemAt(index: 0)
}
return view
}()
......@@ -128,7 +139,19 @@ class YHCertificateListContainerVC: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navigationBar.isHidden = true
self.view.backgroundColor = .white
self.navBar.title = "资料".local
if categoryInfo.categoryId == YHCertificateCategoryId.mainApplicant.rawValue {
self.navBar.title = "主申请人资料".local
} else if categoryInfo.categoryId == YHCertificateCategoryId.spouse.rawValue {
self.navBar.title = "配偶资料".local
} else if categoryInfo.categoryId == YHCertificateCategoryId.child.rawValue {
self.navBar.title = "子女资料".local
}
NotificationCenter.default.addObserver(self, selector: #selector(didCertificateCountStatistics(_:)), name:countStatisticsNotify , object: nil)
for item in categoryItems {
......@@ -192,10 +215,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
guard let dic = notification.object as? [YHCertificateUploadStatus: Int] else { return }
print(dic)
if let count = dic[YHCertificateUploadStatus.all] {
titles[0] = "全部(\(count))"
} else if let count = dic[YHCertificateUploadStatus.preUpload] {
if let count = dic[YHCertificateUploadStatus.preUpload] {
titles[1] = "待上传(\(count))"
} else if let count = dic[YHCertificateUploadStatus.rejected] {
......@@ -205,7 +225,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
titles[3] = "审核中(\(count))"
} else if let count = dic[YHCertificateUploadStatus.finish] {
titles[4] = "已通过(\(count))"
titles[4] = "已完成(\(count))"
}
DispatchQueue.main.async {
self.segmentedDataSource.titles = self.titles
......@@ -224,10 +244,13 @@ extension YHCertificateListContainerVC: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
if 0 <= index && index < itemVCs.count {
let vc = itemVCs[index]
vc.requestList(status: vc.status, extra: self.filterDict)
if index == 0 {
vc.requestList(status: vc.status, extra: self.filterDict)
} else {
vc.requestList(status: vc.status)
}
}
}
/// 正在滚动中的回调
///
/// - Parameters:
......
......@@ -115,7 +115,7 @@ extension YHCertificateListVC: UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
if let url = path?.url, !url.isEmpty {
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName:"预览")
}
}
view.show()
......@@ -196,7 +196,7 @@ extension YHCertificateListVC {
}
print(params)
// state: 3:待上传 2:已驳回 1:已通过 0:审核中
// state: 3:待上传 2:已驳回 1:已完成 0:审核中
viewModel.getCertificateList(params: params) {
[weak self] listInfo, error in
......@@ -229,16 +229,13 @@ extension YHCertificateListVC {
}
}
func uploadImage(_ img: UIImage, supplementInfo:YHSupplementInfo) {
func uploadImage(_ img: UIImage, imageName:String, supplementInfo:YHSupplementInfo, callBack:((Bool)->())?) {
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadImage(img) {
[weak self] url, error in
guard let self = self else { return }
YHHUD.hide()
if let url = url, !url.isEmpty {
let imgName = url.lastPathComponent
var suffix = "jpg"
let suffixName = url.pathExtension.lowercased()
if !suffixName.isEmpty {
......@@ -247,33 +244,34 @@ extension YHCertificateListVC {
// 再调用业务接口
let model = YHContentUrl()
model.name = imgName
model.name = imageName
model.url = url
model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
self.requestList(status: self.status)
callBack?(success)
}
return
}
//
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
callBack?(false)
}
}
func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo) {
func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo, successBlock:(()->())?) {
if let fileData = try? Data(contentsOf: fileUrl) {
// 将文件数据上传到服务器
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)")
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in
guard let self = self else { return }
YHHUD.hide()
// 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty {
let fileName = successUrl.lastPathComponent
......@@ -282,8 +280,23 @@ extension YHCertificateListVC {
model.name = fileName
model.url = successUrl
model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
YHHUD.hide()
self.requestList(status:self.status)
if success {
YHHUD.flash(message: "上传成功")
} else {
var msg = "上传失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
if success {
successBlock?()
}
}
return
}
......@@ -299,30 +312,76 @@ extension YHCertificateListVC {
}
}
func showUploadSheetView(_ supplementInfo: YHSupplementInfo?) {
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
if let url = path?.url, !url.isEmpty {
guard let self = self else { return }
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
}
}
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
uploadFile(fileUrl, supplementInfo: supplementInfo)
uploadFile(fileUrl, supplementInfo: supplementInfo) {
// 待上传的进入详情
DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryInfo = self.categoryInfo
vc.supplementInfo = supplementInfo
self.navigationController?.pushViewController(vc)
}
}
}
sheetView.uploadImageBlock = {
[weak self] image in
[weak self] imgArr in
guard let self = self else { return }
uploadImage(image, supplementInfo: supplementInfo)
var successArr:[YHSelectImageItem] = []
var failArr:[YHSelectImageItem] = []
let group = DispatchGroup()
YHHUD.show(.progress(message: "上传中..."))
for item in imgArr {
if let image = item.data {
group.enter()
uploadImage(image, imageName:item.name, supplementInfo: supplementInfo) {
success in
if success {
successArr.append(item)
} else {
failArr.append(item)
}
group.leave()
}
}
}
// 等待所有任务完成
group.notify(queue: .main) {
YHHUD.hide()
// 所有任务完成,回到主线程继续执行
print("所有任务完成")
if imgArr.count == successArr.count {
YHHUD.flash(message: "上传成功")
} else {
YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
}
if successArr.count > 0 {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryInfo = self.categoryInfo
vc.supplementInfo = supplementInfo
self.navigationController?.pushViewController(vc)
}
}
}
sheetView.show()
}
......
......@@ -58,7 +58,13 @@ class YHCertificateSearchViewController: YHBaseViewController {
[weak self] text in
guard let self = self else { return }
requestList(keyWord: text)
}
bar.textChange = {
[weak self] text in
guard let self = self else { return }
if isEmptyString(text) {
requestList(keyWord: "")
}
}
return bar
}()
......@@ -96,6 +102,7 @@ class YHCertificateSearchViewController: YHBaseViewController {
self.view.backgroundColor = .white
self.gk_navTitle = "资料搜索".local
createUI()
requestList(keyWord:"")
}
override func viewWillAppear(_ animated: Bool) {
......@@ -146,7 +153,7 @@ extension YHCertificateSearchViewController: UITableViewDelegate, UITableViewDat
guard let self = self else { return }
if let url = path?.url, !url.isEmpty {
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
}
}
view.show()
......@@ -217,7 +224,7 @@ extension YHCertificateSearchViewController {
"keyword": keywords]
print(params)
// state: 3:待上传 2:已驳回 1:已通过 0:审核中
// state: 3:待上传 2:已驳回 1:已完成 0:审核中
viewModel.getCertificateList(params: params) {
[weak self] listInfo, error in
......@@ -238,16 +245,13 @@ extension YHCertificateSearchViewController {
}
}
func uploadImage(_ img: UIImage, supplementInfo:YHSupplementInfo) {
func uploadImage(_ img: UIImage, imageName:String, supplementInfo:YHSupplementInfo, callBack:((Bool)->())?) {
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadImage(img) {
[weak self] url, error in
guard let self = self else { return }
YHHUD.hide()
if let url = url, !url.isEmpty {
let imgName = url.lastPathComponent
var suffix = "jpg"
let suffixName = url.pathExtension.lowercased()
if !suffixName.isEmpty {
......@@ -256,33 +260,32 @@ extension YHCertificateSearchViewController {
// 再调用业务接口
let model = YHContentUrl()
model.name = imgName
model.name = imageName
model.url = url
model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
self.requestList(keyWord: self.searchBar.textField.text)
callBack?(success)
}
return
}
//
var msg = "上传图片失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
callBack?(false)
}
}
func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo) {
func uploadFile(_ fileUrl:URL, supplementInfo:YHSupplementInfo, successBlock:(()->())?) {
if let fileData = try? Data(contentsOf: fileUrl) {
// 将文件数据上传到服务器
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
print("\(size)")
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in
guard let self = self else { return }
YHHUD.hide()
// 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty {
let fileName = successUrl.lastPathComponent
......@@ -291,8 +294,23 @@ extension YHCertificateSearchViewController {
model.name = fileName
model.url = successUrl
model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.updateCertificateItem(supplementsId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success, error in
YHHUD.hide()
if success {
YHHUD.flash(message: "上传成功")
} else {
var msg = "上传失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
self.requestList(keyWord: self.searchBar.textField.text)
if success {
successBlock?()
}
}
return
}
......@@ -308,30 +326,78 @@ extension YHCertificateSearchViewController {
}
}
func showUploadSheetView(_ supplementInfo: YHSupplementInfo?) {
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
if let url = path?.url, !url.isEmpty {
guard let self = self else { return }
print(url)
self.previewFileTool.openXLSXRemoteFile(urlString:url)
self.previewFileTool.openXLSXRemoteFile(urlString:url, fileName: "预览")
}
}
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
uploadFile(fileUrl, supplementInfo: supplementInfo)
uploadFile(fileUrl, supplementInfo: supplementInfo) {
// 待上传的进入详情
DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryInfo = self.categoryInfo
vc.supplementInfo = supplementInfo
self.navigationController?.pushViewController(vc)
}
}
}
sheetView.uploadImageBlock = {
[weak self] image in
[weak self] imgArr in
guard let self = self else { return }
uploadImage(image, supplementInfo: supplementInfo)
var successArr:[YHSelectImageItem] = []
var failArr:[YHSelectImageItem] = []
let group = DispatchGroup()
YHHUD.show(.progress(message: "上传中..."))
for item in imgArr {
if let image = item.data {
group.enter()
uploadImage(image, imageName:item.name, supplementInfo: supplementInfo) {
success in
if success {
successArr.append(item)
} else {
failArr.append(item)
}
group.leave()
}
}
}
// 等待所有任务完成
group.notify(queue: .main) {
// 所有任务完成,回到主线程继续执行
print("所有任务完成")
YHHUD.hide()
if imgArr.count == successArr.count {
YHHUD.flash(message: "上传成功")
} else {
YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
}
if successArr.count > 0 {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryInfo = self.categoryInfo
vc.supplementInfo = supplementInfo
self.navigationController?.pushViewController(vc)
}
}
}
sheetView.show()
}
......
......@@ -37,7 +37,7 @@ class YHMineCertificateEntryViewController: YHBaseViewController {
private lazy var topBkg : UIView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "service_center_head_bkg")
imagV.image = UIImage(named: "service_center_head_bkg3")
imagV.contentMode = .scaleAspectFill
return imagV
......@@ -92,7 +92,7 @@ extension YHMineCertificateEntryViewController {
view.addSubview(topBkg)
topBkg.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(216)
make.height.equalTo(240)
}
view.addSubview(bottomView)
......
......@@ -69,7 +69,7 @@ class YHSupplementInfo: SmartCodable {
var nameExtra: YHNameExtra = YHNameExtra()
var templateInfo: YHTemplateInfo = YHTemplateInfo()
var auditContent: String = ""
var uploadRequirement: String = ""
var uploadRequirement: Int = 0
var contentUrl: [YHContentUrl] = []
func getStatusName() -> String {
......@@ -78,12 +78,17 @@ class YHSupplementInfo: SmartCodable {
} else if checkStatus == YHCertificateUploadStatus.preUpload.rawValue {
return "待上传".local
} else if checkStatus == YHCertificateUploadStatus.finish.rawValue {
return "已通过".local
return "已完成".local
} else if checkStatus == YHCertificateUploadStatus.rejected.rawValue {
return "已驳回".local
}
return ""
}
func isNeedSupplemnt()->Bool {
// 0:必须提供, 1:如无可不提供
return uploadRequirement == 0
}
enum CodingKeys: String, CodingKey {
case id = "id"
......@@ -138,6 +143,37 @@ class YHContentUrl: SmartCodable {
case updatedAt = "updated_at"
}
// 获取文件后缀名 eg:123.pdf -> pdf
func getFileSuffixName()->String {
let res1 = url.pathExtension.lowercased()
if !res1.isEmpty {
return res1
}
let res2 = name.pathExtension.lowercased()
if !res2.isEmpty {
return res2
}
if !suffix.isEmpty {
return suffix
}
return ""
}
// 获取文件名(不包含后缀) eg:123.pdf -> 123
func getFileNameWithoutSuffix()->String {
if name.isEmpty {
return name
}
if !name.contains(".") {
return name
}
if !name.pathExtension.isEmpty {
let fileName = (name as NSString).deletingPathExtension
return fileName
}
return ""
}
required init() {
}
......@@ -160,7 +196,7 @@ class YHNameExtra: SmartCodable {
enum CodingKeys: String, CodingKey {
case applicant = "applicant"
case userName = "userName"
case userName = "user_name"
case organization = "organization"
}
......@@ -214,6 +250,8 @@ class YHTemplateInfo: SmartCodable {
class YHMaterialPath: SmartCodable {
var name: String = ""
var url: String = ""
// 自定义类型 0:模版 1:指引
var type: Int = 0
enum CodingKeys: String, CodingKey {
case name = "name"
......@@ -224,7 +262,8 @@ class YHMaterialPath: SmartCodable {
}
init(name: String = "", url: String = "") {
init(type:Int, name: String = "", url: String = "") {
self.type = type
self.name = name
self.url = url
}
......
......@@ -26,6 +26,8 @@ enum YHCertificateEditType:Int {
case preview = 2
case delete = 3
case cancel = 4
case reupload = 5
case sendEmail = 6
}
class YHCertificateEditItem {
......
......@@ -59,7 +59,7 @@ extension YHCertificateEntryCell {
var title = ""
var color : UIColor = .failColor
if dataModel.checkStatus == 0 {
title = "未审核"
title = "审核中"
color = UIColor.labelTextColor2
} else if dataModel.checkStatus == 1 {
title = "已完成"
......
......@@ -37,7 +37,7 @@ class YHCertificateEntryHeadView: UIView {
private lazy var statiticLable : UILabel = {
let titleLable = UILabel(text: "待上传2件,已驳回3件,审核中4件,已通过10件")
let titleLable = UILabel(text: "待上传2件,已驳回3件,审核中4件,已完成10件")
titleLable.font = UIFont.PFSC_R(ofSize: 13)
titleLable.textColor = UIColor.mainTextColor
return titleLable
......@@ -75,7 +75,7 @@ private extension YHCertificateEntryHeadView {
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 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))
......@@ -113,7 +113,7 @@ private extension YHCertificateEntryHeadView {
let cc: ASAttributedString = .init(NSAttributedString(string: String(dataModel.to_be_audit_num)), .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let d: ASAttributedString = .init("件,已通过", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let d: ASAttributedString = .init("件,已完成", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let dd: ASAttributedString = .init(NSAttributedString(string: String(dataModel.pass_num)), .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
......
......@@ -61,7 +61,7 @@ class YHCertificateFilterButton: UIView {
}
@objc func didFilterBtnClicked() {
isSelect = !isSelect
isSelect = true
if let clickBlock = clickBlock {
clickBlock(isSelect)
}
......
......@@ -63,9 +63,7 @@ class YHCertificateFilterView: UIView {
static let margin = 21.0
static let gap = 12.0
static let itemHeight = 36.0
static let sheetView = YHCertificateFilterView(frame:UIScreen.main.bounds)
var confirmBlock:(([String : Any])->())?
var confirmBlock:(([String : String])->())?
var items:[YHCertificateFilterSectionInfo] = [
YHCertificateFilterSectionInfo(title: "类型".local, items: [YHCertificateFilterItem(type: .certificate, title: "证件"),
......@@ -76,7 +74,7 @@ class YHCertificateFilterView: UIView {
YHCertificateFilterSectionInfo(title: "状态".local, items: [YHCertificateFilterItem(type: .preUpload, title: "待上传"),
YHCertificateFilterItem(type: .rejected, title: "已驳回"),
YHCertificateFilterItem(type: .review, title: "审核中"),
YHCertificateFilterItem(type: .finish, title: "已通过"),
YHCertificateFilterItem(type: .finish, title: "已完成"),
])]
lazy var collectionView: UICollectionView = {
......@@ -146,7 +144,7 @@ class YHCertificateFilterView: UIView {
lazy var confirmBtn: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(.white, for: .normal)
btn.backgroundColor = UIColor(hexString:"#4388FF")
btn.layer.cornerRadius = 8.0
......@@ -157,7 +155,7 @@ class YHCertificateFilterView: UIView {
lazy var resetBtn:UIButton = {
let btn = UIButton()
btn.setTitle("重置", 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.backgroundColor = UIColor(hexString:"#F8F9FB")
btn.layer.cornerRadius = 8.0
......@@ -174,13 +172,18 @@ class YHCertificateFilterView: UIView {
createUI()
}
static func sheetView() -> YHCertificateFilterView {
let sheetView = YHCertificateFilterView(frame:UIScreen.main.bounds)
return sheetView
}
func createUI() {
self.addSubview(blackMaskView)
self.addSubview(whiteContentView)
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(16.0, 16.0));
let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(8.0, 8.0));
let layer = CAShapeLayer();
layer.frame = whiteContentView.bounds;
layer.path = path.cgPath;
......@@ -286,8 +289,8 @@ extension YHCertificateFilterView {
}
let statusStr = statusValues.joined(separator: ",")
let typeStr = typeValues.joined(separator: ",")
let dict:[String : Any] = [ "status_all": statusStr,
"template_cate_id": typeStr]
let dict:[String : String] = [ "status_all": statusStr,
"template_cate_id": typeStr]
print(dict)
if let confirmBlock = confirmBlock {
confirmBlock(dict)
......
......@@ -12,7 +12,6 @@ import AttributedString
class YHCertificateInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateNameCell"
var status : YHCertificateUploadStatus = .preUpload
......@@ -22,21 +21,7 @@ class YHCertificateInfoCell: UITableViewCell {
var infoLabel: UILabel!
var statusLabel: UILabel!
var rightArrowImgV: UIImageView!
private lazy var templateLabel : UILabel = {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 48, height: 16))
label.text = "资料模版"
label.font = .PFSC_M(ofSize: 10)
label.backgroundColor = .brandMainColor8
label.textColor = .brandMainColor
label.layer.cornerRadius = 3
label.clipsToBounds = true
label.textAlignment = .center
label.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(didTemplateBtnClicked))
label.addGestureRecognizer(tap)
return label
}()
var templateButton: UIButton!
required init?(coder: NSCoder) {
super.init(coder: coder)
......@@ -61,30 +46,48 @@ class YHCertificateInfoCell: UITableViewCell {
titleColor = .failColor
title = "已驳回".local
case .review:
titleColor = .labelTextColor2
titleColor = .warnColor
title = "审核中".local
case .finish:
titleColor = .labelTextColor2
title = "已通过".local
title = "已完成".local
case .all:
titleColor = .labelTextColor2
}
statusLabel.text = title
statusLabel.textColor = titleColor
}
var infoStr = ""
var typeStr = "无"
var ownerStr = "无"
if !model.typeName.isEmpty {
typeStr = model.typeName
}
if !model.nameExtra.applicant.isEmpty {
ownerStr = model.nameExtra.applicant
}
infoLabel.text = "类型: \(typeStr) 所属人: \(ownerStr)"
var result:ASAttributedString = .init(string:"", .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor))
let cerName: ASAttributedString = .init(string:model.name , .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
var template: ASAttributedString = " \(.view(templateButton, .original(.center)))"
// 是否展示右边的模版按钮
var showTemplateBtn = true
if model.templateInfo.materialPath.isEmpty && model.templateInfo.guideFilePath.isEmpty && model.templateInfo.description.isEmpty {
nameTextView.attributed.text = """
\(model.name, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16)))
"""
} else {
nameTextView.attributed.text = """
\(model.name, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateLabel, .original(.center)))
"""
showTemplateBtn = false
}
infoLabel.text = "类型: \(model.typeName) 所属人: \(model.nameExtra.userName)"
if model.isNeedSupplemnt() {
result += mustTag
}
result += cerName
if showTemplateBtn {
result += template
}
nameTextView.attributed.text = result
}
@objc func didTemplateBtnClicked() {
......@@ -112,8 +115,19 @@ class YHCertificateInfoCell: UITableViewCell {
nameTextView.isSelectable = false
whiteView.addSubview(nameTextView)
templateButton = UIButton()
templateButton.frame = CGRect(x: 0, y: 0, width: 48, height: 16)
templateButton.setTitle("资料模版", for: .normal)
templateButton.titleLabel?.font = .PFSC_M(ofSize: 10)
templateButton.setTitleColor(.brandMainColor, for: .normal)
templateButton.layer.cornerRadius = 3
templateButton.clipsToBounds = true
templateButton.backgroundColor = .brandMainColor8
templateButton.addTarget(self, action: #selector(didTemplateBtnClicked), for: .touchUpInside)
templateButton.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
nameTextView.attributed.text = """
\("资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateLabel, .original(.center)))
\("资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateButton, .original(.center))))
"""
infoLabel = UILabel()
......@@ -164,5 +178,12 @@ class YHCertificateInfoCell: UITableViewCell {
make.centerY.equalToSuperview()
}
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let hitView = super.hitTest(point, with: event)
if hitView == nameTextView {
return self
}
return hitView
}
}
......@@ -37,15 +37,9 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel.text = model.name
timeLabel.text = "上传于\(model.updatedAt)"
var suffix = ""
let suffix = model.getFileSuffixName()
var iconImgName = ""
if !model.url.pathExtension.isEmpty {
suffix = model.url.pathExtension
} else {
suffix = model.suffix
}
if suffix == "jpeg" {
iconImgName = "my_cer_type_jpg"
......@@ -83,7 +77,7 @@ class YHCertificateNameCell: UITableViewCell {
whiteView = UIView()
contentView.addSubview(whiteView)
iconImgV = UIImageView(image:UIImage(named:"my_cer_type_pdf"))
iconImgV = UIImageView(image:UIImage(named:"my_cer_type_jpg"))
whiteView.addSubview(iconImgV)
nameLabel = UILabel()
......@@ -91,14 +85,12 @@ class YHCertificateNameCell: UITableViewCell {
nameLabel.textAlignment = .left
nameLabel.numberOfLines = 0
nameLabel.font = UIFont.PFSC_M(ofSize:14)
nameLabel.text = "文档名称.doc"
whiteView.addSubview(nameLabel)
timeLabel = UILabel()
timeLabel.textColor = UIColor.labelTextColor2
timeLabel.textAlignment = .left
timeLabel.font = UIFont.PFSC_R(ofSize:11)
timeLabel.text = "上传于2024.01.01"
whiteView.addSubview(timeLabel)
editBtn = UIButton()
......@@ -106,10 +98,10 @@ class YHCertificateNameCell: UITableViewCell {
editBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 30, left: 30, bottom: 30, right: 30)
editBtn.addTarget(self, action: #selector(didEditBtnClicked), for: .touchUpInside)
whiteView.addSubview(editBtn)
whiteView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.right.equalToSuperview()
make.top.equalToSuperview().offset(15)
make.bottom.equalToSuperview()
}
......@@ -136,7 +128,7 @@ class YHCertificateNameCell: UITableViewCell {
editBtn.snp.makeConstraints { make in
make.width.height.equalTo(16)
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-6)
make.right.equalToSuperview().offset(-20-6)
}
}
}
......@@ -12,6 +12,7 @@ class YHCertificateSearchBar: UIView {
static let height = 40.0
static let cancelBtnHeight = height-8.0
static let maxWordsCount = 50
var textChange:((String?)->Void)?
var searchBlock:((String?)->Void)?
......@@ -33,12 +34,13 @@ class YHCertificateSearchBar: UIView {
lazy var textField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.attributedPlaceholder = NSAttributedString(string: "请输入", attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
textField.attributedPlaceholder = NSAttributedString(string: "请输入关键词搜索".local, attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
textField.font = UIFont.PFSC_M(ofSize: 12)
textField.tintColor = UIColor(hexString: "#3D88F8")
textField.textColor = UIColor.mainTextColor
textField.clearButtonMode = .whileEditing
textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
textField.delegate = self
return textField
}()
......@@ -73,10 +75,16 @@ class YHCertificateSearchBar: UIView {
}
}
func setSearchButtonEnable(_ enable: Bool) {
searchBtn.isUserInteractionEnabled = enable
searchBtn.alpha = (enable ? 1.0 : 0.5)
}
func createUI() {
self.backgroundColor = .white
setSearchButtonEnable(false)
contentView.addSubview(textField)
contentView.addSubview(searchBtn)
self.addSubview(contentView)
......@@ -99,8 +107,30 @@ class YHCertificateSearchBar: UIView {
}
@objc func textFieldChanged(textField:UITextField) {
if isEmptyString(textField.text) {
setSearchButtonEnable(false)
} else {
setSearchButtonEnable(true)
}
if let textChange = textChange {
textChange(textField.text)
}
}
}
extension YHCertificateSearchBar: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.isEmpty == true { // 点击删除
return true
}
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > Self.maxWordsCount {
YHHUD.flash(message: "搜索限制最多\(Self.maxWordsCount)个字符")
return false
}
return true
}
}
......@@ -72,7 +72,18 @@ class YHCertificateSampleTemplateView: UIView {
class YHCertificateTemplateCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateTemplateCell"
var templatePath: YHMaterialPath?
var templatePath: YHMaterialPath? {
didSet {
if let path = templatePath {
var title = "查看证件示例模版"
if path.type == 1 { // 指引
title = "查看证件操作指引"
}
templateView.titleLabel.text = title
}
}
}
lazy var templateView: YHCertificateSampleTemplateView = {
let view = YHCertificateSampleTemplateView(frame:CGRectZero)
......
......@@ -140,12 +140,16 @@ class YHCertificateTemplateSheetView: UIView {
}
templateArr.removeAll()
if model.materialPath.count > 0 {
templateArr.append(model.materialPath[0])
let template = model.materialPath[0]
template.type = 0
templateArr.append(template)
}
if model.guideFilePath.count > 0 {
templateArr.append(model.guideFilePath[0])
let guide = model.guideFilePath[0]
guide.type = 1
templateArr.append(guide)
}
self.tableView.reloadData()
......@@ -263,7 +267,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = "注意事项\(desc)"
label.text = "注意事项:\n\(desc)"
view.addSubview(label)
label.snp.makeConstraints { make in
......
......@@ -75,6 +75,10 @@ class YHCertificateUploadItemView: UIView {
if item.type == .cancel {
titleLabel.textColor = UIColor(hexString:"#909090")
titleLabel.font = UIFont.PFSC_R(ofSize: 14)
} else {
titleLabel.textColor = UIColor.mainTextColor
titleLabel.font = UIFont.PFSC_M(ofSize: 14)
}
titleLabel.snp.remakeConstraints { make in
......
......@@ -18,6 +18,7 @@ import UIKit
class YHFileRenameInputView: UIView {
static let height = 217.0
static let maxWordsCount = 30
var editBlock:((String?)->Void)?
lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds)
......@@ -40,7 +41,7 @@ class YHFileRenameInputView: UIView {
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_B(ofSize:17)
label.text = "请选择上传方式"
label.text = "文件重命名"
return label
}()
......@@ -72,6 +73,9 @@ class YHFileRenameInputView: UIView {
textField.font = UIFont.PFSC_M(ofSize: 16)
textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor
textField.delegate = self
textField.clearButtonMode = .whileEditing
textField.returnKeyType = .done
return textField
}()
......@@ -203,4 +207,21 @@ extension YHFileRenameInputView {
}
}
extension YHFileRenameInputView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.isEmpty == true { // 点击删除
return true
}
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > Self.maxWordsCount {
YHHUD.flash(message: "重命名限制最多30个字符")
return false
}
return true
}
}
......@@ -59,7 +59,33 @@ class YHCertificateViewModel: YHBaseViewModel {
callBackBlock(false,err)
return
}
self.arrFileListData = resultModel
for (_,item) in resultModel.enumerated() {
let arr = item?.supplement_list.filter { (item) -> Bool in
return item.check_status == 2 || item.check_status == 3
}
item?.supplement_list = arr ?? []
}
// var arr = resultModel.filter { (item) -> Bool in
// if let ttt = item,ttt.supplement_list.count > 0 {
// return true
// }
// return false
// }
var arr = resultModel
//添加 写死的数据类型
let tmpModel = YHFileListModel()
tmpModel.ApplicantName = "温馨提示"
tmpModel.type = 1
tmpModel.arrTxt = ["1.以上资料请提供清晰完整的彩色扫描件。","2.照片最好同时提供电子档及时通知我们以避免对申请结果产生影响。","3.申请递交之后,如目前所报备的情况有任何变化(包含婚姻状况、新生子女、工作情况、亲属关系变化,请及时通知我们以避免对申请结果产生影响。"]
arr.append(tmpModel)
self.arrFileListData = arr
callBackBlock(true,nil)
} else {
......@@ -144,9 +170,11 @@ class YHCertificateViewModel: YHBaseViewModel {
printLog("model 是 ==> \(json)")
let dic = json.data
if code == NetWorkCode.success.rawValue {
if json.code == 200 {
guard let result = YHUploadCertificateInfo.deserialize(dict: dic as? Dictionary ) else {
callBack(nil, YHErrorModel(errorCode:Int32(json.code), errorMsg:"解析失败".local))
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBack(nil, err)
return
}
callBack(result, nil)
......@@ -162,20 +190,14 @@ class YHCertificateViewModel: YHBaseViewModel {
}
// 上传/重命名/删除 证件
func updateCertificates(params:[String : Any], isSilient:Bool = false, callBack:@escaping ((Bool, YHErrorModel?)->())) {
func updateCertificates(params:[String : Any], callBack:@escaping ((Bool, YHErrorModel?)->())) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Certificate.certificateUploadApi
if !isSilient {
YHHUD.show(.progress(message: "数据加载中..."))
}
let _ = YHNetRequest.postRequest(url: strUrl, params:params) { json, code in
if !isSilient {
YHHUD.hide()
}
if code == NetWorkCode.success.rawValue {
if json.code == 200 {
callBack(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
......@@ -183,23 +205,20 @@ class YHCertificateViewModel: YHBaseViewModel {
}
} failBlock: { err in
if !isSilient {
YHHUD.hide()
}
callBack(false, err)
}
}
// 更改证件
// operation参数必填,必须是:add(上传)、del(删除)、rename(重命名)
func updateCertificateItem(supplementId:Int, urlModel: YHContentUrl, operation:String, rename:String, callBack:(()->())?) {
func updateCertificateItem(supplementsId:Int, urlModel: YHContentUrl, operation:String, rename:String, callBack:((Bool, YHErrorModel?)->())?) {
var name = urlModel.name
if operation == "rename" {
name = rename
}
let dic:[String : Any] = [
"id" : supplementId,
"id" : supplementsId,
"content_url": [
"name": name,
"url": urlModel.url,
......@@ -209,56 +228,10 @@ class YHCertificateViewModel: YHBaseViewModel {
"operation" : operation,
]
YHHUD.show(.progress(message: "数据加载中..."))
self.updateCertificates(params: params) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
if operation == "del" {
if success {
YHHUD.flash(message: "删除成功")
} else {
var msg = "删除失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
callBack?()
return
}
if operation == "rename" {
if success {
YHHUD.flash(message: "重命名成功")
} else {
var msg = "重命名失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
callBack?()
return
}
if operation == "add" {
if success {
YHHUD.flash(message: "添加成功")
} else {
var msg = "添加失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
}
callBack?()
return
}
guard self != nil else { return }
callBack?(success, error)
}
}
}
......@@ -16,7 +16,7 @@ class YHFilePreviewTool: NSObject {
self.targetVC = targetVC
}
func openXLSXRemoteFile(urlString: String) {
func openXLSXRemoteFile(urlString: String, fileName: String?) {
guard let url = URL(string: urlString) else { return }
let configuration = URLSessionConfiguration.default
......@@ -36,7 +36,7 @@ class YHFilePreviewTool: NSObject {
try? fileManager.moveItem(at: tempLocalUrl, to: destination)
// 打开文件
self.openXLSXFile(at: destination)
self.openXLSXFile(at: destination, fileName: fileName)
} else {
print("Error downloading the file: \(error?.localizedDescription ?? "Unknown error")")
......@@ -49,8 +49,12 @@ class YHFilePreviewTool: NSObject {
task.resume()
}
func openXLSXFile(at fileURL: URL) {
func openXLSXFile(at fileURL: URL, fileName: String?) {
let controller = UIDocumentInteractionController(url: fileURL)
// 设置标题显示
if let fileName = fileName, !fileName.isEmpty {
controller.name = fileName
}
controller.delegate = self
DispatchQueue.main.async {
controller.presentPreview(animated: true)
......
//
// YHHKPlanDocModel.swift
// galaxy
//
// Created by davidhuangA on 2024/4/1.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum HKPlanDocQuestionType {
case unknow
case planDocQuestion1 //1、主要事业成就
case planDocQuestion2 //2、专业技能成就
case planDocQuestion3 //3、学业成就
case planDocQuestion4 //4、未来发展计划
case planDocQuestion5 //5、专业资格及奖项
case planDocQuestion6 //6、其他材料
}
class YHHKPlanDocModel {
var title : String = ""
var content : String = ""
var type : HKPlanDocQuestionType = .unknow
//本地使用
var canEditFlag : Bool = true
var isFirstData : Bool = false
var isLastData : Bool = false
}
......@@ -30,6 +30,9 @@ class YHMyDocumentProspectusModel: YHBaseModel {
var tag: String = ""
var tencent_file_id: String = ""
var tencent_docs_url: String = ""
//赴港计划书状态
var status : Int = 0
}
class YHMyDocumentWritingDocumentModel: YHBaseModel {
......@@ -46,6 +49,7 @@ class YHMyDocumentWritingDocumentModel: YHBaseModel {
}
class YHMyDocumentWritingDocumentDocSignModel: YHBaseModel {
var id: Int = 0
var is_upload: Int = 0
var supplement_id: Int = 0
var doc_send: String = ""
......@@ -56,6 +60,7 @@ class YHMyDocumentWritingDocumentDocSignModel: YHBaseModel {
var wx_electronically_signed: Int = 0
var doc_return_manual: [String] = []
var doc_type_name: String = ""
var audit_opinion: String = ""
}
class YHMyDocumentWritingDocumentSupplementListModel: YHBaseModel {
......
......@@ -27,6 +27,10 @@ class YHMyDocumentsListModel: YHBaseModel {
var contract_lock: Int = 0
var is_second_page: Bool = false
var audi_opinion: String = ""
var isEditFlag : Bool = false //是否为编辑状态
var isSelectedFlag : Bool = true //是否被选择 默认全部全部选择
}
class YHMyDocumentsNameExtraModel: YHBaseModel {
......
//
// YHCheckEamilAlertView.swift
// galaxy
//
// Created by davidhuangA on 2024/3/31.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHCheckEamilAlertView: UIView {
typealias AgreeBlock = () -> ()
var agreeBlock: AgreeBlock?
var centerView: UIView!
var titleLabel: UILabel!
var messageLabel: UILabel!
var agreeButton: UIButton!
var disAgressButton: UIButton!
static func show(_ title: String? = nil, _ message: String? = nil, _ leftButtonString: String? = nil, _ rightButtonString: String? = nil, callBack: @escaping (() -> Void)) {
let view = YHCheckEamilAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.agreeBlock = callBack
view.setContent(title, message, leftButtonString, rightButtonString)
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap))
tap.delegate = self
addGestureRecognizer(tap)
setView()
}
func setContent(_ title: String? = nil, _ message: String? = nil, _ leftButtonString: String? = nil, _ rightButtonString: String? = nil) {
self.titleLabel.text = title
// self.messageLabel.text = message
let a: ASAttributedString = .init("请确认接收邮箱是否为\n", .font(UIFont.PFSC_R(ofSize: 16)),.foreground(UIColor.mainTextColor))
let aa: ASAttributedString = .init(NSAttributedString(string: message ?? "--"), .font(UIFont.PFSC_R(ofSize: 16)),.foreground(UIColor.brandMainColor))
self.messageLabel.attributed.text = a + aa
self.disAgressButton.setTitle(leftButtonString, for: .normal)
self.agreeButton.setTitle(rightButtonString, for: .normal)
if title?.count == 0 || title == nil {
centerView.snp.remakeConstraints { make in
make.center.equalToSuperview()
make.width.equalTo(299)
}
messageLabel.snp.remakeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.top.equalTo(40)
make.bottom.equalTo(disAgressButton.snp.top).offset(-18)
}
disAgressButton.snp.removeConstraints()
disAgressButton.snp.remakeConstraints { make in
make.top.equalTo(messageLabel.snp.bottom).offset(kMargin)
make.left.equalTo(16)
make.width.equalTo(128)
make.height.equalTo(45)
make.bottom.equalTo(-21)
}
agreeButton.snp.removeConstraints()
agreeButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.width.equalTo(128)
make.height.equalTo(45)
make.top.equalTo(messageLabel.snp.bottom).offset(kMargin)
}
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
backgroundColor = UIColor(hex: 0x0000, alpha: 0.5)
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.equalTo(299)
make.height.equalTo(187)
}
titleLabel = {
let label = UILabel()
label.textAlignment = .center
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_M(ofSize: 17)
label.numberOfLines = 0
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.height.equalTo(20)
make.top.equalTo(16)
}
messageLabel = {
let label = UILabel()
label.textAlignment = .center
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_R(ofSize: 16)
label.numberOfLines = 0
return label
}()
centerView.addSubview(messageLabel)
messageLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.height.equalTo(42)
make.top.equalTo(63)
}
disAgressButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0xffffff)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.contentHorizontalAlignment = .center
button.setTitle("不同意", for: .normal)
button.setTitleColor( UIColor(hex:0x3c86f8), for: .normal)
button.layer.cornerRadius = kCornerRadius6
button.layer.borderWidth = 1
button.layer.borderColor = UIColor(hex: 0x3c86f8).cgColor
button.addTarget(self, action: #selector(disagree), for: .touchUpInside)
return button
}()
centerView.addSubview(disAgressButton)
disAgressButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.bottom.equalTo(-21)
make.width.equalTo(128)
make.height.equalTo(45)
}
agreeButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x3c86f8)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.contentHorizontalAlignment = .center
button.setTitle("同意", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius6
button.addTarget(self, action: #selector(agree), for: .touchUpInside)
return button
}()
centerView.addSubview(agreeButton)
agreeButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.bottom.equalTo(-21)
make.width.equalTo(128)
make.height.equalTo(45)
}
}
@objc func agree() {
if let block = self.agreeBlock {
block()
}
dismiss()
}
@objc private func handleTap(_ sender: AnyObject?) {
print("处理点击手势")
dismiss()
}
@objc func disagree() {
dismiss()
}
func dismiss() {
removeFromSuperview()
}
}
extension YHCheckEamilAlertView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer:UIGestureRecognizer, shouldReceive touch:UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
//
// YHFailPromptView.swift
// galaxy
//
// Created by EDY on 2024/4/1.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHFailPromptView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
initView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
lazy var alertImageView : UIImageView = {
let button = UIImageView()
button.image = UIImage(named: "fail_prompt_image")
return button
}()
private lazy var titleLable : UILabel = {
let lable0 = UILabel(text: "")
lable0.textColor = UIColor.failColor
lable0.font = UIFont.PFSC_R(ofSize: 12)
lable0.numberOfLines = 0
return lable0
}()
func setPrompt(_ prompt: String) {
titleLable.text = prompt
}
}
private extension YHFailPromptView {
func initView() {
backgroundColor = UIColor(hex: 0xfeeded)
addSubview(alertImageView)
alertImageView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(18)
make.width.height.equalTo(16)
}
addSubview(titleLable)
titleLable.snp.makeConstraints { make in
make.left.equalTo(38)
make.right.equalTo(-18)
make.top.bottom.equalToSuperview()
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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