Commit 32a6dd16 authored by Alex朱枝文's avatar Alex朱枝文

在港记录管理

parent b2fb2054
This diff is collapsed.
//
// YHHKImmigrationRecordsVC.swift
// galaxy
//
// Created by alexzzw on 2024/9/14.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHHKImmigrationRecordsVC: YHBaseViewController {
private lazy var controllerOne: YHHKRecordsSummaryVC = YHHKRecordsSummaryVC()
private lazy var controllerTwo: YHHKRecordsContentVC = YHHKRecordsContentVC()
private lazy var controllerThree: YHHKRecordsContentVC = YHHKRecordsContentVC()
private lazy var controllerFour: YHHKRecordsContentVC = YHHKRecordsContentVC()
private lazy var arrItemTitles = ["汇总", "主申", "配偶", "子女"]
private lazy var segmentedView: JXSegmentedView = {
let view = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_safeAreaInsetsTop(), width: KScreenWidth, height: 53))
let indicator = JXSegmentedIndicatorLineView()
indicator.indicatorWidth = 16
indicator.indicatorHeight = 2
indicator.indicatorColor = UIColor.brandMainColor
indicator.indicatorCornerRadius = 0
view.indicators = [indicator]
view.dataSource = segmentedDataSource
view.delegate = self
return view
}()
private lazy var segmentedDataSource: JXSegmentedDotDataSource = {
let dataSource = JXSegmentedDotDataSource()
dataSource.isTitleColorGradientEnabled = true
dataSource.titles = arrItemTitles
dataSource.titleNormalFont = UIFont.PFSC_M(ofSize: 14)
dataSource.titleNormalColor = UIColor(hexString: "#000000")!
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 16)
dataSource.titleSelectedColor = .mainTextColor
dataSource.isItemSpacingAverageEnabled = false
dataSource.itemWidth = JXSegmentedViewAutomaticDimension
dataSource.itemSpacing = 24
dataSource.dotStates = [false, false, false, false]
dataSource.dotSize = CGSize(width: 6, height: 6)
return dataSource
}()
private lazy var listContainerView: JXSegmentedListContainerView = {
return JXSegmentedListContainerView(dataSource: self, type: .scrollView)
}()
private lazy var arrItemVCs: [JXSegmentedListContainerViewListDelegate] = {
return [controllerOne, controllerTwo, controllerThree, controllerFour]
}()
private lazy var addNewButton: UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
let buttonName = "新增在港记录"
button.setTitle(buttonName, for: .normal)
button.setTitle(buttonName, for: .highlighted)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .highlighted)
button.addTarget(self, action: #selector(clickAddNewButton), for: .touchUpInside)
button.layer.cornerRadius = kCornerRadius3
button.clipsToBounds = true
button.backgroundColor = .brandMainColor
return button
}()
private lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
}
extension YHHKImmigrationRecordsVC {
private func setupUI() {
gk_navBarAlpha = 1
gk_navTitle = "在港记录列表"
view.backgroundColor = .white
view.addSubview(segmentedView)
view.addSubview(bottomView)
bottomView.addSubview(addNewButton)
view.addSubview(listContainerView)
segmentedView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(53)
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.right.equalToSuperview()
make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
make.height.equalTo(64)
}
addNewButton.snp.makeConstraints { make in
make.left.equalToSuperview().offset(kMargin)
make.right.equalToSuperview().offset(-kMargin)
make.centerY.equalToSuperview()
make.height.equalTo(48)
}
listContainerView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(segmentedView.snp.bottom)
make.bottom.equalTo(bottomView.snp.top)
}
}
@objc private func clickAddNewButton() {
//
}
}
extension YHHKImmigrationRecordsVC: JXSegmentedViewDelegate {
//
}
extension YHHKImmigrationRecordsVC: JXSegmentedListContainerViewDataSource
{
func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
return titleDataSource.dataSource.count
}
return 0
}
func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> any JXSegmentedListContainerViewListDelegate {
return arrItemVCs[index]
}
//
}
//
// YHHKRecordsContentVC.swift
// galaxy
//
// Created by alexzzw on 2024/9/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHHKRecordsContentVC: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
extension YHHKRecordsContentVC {
private func setupUI() {
gk_navBarAlpha = 0
gk_navigationBar.isHidden = true
view.backgroundColor = UIColor.contentBkgColor
}
}
extension YHHKRecordsContentVC: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
//
// YHHKRecordsEditContentVC.swift
// galaxy
//
// Created by alexzzw on 2024/9/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsEditContentVC: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
//
// YHHKRecordItemDetailType.swift
// galaxy
//
// Created by alexzzw on 2024/9/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
enum YHHKNonPresenceRecordType {
case over90
case over180
var title: String {
switch self {
case .over90:
return "超90天未在港"
case .over180:
return "超180天未在港"
}
}
}
class ExpandedSection {
let title: String
let type: YHHKNonPresenceRecordType
var isExpanded: Bool = true
let summaryItems: [YHHKRecordItemDetailType]
let periodItems: [YHHKRecordItemDetailType]
init(title: String, type: YHHKNonPresenceRecordType, isExpanded: Bool = true, summaryItems: [YHHKRecordItemDetailType], periodItems: [YHHKRecordItemDetailType]) {
self.title = title
self.type = type
self.isExpanded = isExpanded
self.summaryItems = summaryItems
self.periodItems = periodItems
}
var subItems: [YHHKRecordItemDetailType] {
var retItems = [YHHKRecordItemDetailType]()
retItems.append(contentsOf: summaryItems)
if summaryItems.count > 0 {
retItems.append(.occupyingSpace)
}
retItems.append(contentsOf: periodItems)
if periodItems.count > 0 {
retItems.append(.occupyingSpace)
}
return retItems
}
}
enum YHHKRecordSectionType {
case header(_ title: String)
case expandedItem(_ model: ExpandedSection)
}
enum YHHKRecordItemDetailType {
case detailHeader(_ title: String)
case lastStay(_ title: String)
case summaryItem(_ title: String)
case duration(_ from: String, _ to: String, _ total: String)
case occupyingSpace
}
//
// YHHKRecordsDurationItemCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsDurationItemCell: YHHKRecordsSectionItemBaseCell {
static let cellReuseIdentifier = "YHHKRecordsDurationItemCell"
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize:14)
label.textColor = .mainTextColor70
return label
}()
private lazy var infoDetailLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.font = .PFSC_R(ofSize: 14)
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, detail: String?, cellType: YHResignRoundCellType = .top) {
infoTitleLabel.text = title
infoDetailLabel.text = detail
updateCellCorner(cellType)
if cellType == .bottom {
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(8)
make.bottom.equalToSuperview().offset(-16)
}
} else {
infoTitleLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(8)
make.bottom.equalToSuperview().offset(-8)
}
}
}
}
extension YHHKRecordsDurationItemCell {
private func setupUI() {
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(infoDetailLabel)
infoTitleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
infoDetailLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(8)
make.bottom.equalToSuperview().offset(-8)
}
infoDetailLabel.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-14)
make.centerY.equalTo(infoTitleLabel)
make.left.greaterThanOrEqualTo(infoTitleLabel.snp.right).offset(14)
}
}
}
//
// YHHKRecordsExpandedCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsExpandedCell: UITableViewCell {
static let cellReuseIdentifier = "YHHKRecordsExpandedCell"
var isExpanded: Bool = true {
didSet {
infoDetailLabel.text = isExpanded ? "收起" : "详情"
}
}
private lazy var tagView: UIView = {
let view = UIView()
view.backgroundColor = .brandMainColor
return view
}()
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_M(ofSize: 16)
label.textColor = .mainTextColor
return label
}()
private lazy var statusLabel: YHPaddedLabel = {
let label = YHPaddedLabel(padding: UIEdgeInsets(top: 0, left: 6, bottom: 0, right: 6))
label.font = .PFSC_M(ofSize: 12)
return label
}()
private lazy var infoDetailLabel: UILabel = {
let label = UILabel()
label.textColor = .brandMainColor
label.font = .PFSC_R(ofSize: 14)
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, status: YHHKNonPresenceRecordType, isExpanded: Bool) {
infoTitleLabel.text = title
statusLabel.text = status.title
statusLabel.textColor = status.titleColor
statusLabel.backgroundColor = status.bgColor
self.isExpanded = isExpanded
}
}
extension YHHKRecordsExpandedCell {
private func setupUI() {
selectionStyle = .none
backgroundColor = .white
contentView.addSubview(tagView)
contentView.addSubview(infoTitleLabel)
contentView.addSubview(statusLabel)
contentView.addSubview(infoDetailLabel)
tagView.setContentCompressionResistancePriority(.required, for: .horizontal)
infoTitleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
statusLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
infoDetailLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
tagView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.centerY.equalToSuperview()
make.width.equalTo(3)
make.height.equalTo(14)
}
infoTitleLabel.snp.makeConstraints { make in
make.left.equalTo(tagView.snp.right).offset(5)
make.centerY.equalToSuperview()
}
statusLabel.snp.makeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.right).offset(4)
make.centerY.equalToSuperview()
make.height.equalTo(19)
}
infoDetailLabel.snp.makeConstraints { make in
make.left.greaterThanOrEqualTo(statusLabel.snp.right).offset(4)
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-18)
}
}
}
private extension YHHKNonPresenceRecordType {
var titleColor: UIColor {
switch self {
case .over90:
return UIColor.yhOrangeColor
case .over180:
return UIColor.failColor
}
}
var bgColor: UIColor {
switch self {
case .over90:
return UIColor(hexString: "#FFF5EB")!
case .over180:
return UIColor(hexString: "#FFF2F2")!
}
}
}
//
// YHHKRecordsHeaderCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsHeaderCell: UITableViewCell {
static let cellReuseIdentifier = "YHHKRecordsHeaderCell"
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_M(ofSize:17)
label.textColor = .mainTextColor
return label
}()
private lazy var bottomLineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(_ title: String?) {
infoTitleLabel.text = title
}
}
extension YHHKRecordsHeaderCell {
private func setupUI() {
selectionStyle = .none
backgroundColor = .white
contentView.addSubview(infoTitleLabel)
contentView.addSubview(bottomLineView)
bottomLineView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(1)
}
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(16)
make.bottom.equalTo(bottomLineView.snp.top).offset(-12)
}
}
}
//
// YHHKRecordsLastStayCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsLastStayCell: YHHKRecordsSectionItemBaseCell {
static let cellReuseIdentifier = "YHHKRecordsLastStayCell"
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize:14)
label.textColor = .mainTextColor50
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, cellType: YHResignRoundCellType = .top) {
infoTitleLabel.text = title
updateCellCorner(cellType)
}
}
extension YHHKRecordsLastStayCell {
private func setupUI() {
subContainerView.addSubview(infoTitleLabel)
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(12)
make.bottom.equalToSuperview().offset(-8)
}
}
}
//
// YHHKRecordsOccupyingSpaceCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsOccupyingSpaceCell: UITableViewCell {
static let cellReuseIdentifier = "YHHKRecordsOccupyingSpaceCell"
private lazy var bottomLineView: UIView = {
let view = UIView()
view.isHidden = true
view.backgroundColor = .separatorColor
return view
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(_ isShowBottomLine: Bool = false) {
bottomLineView.isHidden = !isShowBottomLine
}
}
extension YHHKRecordsOccupyingSpaceCell {
private func setupUI() {
selectionStyle = .none
backgroundColor = .white
contentView.addSubview(bottomLineView)
bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.height.equalTo(1)
}
}
}
//
// YHHKRecordsSectionHeaderCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsSectionHeaderCell: YHHKRecordsSectionItemBaseCell {
static let cellReuseIdentifier = "YHHKRecordsSectionHeaderCell"
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_M(ofSize:14)
label.textColor = .mainTextColor
return label
}()
private lazy var bottomLineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, cellType: YHResignRoundCellType = .top) {
infoTitleLabel.text = title
updateCellCorner(cellType)
}
}
extension YHHKRecordsSectionHeaderCell {
private func setupUI() {
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(bottomLineView)
bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(14)
make.right.equalToSuperview().offset(-14)
make.height.equalTo(1)
}
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(16)
make.bottom.equalTo(bottomLineView.snp.top).offset(-10)
}
}
}
//
// YHHKRecordsSectionItemBaseCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsSectionItemBaseCell: UITableViewCell {
lazy var subContainerView: YHBaseDynamicCornerRadiusView = {
let view = YHBaseDynamicCornerRadiusView(cornerRadius: 4, corner: .none)
view.backgroundColor = .contentBkgColor
return view
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func updateCellCorner(_ cellType: YHResignRoundCellType) {
switch cellType {
case .top:
subContainerView.corner = [.topLeft, .topRight]
case .mid:
subContainerView.corner = .none
case .bottom:
subContainerView.corner = [.bottomLeft, .bottomRight]
case .single:
subContainerView.corner = .allCorners
}
}
}
extension YHHKRecordsSectionItemBaseCell {
private func setupUI() {
selectionStyle = .none
backgroundColor = .white
contentView.addSubview(subContainerView)
subContainerView.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
}
}
}
//
// YHHKRecordsSummaryItemCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKRecordsSummaryItemCell: YHHKRecordsSectionItemBaseCell {
static let cellReuseIdentifier = "YHHKRecordsSummaryItemCell"
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize:14)
label.textColor = .mainTextColor
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, cellType: YHResignRoundCellType = .top) {
infoTitleLabel.text = title
updateCellCorner(cellType)
if cellType == .bottom {
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(8)
make.bottom.equalToSuperview().offset(-16)
}
} else {
infoTitleLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(8)
make.bottom.equalToSuperview().offset(-8)
}
}
}
}
extension YHHKRecordsSummaryItemCell {
private func setupUI() {
subContainerView.addSubview(infoTitleLabel)
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.right.lessThanOrEqualToSuperview().offset(-18)
make.top.equalToSuperview().offset(8)
make.bottom.equalToSuperview().offset(-8)
}
}
}
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