Commit 34a6de03 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '0ea6f74d' into xiezhaolin

parents f0efb0d0 0ea6f74d
......@@ -32,6 +32,11 @@
044867B82BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044867B72BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift */; };
044CF8D42BB6BCF700008CE8 /* YHSignatureUploadTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044CF8D32BB6BCF700008CE8 /* YHSignatureUploadTableViewCell.swift */; };
044CF8D62BBA57DC00008CE8 /* YHFailPromptView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044CF8D52BBA57DC00008CE8 /* YHFailPromptView.swift */; };
044E1E812BC3BBC200A3B4AF /* YHSearchInfomationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E1E802BC3BBC200A3B4AF /* YHSearchInfomationVC.swift */; };
044E1E832BC3BBFC00A3B4AF /* YHSearchInfoHistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E1E822BC3BBFC00A3B4AF /* YHSearchInfoHistoryView.swift */; };
044E1E852BC3BEC300A3B4AF /* YHSearchInfoHistoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E1E842BC3BEC300A3B4AF /* YHSearchInfoHistoryCell.swift */; };
044E1E872BC3D00E00A3B4AF /* YHSearchItemLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E1E862BC3D00E00A3B4AF /* YHSearchItemLayout.swift */; };
044E1E892BC3D7DF00A3B4AF /* YHSearchInfoBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E1E882BC3D7DF00A3B4AF /* YHSearchInfoBar.swift */; };
045EEE792B9F171A0022A143 /* YHPreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9A2B9F171A0022A143 /* YHPreviewViewModel.swift */; };
045EEE7A2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9C2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift */; };
045EEE7B2B9F171A0022A143 /* YHPersonInfoCellModel2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9D2B9F171A0022A143 /* YHPersonInfoCellModel2.swift */; };
......@@ -281,6 +286,8 @@
A53B61192BB3C9960010B573 /* YHMyDocListHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53B61182BB3C9960010B573 /* YHMyDocListHeaderView.swift */; };
A53D381E2BC23794006AE6F7 /* YHMsgViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53D381D2BC23794006AE6F7 /* YHMsgViewController.swift */; };
A53D38202BC243F1006AE6F7 /* YHStartPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53D381F2BC243F1006AE6F7 /* YHStartPageViewController.swift */; };
A53F42B92BC3DCA9009CAC70 /* YHHomeKingKongBlockModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53F42B82BC3DCA9009CAC70 /* YHHomeKingKongBlockModel.swift */; };
A53F42BB2BC3DE6F009CAC70 /* YHHomeKingKongBlockItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53F42BA2BC3DE6F009CAC70 /* YHHomeKingKongBlockItem.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 */; };
......@@ -456,6 +463,11 @@
044867B72BA1C75700DFAD4A /* YHCertificateUploadFailTipsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadFailTipsView.swift; sourceTree = "<group>"; };
044CF8D32BB6BCF700008CE8 /* YHSignatureUploadTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSignatureUploadTableViewCell.swift; sourceTree = "<group>"; };
044CF8D52BBA57DC00008CE8 /* YHFailPromptView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFailPromptView.swift; sourceTree = "<group>"; };
044E1E802BC3BBC200A3B4AF /* YHSearchInfomationVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSearchInfomationVC.swift; sourceTree = "<group>"; };
044E1E822BC3BBFC00A3B4AF /* YHSearchInfoHistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSearchInfoHistoryView.swift; sourceTree = "<group>"; };
044E1E842BC3BEC300A3B4AF /* YHSearchInfoHistoryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSearchInfoHistoryCell.swift; sourceTree = "<group>"; };
044E1E862BC3D00E00A3B4AF /* YHSearchItemLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchItemLayout.swift; sourceTree = "<group>"; };
044E1E882BC3D7DF00A3B4AF /* YHSearchInfoBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSearchInfoBar.swift; sourceTree = "<group>"; };
045EED9A2B9F171A0022A143 /* YHPreviewViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPreviewViewModel.swift; sourceTree = "<group>"; };
045EED9C2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPreviewForOtherInfoModel.swift; sourceTree = "<group>"; };
045EED9D2B9F171A0022A143 /* YHPersonInfoCellModel2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPersonInfoCellModel2.swift; sourceTree = "<group>"; };
......@@ -708,6 +720,8 @@
A53B61182BB3C9960010B573 /* YHMyDocListHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyDocListHeaderView.swift; sourceTree = "<group>"; };
A53D381D2BC23794006AE6F7 /* YHMsgViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMsgViewController.swift; sourceTree = "<group>"; };
A53D381F2BC243F1006AE6F7 /* YHStartPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHStartPageViewController.swift; sourceTree = "<group>"; };
A53F42B82BC3DCA9009CAC70 /* YHHomeKingKongBlockModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeKingKongBlockModel.swift; sourceTree = "<group>"; };
A53F42BA2BC3DE6F009CAC70 /* YHHomeKingKongBlockItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeKingKongBlockItem.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; };
......@@ -2130,6 +2144,7 @@
A5C5B2FC2B55361700A7C5D1 /* YHBannerModel.swift */,
A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */,
A5C5B2E92B4ECA4D00A7C5D1 /* YHDavidModel0.swift */,
A53F42B82BC3DCA9009CAC70 /* YHHomeKingKongBlockModel.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -2152,9 +2167,14 @@
A5C5B2FA2B5535DF00A7C5D1 /* YHHomeBannerView.swift */,
A501BE672BC2B85F00C4F1FB /* YHHomeSearchView.swift */,
A5C5B30F2B57677300A7C5D1 /* YHGestureTableView.swift */,
044E1E862BC3D00E00A3B4AF /* YHSearchItemLayout.swift */,
044E1E822BC3BBFC00A3B4AF /* YHSearchInfoHistoryView.swift */,
044E1E842BC3BEC300A3B4AF /* YHSearchInfoHistoryCell.swift */,
044E1E882BC3D7DF00A3B4AF /* YHSearchInfoBar.swift */,
A5173D692BC3C187007D4E74 /* YHHkLifeAndIdView.swift */,
A5173D6B2BC3C273007D4E74 /* YHHomeKingKongBlockView.swift */,
A5F9AD322BC3CD66000323F8 /* YHHkLifeAndIdItemView.swift */,
A53F42BA2BC3DE6F009CAC70 /* YHHomeKingKongBlockItem.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -2168,6 +2188,7 @@
044413F62BC2786200784A14 /* YHHomeWebViewController.swift */,
A53D381F2BC243F1006AE6F7 /* YHStartPageViewController.swift */,
A5173D672BC399B9007D4E74 /* YHHomePageViewController.swift */,
044E1E802BC3BBC200A3B4AF /* YHSearchInfomationVC.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -2419,6 +2440,7 @@
A5ACE92F2B4564F7002C94D2 /* YHMyViewController.swift in Sources */,
A5C5B2E62B4EC0BF00A7C5D1 /* YHDavidTestViewController.swift in Sources */,
A5ACE9332B4564F7002C94D2 /* NetBaseModel.swift in Sources */,
044E1E892BC3D7DF00A3B4AF /* YHSearchInfoBar.swift in Sources */,
045EEE9B2B9F171A0022A143 /* YHWorkExperienceViewModel.swift in Sources */,
045EEEC22B9F171A0022A143 /* YHOtherInfoFillViewController.swift in Sources */,
045EEE7C2B9F171A0022A143 /* YHPreviewInfoSessionModel.swift in Sources */,
......@@ -2459,6 +2481,7 @@
045EEED72B9F171A0022A143 /* YHEducationInfo.swift in Sources */,
045EEEDE2B9F171A0022A143 /* YHEducationInfoCell.swift in Sources */,
A5ACE93A2B4564F7002C94D2 /* NSAttributedString+Extension.swift in Sources */,
A53F42BB2BC3DE6F009CAC70 /* YHHomeKingKongBlockItem.swift in Sources */,
04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */,
04A7BD112BA4218B00BD35A2 /* YHMyDocumentsListViewModel.swift in Sources */,
A5EF21352BA6E05E005027E6 /* YHQuestionAndAnswerViewController.swift in Sources */,
......@@ -2490,6 +2513,7 @@
045EEE982B9F171A0022A143 /* YHPreviewInfoQuestionAndAnswerItemsView.swift in Sources */,
045EEE7A2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift in Sources */,
A501BE682BC2B85F00C4F1FB /* YHHomeSearchView.swift in Sources */,
044E1E872BC3D00E00A3B4AF /* YHSearchItemLayout.swift in Sources */,
A5ACE94A2B4564F7002C94D2 /* YHHUDProgressView.swift in Sources */,
04A271232BABFF3200652B1B /* YHCertificateUploadTypeCell.swift in Sources */,
A582B2412BB95998009D098C /* YHHKPlanTipsCell.swift in Sources */,
......@@ -2523,6 +2547,7 @@
A5ACE94F2B4564F7002C94D2 /* YhOverlayView.swift in Sources */,
045EEEB92B9F171A0022A143 /* YHWorkMessageSelectTableViewCell.swift in Sources */,
A53026902B4E6F2700F35102 /* YHHomeCustomCell.swift in Sources */,
044E1E812BC3BBC200A3B4AF /* YHSearchInfomationVC.swift in Sources */,
04A7BD0F2BA41C9800BD35A2 /* YHMyDocumentsModel.swift in Sources */,
A5ACE92E2B4564F7002C94D2 /* YHValidateCodeInputView.swift in Sources */,
045EEED82B9F171A0022A143 /* YHQuestionInfo.swift in Sources */,
......@@ -2554,6 +2579,7 @@
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */,
A5D5ADEF2BB90FBC0039FA6B /* YHCheckEamilAlertView.swift in Sources */,
04A671602BA0280800C1FB91 /* YHFileRenameInputView.swift in Sources */,
A53F42B92BC3DCA9009CAC70 /* YHHomeKingKongBlockModel.swift in Sources */,
A5ACE93F2B4564F7002C94D2 /* UIViewController+Extension.swift in Sources */,
A53B61192BB3C9960010B573 /* YHMyDocListHeaderView.swift in Sources */,
045EEF082B9F171A0022A143 /* YHBasicInfoCellModel.swift in Sources */,
......@@ -2634,6 +2660,7 @@
045EEE852B9F171A0022A143 /* YHPreviewFamilyMemberViewController.swift in Sources */,
045EEE7F2B9F171A0022A143 /* YHWorkExpInfoPreviewModel.swift in Sources */,
045EEEE72B9F171A0022A143 /* YHMySignatureListTableViewCell.swift in Sources */,
044E1E852BC3BEC300A3B4AF /* YHSearchInfoHistoryCell.swift in Sources */,
A5C382CC2B5EA11800C5E65C /* YHContractCell.swift in Sources */,
0477E17C2BA4238400436346 /* YHCertificateListContainerVC.swift in Sources */,
A517A4DF2BB53BE8000DEECD /* YHDocListBottomView.swift in Sources */,
......@@ -2696,6 +2723,7 @@
A582B23D2BB944ED009D098C /* YHHKPlanDoctumentVC.swift in Sources */,
045EEEE12B9F171A0022A143 /* YHMySignatureListViewModel.swift in Sources */,
04A7BD152BA4361700BD35A2 /* YHMyDocumentDetailModel.swift in Sources */,
044E1E832BC3BBFC00A3B4AF /* YHSearchInfoHistoryView.swift in Sources */,
045EEEA02B9F171A0022A143 /* YHWorkItemListModel.swift in Sources */,
04EA230E2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift in Sources */,
045EEEAD2B9F171A0022A143 /* YHWorkExperienceListTableViewCell.swift in Sources */,
......
//
// YHSearchInfomationVC.swift
// galaxy
//
// Created by edy on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSearchInfomationVC: YHBaseViewController {
var searchHistoryView: YHSearchInfoHistoryView = {
let view = YHSearchInfoHistoryView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: KScreenHeight-k_Height_NavigationtBarAndStatuBar))
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
view.addSubview(searchHistoryView)
}
}
//
// YHHomeKingKongBlockModel.swift
// galaxy
//
// Created by davidhuangA on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHomeKingKongBlockModel {
var type : String
var iconName : String
var title : String
init(type: String, iconName: String, title: String) {
self.type = type
self.iconName = iconName
self.title = title
}
}
//
// YHHomeKingKongBlockItem.swift
// galaxy
//
// Created by davidhuangA on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHomeKingKongBlockItem: UIView {
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
}
......@@ -10,7 +10,7 @@ import UIKit
class YHHomeKingKongBlockView: UIView {
static let viewH : CGFloat = 71.0
static let viewH : CGFloat = (KScreenWidth - 20 * 2 - 16 * 3) / 4.0
override init(frame: CGRect) {
super.init(frame: frame)
......@@ -20,10 +20,19 @@ class YHHomeKingKongBlockView: UIView {
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var arrData : [YHHomeKingKongBlockModel] = [
YHHomeKingKongBlockModel(type: "1", iconName: "", title: "身份福利"),
YHHomeKingKongBlockModel(type: "2", iconName: "", title: "办理攻略"),
YHHomeKingKongBlockModel(type: "3", iconName: "", title: "客户心声"),
YHHomeKingKongBlockModel(type: "4", iconName: "", title: "香港办事"),
]
}
private extension YHHomeKingKongBlockView {
func initView() {
for (index,item) in arrData.enumerated() {
}
}
}
//
// YHSearchInfoBar.swift
// galaxy
//
// Created by edy on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSearchInfoBar: UIView {
static let height = 36.0
static let cancelBtnHeight = height-8.0
static let maxWordsCount = 50
var textChange:((String?)->Void)?
var searchBlock:((String?)->Void)?
var placeHolder:String? {
didSet {
if let placeholder = placeHolder {
textField.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
}
}
}
private lazy var contentView = {
let view = UIView()
view.backgroundColor = .contentBkgColor
view.layer.cornerRadius = Self.height/2.0
view.clipsToBounds = true
return view
}()
lazy var searchImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: ""))
return imgView
}()
lazy var textField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
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
}()
lazy var searchBtn: UIButton = {
let btn = UIButton()
btn.setTitle("搜索".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 12)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor(hexString: "#3D88F8")
btn.layer.cornerRadius = Self.cancelBtnHeight/2.0
btn.addTarget(self, action: #selector(searchBtnClicked), for: .touchUpInside)
return btn
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.createUI()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
static func createBar() -> YHCertificateSearchBar {
let view = YHCertificateSearchBar(frame: CGRect(x: 0, y: 0, width: KScreenWidth-32, height: height))
return view
}
@objc func searchBtnClicked() {
if let searchBlock = searchBlock {
searchBlock(textField.text)
}
}
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)
contentView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
textField.snp.makeConstraints { make in
make.left.equalToSuperview().offset(Self.height/2.0)
make.right.equalTo(searchBtn.snp.left).offset(-4)
make.centerY.equalToSuperview()
}
searchBtn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: 66, height: Self.height-8.0))
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-4)
}
}
@objc func textFieldChanged(textField:UITextField) {
if isEmptyString(textField.text) {
setSearchButtonEnable(false)
} else {
setSearchButtonEnable(true)
}
if let textChange = textChange {
textChange(textField.text)
}
}
}
extension YHSearchInfoBar: 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
}
}
//
// YHSearchInfoHistoryCell.swift
// galaxy
//
// Created by edy on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSearchInfoHistoryCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHSearchInfoHistoryCell"
lazy var titleLabel: UILabel = {
var label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textAlignment = .left
label.textColor = UIColor(hex: 0x121A26)
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
private func setupUI() {
contentView.backgroundColor = UIColor(hexString: "#F4F6FA")
contentView.clipsToBounds = true
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalToSuperview().offset(12.0)
make.right.equalToSuperview().offset(-12.0)
}
}
}
//
// YHSearchInfoHistoryView.swift
// galaxy
//
// Created by edy on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSearchInfoHistoryView: UIView {
var historyItems:[String] = ["阿法守法发生懂法守法阿法守法发生懂法守法阿法守法发生懂法守法阿法守法发生懂法守法", "几天萨法", "阿德", "守法", "几天萨法", "德", "阿法守法发生懂法守法", "阿德", "几天", "阿德", "守法", "几天萨法"]
// var historyItems:[String] = ["几天2345", "阿", "萨法", "阿德"]
let interItemSpacing: CGFloat = 12.0 // 相邻单元格之间的水平间距
let gap: CGFloat = 12.0
let cellHeight: CGFloat = 30.0 // 单元格的固定高度
lazy var titleLabel: UILabel = {
var label = UILabel()
label.font = .PFSC_R(ofSize: 14)
label.textColor = UIColor(hex: 0x94A3B8)
label.text = "历史搜索"
return label
}()
lazy var collectionView: UICollectionView = {
// 创建集合视图布局
let layout = YHSearchItemLayout()
layout.scrollDirection = .vertical
layout.minimumInteritemSpacing = interItemSpacing
// 创建集合视图
let collectView = UICollectionView(frame:.zero, collectionViewLayout: layout)
collectView.delegate = self
collectView.dataSource = self
collectView.backgroundColor = .white
// 注册自定义单元格
collectView.register(YHSearchInfoHistoryCell.self, forCellWithReuseIdentifier: YHSearchInfoHistoryCell.cellReuseIdentifier)
return collectView
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupUI() {
self.addSubview(titleLabel)
self.addSubview(collectionView)
titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.height.equalTo(20.0)
}
collectionView.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(15.0)
make.left.right.equalTo(titleLabel)
make.bottom.equalToSuperview()
}
}
// 计算文字宽度大小
func getwith(font: UIFont, height: CGFloat, string: String) -> CGSize {
let size = CGSize.init(width: CGFloat(MAXFLOAT), height: height)
let dic = [NSAttributedString.Key.font: font] // swift 4.2
let strSize = string.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size
return strSize
}
}
extension YHSearchInfoHistoryView: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
// 返回单元格数量
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return historyItems.count
}
// 返回每个单元格的大小
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let size = self.getwith(font: UIFont.systemFont(ofSize: 12), height: 24, string: historyItems[indexPath.item])
var width = size.width + gap*2.0
if width > collectionView.width {
width = collectionView.width
}
return CGSize(width: width, height: cellHeight)
}
// 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHSearchInfoHistoryCell.cellReuseIdentifier, for: indexPath) as! YHSearchInfoHistoryCell
if 0 <= indexPath.item && indexPath.item < historyItems.count {
cell.titleLabel.text = historyItems[indexPath.item]
}
return cell
}
}
//
// ViewController.swift
// LayoutCollection
//
// Created by mac on 2019/6/2.
// Copyright © 2019年 mac. All rights reserved.
//
import UIKit
class YHSearchItemLayout: UICollectionViewFlowLayout {
var interItemSpacing: CGFloat = 12.0 // 相邻单元格之间的水平间距
override func prepare() {
super.prepare()
self.minimumInteritemSpacing = 12
}
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
let arrCell = super.layoutAttributesForElements(in: rect)
if arrCell == nil { return nil }
for i in 1 ..< arrCell!.count {
//当前 UICollectionViewLayoutAttributes
let currentLayout = arrCell![i]
//上一个 UICollectionViewLayoutAttributes
let prevLayout = arrCell![i - 1]
if (prevLayout.indexPath.section == currentLayout.indexPath.section) {
//我们想设置的最大间距,可根据需要改
let maximumSpacing = 12.0
//前一个cell的最右边
let originX = prevLayout.frame.maxX
//如果当 (上一个cell的最右边X + 我们想要的间距 + 当前cell的宽度 + 区边距) 依然在contentSize中 (小于屏幕宽度),我们改变当前cell的原点位置
//判断 当前cell的 maxX 是否超出屏幕
if((CGFloat(originX) + CGFloat(maximumSpacing) + currentLayout.frame.size.width) + self.sectionInset.right < self.collectionViewContentSize.width) {
var frame = currentLayout.frame
frame.origin.x = CGFloat(originX) + CGFloat(maximumSpacing)
currentLayout.frame = frame
} else {
print("超出屏幕, 换一行")
var frame = currentLayout.frame
frame.origin.x = self.sectionInset.left
currentLayout.frame = frame
}
}
}
return arrCell
}
}
......@@ -159,27 +159,21 @@ class YHDocListCell: UITableViewCell {
var color : UIColor = .brandMainColor
let status = dataSource.status
if status == 1 {
if status == 2 {
statusTxt = "待确认"
color = UIColor.brandMainColor
} else if status == 2 {
statusTxt = "待签章"
color = UIColor.brandMainColor
} else if status == 3 {
statusTxt = "已驳回"
color = UIColor.failColor
}else if status == 3 {
statusTxt = "核对中"
color = UIColor.warnColor
} else if status == 4 {
statusTxt = "核对中"
color = UIColor.warnColor
} else if status == 5 {
statusTxt = "已签章"
color = UIColor.successColor
statusTxt = "已驳回"
color = UIColor.failColor
} else if status == 6 {
statusTxt = "已定稿"
color = UIColor.labelTextColor2
} else if status == 7 {
statusTxt = "已完成"
color = UIColor.labelTextColor2
} else {
statusTxt = "--"
color = UIColor.failColor
......@@ -230,7 +224,6 @@ class YHDocListCell: UITableViewCell {
}
statusLabel.text = statusTxt
statusLabel.textColor = color
}
}
......
......@@ -198,6 +198,12 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
if (indexPath.row >= items.count) { return }
if true {
let vc = YHSearchInfomationVC()
self.navigationController?.pushViewController(vc)
return
}
if !checkLogin() {
let vc = UINavigationController(rootVC: YHPhoneLoginViewController())
vc.modalPresentationStyle = .custom
......
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