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

Merge commit '0ea6f74d' into xiezhaolin

parents f0efb0d0 0ea6f74d
This diff is collapsed.
//
// 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 ...@@ -10,7 +10,7 @@ import UIKit
class YHHomeKingKongBlockView: UIView { class YHHomeKingKongBlockView: UIView {
static let viewH : CGFloat = 71.0 static let viewH : CGFloat = (KScreenWidth - 20 * 2 - 16 * 3) / 4.0
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
...@@ -20,10 +20,19 @@ class YHHomeKingKongBlockView: UIView { ...@@ -20,10 +20,19 @@ class YHHomeKingKongBlockView: UIView {
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented") 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 { private extension YHHomeKingKongBlockView {
func initView() { 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 { ...@@ -159,27 +159,21 @@ class YHDocListCell: UITableViewCell {
var color : UIColor = .brandMainColor var color : UIColor = .brandMainColor
let status = dataSource.status let status = dataSource.status
if status == 1 { if status == 2 {
statusTxt = "待确认" statusTxt = "待确认"
color = UIColor.brandMainColor color = UIColor.brandMainColor
} else if status == 2 { }else if status == 3 {
statusTxt = "待签章" statusTxt = "核对中"
color = UIColor.brandMainColor color = UIColor.warnColor
} else if status == 3 {
statusTxt = "已驳回"
color = UIColor.failColor
} else if status == 4 { } else if status == 4 {
statusTxt = "核对中" statusTxt = "核对中"
color = UIColor.warnColor color = UIColor.warnColor
} else if status == 5 { } else if status == 5 {
statusTxt = "已签章" statusTxt = "已驳回"
color = UIColor.successColor color = UIColor.failColor
} else if status == 6 { } else if status == 6 {
statusTxt = "已定稿" statusTxt = "已定稿"
color = UIColor.labelTextColor2 color = UIColor.labelTextColor2
} else if status == 7 {
statusTxt = "已完成"
color = UIColor.labelTextColor2
} else { } else {
statusTxt = "--" statusTxt = "--"
color = UIColor.failColor color = UIColor.failColor
...@@ -230,7 +224,6 @@ class YHDocListCell: UITableViewCell { ...@@ -230,7 +224,6 @@ class YHDocListCell: UITableViewCell {
} }
statusLabel.text = statusTxt statusLabel.text = statusTxt
statusLabel.textColor = color statusLabel.textColor = color
} }
} }
......
...@@ -198,6 +198,12 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -198,6 +198,12 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
if (indexPath.row >= items.count) { return } if (indexPath.row >= items.count) { return }
if true {
let vc = YHSearchInfomationVC()
self.navigationController?.pushViewController(vc)
return
}
if !checkLogin() { if !checkLogin() {
let vc = UINavigationController(rootVC: YHPhoneLoginViewController()) let vc = UINavigationController(rootVC: YHPhoneLoginViewController())
vc.modalPresentationStyle = .custom 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