Commit 17e0e936 authored by Alex朱枝文's avatar Alex朱枝文

在港记录相关页面调整

parent db256a5f
......@@ -595,6 +595,7 @@
04F2436E2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436D2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift */; };
04F243702C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436F2C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift */; };
04F243722C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F243712C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift */; };
04F243742CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F243732CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift */; };
04F316442C3568F000024164 /* YHAboutGalaxyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F316432C3568F000024164 /* YHAboutGalaxyViewController.swift */; };
04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */; };
04F5F86A2C1A95BB004A463C /* YHOtherServiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */; };
......@@ -1443,6 +1444,7 @@
04F2436D2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentSignatureModel.swift; sourceTree = "<group>"; };
04F2436F2C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentPreviewModel.swift; sourceTree = "<group>"; };
04F243712C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKRecordsEditPersonnelModel.swift; sourceTree = "<group>"; };
04F243732CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCollectionViewLeftAlignedFlowLayout.swift; sourceTree = "<group>"; };
04F316432C3568F000024164 /* YHAboutGalaxyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutGalaxyViewController.swift; sourceTree = "<group>"; };
04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; };
04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceViewController.swift; sourceTree = "<group>"; };
......@@ -3575,6 +3577,7 @@
04F2434A2C9BB70300DF2C74 /* YHHKRecordsSummaryItemCell.swift */,
04F2434C2C9BB72500DF2C74 /* YHHKRecordsDurationItemCell.swift */,
04F2434E2C9BB74E00DF2C74 /* YHHKRecordsOccupyingSpaceCell.swift */,
04F243732CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -4838,6 +4841,7 @@
04256DD42C70538400A37BA4 /* YHFamilyInfoUpdateViewController.swift in Sources */,
04F243682C9D670E00DF2C74 /* YHResignDocumentListModel.swift in Sources */,
04FD85702C21646200BEF9C5 /* YHMyInterestTopicCell.swift in Sources */,
04F243742CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift in Sources */,
04F243592C9C43A100DF2C74 /* YHHKRecordsEditButtonCell.swift in Sources */,
A5CA3F542C744CAB00EB22F5 /* YHUploadCertificateDetailCell.swift in Sources */,
04A7BD172BA43A0F00BD35A2 /* YHMyDocumentsDetailViewModel.swift in Sources */,
......
......@@ -8,6 +8,7 @@
import UIKit
import JXSegmentedView
import IQKeyboardManagerSwift
class YHHKRecordsEditContentVC: YHBaseViewController {
......@@ -46,13 +47,13 @@ class YHHKRecordsEditContentVC: YHBaseViewController {
view.delegate = self
view.dataSource = self
view.backgroundColor = .clear
view.rowHeight = 52
view.tableFooterView = UITableViewHeaderFooterView()
view.register(YHResignDocumentTipsCell.self, forCellReuseIdentifier: YHResignDocumentTipsCell.cellReuseIdentifier)
view.register(YHHKRecordsTitleCell.self, forCellReuseIdentifier: YHHKRecordsTitleCell.cellReuseIdentifier)
view.register(YHHKRecordsRemarkCell.self, forCellReuseIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier)
view.register(YHHKRecordsTimeSelectCell.self, forCellReuseIdentifier: YHHKRecordsTimeSelectCell.cellReuseIdentifier)
view.register(YHHKRecordsStayingPersonnelCell.self, forCellReuseIdentifier: YHHKRecordsStayingPersonnelCell.cellReuseIdentifier)
view.keyboardDismissMode = .onDrag
return view
}()
......@@ -77,6 +78,8 @@ class YHHKRecordsEditContentVC: YHBaseViewController {
return button
}()
private var personnelStayingHeight: CGFloat?
private let pageType: YHHKRecordsEditPageType
init(pageType: YHHKRecordsEditPageType) {
self.pageType = pageType
......@@ -94,8 +97,14 @@ class YHHKRecordsEditContentVC: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
IQKeyboardManager.shared.enable = true
setupData()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
IQKeyboardManager.shared.enable = false
}
}
extension YHHKRecordsEditContentVC {
......@@ -125,17 +134,18 @@ extension YHHKRecordsEditContentVC {
tableView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.right.equalToSuperview()
make.top.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top)
}
tableView.tableFooterView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin))
}
private func setupData() {
let names: [String] = ["钻石王老五·钻石王老五·名字很长·长到放不哈哈哈哈哈哈", "玛尔扎哈", "李白", "王晓霞", "巴斯", "王五", "张四", "李霞"]
let names: [String] = ["钻石王老五·钻石王老五·名字很长·长到放不哈哈哈哈哈哈", "玛尔扎哈", "李白", "王晓霞", "巴斯"]
let personnels = names.map { name in
YHHKRecordsEditPersonnelModel(name: name)
}
datas = [[.tips("温馨提示:", getTips())], [.header("在港逗留记录"), .personnelStaying("逗留人员", personnels), .selectTime("入境时间", nil, "请选择"), .selectTime("离境时间", "2018-07-31", "请选择"), .remark("备注", "这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息")]]
tableView.reloadData()
}
......@@ -193,11 +203,20 @@ extension YHHKRecordsEditContentVC: UITableViewDelegate, UITableViewDataSource {
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsStayingPersonnelCell.cellReuseIdentifier) as? YHHKRecordsStayingPersonnelCell {
cell.setupCellInfo(title: title)
cell.collectionData = personnels
cell.didHeightChanged = { [weak self] height in
self?.personnelStayingHeight = height
self?.tableView.performBatchUpdates { [weak tableView] in
guard let tableView = tableView else {
return
}
tableView.reloadRows(at: [indexPath], with: .none)
}
}
return cell
}
case let .selectTime(title, detail, placeholder):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier) as? YHHKRecordsRemarkCell {
cell.setupCellInfo(title: title, detail: detail)
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsTimeSelectCell.cellReuseIdentifier) as? YHHKRecordsTimeSelectCell {
cell.setupCellInfo(title: title, detail: detail, placeholder: placeholder)
return cell
}
}
......@@ -234,6 +253,9 @@ extension YHHKRecordsEditContentVC: UITableViewDelegate, UITableViewDataSource {
case .header:
return 52
case .personnelStaying:
if let personnelStayingHeight = personnelStayingHeight {
return personnelStayingHeight
}
return UITableView.automaticDimension
case .selectTime:
return 52
......
......@@ -71,10 +71,11 @@ extension YHHKRecordsSummaryVC {
tableView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(kMargin).priority(.high)
make.right.equalToSuperview().offset(-kMargin).priority(.high)
make.top.bottom.equalToSuperview()
make.top.equalToSuperview().offset(kMargin)
make.bottom.equalToSuperview().offset(-kMargin)
}
tableView.tableHeaderView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin))
tableView.tableFooterView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin))
// tableView.tableHeaderView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin))
// tableView.tableFooterView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin))
}
private func getSubCellType(model: YHHKRecordsExpandedSection, indexPath: IndexPath, subType: YHHKRecordItemDetailType) -> YHResignRoundCellType {
......@@ -87,7 +88,7 @@ extension YHHKRecordsSummaryVC {
cellType = .mid
}
case .duration:
if indexPath.row == model.periodItems.count {
if indexPath.row == model.subItems.count - 1 {
cellType = .bottom
} else {
cellType = .mid
......
//
// YHCollectionViewLeftAlignedFlowLayout.swift
// galaxy
//
// Created by AlexZhu on 9/22/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCollectionViewLeftAlignedFlowLayout: UICollectionViewFlowLayout {
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
guard let attrsArry = super.layoutAttributesForElements(in: rect) else {
return nil
}
for i in 0 ..< attrsArry.count {
if i != attrsArry.count - 1 {
let curAttr = attrsArry[i] // 当前attr
let nextAttr = attrsArry[i + 1] // 下一个attr
/// 如果下一个在同一行则调整,不在同一行则跳过
if curAttr.frame.minY == nextAttr.frame.minY {
if nextAttr.representedElementCategory != .cell {
break
}
if nextAttr.frame.minX - curAttr.frame.maxX > minimumInteritemSpacing {
var frame = nextAttr.frame
let x = curAttr.frame.maxX + minimumInteritemSpacing
frame = CGRect(x: x, y: frame.minY, width: frame.width, height: frame.height)
nextAttr.frame = frame
}
} else {
if curAttr.representedElementCategory != .cell {
break
}
var edgeInset: UIEdgeInsets = sectionInset
if let collectionView = collectionView, let flowDelegate = collectionView.delegate as? UICollectionViewDelegateFlowLayout, let tempEdgeInset = flowDelegate.collectionView?(collectionView, layout: self, insetForSectionAt: curAttr.indexPath.section) {
edgeInset = tempEdgeInset
}
/// 独立成行的也左对齐
let isFirstSingleCell = i == 0 && curAttr.frame.minY < nextAttr.frame.minY
let isNextSingleCell = i > 0 && attrsArry[i - 1].frame.minY < curAttr.frame.minY && curAttr.frame.minY < nextAttr.frame.minY
if isFirstSingleCell || isNextSingleCell {
var frame = curAttr.frame
frame = CGRect(x: edgeInset.left, y: frame.minY, width: frame.width, height: frame.height)
curAttr.frame = frame
}
}
} else {
let curAttr = attrsArry[i]
if curAttr.representedElementCategory != .cell {
break
}
var edgeInset: UIEdgeInsets = sectionInset
if let collectionView = collectionView, let flowDelegate = collectionView.delegate as? UICollectionViewDelegateFlowLayout, let tempEdgeInset = flowDelegate.collectionView?(collectionView, layout: self, insetForSectionAt: curAttr.indexPath.section) {
edgeInset = tempEdgeInset
}
/// 只有一个也左对齐
let onlyOneCell = i == 0
/// 最后一行也左对齐
let lastSingleCell = i > 0 && attrsArry[i - 1].frame.minY < curAttr.frame.minY
if onlyOneCell || lastSingleCell {
var frame = curAttr.frame
frame = CGRect(x: edgeInset.left, y: frame.minY, width: frame.width, height: frame.height)
curAttr.frame = frame
}
}
}
return attrsArry
}
}
......@@ -75,13 +75,14 @@ class YHHKRecordsPersonnelSelectCell: UICollectionViewCell {
backCover.addSubview(tagLabel)
backCover.addSubview(selctedBadgeIcon)
backCover.snp.makeConstraints { maker in
maker.edges.equalToSuperview()
backCover.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
tagLabel.snp.makeConstraints { maker in
maker.top.bottom.equalToSuperview()
maker.left.equalToSuperview().offset(YHHKRecordsPersonnelSelectCell.offsetX).priority(.high)
maker.right.equalToSuperview().offset(-YHHKRecordsPersonnelSelectCell.offsetX).priority(.high)
tagLabel.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.centerX.equalToSuperview()
make.left.greaterThanOrEqualToSuperview().offset(YHHKRecordsPersonnelSelectCell.offsetX)
make.right.lessThanOrEqualToSuperview().offset(-YHHKRecordsPersonnelSelectCell.offsetX)
}
selctedBadgeIcon.snp.makeConstraints { make in
make.bottom.right.equalToSuperview()
......
......@@ -15,7 +15,12 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
private static let minimumLineSpacing: CGFloat = 12
private static let minimumInteritemSpacing: CGFloat = 8
private static let labelToTop: CGFloat = 16
private static let labelHeight: CGFloat = 20
var selectItemAction: ((YHHKRecordsEditPersonnelModel?) -> Void)?
var didHeightChanged: ((CGFloat) -> Void)?
var collectionData: [YHHKRecordsEditPersonnelModel] = [] {
didSet {
......@@ -24,11 +29,11 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
}
private var minWidth: CGFloat {
return (KScreenWidth - YHHKRecordsStayingPersonnelCell.offsetX * 2 - YHHKRecordsStayingPersonnelCell.minimumLineSpacing * 3) / 4.0
return (KScreenWidth - YHHKRecordsStayingPersonnelCell.offsetX * 2 - YHHKRecordsStayingPersonnelCell.minimumInteritemSpacing * 3 - 2 * kMargin) / 4.0
}
private var maxWidth: CGFloat {
return (KScreenWidth - YHHKRecordsStayingPersonnelCell.offsetX * 2)
return (KScreenWidth - YHHKRecordsStayingPersonnelCell.offsetX * 2 - 2 * kMargin)
}
static let cellReuseIdentifier = "YHHKRecordsStayingPersonnelCell"
......@@ -52,8 +57,8 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
return view
}()
private lazy var layout: AlignedCollectionViewFlowLayout = {
return AlignedCollectionViewFlowLayout(horizontalAlignment: .left)
private lazy var layout: YHCollectionViewLeftAlignedFlowLayout = {
return YHCollectionViewLeftAlignedFlowLayout()
}()
private lazy var infoCollectionView: UICollectionView = {
......@@ -66,9 +71,26 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
collectionView.delegate = self
collectionView.dataSource = self
collectionView.showsHorizontalScrollIndicator = false
collectionView.showsVerticalScrollIndicator = false
collectionView.allowsMultipleSelection = true
collectionView.isScrollEnabled = false
collectionView.register(YHHKRecordsPersonnelSelectCell.self, forCellWithReuseIdentifier: YHHKRecordsPersonnelSelectCell.cellReuseIdentifier)
return collectionView
}()
private var collectionViewContentSize: CGSize = CGSize.zero {
didSet {
if collectionViewContentSize != oldValue {
infoCollectionView.snp.remakeConstraints { make in
make.top.equalTo(infoTitleLabel.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(collectionViewContentSize.height)
make.bottom.equalTo(bottomLineView.snp.top)
}
didHeightChanged?(collectionViewContentSize.height + YHHKRecordsStayingPersonnelCell.labelToTop + YHHKRecordsStayingPersonnelCell.labelHeight)
}
}
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
......@@ -79,6 +101,17 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented")
}
deinit {
if infoCollectionView.observationInfo != nil {
infoCollectionView.removeObserver(self, forKeyPath: "contentSize", context: nil)
}
}
override func layoutSubviews() {
super.layoutSubviews()
infoCollectionView.collectionViewLayout.invalidateLayout()
}
func setupCellInfo(title: String?) {
infoTitleLabel.text = title
}
......@@ -101,7 +134,8 @@ extension YHHKRecordsStayingPersonnelCell {
infoTitleLabel.snp.makeConstraints { make in
make.left.equalTo(asteriskIcon.snp.right).offset(2)
make.top.equalToSuperview().offset(16)
make.top.equalToSuperview().offset(YHHKRecordsStayingPersonnelCell.labelToTop)
make.height.equalTo(YHHKRecordsStayingPersonnelCell.labelHeight)
}
bottomLineView.snp.makeConstraints { make in
......@@ -114,6 +148,14 @@ extension YHHKRecordsStayingPersonnelCell {
make.left.right.equalToSuperview()
make.bottom.equalTo(bottomLineView.snp.top)
}
infoCollectionView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
guard keyPath == "contentSize" else {
return
}
collectionViewContentSize = infoCollectionView.contentSize
}
}
......
......@@ -108,6 +108,7 @@ extension YHHKRecordsTimeSelectCell {
}
bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.height.equalTo(1)
......
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