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

// 确认

parent e8d1828f
This diff is collapsed.
...@@ -39,8 +39,8 @@ class YHResignAppointScheduleListViewController: YHBaseViewController { ...@@ -39,8 +39,8 @@ class YHResignAppointScheduleListViewController: YHBaseViewController {
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.bounces = false tableView.bounces = false
tableView.register(YHResignHaveAppointedMultipleInfoCell.self, forCellReuseIdentifier: YHResignHaveAppointedMultipleInfoCell.cellReuseIdentifier) tableView.register(YHResignScheduleMultipleInfoCell.self, forCellReuseIdentifier: YHResignScheduleMultipleInfoCell.cellReuseIdentifier)
tableView.register(YHResignHaveAppointedSingleInfoCell.self, forCellReuseIdentifier: YHResignHaveAppointedSingleInfoCell.cellReuseIdentifier) tableView.register(YHResignScheduleSingleInfoCell.self, forCellReuseIdentifier: YHResignScheduleSingleInfoCell.cellReuseIdentifier)
tableView.delegate = self tableView.delegate = self
tableView.dataSource = self tableView.dataSource = self
return tableView return tableView
...@@ -360,7 +360,7 @@ extension YHResignAppointScheduleListViewController: UITableViewDelegate, UITabl ...@@ -360,7 +360,7 @@ extension YHResignAppointScheduleListViewController: UITableViewDelegate, UITabl
if 0 <= indexPath.row && indexPath.row < scheduleArr.count { if 0 <= indexPath.row && indexPath.row < scheduleArr.count {
let model = scheduleArr[indexPath.row] let model = scheduleArr[indexPath.row]
if scheduleArr.count <= 1 { if scheduleArr.count <= 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedSingleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedSingleInfoCell let cell = tableView.dequeueReusableCell(withIdentifier: YHResignScheduleSingleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignScheduleSingleInfoCell
cell.updateModel(model) cell.updateModel(model)
// 点击确认在港或未确认在港按钮 // 点击确认在港或未确认在港按钮
cell.clickConfirmBtnBlock = { cell.clickConfirmBtnBlock = {
...@@ -379,7 +379,7 @@ extension YHResignAppointScheduleListViewController: UITableViewDelegate, UITabl ...@@ -379,7 +379,7 @@ extension YHResignAppointScheduleListViewController: UITableViewDelegate, UITabl
} }
// 分组 // 分组
let cell2 = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedMultipleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedMultipleInfoCell let cell2 = tableView.dequeueReusableCell(withIdentifier: YHResignScheduleMultipleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignScheduleMultipleInfoCell
model.batchIndex = indexPath.row+1 model.batchIndex = indexPath.row+1
cell2.updateModel(model) cell2.updateModel(model)
cell2.clickConfirmBtnBlock = { cell2.clickConfirmBtnBlock = {
......
...@@ -33,7 +33,7 @@ class YHResignAppointTimeModifyViewController: YHBaseViewController { ...@@ -33,7 +33,7 @@ class YHResignAppointTimeModifyViewController: YHBaseViewController {
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.bounces = false tableView.bounces = false
tableView.register(YHResignAppointOptionResultCell.self, forCellReuseIdentifier: YHResignAppointOptionResultCell.cellReuseIdentifier) tableView.register(YHResignAppointOptionResultCell.self, forCellReuseIdentifier: YHResignAppointOptionResultCell.cellReuseIdentifier)
tableView.register(YHResignAppointApplicantInfoCell.self, forCellReuseIdentifier: YHResignAppointApplicantInfoCell.cellReuseIdentifier) tableView.register(YHResignHaveAppointedApplicantsInfoCell.self, forCellReuseIdentifier: YHResignHaveAppointedApplicantsInfoCell.cellReuseIdentifier)
tableView.register(YHResignAppointTimeMultipleCell.self, forCellReuseIdentifier: YHResignAppointTimeMultipleCell.cellReuseIdentifier) tableView.register(YHResignAppointTimeMultipleCell.self, forCellReuseIdentifier: YHResignAppointTimeMultipleCell.cellReuseIdentifier)
tableView.delegate = self tableView.delegate = self
tableView.dataSource = self tableView.dataSource = self
...@@ -129,7 +129,7 @@ extension YHResignAppointTimeModifyViewController: UITableViewDelegate, UITableV ...@@ -129,7 +129,7 @@ extension YHResignAppointTimeModifyViewController: UITableViewDelegate, UITableV
if 0 <= indexPath.row && indexPath.row < selectGroupArr.count { if 0 <= indexPath.row && indexPath.row < selectGroupArr.count {
let model = selectGroupArr[indexPath.row] let model = selectGroupArr[indexPath.row]
if model.isHaveAppointed { // 已确认在港 只展示信息 if model.isHaveAppointed { // 已确认在港 只展示信息
let cell1 = tableView.dequeueReusableCell(withIdentifier: YHResignAppointApplicantInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignAppointApplicantInfoCell let cell1 = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedApplicantsInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedApplicantsInfoCell
cell1.updateModel(model) cell1.updateModel(model)
return cell1 return cell1
} }
......
...@@ -84,7 +84,7 @@ class YHResignAppointTimeMultipleCell: UITableViewCell { ...@@ -84,7 +84,7 @@ class YHResignAppointTimeMultipleCell: UITableViewCell {
collectView.dataSource = self collectView.dataSource = self
collectView.backgroundColor = .clear collectView.backgroundColor = .clear
// 注册自定义单元格 // 注册自定义单元格
collectView.register(YHResignAppointApplicantCell.self, forCellWithReuseIdentifier: YHResignAppointApplicantCell.cellReuseIdentifier) collectView.register(YHResignSelectApplicantCollectCell.self, forCellWithReuseIdentifier: YHResignSelectApplicantCollectCell.cellReuseIdentifier)
return collectView return collectView
}() }()
...@@ -425,7 +425,7 @@ extension YHResignAppointTimeMultipleCell: UICollectionViewDelegate, UICollectio ...@@ -425,7 +425,7 @@ extension YHResignAppointTimeMultipleCell: UICollectionViewDelegate, UICollectio
// 返回自定义单元格 // 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHResignAppointApplicantCell.cellReuseIdentifier, for: indexPath) as! YHResignAppointApplicantCell let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHResignSelectApplicantCollectCell.cellReuseIdentifier, for: indexPath) as! YHResignSelectApplicantCollectCell
if 0 <= indexPath.item && indexPath.item < arr.count { if 0 <= indexPath.item && indexPath.item < arr.count {
let applicant = arr[indexPath.item] let applicant = arr[indexPath.item]
cell.updateApplicantInfo(applicant) cell.updateApplicantInfo(applicant)
......
...@@ -44,7 +44,7 @@ class YHResignAppointedScheduleLineView: UIView { ...@@ -44,7 +44,7 @@ class YHResignAppointedScheduleLineView: UIView {
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout) let collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.backgroundColor = .clear collectionView.backgroundColor = .clear
collectionView.register(YHResignAppointedScheduleLineCollectCell.self, forCellWithReuseIdentifier:YHResignAppointedScheduleLineCollectCell.cellReuseIdentifier) collectionView.register(YHResignScheduleLineCollectCell.self, forCellWithReuseIdentifier:YHResignScheduleLineCollectCell.cellReuseIdentifier)
collectionView.delegate = self collectionView.delegate = self
collectionView.dataSource = self collectionView.dataSource = self
collectionView.bounces = false collectionView.bounces = false
...@@ -134,7 +134,7 @@ extension YHResignAppointedScheduleLineView: UICollectionViewDelegate, UICollect ...@@ -134,7 +134,7 @@ extension YHResignAppointedScheduleLineView: UICollectionViewDelegate, UICollect
// 返回自定义单元格 // 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHResignAppointedScheduleLineCollectCell.cellReuseIdentifier, for: indexPath) as! YHResignAppointedScheduleLineCollectCell let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHResignScheduleLineCollectCell.cellReuseIdentifier, for: indexPath) as! YHResignScheduleLineCollectCell
if 0 <= indexPath.item && indexPath.item < steps.count { if 0 <= indexPath.item && indexPath.item < steps.count {
let model = steps[indexPath.item] let model = steps[indexPath.item]
model.index = indexPath.item+1 model.index = indexPath.item+1
......
// //
// YHResignAppointApplicantInfoCell.swift // YHResignHaveAppointedApplicantsInfoCell.swift
// galaxy // galaxy
// //
// Created by edy on 2024/10/10. // Created by edy on 2024/10/10.
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
import UIKit import UIKit
import AttributedString import AttributedString
class YHResignAppointApplicantInfoCell: UITableViewCell { class YHResignHaveAppointedApplicantsInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignAppointApplicantInfoCell" static let cellReuseIdentifier = "YHResignHaveAppointedApplicantsInfoCell"
lazy var whiteContentView: UIView = { lazy var whiteContentView: UIView = {
let view = UIView() let view = UIView()
......
// //
// YHResignAppointedScheduleLineCell.swift // YHResignScheduleLineCollectCell.swift
// galaxy // galaxy
// //
// Created by edy on 2024/10/10. // Created by edy on 2024/10/10.
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
import UIKit import UIKit
class YHResignAppointedScheduleLineCollectCell: UICollectionViewCell { class YHResignScheduleLineCollectCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHResignAppointedScheduleLineCollectCell" static let cellReuseIdentifier = "YHResignScheduleLineCollectCell"
lazy var numLabel: UILabel = { lazy var numLabel: UILabel = {
var label = UILabel() var label = UILabel()
......
// //
// YHResignHaveAppointedInfoCellTableViewCell.swift // YHResignScheduleMultipleInfoCell.swift
// galaxy // galaxy
// //
// Created by edy on 2024/10/10. // Created by edy on 2024/10/10.
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
import UIKit import UIKit
class YHResignHaveAppointedMultipleInfoCell: UITableViewCell { class YHResignScheduleMultipleInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignHaveAppointedMultipleInfoCell" static let cellReuseIdentifier = "YHResignScheduleMultipleInfoCell"
var confirmHKStatus: YHResignConfirmHKStatus = .waitConfirmHK var confirmHKStatus: YHResignConfirmHKStatus = .waitConfirmHK
var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())? var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())?
......
// //
// YHResignHaveAppointedSingleInfoCell.swift // YHResignScheduleSingleInfoCell.swift
// galaxy // galaxy
// //
// Created by edy on 2024/10/11. // Created by edy on 2024/10/11.
...@@ -14,9 +14,9 @@ enum YHResignConfirmHKStatus: Int { ...@@ -14,9 +14,9 @@ enum YHResignConfirmHKStatus: Int {
case haveConfirmHK = 2 // 已确认在港 case haveConfirmHK = 2 // 已确认在港
} }
class YHResignHaveAppointedSingleInfoCell: UITableViewCell { class YHResignScheduleSingleInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignHaveAppointedSingleInfoCell" static let cellReuseIdentifier = "YHResignScheduleSingleInfoCell"
var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())? var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())?
var modifyBtnBlock: (()->())? var modifyBtnBlock: (()->())?
......
// //
// YHResignAppointApplicantCell.swift // YHResignSelectApplicantCollectCell.swift
// galaxy // galaxy
// //
// Created by edy on 2024/10/12. // Created by edy on 2024/10/12.
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
import UIKit import UIKit
class YHResignAppointApplicantCell: UICollectionViewCell { class YHResignSelectApplicantCollectCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHResignAppointApplicantCell" static let cellReuseIdentifier = "YHResignSelectApplicantCollectCell"
lazy var selectImgView:UIImageView = { lazy var selectImgView:UIImageView = {
let view = UIImageView(image: UIImage(named: "")) let view = UIImageView(image: UIImage(named: ""))
......
...@@ -167,6 +167,21 @@ class YHResignInfoConfirmModifyViewController: YHBaseViewController { ...@@ -167,6 +167,21 @@ class YHResignInfoConfirmModifyViewController: YHBaseViewController {
} }
} }
} }
func requestNamePinYin() {
YHHUD.hide()
if !self.detailMember.name.isEmpty, self.detailMember.familyName.isEmpty {
YHHUD.show(.progress(message: "加载中..."))
self.viewModel.getPinYinFromName(self.detailMember.name) {
[weak self] firstName, lastName in
YHHUD.hide()
guard let self = self else { return }
self.detailMember.familyName = firstName
self.detailMember.givenName = lastName
self.updateData()
}
}
}
} }
extension YHResignInfoConfirmModifyViewController: UITableViewDelegate, UITableViewDataSource { extension YHResignInfoConfirmModifyViewController: UITableViewDelegate, UITableViewDataSource {
...@@ -202,13 +217,21 @@ extension YHResignInfoConfirmModifyViewController: UITableViewDelegate, UITableV ...@@ -202,13 +217,21 @@ extension YHResignInfoConfirmModifyViewController: UITableViewDelegate, UITableV
self.isInfoEditing = true self.isInfoEditing = true
self.detailMember.isNeedCheck = true self.detailMember.isNeedCheck = true
self.updateData() self.updateData()
self.requestNamePinYin()
return return
} }
} }
self.isInfoEditing = isEdit self.isInfoEditing = isEdit
self.updateData() self.updateData()
self.requestNamePinYin()
} }
cell.updateNamePinYinBlock = {
[weak self] in
guard let self = self else { return }
self.requestNamePinYin()
}
// 选择出生国家/地区 // 选择出生国家/地区
cell.selectBirthNation = { cell.selectBirthNation = {
[weak self] isInChina in [weak self] isInChina in
......
...@@ -143,6 +143,8 @@ class YHResignFamilyInfoListCell: UITableViewCell { ...@@ -143,6 +143,8 @@ class YHResignFamilyInfoListCell: UITableViewCell {
// 是否进入编辑模式 // 是否进入编辑模式
var editBlock:((Bool)->())? var editBlock:((Bool)->())?
// 更新姓名拼音
var updateNamePinYinBlock:(()->())?
// 选择出生国家 // 选择出生国家
var selectBirthNation:((Bool)->())? var selectBirthNation:((Bool)->())?
// 姓名更改 // 姓名更改
...@@ -249,32 +251,12 @@ class YHResignFamilyInfoListCell: UITableViewCell { ...@@ -249,32 +251,12 @@ class YHResignFamilyInfoListCell: UITableViewCell {
guard let self = self else { return } guard let self = self else { return }
self.updateList?() self.updateList?()
} }
// itemView.updateName = { itemView.updateNamePinYinBlock = {
// [weak self] text in [weak self] in
// guard let self = self else { return } guard let self = self else { return }
// for subView in self.itemsContentView.subviews { self.updateNamePinYinBlock?()
// if subView is YHResignInfoItemView { }
// let targetView = subView as! YHResignInfoItemView
// if targetView.item.id == .firstName {
// targetView.item.value = self.familyInfo.familyName
// }
// if targetView.item.id == .lastName {
// targetView.item.value = self.familyInfo.givenName
// targetView.updateItem(targetView.item, familyInfo: self.familyInfo)
// }
// targetView.updateItem(targetView.item, familyInfo: self.familyInfo)
// }
// }
// self.itemsContentView.snp.updateConstraints { make in
// make.top.equalTo(self.titleLabel.snp.bottom).offset(12)
// make.left.equalTo(18)
// make.right.equalTo(-18)
// make.bottom.equalTo(0)
// }
// self.setNeedsLayout()
// self.layoutIfNeeded()
//
// }
} else if let itemView = itemView as? YHResignInfoValidTimeItemView { } else if let itemView = itemView as? YHResignInfoValidTimeItemView {
itemsContentView.addSubview(itemView) itemsContentView.addSubview(itemView)
itemView.updateItem(item, familyInfo: familyInfo) itemView.updateItem(item, familyInfo: familyInfo)
......
...@@ -17,8 +17,8 @@ class YHResignInfoItemView: UIView { ...@@ -17,8 +17,8 @@ class YHResignInfoItemView: UIView {
var item: YHResignFamilyInfoItem = YHResignFamilyInfoItem() var item: YHResignFamilyInfoItem = YHResignFamilyInfoItem()
var faimilyInfo = YHResignInfoConfirmFamilyModel() var faimilyInfo = YHResignInfoConfirmFamilyModel()
// 姓名更改 // 更新姓名拼音
var updateName:((String)->())? var updateNamePinYinBlock:(()->())?
var updateList:(()->())? var updateList:(()->())?
let rightBtnWidth = 22.0 let rightBtnWidth = 22.0
...@@ -350,11 +350,8 @@ extension YHResignInfoItemView: UITextFieldDelegate { ...@@ -350,11 +350,8 @@ extension YHResignInfoItemView: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) { func textFieldDidEndEditing(_ textField: UITextField) {
if self.item.id == .mainApplicantName || self.item.id == .spouseName || self.item.id == .childName { if self.item.id == .mainApplicantName || self.item.id == .spouseName || self.item.id == .childName {
// 名称编辑时需防抖请求拼音 self.updateNamePinYin()
debounceTimer?.invalidate()
debounceTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false) { [weak self] _ in
self?.updateNamePinYin()
}
} else { } else {
self.updateList?() self.updateList?()
} }
...@@ -371,17 +368,7 @@ extension YHResignInfoItemView: UITextFieldDelegate { ...@@ -371,17 +368,7 @@ extension YHResignInfoItemView: UITextFieldDelegate {
self.updateList?() self.updateList?()
return return
} }
self.updateNamePinYinBlock?()
YHHUD.show(.progress(message: "加载中..."))
self.viewModel.getPinYinFromName(text) {
[weak self] firstNamePinYin, lastNamePinYin in
YHHUD.hide()
guard let self = self else { return }
self.faimilyInfo.familyName = firstNamePinYin
self.faimilyInfo.givenName = lastNamePinYin
self.updateList?()
}
} }
} }
...@@ -395,6 +382,8 @@ extension YHResignInfoItemView: UITextFieldDelegate { ...@@ -395,6 +382,8 @@ extension YHResignInfoItemView: UITextFieldDelegate {
self.faimilyInfo.familyName = "" self.faimilyInfo.familyName = ""
self.faimilyInfo.givenName = "" self.faimilyInfo.givenName = ""
self.updateList?() self.updateList?()
} else {
} }
return return
} }
......
...@@ -105,7 +105,7 @@ class YHResignInfoConfirmViewModel { ...@@ -105,7 +105,7 @@ class YHResignInfoConfirmViewModel {
} }
} }
func getPinYinFromName(_ name: String, callback:((String, String)->())?) { func getPinYinFromName(_ name: String, callback: @escaping ((String, String)->())) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.FamilyInfoConfirm.pinyinInfo let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.FamilyInfoConfirm.pinyinInfo
let _ = YHNetRequest.getRequest(url: strUrl,params: ["name" : name]) { [weak self] json, code in let _ = YHNetRequest.getRequest(url: strUrl,params: ["name" : name]) { [weak self] json, code in
...@@ -117,19 +117,19 @@ class YHResignInfoConfirmViewModel { ...@@ -117,19 +117,19 @@ class YHResignInfoConfirmViewModel {
guard let dic = json.data?.peel as? [String : Any], let resultModel = YHFamilyNamePinYin.deserialize(from: dic) else { guard let dic = json.data?.peel as? [String : Any], let resultModel = YHFamilyNamePinYin.deserialize(from: dic) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description()) let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callback?("", "") callback("", "")
return return
} }
self.pinyinInfo = resultModel self.pinyinInfo = resultModel
callback?(resultModel.family_name, resultModel.given_name) callback(resultModel.family_name, resultModel.given_name)
} else { } else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg) let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback?("", "") callback("", "")
} }
} failBlock: { err in } failBlock: { err in
callback?("", "") callback("", "")
} }
} }
} }
......
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