Commit c3993a95 authored by Steven杜宇's avatar Steven杜宇

// 信息确认

parent 2a5c021b
...@@ -198,6 +198,8 @@ ...@@ -198,6 +198,8 @@
044E31C72CBD264D00500F8E /* YHResignInfoConfirmInfoListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E31C62CBD264D00500F8E /* YHResignInfoConfirmInfoListModel.swift */; }; 044E31C72CBD264D00500F8E /* YHResignInfoConfirmInfoListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E31C62CBD264D00500F8E /* YHResignInfoConfirmInfoListModel.swift */; };
044E31C92CBD2AA400500F8E /* YHResignInfoConfirmIViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E31C82CBD2AA400500F8E /* YHResignInfoConfirmIViewModel.swift */; }; 044E31C92CBD2AA400500F8E /* YHResignInfoConfirmIViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E31C82CBD2AA400500F8E /* YHResignInfoConfirmIViewModel.swift */; };
044E31CB2CBD336800500F8E /* YHResignInfoConfirmModifyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E31CA2CBD336800500F8E /* YHResignInfoConfirmModifyViewController.swift */; }; 044E31CB2CBD336800500F8E /* YHResignInfoConfirmModifyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E31CA2CBD336800500F8E /* YHResignInfoConfirmModifyViewController.swift */; };
044E31CD2CBE3A7100500F8E /* YHResignFamilyInfoListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E31CC2CBE3A7100500F8E /* YHResignFamilyInfoListCell.swift */; };
044E31CF2CBE3BCC00500F8E /* YHResignInfoItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044E31CE2CBE3BCC00500F8E /* YHResignInfoItemView.swift */; };
044EE2232C8FE1D000A2FE3A /* YHServiceCenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2222C8FE1D000A2FE3A /* YHServiceCenterViewController.swift */; }; 044EE2232C8FE1D000A2FE3A /* YHServiceCenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2222C8FE1D000A2FE3A /* YHServiceCenterViewController.swift */; };
044EE2252C90138000A2FE3A /* YHServerCenterHoldViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2242C90138000A2FE3A /* YHServerCenterHoldViewController.swift */; }; 044EE2252C90138000A2FE3A /* YHServerCenterHoldViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2242C90138000A2FE3A /* YHServerCenterHoldViewController.swift */; };
044EE2272C91367800A2FE3A /* YHServiceStepThreeSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2262C91367800A2FE3A /* YHServiceStepThreeSectionView.swift */; }; 044EE2272C91367800A2FE3A /* YHServiceStepThreeSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2262C91367800A2FE3A /* YHServiceStepThreeSectionView.swift */; };
...@@ -1147,6 +1149,8 @@ ...@@ -1147,6 +1149,8 @@
044E31C62CBD264D00500F8E /* YHResignInfoConfirmInfoListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignInfoConfirmInfoListModel.swift; sourceTree = "<group>"; }; 044E31C62CBD264D00500F8E /* YHResignInfoConfirmInfoListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignInfoConfirmInfoListModel.swift; sourceTree = "<group>"; };
044E31C82CBD2AA400500F8E /* YHResignInfoConfirmIViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignInfoConfirmIViewModel.swift; sourceTree = "<group>"; }; 044E31C82CBD2AA400500F8E /* YHResignInfoConfirmIViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignInfoConfirmIViewModel.swift; sourceTree = "<group>"; };
044E31CA2CBD336800500F8E /* YHResignInfoConfirmModifyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignInfoConfirmModifyViewController.swift; sourceTree = "<group>"; }; 044E31CA2CBD336800500F8E /* YHResignInfoConfirmModifyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignInfoConfirmModifyViewController.swift; sourceTree = "<group>"; };
044E31CC2CBE3A7100500F8E /* YHResignFamilyInfoListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignFamilyInfoListCell.swift; sourceTree = "<group>"; };
044E31CE2CBE3BCC00500F8E /* YHResignInfoItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignInfoItemView.swift; sourceTree = "<group>"; };
044EE2222C8FE1D000A2FE3A /* YHServiceCenterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceCenterViewController.swift; sourceTree = "<group>"; }; 044EE2222C8FE1D000A2FE3A /* YHServiceCenterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceCenterViewController.swift; sourceTree = "<group>"; };
044EE2242C90138000A2FE3A /* YHServerCenterHoldViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServerCenterHoldViewController.swift; sourceTree = "<group>"; }; 044EE2242C90138000A2FE3A /* YHServerCenterHoldViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServerCenterHoldViewController.swift; sourceTree = "<group>"; };
044EE2262C91367800A2FE3A /* YHServiceStepThreeSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceStepThreeSectionView.swift; sourceTree = "<group>"; }; 044EE2262C91367800A2FE3A /* YHServiceStepThreeSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceStepThreeSectionView.swift; sourceTree = "<group>"; };
...@@ -3555,6 +3559,8 @@ ...@@ -3555,6 +3559,8 @@
children = ( children = (
04912F5F2CB6697300CC3105 /* YHResignRiskWarningAlertView.swift */, 04912F5F2CB6697300CC3105 /* YHResignRiskWarningAlertView.swift */,
04912F632CB6885D00CC3105 /* YHResignFamilyMemberInfoCell.swift */, 04912F632CB6885D00CC3105 /* YHResignFamilyMemberInfoCell.swift */,
044E31CC2CBE3A7100500F8E /* YHResignFamilyInfoListCell.swift */,
044E31CE2CBE3BCC00500F8E /* YHResignInfoItemView.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -5412,6 +5418,7 @@ ...@@ -5412,6 +5418,7 @@
04F243742CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift in Sources */, 04F243742CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift in Sources */,
044F392C2CB54C5E007CA277 /* YHHKVisaRenewalPaymentVC.swift in Sources */, 044F392C2CB54C5E007CA277 /* YHHKVisaRenewalPaymentVC.swift in Sources */,
04F243592C9C43A100DF2C74 /* YHHKRecordsEditButtonCell.swift in Sources */, 04F243592C9C43A100DF2C74 /* YHHKRecordsEditButtonCell.swift in Sources */,
044E31CF2CBE3BCC00500F8E /* YHResignInfoItemView.swift in Sources */,
A5CA3F542C744CAB00EB22F5 /* YHUploadCertificateDetailCell.swift in Sources */, A5CA3F542C744CAB00EB22F5 /* YHUploadCertificateDetailCell.swift in Sources */,
04A7BD172BA43A0F00BD35A2 /* YHMyDocumentsDetailViewModel.swift in Sources */, 04A7BD172BA43A0F00BD35A2 /* YHMyDocumentsDetailViewModel.swift in Sources */,
04256DF82C73726C00A37BA4 /* YHCerAppointViewModel.swift in Sources */, 04256DF82C73726C00A37BA4 /* YHCerAppointViewModel.swift in Sources */,
...@@ -6069,6 +6076,7 @@ ...@@ -6069,6 +6076,7 @@
04FA8B2B2C06F59D00ABE43F /* YHAppleLoginManager.swift in Sources */, 04FA8B2B2C06F59D00ABE43F /* YHAppleLoginManager.swift in Sources */,
048058372C7F03B500502CAA /* YHTravelCertificateUploadCell.swift in Sources */, 048058372C7F03B500502CAA /* YHTravelCertificateUploadCell.swift in Sources */,
A567E5932BD7643D00D5D5A0 /* YHHomePageViewModel.swift in Sources */, A567E5932BD7643D00D5D5A0 /* YHHomePageViewModel.swift in Sources */,
044E31CD2CBE3A7100500F8E /* YHResignFamilyInfoListCell.swift in Sources */,
045EEE822B9F171A0022A143 /* YHPersonInfoIdentityCardModel.swift in Sources */, 045EEE822B9F171A0022A143 /* YHPersonInfoIdentityCardModel.swift in Sources */,
045EEE952B9F171A0022A143 /* YHPreviewInfoCertificateInformationItemsView.swift in Sources */, 045EEE952B9F171A0022A143 /* YHPreviewInfoCertificateInformationItemsView.swift in Sources */,
044D0C042C2180B700C5CF5E /* YHInformationAuthorizationStepTwoViewController.swift in Sources */, 044D0C042C2180B700C5CF5E /* YHInformationAuthorizationStepTwoViewController.swift in Sources */,
......
...@@ -205,9 +205,11 @@ class YHServiceOrderListView: YHBaseViewController { ...@@ -205,9 +205,11 @@ class YHServiceOrderListView: YHBaseViewController {
//续签文书管理 //续签文书管理
let vc = YHResignDocumentManagementVC(orderId: orderId, id: stepId) let vc = YHResignDocumentManagementVC(orderId: orderId, id: stepId)
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
} else if type == 33 { } else if type == 33 {
//续签信息确认 //续签信息确认
let vc = YHResignConfirmInfoListViewController() let vc = YHResignConfirmInfoListViewController()
vc.orderId = orderId
vc.stepId = stepId vc.stepId = stepId
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
......
...@@ -11,6 +11,7 @@ import AttributedString ...@@ -11,6 +11,7 @@ import AttributedString
class YHResignConfirmInfoListViewController: YHBaseViewController { class YHResignConfirmInfoListViewController: YHBaseViewController {
var orderId: Int = 0
var stepId: Int = 0 // 批次ID var stepId: Int = 0 // 批次ID
var familyArr = [YHResignInfoConfirmFamilyInfoModel]() var familyArr = [YHResignInfoConfirmFamilyInfoModel]()
...@@ -144,8 +145,12 @@ extension YHResignConfirmInfoListViewController: UITableViewDelegate, UITableVie ...@@ -144,8 +145,12 @@ extension YHResignConfirmInfoListViewController: UITableViewDelegate, UITableVie
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.row && indexPath.row < familyArr.count { if 0 <= indexPath.row && indexPath.row < familyArr.count {
let model = familyArr[indexPath.row]
let model = familyArr[indexPath.row]
let vc = YHResignInfoConfirmModifyViewController()
vc.detailMember = model
vc.listId = self.viewModel.listModel.id
self.navigationController?.pushViewController(vc)
} }
} }
......
...@@ -7,13 +7,241 @@ ...@@ -7,13 +7,241 @@
// //
import UIKit import UIKit
import AttributedString
class YHResignInfoConfirmModifyViewController: YHBaseViewController { class YHResignInfoConfirmModifyViewController: YHBaseViewController {
var stepId: Int = 0 // 批次ID var listId: Int = 0
var detailMember = YHResignInfoConfirmFamilyInfoModel()
let viewModel = YHResignInfoConfirmViewModel()
var isInfoEditing: Bool = false
var items: [[YHResignFamilyInfoItem]] = []
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 0.01
tableView.estimatedSectionFooterHeight = 0.01
tableView.contentInsetAdjustmentBehavior = .never
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor(hex: 0xF8F9FB)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHResignFamilyInfoListCell.self, forCellReuseIdentifier: YHResignFamilyInfoListCell.cellReuseIdentifier)
return tableView
}()
lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
let cancelBtn = UIButton()
cancelBtn.backgroundColor = UIColor.init(hex: 0xF8F9FB)
cancelBtn.setTitle("取消", for: .normal)
cancelBtn.setTitleColor(.init(hex: 0x222222), for: .normal)
cancelBtn.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
cancelBtn.addTarget(self, action: #selector(didCancelBtnClicked), for: .touchUpInside)
cancelBtn.layer.cornerRadius = kCornerRadius3
view.addSubview(cancelBtn)
let confirmBtn = UIButton()
confirmBtn.backgroundColor = .brandMainColor
confirmBtn.setTitle("确认", for: .normal)
confirmBtn.setTitleColor(.white, for: .normal)
confirmBtn.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
confirmBtn.addTarget(self, action: #selector(didConfirmBtnClicked), for: .touchUpInside)
confirmBtn.layer.cornerRadius = kCornerRadius3
view.addSubview(confirmBtn)
cancelBtn.snp.makeConstraints { make in
make.top.equalTo(10)
make.left.equalTo(16)
make.height.equalTo(44)
make.width.equalTo(86)
}
confirmBtn.snp.makeConstraints { make in
make.top.equalTo(10)
make.right.equalTo(-16)
make.height.equalTo(44)
make.left.equalTo(cancelBtn.snp.right).offset(10)
}
return view
}()
// 展示挽留弹窗
func showRetainAlertView() {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "仍然关闭", "继续编辑", fullGuestureEnable: false) {
self.navigationController?.popViewController()
} callBack: {
}
}
@objc func didCancelBtnClicked() {
if self.isInfoEditing {
showRetainAlertView()
return
}
self.navigationController?.popViewController()
}
func checkInfo() -> Bool {
return false
}
@objc func didConfirmBtnClicked() {
self.detailMember.info.isCheck = true
self.updateData()
if !checkInfo() {
return
}
if let detaiParams = self.detailMember.info.toDictionary() {
let param:[String: Any] = ["id": listId,
"data": detaiParams]
YHHUD.show(.progress(message: "提交中..."))
viewModel.submitFamilyUpdate(param:param) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
if success {
YHHUD.flash(message: "提交成功")
self.navigationController?.popViewController()
return
}
let msg = error?.errorMsg ?? "提交失败"
YHHUD.flash(message: msg)
}
}
}
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.gk_navTitle = "续签信息确认"
self.view.backgroundColor = .white
self.view.addSubview(self.tableView)
self.view.addSubview(self.bottomView)
self.tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar+16)
make.bottom.equalTo(self.bottomView.snp.top)
}
self.bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(98)
}
self.updateData()
}
}
extension YHResignInfoConfirmModifyViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignFamilyInfoListCell.cellReuseIdentifier, for: indexPath) as! YHResignFamilyInfoListCell
if indexPath.row == 0 {
// 标题
let title: ASAttributedString = .init("信息核实", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
cell.titleLabel.attributed.text = title
cell.modifyBtn.isHidden = false
cell.isEditState = self.isInfoEditing
cell.familyInfo = self.detailMember.info
// 更改编辑状态
cell.editBlock = {
[weak self] isEdit in
guard let self = self else { return }
if !isEdit {
if !checkInfo() {
// 检查信息错误
self.isInfoEditing = true
self.detailMember.info.isCheck = true
self.updateData()
return
}
}
self.isInfoEditing = isEdit
self.updateData()
}
// 选择出生国家/地区
cell.selectBirthNation = {
[weak self] isInChina in
guard let self = self else { return }
self.updateData()
}
} else {
let title: ASAttributedString = .init("递交证件信息", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
let subtitle: ASAttributedString = .init("(如需更换,请联系您的生活管家)", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
cell.titleLabel.attributed.text = title + subtitle
cell.modifyBtn.isHidden = true
}
if 0 <= indexPath.row && indexPath.row < items.count {
let arr = items[indexPath.row]
cell.updateItems(arr)
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.section && indexPath.section < items.count {
}
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 16.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
} }
} }
extension YHResignInfoConfirmModifyViewController {
func updateData() {
}
}
...@@ -120,6 +120,24 @@ class YHResignInfoConfirmFamilyModel: SmartCodable { ...@@ -120,6 +120,24 @@ class YHResignInfoConfirmFamilyModel: SmartCodable {
} }
func getMarriageState() -> String {
return self.getMarriageStatus(self.married)
}
func getHistoryMarriageState() -> String {
return self.getMarriageStatus(self.marriedHistory)
}
func getMarriageStatus(_ marrage: String) -> String {
let arr = YHSheetPickerView.dataSource[.marriage1]!
for item in arr {
if item.index == Int(marrage) {
return item.title
}
}
return ""
}
func getRelation() -> String { func getRelation() -> String {
if relation == YHFamilyMemberRelationType.mainApplicant.rawValue { if relation == YHFamilyMemberRelationType.mainApplicant.rawValue {
return "主申人" return "主申人"
......
//
// YHResignFamilyInfoListCell.swift
// galaxy
//
// Created by edy on 2024/10/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
enum YHResignFamilyInfoType: Int {
case none = 0
case mainApplicantName = 1
case firstName = 2
case lastName = 3
case marriage = 4
case declareNation = 5
case occupation = 6
case hongKongId = 7
case hongkongAddress = 8
case travelCertificateType = 9
case travelCertificateId = 10
case childName = 11
case spouseName = 12
case certificateValidTime = 13
}
enum YHResignFamilyInfoActionType: Int {
case none = 0
case edit = 1 // 输入框编辑
case select = 2 // 弹出弹窗选择
}
class YHResignFamilyInfoOption {
var value: String = ""
var index: Int = -1
var isSelect: Bool = false
init(index: Int, value: String, isSelect: Bool) {
self.index = index
self.value = value
self.isSelect = isSelect
}
}
class YHResignFamilyInfoItem {
var id: YHResignFamilyInfoType = .none
var action:YHResignFamilyInfoActionType = .none
var isMust: Bool = false
var title: String = ""
var value: String = ""
var previousTitle: String = ""
var previousValue: String = ""
var options:[YHResignFamilyInfoOption] = []
var isEditMode: Bool = false
var isShowPreviousInfo: Bool = false
var tips: String {
get {
return self.getRedTips()
}
}
func getRedTips() -> String {
if !self.value.isEmpty { // value不为空
if self.id == .hongKongId, !self.value.isHKIdentityCardNumber() {
return "请输入正确的香港身份证号"
}
return ""
}
if self.isMust == false { // 非必填
return ""
}
// 必填
// value 为空的情况
if self.id == .mainApplicantName {
return "请输入主申人姓名"
}
if self.id == .spouseName {
return "请输入配偶姓名"
}
if self.id == .childName {
return "请输入子女姓名"
} else if self.id == .firstName {
return "请输入姓(拼音)"
} else if self.id == .lastName {
return "请输入名(拼音)"
} else if self.id == .occupation {
return "请输入职业"
} else if self.id == .hongKongId {
return "请输入香港身份证号"
}
return ""
}
required init() {
}
init(id: YHResignFamilyInfoType, action: YHResignFamilyInfoActionType, isMust: Bool, title: String, value: String, previousTitle: String, previousValue: String, options: [YHResignFamilyInfoOption] = [], isEditMode: Bool, isShowPreviousInfo: Bool) {
self.id = id
self.action = action
self.isMust = isMust
self.title = title
self.value = value
self.previousTitle = previousTitle
self.previousValue = previousValue
self.isEditMode = isEditMode
self.isShowPreviousInfo = isShowPreviousInfo
self.options = options
}
}
class YHResignFamilyInfoListCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignFamilyInfoListCell"
var familyInfo = YHResignInfoConfirmFamilyModel()
var isEditState: Bool = false {
didSet {
let text = self.isEditState ? "完成" : "修改"
self.modifyBtn.setTitle(text, for: .normal)
}
}
// 是否进入编辑模式
var editBlock:((Bool)->())?
// 选择出生国家
var selectBirthNation:((Bool)->())?
// 姓名更改
var updateName:((String)->())?
var items: [YHResignFamilyInfoItem] = []
lazy var whiteView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
return label
}()
lazy var modifyBtn: UIButton = {
let btn = UIButton()
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(.brandMainColor, for: .normal)
btn.setTitle("修改", for: .normal)
btn.addTarget(self, action: #selector(didModifyBtnClicked), for: .touchUpInside)
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)
return btn
}()
lazy var itemsContentView: UIView = {
let view = UIView()
return view
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
@objc func didModifyBtnClicked() {
editBlock?(!self.isEditState)
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
contentView.addSubview(whiteView)
whiteView.addSubview(titleLabel)
whiteView.addSubview(modifyBtn)
whiteView.addSubview(itemsContentView)
whiteView.snp.makeConstraints { make in
make.top.equalTo(16.0)
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(0)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(18)
make.left.equalTo(18)
make.right.equalTo(-18)
}
modifyBtn.snp.makeConstraints { make in
make.top.equalTo(18)
make.right.equalTo(-18)
make.size.equalTo(CGSize(width: 28, height: 20))
}
itemsContentView.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.left.equalTo(18)
make.right.equalTo(-18)
make.bottom.equalTo(0)
}
}
func updateItems(_ items:[YHResignFamilyInfoItem]) {
self.items = items
itemsContentView.removeSubviews()
var lastItemView:UIView? = nil
for (index, item) in items.enumerated() {
var itemView:UIView? = YHResignInfoItemView(frame: .zero)
// if item.action == .choice {
// itemView = YHInfoOptionView(frame: .zero)
// }
if let itemView = itemView as? YHResignInfoItemView {
itemsContentView.addSubview(itemView)
itemView.updateItem(item, familyInfo: familyInfo)
itemView.updateName = {
[weak self] text in
guard let self = self else { return }
for subView in self.itemsContentView.subviews {
if subView is YHResignInfoItemView {
let targetView = subView as! YHResignInfoItemView
if targetView.item.id == .firstName {
targetView.item.value = self.familyInfo.familyName
targetView.updateItem(targetView.item, familyInfo: self.familyInfo)
}
if targetView.item.id == .lastName {
targetView.item.value = self.familyInfo.givenName
targetView.updateItem(targetView.item, familyInfo: self.familyInfo)
}
}
}
}
}
if let itemView = itemView {
itemView.snp.makeConstraints { make in
make.left.right.equalTo(0)
if let lastView = lastItemView {
make.top.equalTo(lastView.snp.bottom)
} else {
make.top.equalTo(itemsContentView.snp.top)
}
if index == items.count-1 {
make.bottom.equalTo(itemsContentView.snp.bottom)
}
}
lastItemView = itemView
}
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
...@@ -57,4 +57,27 @@ class YHResignInfoConfirmViewModel { ...@@ -57,4 +57,27 @@ class YHResignInfoConfirmViewModel {
} }
return results return results
} }
// 提交信息确认修改
func submitFamilyUpdate(param:[String : Any], callback:((_ success: Bool,_ error:YHErrorModel?)->())?) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.ResignInfoConfirm.update
let _ = YHNetRequest.postRequest(url: strUrl,params: param) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
callback?(true, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback?(false, err)
}
} failBlock: { err in
callback?(false, err)
}
}
} }
...@@ -567,9 +567,11 @@ class YHAllApiName { ...@@ -567,9 +567,11 @@ class YHAllApiName {
// 续签信息确认 // 续签信息确认
struct ResignInfoConfirm { struct ResignInfoConfirm {
// 信息确认成员列表
static let getList = "super-app/renewal/information-list" static let getList = "super-app/renewal/information-list"
// 信息确认成员列表点击确认
static let confirmInfo = "super-app/renewal/information-confirm" static let confirmInfo = "super-app/renewal/information-confirm"
static let upate = "super-app/renewal/information-update" static let update = "super-app/renewal/information-update"
} }
// 在港记录 // 在港记录
......
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