Commit db256a5f authored by Alex朱枝文's avatar Alex朱枝文

在港记录相关

parent b28739e6
......@@ -594,6 +594,7 @@
04F2436C2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436B2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift */; };
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 */; };
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 */; };
......@@ -1441,6 +1442,7 @@
04F2436B2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentCompleteModel.swift; sourceTree = "<group>"; };
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>"; };
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>"; };
......@@ -3549,6 +3551,7 @@
isa = PBXGroup;
children = (
04F243402C9AFBAB00DF2C74 /* YHHKRecordItemDetailType.swift */,
04F243712C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -5436,6 +5439,7 @@
A5ACE9562B4564F7002C94D2 /* YHBouncesContentView.swift in Sources */,
A554A5122B99715000EA5973 /* YHConstantArrayData.swift in Sources */,
045EEE962B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemsView.swift in Sources */,
04F243722C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift in Sources */,
044EE2362C92916600A2FE3A /* YHResignCertificateListViewController.swift in Sources */,
04F243412C9AFBAB00DF2C74 /* YHHKRecordItemDetailType.swift in Sources */,
04256DDE2C72DA3B00A37BA4 /* YHCertificateAppointViewController.swift in Sources */,
......
......@@ -122,7 +122,8 @@ extension YHHKImmigrationRecordsVC {
}
@objc private func clickAddNewButton() {
//
let vc = YHHKRecordsEditContentVC(pageType: .add)
navigationController?.pushViewController(vc)
}
}
......
......@@ -135,7 +135,7 @@ extension YHHKRecordsContentVC: UITableViewDelegate, UITableViewDataSource {
}
let row = sectionArr[indexPath.row]
if case .edit = row {
let vc = YHHKRecordsEditContentVC()
let vc = YHHKRecordsEditContentVC(pageType: .edit)
navigationController?.pushViewController(vc)
}
}
......
......@@ -7,24 +7,256 @@
//
import UIKit
import JXSegmentedView
class YHHKRecordsEditContentVC: YHBaseViewController {
enum YHHKRecordsEditPageType {
case add, edit
var title: String {
switch self {
case .add:
return "新增在港记录"
case .edit:
return "编辑在港记录"
}
}
}
enum RowType {
case tips(_ title: String, _ detail: NSAttributedString)
case header(_ title: String)
case personnelStaying(_ title: String, _ detail: [YHHKRecordsEditPersonnelModel])
case selectTime(_ title: String, _ detail: String?, _ placeholder: String)
case remark(_ title: String, _ detail: String)
}
private var datas: [[RowType]] = []
private lazy var tableView: UITableView = {
let view = UITableView(frame:.zero, style:.grouped)
view.estimatedSectionHeaderHeight = 16.0
view.estimatedSectionFooterHeight = 0.01
view.sectionHeaderHeight = 16.0
view.sectionFooterHeight = 0.01
view.contentInsetAdjustmentBehavior = .never
view.showsVerticalScrollIndicator = false
view.separatorStyle = .none
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)
return view
}()
private lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
private lazy var saveButton: 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(clickSaveButton), for: .touchUpInside)
button.layer.cornerRadius = kCornerRadius3
button.clipsToBounds = true
button.backgroundColor = .brandMainColor
return button
}()
private let pageType: YHHKRecordsEditPageType
init(pageType: YHHKRecordsEditPageType) {
self.pageType = pageType
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setupData()
}
}
extension YHHKRecordsEditContentVC {
private func setupUI() {
gk_navBarAlpha = 1
gk_navTitle = pageType.title
view.backgroundColor = UIColor.contentBkgColor
view.addSubview(tableView)
view.addSubview(bottomView)
bottomView.addSubview(saveButton)
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.right.equalToSuperview()
make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
make.height.equalTo(64)
}
saveButton.snp.makeConstraints { make in
make.left.equalToSuperview().offset(kMargin)
make.right.equalToSuperview().offset(-kMargin)
make.centerY.equalToSuperview()
make.height.equalTo(48)
}
tableView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.right.equalToSuperview()
make.top.equalToSuperview()
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 personnels = names.map { name in
YHHKRecordsEditPersonnelModel(name: name)
}
datas = [[.tips("温馨提示:", getTips())], [.header("在港逗留记录"), .personnelStaying("逗留人员", personnels), .selectTime("入境时间", nil, "请选择"), .selectTime("离境时间", "2018-07-31", "请选择"), .remark("备注", "这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息")]]
tableView.reloadData()
}
@objc private func clickSaveButton() {
//
}
}
extension YHHKRecordsEditContentVC: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
extension YHHKRecordsEditContentVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return datas.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
guard datas.count > section else {
return 0
}
let sectionArr = datas[section]
return sectionArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard datas.count > indexPath.section else {
return UITableViewCell()
}
let sectionArr = datas[indexPath.section]
guard sectionArr.count > indexPath.row else {
return UITableViewCell()
}
let row = sectionArr[indexPath.row]
switch row {
case let .remark(title, detail):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier) as? YHHKRecordsRemarkCell {
cell.setupCellInfo(title: title, titleColor: .mainTextColor, detail: detail, isEditable: true, cellType: .bottom)
return cell
}
case let .tips(title, detail):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHResignDocumentTipsCell.cellReuseIdentifier) as? YHResignDocumentTipsCell {
cell.setupCellInfo(title: title, detail: detail, detailColor: .mainTextColor70)
return cell
}
case let .header(title):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsTitleCell.cellReuseIdentifier) as? YHHKRecordsTitleCell {
cell.setupCellInfo(title)
return cell
}
case let .personnelStaying(title, personnels):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsStayingPersonnelCell.cellReuseIdentifier) as? YHHKRecordsStayingPersonnelCell {
cell.setupCellInfo(title: title)
cell.collectionData = personnels
return cell
}
case let .selectTime(title, detail, placeholder):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier) as? YHHKRecordsRemarkCell {
cell.setupCellInfo(title: title, detail: detail)
return cell
}
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard datas.count > indexPath.section else {
return
}
let sectionArr = datas[indexPath.section]
guard sectionArr.count > indexPath.row else {
return
}
let row = sectionArr[indexPath.row]
}
// Do any additional setup after loading the view.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
guard datas.count > indexPath.section else {
return 0
}
let sectionArr = datas[indexPath.section]
guard sectionArr.count > indexPath.row else {
return 0
}
let row = sectionArr[indexPath.row]
switch row {
case .remark:
return 146
case .tips:
return UITableView.automaticDimension
case .header:
return 52
case .personnelStaying:
return UITableView.automaticDimension
case .selectTime:
return 52
}
}
/*
// MARK: - Navigation
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
// 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.
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
*/
}
extension YHHKRecordsEditContentVC {
private func getTips() -> NSAttributedString {
let normalTextFirst = "您好,所有家庭成员赴港时间"
let attText = "间隔不能超出180天"
let normalTextLast = "(红线)如超出,递交续签时需向港府解释说明连续180未赴港原因。主申请人赴港频率越高,逗留时间越长,续签成功率越高哦~"
let attStr = NSMutableAttributedString(string: normalTextFirst + attText + normalTextLast)
attStr.setAttributes([.foregroundColor: UIColor.brandMainColor], range: NSRange(location: normalTextFirst.count, length: attText.count))
return attStr
}
}
//
// YHHKRecordsEditPersonnelModel.swift
// galaxy
//
// Created by alexzzw on 2024/9/21.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
struct YHHKRecordsEditPersonnelModel {
var name: String = ""
var isSelected: Bool = false
}
......@@ -89,8 +89,9 @@ class YHHKRecordsPersonnelSelectCell: UICollectionViewCell {
}
}
func setupCellInfo(_ text: String?) {
func setupCellInfo(_ text: String?, isSelected: Bool) {
tagLabel.text = text
self.isSelected = isSelected
}
}
......@@ -15,9 +15,9 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
private static let minimumLineSpacing: CGFloat = 12
private static let minimumInteritemSpacing: CGFloat = 8
var selectItemAction: ((String?) -> Void)?
var selectItemAction: ((YHHKRecordsEditPersonnelModel?) -> Void)?
var collectionData: [String] = [] {
var collectionData: [YHHKRecordsEditPersonnelModel] = [] {
didSet {
infoCollectionView.reloadData()
}
......@@ -91,6 +91,7 @@ extension YHHKRecordsStayingPersonnelCell {
subContainerView.addSubview(asteriskIcon)
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(bottomLineView)
subContainerView.addSubview(infoCollectionView)
asteriskIcon.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
......@@ -129,7 +130,7 @@ extension YHHKRecordsStayingPersonnelCell: UICollectionViewDelegate, UICollectio
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if collectionData.count > indexPath.item, let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHKRecordsPersonnelSelectCell.cellReuseIdentifier, for: indexPath) as? YHHKRecordsPersonnelSelectCell {
let data = collectionData[indexPath.item]
cell.setupCellInfo(data)
cell.setupCellInfo(data.name, isSelected: data.isSelected)
return cell
}
return UICollectionViewCell()
......@@ -138,7 +139,7 @@ extension YHHKRecordsStayingPersonnelCell: UICollectionViewDelegate, UICollectio
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
if collectionData.count > indexPath.item {
let data = collectionData[indexPath.item]
let attrString = NSAttributedString(string: data, attributes: [.font: YHHKRecordsPersonnelSelectCell.labelFont])
let attrString = NSAttributedString(string: data.name, attributes: [.font: YHHKRecordsPersonnelSelectCell.labelFont])
var width = attrString.yh_width(containerHeight: YHHKRecordsPersonnelSelectCell.cellHeight) + 2 * YHHKRecordsPersonnelSelectCell.offsetX
if width < minWidth {
width = minWidth
......
......@@ -11,6 +11,8 @@ import UIKit
class YHHKRecordsTimeSelectCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHHKRecordsTimeSelectCell"
private let placeholderColor = UIColor.mainTextColor30
private let selectedColor = UIColor.mainTextColor
private lazy var asteriskIcon: UIImageView = {
let view = UIImageView()
......@@ -53,9 +55,16 @@ class YHHKRecordsTimeSelectCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, detail: String?) {
func setupCellInfo(title: String?, detail: String?, placeholder: String) {
infoTitleLabel.text = title
if let detail = detail {
infoDetailLabel.text = detail
infoDetailLabel.textColor = selectedColor
} else {
infoDetailLabel.text = placeholder
infoDetailLabel.textColor = placeholderColor
}
}
}
......
......@@ -49,8 +49,9 @@ class YHResignDocumentTipsCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, detail: NSAttributedString?) {
func setupCellInfo(title: String?, detail: NSAttributedString?, detailColor: UIColor = .mainTextColor50) {
infoTitleLabel.text = title
infoDetailLabel.textColor = detailColor
infoDetailLabel.attributedText = detail
}
}
......
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