Commit 809f6166 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '954095ea' into xiezhaolin

parents 43e428b9 954095ea
......@@ -249,6 +249,7 @@
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */; };
A520124F2BABCE05008655EA /* YHFileListContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A520124E2BABCE05008655EA /* YHFileListContentView.swift */; };
A53026902B4E6F2700F35102 /* YHHomeCustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */; };
A53B61122BB128AF0010B573 /* YHFileListItemsView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53B61112BB128AF0010B573 /* YHFileListItemsView2.swift */; };
A554A5122B99715000EA5973 /* YHConstantArrayData.swift in Sources */ = {isa = PBXBuildFile; fileRef = A554A5112B99715000EA5973 /* YHConstantArrayData.swift */; };
A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */; };
A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */; };
......@@ -258,6 +259,8 @@
A5573EF52B317C0100D98EC0 /* galaxyUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5573EF42B317C0100D98EC0 /* galaxyUITestsLaunchTests.swift */; };
A56D2D612B62020C009C83A8 /* YHContractMainItemStatusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */; };
A57F1F252B48F09200B644E6 /* ATAuthSDK_D.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04808C032B4686510056D53C /* ATAuthSDK_D.framework */; };
A580371E2BAD784B0031C312 /* YHMySchemeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A580371D2BAD784B0031C312 /* YHMySchemeViewModel.swift */; };
A58037212BAD7B2A0031C312 /* YHMySchemeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A58037202BAD7B2A0031C312 /* YHMySchemeModel.swift */; };
A58556BA2B6BCF1A003746B2 /* YHPersonInfoFillStepModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A58556B92B6BCF1A003746B2 /* YHPersonInfoFillStepModel.swift */; };
A58951C52B398D1000225C19 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A58951C42B398D1000225C19 /* Launch Screen.storyboard */; };
A58A8C8F2BA6978100632765 /* YHMineCertificateEntryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A58A8C8E2BA6978100632765 /* YHMineCertificateEntryViewController.swift */; };
......@@ -634,6 +637,7 @@
A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceCenterSecondViewController.swift; sourceTree = "<group>"; };
A520124E2BABCE05008655EA /* YHFileListContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFileListContentView.swift; sourceTree = "<group>"; };
A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeCustomCell.swift; sourceTree = "<group>"; };
A53B61112BB128AF0010B573 /* YHFileListItemsView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListItemsView2.swift; sourceTree = "<group>"; };
A554A5112B99715000EA5973 /* YHConstantArrayData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHConstantArrayData.swift; sourceTree = "<group>"; };
A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBaseViewModel.swift; sourceTree = "<group>"; };
A5573ECE2B317BFF00D98EC0 /* galaxy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = galaxy.app; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -646,6 +650,8 @@
A5573EF22B317C0100D98EC0 /* galaxyUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = galaxyUITests.swift; sourceTree = "<group>"; };
A5573EF42B317C0100D98EC0 /* galaxyUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = galaxyUITestsLaunchTests.swift; sourceTree = "<group>"; };
A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHContractMainItemStatusCell.swift; sourceTree = "<group>"; };
A580371D2BAD784B0031C312 /* YHMySchemeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySchemeViewModel.swift; sourceTree = "<group>"; };
A58037202BAD7B2A0031C312 /* YHMySchemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySchemeModel.swift; sourceTree = "<group>"; };
A58556B92B6BCF1A003746B2 /* YHPersonInfoFillStepModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPersonInfoFillStepModel.swift; sourceTree = "<group>"; };
A58951C42B398D1000225C19 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
A58A8C8E2BA6978100632765 /* YHMineCertificateEntryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMineCertificateEntryViewController.swift; sourceTree = "<group>"; };
......@@ -803,6 +809,7 @@
isa = PBXGroup;
children = (
0425E63F2BA9357D00A5E763 /* YHScemeItemModel.swift */,
A58037202BAD7B2A0031C312 /* YHMySchemeModel.swift */,
);
path = Model;
sourceTree = "<group>";
......@@ -1564,6 +1571,7 @@
A525D22A2BA836D6001A84F5 /* MyScheme(我的方案) */ = {
isa = PBXGroup;
children = (
A580371C2BAD77DB0031C312 /* VM */,
0425E63E2BA9355F00A5E763 /* Model */,
0425E63B2BA931B300A5E763 /* View */,
A525D22B2BA8370F001A84F5 /* C */,
......@@ -1648,6 +1656,14 @@
path = galaxyUITests;
sourceTree = "<group>";
};
A580371C2BAD77DB0031C312 /* VM */ = {
isa = PBXGroup;
children = (
A580371D2BAD784B0031C312 /* YHMySchemeViewModel.swift */,
);
path = VM;
sourceTree = "<group>";
};
A58A8C902BA6C40A00632765 /* VM */ = {
isa = PBXGroup;
children = (
......@@ -2009,6 +2025,7 @@
A5D001292BABC84A001F003C /* YHFileListBottomView.swift */,
A58AC0A02BAC0B2900A30FA9 /* YHFileListItemView.swift */,
A58AC09E2BAC05BA00A30FA9 /* YHFileListItemsView.swift */,
A53B61112BB128AF0010B573 /* YHFileListItemsView2.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -2285,6 +2302,7 @@
045EEEB42B9F171A0022A143 /* YHWorkExampleMessageTableViewCell.swift in Sources */,
045EEF132B9F171A0022A143 /* YHCountryMessage.swift in Sources */,
045EEE7B2B9F171A0022A143 /* YHPersonInfoCellModel2.swift in Sources */,
A53B61122BB128AF0010B573 /* YHFileListItemsView2.swift in Sources */,
045EEE892B9F171A0022A143 /* YHPreviewBaseViewController.swift in Sources */,
045EEEA42B9F171A0022A143 /* YHImageResultViewController.swift in Sources */,
045EEE812B9F171A0022A143 /* YHPreviewQuestionAndAnswerModel.swift in Sources */,
......@@ -2496,10 +2514,12 @@
045EEE8B2B9F171A0022A143 /* YHPreviewMainApplicantInfoViewController.swift in Sources */,
045EEE922B9F171A0022A143 /* YHPreviewInfoNameAndSubNameItemView.swift in Sources */,
045EEEF92B9F171A0022A143 /* YHFormItemTitleCell.swift in Sources */,
A580371E2BAD784B0031C312 /* YHMySchemeViewModel.swift in Sources */,
0425E6482BA96B4100A5E763 /* YHSchemeHeadScoreItemView.swift in Sources */,
04A271252BAC33BB00652B1B /* YHFilePreviewTool.swift in Sources */,
045EEEC32B9F171A0022A143 /* YHOtherResidenceFillView.swift in Sources */,
045EEE792B9F171A0022A143 /* YHPreviewViewModel.swift in Sources */,
A58037212BAD7B2A0031C312 /* YHMySchemeModel.swift in Sources */,
0493B3DE2BA80C2300AF9393 /* YHCertificateFilterButton.swift in Sources */,
045EEE822B9F171A0022A143 /* YHPersonInfoIdentityCardModel.swift in Sources */,
045EEE952B9F171A0022A143 /* YHPreviewInfoCertificateInformationItemsView.swift in Sources */,
......@@ -2711,7 +2731,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -2731,7 +2751,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.2.3;
MARKETING_VERSION = 0.2.7;
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
......@@ -2753,7 +2773,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -2773,7 +2793,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.2.3;
MARKETING_VERSION = 0.2.7;
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
......
......@@ -8,7 +8,7 @@
import UIKit
import Alamofire
import SmartCodable
//import SmartCodable
class YHBaseViewModel {
// 上传方法
......
......@@ -7,6 +7,7 @@
//
import UIKit
import Photos
/*
文件清单
*/
......@@ -40,7 +41,12 @@ class YHFileListViewController: YHBaseViewController {
}()
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,6 +56,7 @@ class YHFileListViewController: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
loadData2()
}
......@@ -58,9 +65,11 @@ class YHFileListViewController: YHBaseViewController {
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,39 @@ 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 ?? "请求出错")
}
}
} else {
printLog("error : orderID 为空")
}
}
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 ?? "请求出错")
}
......@@ -84,6 +119,7 @@ extension YHFileListViewController {
}
}
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()
func captureScrollView(scrollView : UIScrollView) -> UIImage? {
printLog(myScrollView.contentSize)
return
}
scrollView.showsVerticalScrollIndicator = false
UIGraphicsBeginImageContextWithOptions(scrollView.contentSize, false, UIScreen.main.scale)
let savedContentOffset = scrollView.contentOffset
let savedFrame = scrollView.frame
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
scrollView.contentOffset = CGPoint.zero
scrollView.frame = CGRect(x: 0, y: 0, width: scrollView.contentSize.width, height: scrollView.contentSize.height)
scrollView.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
scrollView.contentOffset = savedContentOffset
scrollView.frame = savedFrame
UIGraphicsEndImageContext()
scrollView.showsVerticalScrollIndicator = true
return image
}
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)
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: "没有访问图库权限")
}
}
}
myScrollView.layoutIfNeeded()
printLog("============")
@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,7 +25,6 @@ class YHFileListContentView: UIView {
}
}
private extension YHFileListContentView {
func initView() {
backgroundColor = .clear
......@@ -37,13 +36,13 @@ private extension YHFileListContentView {
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)
if arrData.isEmpty {
sessionBkgImageV.snp.makeConstraints { make in
make.top.equalToSuperview().offset(2)
......@@ -55,32 +54,38 @@ 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)
}
}
var lastView : UIView?
for (index,item) in arrData.enumerated() {
let view = YHFileListItemsView()
view.dataModel = item
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
}
addSubview(view)
if let lastView = lastView {
if index == arrData.count - 1 {
if let tttttt = lastView {
if index == arrData.count - 1 {
view.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom)
make.top.equalTo(tttttt.snp.bottom)
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-20)
}
} else {
view.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom)
make.top.equalTo(tttttt.snp.bottom)
make.left.right.equalToSuperview()
}
}
......@@ -100,6 +105,6 @@ extension YHFileListContentView {
}
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.warnColor))
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.warnColor))
let bbb: ASAttributedString = .init(" 项需重传", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.white))
reuploadLable.attributed.text = a + bb + bbb
}
}
......@@ -22,34 +22,35 @@ 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
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 +72,12 @@ class YHFileListItemView: UIView {
updateUI()
}
}
var myIndex : Int = -1 {
didSet {
updateIndex()
}
}
}
private extension YHFileListItemView {
......@@ -79,6 +86,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 +94,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 +103,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(-6)
}
......@@ -125,18 +134,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
}
}
}
......@@ -25,7 +25,7 @@ class YHCertificateCategoryItem {
case .preUpload:
return "待上传".local
case .finish:
return "已通过".local
return "已完成".local
}
}
......@@ -39,11 +39,10 @@ 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.showLeftSecondButtonType(.search)
bar.backBlock = {
[weak self] in
......@@ -60,7 +59,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),
......@@ -112,15 +111,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
}()
......@@ -129,6 +138,17 @@ class YHCertificateListContainerVC: YHBaseViewController {
super.viewDidLoad()
self.gk_navigationBar.isHidden = true
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 +212,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 +222,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 +241,13 @@ extension YHCertificateListContainerVC: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
if 0 <= index && index < itemVCs.count {
let vc = itemVCs[index]
if index == 0 {
vc.requestList(status: vc.status, extra: self.filterDict)
} else {
vc.requestList(status: vc.status)
}
}
}
/// 正在滚动中的回调
///
/// - Parameters:
......
......@@ -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,7 +229,7 @@ extension YHCertificateListVC {
}
}
func uploadImage(_ img: UIImage, supplementInfo:YHSupplementInfo) {
func uploadImage(_ img: UIImage, supplementInfo:YHSupplementInfo, successBlock:(()->())?) {
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
......@@ -251,7 +251,11 @@ extension YHCertificateListVC {
model.url = url
model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in
self.requestList(status: self.status)
if success {
successBlock?()
}
}
return
}
......@@ -264,7 +268,7 @@ extension YHCertificateListVC {
}
}
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))
......@@ -283,7 +287,11 @@ extension YHCertificateListVC {
model.url = successUrl
model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in
self.requestList(status:self.status)
if success {
successBlock?()
}
}
return
}
......@@ -299,11 +307,9 @@ extension YHCertificateListVC {
}
}
func showUploadSheetView(_ supplementInfo: YHSupplementInfo?) {
func showUploadSheetView(_ supplementInfo: YHSupplementInfo) {
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
......@@ -317,12 +323,30 @@ extension YHCertificateListVC {
[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
guard let self = self else { return }
uploadImage(image, supplementInfo: supplementInfo)
uploadImage(image, supplementInfo: supplementInfo) {
// 非待上传的进入详情
DispatchQueue.main.async {
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) {
......@@ -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
......@@ -260,6 +267,7 @@ extension YHCertificateSearchViewController {
model.url = url
model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in
self.requestList(keyWord: self.searchBar.textField.text)
}
return
......@@ -292,6 +300,7 @@ extension YHCertificateSearchViewController {
model.url = successUrl
model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in
self.requestList(keyWord: self.searchBar.textField.text)
}
return
......@@ -312,7 +321,7 @@ extension YHCertificateSearchViewController {
guard let supplementInfo = supplementInfo else { return }
let sheetView = YHCertificateUploadSheetView.sheetView
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.clickTemplateBlock = {
[weak self] path in
......
......@@ -100,8 +100,10 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
renameInputView.editBlock = {
[weak self] text in
guard let self = self else { return }
if let selectEditItem = selectEditItem, let text = text {
if let selectEditItem = selectEditItem, var text = text {
text = text + "." + selectEditItem.getFileSuffixName()
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:selectEditItem, operation: "rename", rename: text) {
success in
self.requestList()
}
}
......@@ -113,7 +115,12 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
}
@objc func didClickUploadBtn() {
let sheetView = YHCertificateUploadSheetView.sheetView
if items.count >= 100 {
YHHUD.flash(message: "最多上传100张图片或文件")
return
}
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.templateInfo = supplementInfo.templateInfo
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
......@@ -210,7 +217,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
if editType == .rename { // 重命名
IQKeyboardManager.shared.enable = false
renameInputView.textField.text = contentItem.name
renameInputView.textField.text = contentItem.getFileNameWithoutSuffix()
renameInputView.textField.becomeFirstResponder()
} else if editType == .delete { // 删除
......@@ -219,6 +226,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
YHTwoOptionAlertView.showAlertView(message:msg) { sure in
if !sure { return }
self.viewModel.updateCertificateItem(supplementId:self.supplementInfo.id, urlModel:contentItem, operation: "del", rename:"") {
success in
self.requestList()
}
}
......@@ -284,7 +292,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
tipsLabel.font = UIFont.PFSC_R(ofSize:14)
tipsLabel.numberOfLines = 0
if !supplementInfo.templateInfo.description.isEmpty {
tipsLabel.text = "注意事项:\(supplementInfo.templateInfo.description)"
tipsLabel.text = supplementInfo.templateInfo.description
}
view.addSubview(tipsLabel)
......@@ -326,7 +334,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
bgColor = UIColor(hexString: "#2F7EF6", 0.08)
} else if supplementInfo.checkStatus == YHCertificateUploadStatus.finish.rawValue {
text = "已通过".local
text = "已完成".local
textColor = UIColor(hexString: "#49D2B1")
bgColor = UIColor(hexString: "#49D2B1", 0.08)
......@@ -340,7 +348,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
statusLabel.backgroundColor = bgColor
let tipsLabel = UILabel()
tipsLabel.textColor = .warnColor
tipsLabel.textColor = .failColor
tipsLabel.font = UIFont.PFSC_R(ofSize:12)
tipsLabel.textAlignment = .left
tipsLabel.numberOfLines = 0
......@@ -404,9 +412,15 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
}
} else if indexPath.section == 1 { // 证件列表
if 0 <= indexPath.row && indexPath.row < items.count {
let cer = items[indexPath.row]
print("\(cer.url)")
print("\(cer.name)")
print("\(cer.suffix)")
}
}
}
@objc func dismissed() {
renameInputView.textField.resignFirstResponder()
......@@ -476,6 +490,8 @@ extension YHCertificateUploadContentListVC {
items.append(contentsOf: item.contentUrl)
}
}
self.uploadBtn.alpha = (items.count >= 100 ? 0.5 : 1.0)
self.tableView.reloadData()
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
......@@ -508,6 +524,7 @@ extension YHCertificateUploadContentListVC {
model.url = url
model.suffix = suffix
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in
self.requestList()
}
return
......@@ -540,6 +557,7 @@ extension YHCertificateUploadContentListVC {
model.url = successUrl
model.suffix = suffixName
self.viewModel.updateCertificateItem(supplementId:supplementInfo.id, urlModel:model, operation: "add", rename: "") {
success in
self.requestList()
}
return
......@@ -549,6 +567,7 @@ extension YHCertificateUploadContentListVC {
msg = errorMsg
}
YHHUD.flash(message: msg)
YHCertificateUploadFailTipsView.tipsView().show()
}
} else {
......
......@@ -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,13 +78,18 @@ 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"
case name = "name"
......@@ -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() {
}
......
......@@ -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 = {
......@@ -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,7 +289,7 @@ extension YHCertificateFilterView {
}
let statusStr = statusValues.joined(separator: ",")
let typeStr = typeValues.joined(separator: ",")
let dict:[String : Any] = [ "status_all": statusStr,
let dict:[String : String] = [ "status_all": statusStr,
"template_cate_id": typeStr]
print(dict)
if let confirmBlock = confirmBlock {
......
......@@ -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)
......@@ -65,26 +50,44 @@ class YHCertificateInfoCell: UITableViewCell {
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.userName.isEmpty {
ownerStr = model.nameExtra.userName
}
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)))
"""
showTemplateBtn = false
}
} else {
nameTextView.attributed.text = """
\(model.name, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateLabel, .original(.center)))
"""
if model.isNeedSupplemnt() {
result += mustTag
}
result += cerName
if showTemplateBtn {
result += template
}
infoLabel.text = "类型: \(model.typeName) 所属人: \(model.nameExtra.userName)"
nameTextView.attributed.text = result
}
@objc func didTemplateBtnClicked() {
......@@ -112,8 +115,18 @@ 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)
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()
......@@ -165,4 +178,11 @@ class YHCertificateInfoCell: UITableViewCell {
}
}
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 = ""
var 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"
......
......@@ -73,9 +73,15 @@ 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)
......@@ -99,6 +105,11 @@ class YHCertificateSearchBar: UIView {
}
@objc func textFieldChanged(textField:UITextField) {
if isEmptyString(textField.text) {
setSearchButtonEnable(false)
} else {
setSearchButtonEnable(true)
}
if let textChange = textChange {
textChange(textField.text)
}
......
......@@ -263,7 +263,7 @@ extension YHCertificateTemplateSheetView: UITableViewDelegate, UITableViewDataSo
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = "注意事项:\(desc)"
label.text = desc
view.addSubview(label)
label.snp.makeConstraints { make in
......
......@@ -8,7 +8,7 @@
/*
【Usage】
YHCertificateUploadSheetView.sheetView.show {
YHCertificateUploadSheetView.sheetView().show {
[weak self] actionType in
guard let self = self else { return }
print("%d", actionType.rawValue)
......@@ -31,7 +31,33 @@ enum YHCertificateUploadType: Int {
class YHCertificateUploadSheetView: UIView {
static let sheetView = YHCertificateUploadSheetView(frame:UIScreen.main.bounds)
static func sheetView() -> YHCertificateUploadSheetView {
let view = YHCertificateUploadSheetView(frame:UIScreen.main.bounds)
return view
}
func calculateHeight() -> CGFloat {
guard let templateInfo = templateInfo else { return 0.0}
// 注意事项文字高度
var descHeight = templateInfo.description.boundingRect(with: CGSize(width:KScreenWidth-40.0 , height:.greatestFiniteMagnitude),
options: .usesLineFragmentOrigin,
attributes: [.font : UIFont.PFSC_R(ofSize:14)],
context: nil).size.height
descHeight = ceil(descHeight)+20
// 所有模版高度之和
let templatesHeight = 82.0 * Double(templateArr.count)
// 底部四个操作行高度之和
let actionsHeight = 52.0 * 4.0
let tableViewHeight = descHeight+templatesHeight+actionsHeight
// 白色View总高度
var totalHeight = 53.0+20.0+tableViewHeight+k_Height_safeAreaInsetsBottom()
if totalHeight > KScreenHeight {
totalHeight = 458
}
return totalHeight
}
var templateInfo: YHTemplateInfo? {
didSet {
......@@ -44,6 +70,12 @@ class YHCertificateUploadSheetView: UIView {
templateArr.append(templateInfo.guideFilePath[0])
}
}
let totalHeight = calculateHeight()
whiteContentView.snp.updateConstraints { make in
make.height.equalTo(totalHeight)
}
self.setNeedsLayout()
self.layoutIfNeeded()
self.tableView.reloadData()
}
}
......@@ -195,7 +227,7 @@ class YHCertificateUploadSheetView: UIView {
whiteContentView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalToSuperview().offset(355)
make.height.equalTo(458.0)
}
topView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
......@@ -310,7 +342,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = "注意事项:\(desc)"
label.text = desc
view.addSubview(label)
label.snp.makeConstraints { make in
......@@ -331,7 +363,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINavigationControllerDelegate) {
private func getPhotoLibraryAuthorization() -> Bool {
private func getPhotoLibraryAuthorization(notDeterminedBlock: (()->())?) -> Bool? {
let authorizationStatus = PHPhotoLibrary.authorizationStatus()
switch authorizationStatus {
case .authorized:
......@@ -340,7 +372,11 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
case .notDetermined:
print("不确定是否授权")
// 请求授权
PHPhotoLibrary.requestAuthorization({ (status) in })
PHPhotoLibrary.requestAuthorization {
status in
notDeterminedBlock?()
}
return nil
case .denied:
print("拒绝授权")
case .restricted:
......@@ -354,7 +390,19 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
}
func takePhoto() {
guard getPhotoLibraryAuthorization() else { return }
guard let authorization = getPhotoLibraryAuthorization(notDeterminedBlock: {
DispatchQueue.main.async {
self.takePhoto()
}
}) else {
return
}
if !authorization {
YHHUD.flash(message: "请在设置中打开相册权限")
return
}
if UIImagePickerController.isSourceTypeAvailable(.camera){
//创建图片控制器
let imagePicker = UIImagePickerController()
......@@ -372,7 +420,21 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
}
func selectPhoto() {
guard getPhotoLibraryAuthorization() else { return }
guard let authorization = getPhotoLibraryAuthorization(notDeterminedBlock: {
DispatchQueue.main.async {
self.selectPhoto()
}
}) else {
return
}
if !authorization {
YHHUD.flash(message: "请在设置中打开相册权限")
return
}
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
......
......@@ -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
......
......@@ -40,7 +40,7 @@ class YHFileRenameInputView: UIView {
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_B(ofSize:17)
label.text = "请选择上传方式"
label.text = "文件重命名"
return label
}()
......
......@@ -59,7 +59,32 @@ 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
}
//添加 写死的数据类型
let tmpModel = YHFileListModel()
tmpModel.ApplicantName = "温馨提示"
tmpModel.type = 1
tmpModel.arrTxt = ["1.以上资料请提供清晰完整的彩色扫描件。","2.照片最好同时提供电子档及时通知我们以避免对申请结果产生影响。","3.申请递交之后,如目前所报备的情况有任何变化(包含婚姻状况、新生子女、工作情况、亲属关系变化,请及时通知我们以避免对申请结果产生影响。"]
arr.append(tmpModel)
self.arrFileListData = arr
callBackBlock(true,nil)
} else {
......@@ -192,7 +217,7 @@ class YHCertificateViewModel: YHBaseViewModel {
// 更改证件
// operation参数必填,必须是:add(上传)、del(删除)、rename(重命名)
func updateCertificateItem(supplementId:Int, urlModel: YHContentUrl, operation:String, rename:String, callBack:(()->())?) {
func updateCertificateItem(supplementId:Int, urlModel: YHContentUrl, operation:String, rename:String, callBack:((Bool)->())?) {
var name = urlModel.name
if operation == "rename" {
......@@ -227,7 +252,7 @@ class YHCertificateViewModel: YHBaseViewModel {
}
YHHUD.flash(message:msg)
}
callBack?()
callBack?(success)
return
}
......@@ -242,21 +267,22 @@ class YHCertificateViewModel: YHBaseViewModel {
}
YHHUD.flash(message:msg)
}
callBack?()
callBack?(success)
return
}
if operation == "add" {
if success {
YHHUD.flash(message: "添加成功")
YHHUD.flash(message: "上传成功")
} else {
var msg = "添加失败"
var msg = "上传失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message:msg)
YHCertificateUploadFailTipsView.tipsView().show()
}
callBack?()
callBack?(success)
return
}
}
......
......@@ -17,6 +17,16 @@ class YHMineSchemeViewController: YHBaseViewController {
var tableView: UITableView!
var dataSource: [YHScemeItemModel]? = []
lazy var reqSchemeVM : YHMySchemeViewModel = {
let vm = YHMySchemeViewModel()
return vm
}()
lazy var headView : YHSchemeTableHeadView = {
let headView = YHSchemeTableHeadView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 566))
return headView
}()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "我的方案"
......@@ -25,12 +35,37 @@ class YHMineSchemeViewController: YHBaseViewController {
gk_navBackgroundImage = UIImage(named: "my_scheme_nav")
gk_backImage = UIImage(named: "nav_icon_back")
setView()
getData()
// Do any additional setup after loading the view.
loadData()
}
}
extension YHMineSchemeViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataSource?.count ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHSchemeTableViewCell.self)
cell.dataSource = dataSource?[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
return 199
} else if indexPath.row == 1 {
return 251
} else if indexPath.row == 2 {
return 190
}
return 0
}
}
extension YHMineSchemeViewController {
func getData() {
let model1 = YHScemeItemModel(title: "行业定位", mainMessage: "根据您目前给来的材料,初步建议您申请的行业:其他(环境科学、HSE)", lightMessage: "其他(环境科学、HSE)", subMessage: "后续会根据您文书准备的补充情况来最终确定,如有修改会再告知您。")
let model1 = YHScemeItemModel(title: "行业定位", mainMessage: "根据您目前给来的材料,初步建议您申请的行业:--", lightMessage: "--", subMessage: "后续会根据您文书准备的补充情况来最终确定,如有修改会再告知您。")
let model2 = YHScemeItemModel(title: "资料清单", buttonTitle: "资料清单", mainMessage: "这是您的资料清单,请您前往查看。请您在1-2周内上传基础类证件哦,需要重新办理的可以晚些提供。需要注意的点如下:", lightMessage: "1-2周内", subMessage: "(1)港澳通如未办理,请尽快办理好反馈过来;\n(2)如为国内学校,需要尽快办理学位认证报告;\n(3)如为海外学校,需提供成绩单副本")
let model3 = YHScemeItemModel(title: "文书清单", buttonTitle: "文书写作", mainMessage: "这是您的文书清单,包括推荐信、赴港计划书,我写好后会发在微信里,与您一起沟通进行哈。3周-4周左右完成,需要咱们共同配合完成的噢", lightMessage: "3周-4周")
dataSource = [model1, model2, model3]
......@@ -53,9 +88,8 @@ class YHMineSchemeViewController: YHBaseViewController {
tableView.delegate = self
tableView.dataSource = self
tableView.tableFooterView = YHSchemeTableFooterView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 112))
let head = YHSchemeTableHeadView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 511))
head.dataSource = YHScemeHeadModel(totalScore: "100", scoreArray: ["年龄30分","学历30分","工作经验加分15分","语言加分15分","家庭背景加分10分"], scoreLightArray: ["30","30","15","15","10"], addScore: "", name: "黄金龙")
tableView.tableHeaderView = head
tableView.tableHeaderView = headView
tableView.register(cellWithClass: YHSchemeTableViewCell.self)
tableView.bounces = false
return tableView
......@@ -66,31 +100,46 @@ class YHMineSchemeViewController: YHBaseViewController {
make.left.right.bottom.equalToSuperview()
}
}
}
extension YHMineSchemeViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataSource?.count ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHSchemeTableViewCell.self)
cell.dataSource = dataSource?[indexPath.row]
return cell
}
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let param = ["order_id":orderID]
reqSchemeVM.getMySchemeData(params: param) { success, error in
if success == true {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
return 199
}
guard let model = self.reqSchemeVM.schemeModel else { return }
if indexPath.row == 1 {
return 251
}
let industry = model.industry.defaultStringIfEmpty()
let model1 = YHScemeItemModel(title: "行业定位", mainMessage: "根据您目前给来的材料,初步建议您申请的行业:" + industry, lightMessage: industry, subMessage: "后续会根据您文书准备的补充情况来最终确定,如有修改会再告知您。")
let model2 = YHScemeItemModel(title: "资料清单", buttonTitle: "资料清单", mainMessage: "这是您的资料清单,请您前往查看。请您在1-2周内上传基础类证件哦,需要重新办理的可以晚些提供。需要注意的点如下:", lightMessage: "1-2周内", subMessage: "(1)港澳通如未办理,请尽快办理好反馈过来;\n(2)如为国内学校,需要尽快办理学位认证报告;\n(3)如为海外学校,需提供成绩单副本")
let model3 = YHScemeItemModel(title: "文书清单", buttonTitle: "文书写作", mainMessage: "这是您的文书清单,包括推荐信、赴港计划书,我写好后会发在微信里,与您一起沟通进行哈。3周-4周左右完成,需要咱们共同配合完成的噢", lightMessage: "3周-4周")
self.dataSource = [model1, model2, model3]
self.tableView.reloadData()
if indexPath.row == 2 {
return 190
let ageTxt = "年龄" + model.age_score.string + "分"
let eduTxtA = "学历" + model.education_score_a.string + "分,名校加分XX分"
let workExp = "工作经验加分" + model.work_experience_score.string + "分"
let famous_enterprise = "名企加分" + model.famous_enterprise.string + "分"
let talent_list = "人才清单加分" + model.talent_list.string + "分"
let language = "语言加分" + model.language_score.string + "分"
let family = "家庭背景加分" + model.background_score.string + "分"
let arrText : [String] = [ageTxt,eduTxtA,workExp,famous_enterprise,talent_list,language,family]
let arrH : [String] = [model.age_score.string,model.education_score_a.string,model.work_experience_score.string,model.famous_enterprise.string,model.talent_list.string,model.language_score.string,model.background_score.string]
self.headView.dataSource = YHScemeHeadModel(totalScore: model.sum_score.string, scoreArray: arrText, scoreLightArray: arrH, addScore: "", name: model.username.defaultStringIfEmpty(),addtionStr: model.education_score_b.string)
} else {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
}
} else {
printLog("error : orderID 为空")
}
return 0
}
}
//
// YHMySchemeModel.swift
// galaxy
//
// Created by davidhuangA on 2024/3/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHMySchemeModel: SmartCodable {
var age_score : Int = 0
var background_score : Int = 0
var education_score_a : Int = 0
var education_score_b : Int = 0
var famous_enterprise : Int = 0
var industry : String = ""
var language_score : Int = 0
var sum_score : Int = 0
var talent_list : Int = 0
var username : String = ""
var work_experience_score : Int = 0
required init() {
}
}
......@@ -22,4 +22,5 @@ struct YHScemeHeadModel {
var scoreLightArray: [String] = []
var addScore: String = ""
var name: String = ""
var addtionStr : String = ""
}
//
// YHMySchemeViewModel.swift
// galaxy
//
// Created by davidhuangA on 2024/3/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMySchemeViewModel: YHBaseViewModel {
var schemeModel : YHMySchemeModel?
//我的方案
func getMySchemeData( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Assessment.applyPlanApi
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 = YHMySchemeModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,err)
return
}
self.schemeModel = 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)
}
}
}
......@@ -7,6 +7,7 @@
//
import UIKit
import AttributedString
class YHSchemeHeadScoreItemView: UIView {
var titleLabel: UILabel!
......@@ -46,8 +47,24 @@ class YHSchemeHeadScoreItemView: UIView {
}
}
func setContent(_ message: String, _ light: String) {
let newString: NSAttributedString = message.highlighted(keyWords: light, highlightColor: UIColor(hex: 0xd48638))
func setContent(_ message: String, _ light: String,_ addtionStr: String) {
if message.contains("名校加分") {
let a: ASAttributedString = .init("学历", .font(UIFont.PFSC_M(ofSize: 14)),.foreground(UIColor.mainTextColor))
let aa: ASAttributedString = .init(NSAttributedString(string: light), .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let b: ASAttributedString = .init("分,名校加分", .font(UIFont.PFSC_M(ofSize: 14)),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init(NSAttributedString(string: addtionStr), .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.warnColor))
let bbb: ASAttributedString = .init("分", .font(UIFont.PFSC_M(ofSize: 14)),.foreground(UIColor.mainTextColor))
titleLabel.attributed.text = a + aa + b + bb + bbb
} else {
let newString: NSAttributedString = message.highlighted(keyWords: light, highlightColor: UIColor.warnColor)
titleLabel.attributedText = newString
}
}
}
......@@ -171,7 +171,7 @@ class YHSchemeTableHeadView: UIView {
button.setTitleColor(UIColor(hex:0xd48638), for: .normal)
button.layer.cornerRadius = kCornerRadius4
button.clipsToBounds = true
// button.addTarget(self, action: #selector(goNext), for: .touchUpInside)
button.addTarget(self, action: #selector(goNext), for: .touchUpInside)
return button
}()
addSubview(titleButton)
......@@ -214,14 +214,14 @@ class YHSchemeTableHeadView: UIView {
func updateAllViews() {
guard let model = dataSource else { return }
nameLabel.text = "尊敬的" + model.name + "先生"
nameLabel.text = "尊敬的" + model.name
scoreTotalView.setScore(model.totalScore)
scoreItemView.removeSubviews()
for i in 0..<model.scoreArray.count {
let string = model.scoreArray[i]
let light = model.scoreLightArray[i]
let view = YHSchemeHeadScoreItemView()
view.setContent(string, light)
view.setContent(string, light,model.addtionStr)
scoreItemView.addSubview(view)
view.snp.makeConstraints { make in
make.top.equalTo(i * 28)
......@@ -230,4 +230,9 @@ class YHSchemeTableHeadView: UIView {
}
}
}
@objc func goNext() {
UIViewController.current?.navigationController?.pushViewController(YHScoreDetailViewController())
}
}
......@@ -112,7 +112,7 @@ class YHSchemeTableViewCell: UITableViewCell {
button.setTitleColor(UIColor(hex:0xd48638), for: .normal)
button.layer.cornerRadius = kCornerRadius4
button.clipsToBounds = true
// button.addTarget(self, action: #selector(goNext), for: .touchUpInside)
button.addTarget(self, action: #selector(goNext), for: .touchUpInside)
return button
}()
centerView.addSubview(titleButton)
......@@ -165,4 +165,16 @@ class YHSchemeTableViewCell: UITableViewCell {
mainMessageLabel.attributedText = newString
subMessageLabel.text = model.subMessage
}
@objc func goNext() {
if let title = titleButton.titleLabel?.text {
if title.contains("资料清单") {
UIViewController.current?.navigationController?.pushViewController(YHFileListViewController())
} else if title.contains("文书写作") {
UIViewController.current?.navigationController?.pushViewController(YHMyDocumentsListViewController())
}
}
}
}
......@@ -82,8 +82,8 @@ extension YHScoreDetailViewController {
private func loadData() {
guard let orderId = orderId else { return}
let param = ["order_id":orderId]
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let param = ["order_id":orderID]
serviceCenterMainReqVM.getMyScoreDetail(params: param) { success, error in
if success == true {
......@@ -92,6 +92,9 @@ extension YHScoreDetailViewController {
}
self.homeTableView.reloadData()
}
} else {
YHHUD.flash(message: "订单号不存在")
}
}
}
......
......@@ -84,7 +84,7 @@ class YHEducationDetailVC: YHBaseViewController {
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.bottom.equalToSuperview()
make.height.equalTo(YHSaveAndSubmitView.height)
}
......
......@@ -85,7 +85,7 @@ class YHEducationInfoListVC: YHBaseViewController {
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.bottom.equalToSuperview()
make.height.equalTo(YHSaveAndSubmitView.height)
}
......@@ -114,7 +114,7 @@ class YHEducationInfoListVC: YHBaseViewController {
arr0.append(item)
}
// 多学历可编辑删除状态
if eduList.count <= 0 {
if eduList.count <= 1 {
isDegreeEditMode = .none
} else {
if isDegreeEditMode == .none {
......@@ -317,7 +317,7 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
}
let tips = String(format: "有%d项未填", eduInfo.vacantNum)
cell.detailLabel.text = tips
cell.isShowDeleteBtn = (isDegreeEditMode == .canCancel)
cell.isShowDeleteBtn = (isDegreeEditMode == .canCancel && eduList.count > 1)
cell.setTips(tips, isShow:(isNeedShowError && eduInfo.vacantNum > 0))
cell.deleteBlock = {
var title = "确定删除该学历吗?"
......
......@@ -82,7 +82,7 @@ class YHQualificationDetailVC: YHBaseViewController {
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.bottom.equalToSuperview()
make.height.equalTo(YHSaveAndSubmitView.height)
}
......
......@@ -54,7 +54,7 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
view.addSubview(tableView);
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
let bottomHeight = YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
......
......@@ -62,7 +62,7 @@ class YHCertificateUploadVC: YHBaseViewController, YHFamilyMemberProtol {
view.addSubview(tableView)
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
let bottomHeight = YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview()
......
......@@ -53,7 +53,7 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
view.addSubview(tableView);
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
let bottomHeight = YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
......
......@@ -127,7 +127,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.bottom.equalToSuperview()
make.height.equalTo(YHSaveAndSubmitView.height)
}
}
......@@ -160,7 +160,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
var titles:[String] = []
for vcItem in stepVCs {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
let bottomHeight = YHSaveAndSubmitView.height
vcItem.vc.view.frame = CGRectMake(0, topHeight, KScreenWidth, KScreenHeight-topHeight-bottomHeight)
self.addChild(vcItem.vc)
self.view.addSubview(vcItem.vc.view)
......
......@@ -122,7 +122,7 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
view.addSubview(tableView);
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
let bottomHeight = YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
......
......@@ -77,7 +77,7 @@ class YHBrotherInfoVC: YHBaseViewController {
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.bottom.equalToSuperview()
make.height.equalTo(YHSaveAndSubmitView.height)
}
......
......@@ -79,7 +79,7 @@ class YHParentInfoVC: YHBaseViewController {
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.bottom.equalToSuperview()
make.height.equalTo(YHSaveAndSubmitView.height)
}
......
......@@ -70,7 +70,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
view.addSubview(tableView);
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
let bottomHeight = YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
......
......@@ -142,7 +142,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.bottom.equalToSuperview()
make.height.equalTo(YHSaveAndSubmitView.height)
}
}
......@@ -175,7 +175,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
var titles:[String] = []
for vcItem in stepVCs {
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
let bottomHeight = YHSaveAndSubmitView.height
vcItem.vc.view.frame = CGRectMake(0, topHeight, KScreenWidth, KScreenHeight-topHeight-bottomHeight)
self.addChild(vcItem.vc)
self.view.addSubview(vcItem.vc.view)
......
......@@ -126,7 +126,7 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
view.addSubview(tableView);
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
let bottomHeight = YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(16)
......
......@@ -13,7 +13,7 @@ class YHSaveAndSubmitView: UIView {
static let submitBtnHeight = 48.0
static let saveBtnWidth = 86.0
static let gap = 8.0
static let height = submitBtnHeight+gap*2
static let height = submitBtnHeight+gap*2+k_Height_safeAreaInsetsBottom()
var saveBlock:(()->Void)?
var submitBlock:(()->Void)?
......
......@@ -165,7 +165,10 @@ class YHImagePickerView: UIView {
}
@objc func takePhoto() {
guard getPhotoLibraryAuthorization() else { return }
guard getPhotoLibraryAuthorization() else {
YHHUD.flash(message: "请打开相册权限")
return
}
if UIImagePickerController.isSourceTypeAvailable(.camera){
//创建图片控制器
let imagePicker = UIImagePickerController()
......@@ -183,7 +186,10 @@ class YHImagePickerView: UIView {
}
@objc func selectPhoto() {
guard getPhotoLibraryAuthorization() else { return }
guard getPhotoLibraryAuthorization() else {
YHHUD.flash(message: "请打开相册权限")
return
}
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
......
......@@ -137,8 +137,7 @@ extension YHServiceCenterMainViewModel {
model.isFinished = true
arrContactStausItmes.append(model)
//我的证件
if resultModel.supplement_not_submit_num > 0 {
let model2 = YHContactMainItemStatusModel()
model2.type = 2
......@@ -158,31 +157,31 @@ extension YHServiceCenterMainViewModel {
model3.isFinished = true
arrContactStausItmes.append(model3)
// if resultModel.my_document {
if resultModel.my_document {
//我的文书
let model4 = YHContactMainItemStatusModel()
model4.type = 4
model4.isFinished = true
arrContactStausItmes.append(model4)
// }
}
// if resultModel.my_signature {
if resultModel.my_signature {
//我的签字
let model5 = YHContactMainItemStatusModel()
model5.type = 5
model5.isFinished = true
arrContactStausItmes.append(model5)
// }
}
// if resultModel.scheme_position_switch == 1 {
if resultModel.scheme_position_switch == 1 {
//我的方案
let model6 = YHContactMainItemStatusModel()
model6.type = 6
model6.isFinished = true
arrContactStausItmes.append(model6)
// }
}
} else {
let model = YHContactMainItemStatusModel()
......
......@@ -211,4 +211,10 @@ class YHAllApiName {
//获取问答列表
static let questionAndAnswerApi = "infoflow/answer-question/getAnswerQuestion"
}
// 我的方案
struct Assessment {
//方案计划
static let applyPlanApi = "infoflow/assessment/apply_plan"
}
}
......@@ -28,7 +28,7 @@ class YHBaseUrlManager {
// MARK: - 当前使用的url
func curURL() -> String {
// return YHBaseUrlManager.baseUrlRelease //for test hjl
return YHBaseUrlManager.baseUrlTest //for test hjl
#if DEBUG
return YHBaseUrlManager.baseUrlTest
#else
......@@ -37,7 +37,7 @@ class YHBaseUrlManager {
}
func curOssURL() -> String {
// return YHBaseUrlManager.baseOSSUrlRelease //for test hjl
return YHBaseUrlManager.baseOSSUrlTest //for test hjl
#if DEBUG
return YHBaseUrlManager.baseOSSUrlTest
#else
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ziliaoshangc-toutu@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ziliaoshangc-toutu@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>UIAppFonts</key>
<array>
<string>DIN Alternate Bold</string>
......@@ -17,9 +19,6 @@
<string>photoLibraryDesciption</string>
<key>NSFileProviderDomainUsageDescription</key>
<string>需要访问您的文件以选择和上传</string>
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
......@@ -79,9 +78,5 @@
<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