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

在港记录页面调整

parent b62df4fb
...@@ -172,6 +172,8 @@ extension YHServiceOrderListView : UITableViewDelegate,UITableViewDataSource { ...@@ -172,6 +172,8 @@ extension YHServiceOrderListView : UITableViewDelegate,UITableViewDataSource {
//我的续签方案 //我的续签方案
} else if tag == 3 { } else if tag == 3 {
//添加在港记录 //添加在港记录
let vc = YHHKImmigrationRecordsVC()
UIViewController.current?.navigationController?.pushViewController(vc)
} else if tag == 4 { } else if tag == 4 {
//续签证件管理 //续签证件管理
let vc = YHResignCertificateListViewController() let vc = YHResignCertificateListViewController()
......
...@@ -118,6 +118,7 @@ extension YHHKImmigrationRecordsVC { ...@@ -118,6 +118,7 @@ extension YHHKImmigrationRecordsVC {
make.top.equalTo(segmentedView.snp.bottom) make.top.equalTo(segmentedView.snp.bottom)
make.bottom.equalTo(bottomView.snp.top) make.bottom.equalTo(bottomView.snp.top)
} }
segmentedView.listContainer = listContainerView
} }
@objc private func clickAddNewButton() { @objc private func clickAddNewButton() {
...@@ -126,11 +127,17 @@ extension YHHKImmigrationRecordsVC { ...@@ -126,11 +127,17 @@ extension YHHKImmigrationRecordsVC {
} }
extension YHHKImmigrationRecordsVC: JXSegmentedViewDelegate { extension YHHKImmigrationRecordsVC: JXSegmentedViewDelegate {
//
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
//先更新数据源的数据
// segmentedDataSource.dotStates[index] = false
//再调用reloadItem(at: index)
// segmentedView.reloadItem(at: index)
}
} }
extension YHHKImmigrationRecordsVC: JXSegmentedListContainerViewDataSource extension YHHKImmigrationRecordsVC: JXSegmentedListContainerViewDataSource {
{
func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int { func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource { if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
return titleDataSource.dataSource.count return titleDataSource.dataSource.count
......
...@@ -11,6 +11,15 @@ import JXSegmentedView ...@@ -11,6 +11,15 @@ import JXSegmentedView
class YHHKRecordsContentVC: YHBaseViewController { class YHHKRecordsContentVC: YHBaseViewController {
enum RowType {
case customer(_ title: String, _ detail: String)
case info(_ title: String, _ detail: String, _ topMargin: CGFloat = 18, _ bottomMargin: CGFloat = 18)
case remark(_ title: String, _ detail: String)
case edit(_ title: String)
}
private var datas: [[RowType]] = []
private lazy var tableView: UITableView = { private lazy var tableView: UITableView = {
let view = UITableView(frame:.zero, style:.grouped) let view = UITableView(frame:.zero, style:.grouped)
view.estimatedSectionHeaderHeight = 16.0 view.estimatedSectionHeaderHeight = 16.0
...@@ -25,16 +34,22 @@ class YHHKRecordsContentVC: YHBaseViewController { ...@@ -25,16 +34,22 @@ class YHHKRecordsContentVC: YHBaseViewController {
view.backgroundColor = .clear view.backgroundColor = .clear
view.rowHeight = 52 view.rowHeight = 52
view.tableFooterView = UITableViewHeaderFooterView() view.tableFooterView = UITableViewHeaderFooterView()
view.register(YHResignDocumentHeaderCell.self, forCellReuseIdentifier: YHResignDocumentHeaderCell.cellReuseIdentifier) view.register(YHHKRecordsCustomerItemCell.self, forCellReuseIdentifier: YHHKRecordsCustomerItemCell.cellReuseIdentifier)
view.register(YHResignDocumentContentCell.self, forCellReuseIdentifier: YHResignDocumentContentCell.cellReuseIdentifier) view.register(YHHKRecordsInfoItemCell.self, forCellReuseIdentifier: YHHKRecordsInfoItemCell.cellReuseIdentifier)
view.register(YHHKRecordsRemarkCell.self, forCellReuseIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier)
view.register(YHHKRecordsEditButtonCell.self, forCellReuseIdentifier: YHHKRecordsEditButtonCell.cellReuseIdentifier)
return view return view
}() }()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setupUI() setupUI()
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setupData()
}
} }
extension YHHKRecordsContentVC { extension YHHKRecordsContentVC {
...@@ -50,6 +65,11 @@ extension YHHKRecordsContentVC { ...@@ -50,6 +65,11 @@ extension YHHKRecordsContentVC {
} }
tableView.tableFooterView = 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 setupData() {
datas = [[.customer("客户", "2023-12-13 12:00:00"), .info("逗留人员:", "张三丰、章一刀", 18, 9), .info("出入境时间:", "2023-10-04 ~ 2023-12-04", 9, 2), .remark("备注:", "这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息"), .edit("编辑")], [.customer("客户", "2023-12-13 12:00:00"), .info("逗留人员:", "张三丰、章一刀", 18, 9), .info("出入境时间:", "2023-10-04 ~ 2023-12-04", 9, 18), .edit("编辑")]]
tableView.reloadData()
}
} }
extension YHHKRecordsContentVC: JXSegmentedListContainerViewListDelegate { extension YHHKRecordsContentVC: JXSegmentedListContainerViewListDelegate {
...@@ -60,19 +80,85 @@ extension YHHKRecordsContentVC: JXSegmentedListContainerViewListDelegate { ...@@ -60,19 +80,85 @@ extension YHHKRecordsContentVC: JXSegmentedListContainerViewListDelegate {
extension YHHKRecordsContentVC: UITableViewDelegate, UITableViewDataSource { extension YHHKRecordsContentVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
0 return datas.count
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
0 guard datas.count > section else {
return 0
}
let sectionArr = datas[section]
return sectionArr.count
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 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 .customer(title, detail):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsCustomerItemCell.cellReuseIdentifier) as? YHHKRecordsCustomerItemCell {
cell.setupCellInfo(title: title, detail: detail)
return cell
}
case let .info(title, detail, top, bottom):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsInfoItemCell.cellReuseIdentifier) as? YHHKRecordsInfoItemCell {
cell.setupCellInfo(title: title, detail: detail, topMargin: top, bottomMargin: bottom)
return cell
}
case let .remark(title, detail):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier) as? YHHKRecordsRemarkCell {
cell.setupCellInfo(title: title, detail: detail)
return cell
}
case let .edit(title):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsEditButtonCell.cellReuseIdentifier) as? YHHKRecordsEditButtonCell {
cell.setupCellInfo(title: title)
return cell
}
}
return UITableViewCell() return UITableViewCell()
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 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]
if case .edit = row {
let vc = YHHKRecordsEditContentVC()
navigationController?.pushViewController(vc)
}
}
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 .customer:
return 52
case .info:
return UITableView.automaticDimension
case .remark:
return 146
case .edit:
return 52
}
} }
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
......
...@@ -15,7 +15,7 @@ class YHHKRecordsEditButtonCell: YHResignDocumentCell { ...@@ -15,7 +15,7 @@ class YHHKRecordsEditButtonCell: YHResignDocumentCell {
private lazy var centerLabel: UILabel = { private lazy var centerLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = .PFSC_M(ofSize: 14) label.font = .PFSC_M(ofSize: 14)
label.textColor = UIColor(hexString: "#222222") label.textColor = .brandMainColor
return label return label
}() }()
......
...@@ -27,12 +27,10 @@ class YHHKRecordsRemarkCell: YHResignDocumentCell { ...@@ -27,12 +27,10 @@ class YHHKRecordsRemarkCell: YHResignDocumentCell {
view.textColor = .mainTextColor view.textColor = .mainTextColor
view.tintColor = .mainTextColor view.tintColor = .mainTextColor
view.backgroundColor = .contentBkgColor view.backgroundColor = .contentBkgColor
view.font = UIFont.systemFont(ofSize: 14)
view.returnKeyType = .default view.returnKeyType = .default
view.enablesReturnKeyAutomatically = true view.enablesReturnKeyAutomatically = true
view.delegate = self view.delegate = self
view.addObserver(self, forKeyPath: "attributedText", options: .new, context: nil) view.textContainerInset = UIEdgeInsets(top: 10, left: 12, bottom: 10, right: 12)
view.textContainerInset = UIEdgeInsets.zero
view.textContainer.lineFragmentPadding = 0 view.textContainer.lineFragmentPadding = 0
return view return view
}() }()
...@@ -77,8 +75,8 @@ extension YHHKRecordsRemarkCell { ...@@ -77,8 +75,8 @@ extension YHHKRecordsRemarkCell {
} }
remarkTextView.snp.makeConstraints { make in remarkTextView.snp.makeConstraints { make in
make.left.equalTo(infoTitleLabel) make.left.equalTo(infoTitleLabel)
make.right.equalToSuperview().offset(18) make.right.equalToSuperview().offset(-18)
make.height.equalTo(88) make.height.equalTo(86)
make.top.equalTo(infoTitleLabel.snp.bottom).offset(8) make.top.equalTo(infoTitleLabel.snp.bottom).offset(8)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
......
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