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

// 确认

parent e8d1828f
This diff is collapsed.
......@@ -39,8 +39,8 @@ class YHResignAppointScheduleListViewController: YHBaseViewController {
tableView.separatorStyle = .none
tableView.bounces = false
tableView.register(YHResignHaveAppointedMultipleInfoCell.self, forCellReuseIdentifier: YHResignHaveAppointedMultipleInfoCell.cellReuseIdentifier)
tableView.register(YHResignHaveAppointedSingleInfoCell.self, forCellReuseIdentifier: YHResignHaveAppointedSingleInfoCell.cellReuseIdentifier)
tableView.register(YHResignScheduleMultipleInfoCell.self, forCellReuseIdentifier: YHResignScheduleMultipleInfoCell.cellReuseIdentifier)
tableView.register(YHResignScheduleSingleInfoCell.self, forCellReuseIdentifier: YHResignScheduleSingleInfoCell.cellReuseIdentifier)
tableView.delegate = self
tableView.dataSource = self
return tableView
......@@ -360,7 +360,7 @@ extension YHResignAppointScheduleListViewController: UITableViewDelegate, UITabl
if 0 <= indexPath.row && indexPath.row < scheduleArr.count {
let model = scheduleArr[indexPath.row]
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.clickConfirmBtnBlock = {
......@@ -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
cell2.updateModel(model)
cell2.clickConfirmBtnBlock = {
......
......@@ -33,7 +33,7 @@ class YHResignAppointTimeModifyViewController: YHBaseViewController {
tableView.separatorStyle = .none
tableView.bounces = false
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.delegate = self
tableView.dataSource = self
......@@ -129,7 +129,7 @@ extension YHResignAppointTimeModifyViewController: UITableViewDelegate, UITableV
if 0 <= indexPath.row && indexPath.row < selectGroupArr.count {
let model = selectGroupArr[indexPath.row]
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)
return cell1
}
......
......@@ -84,7 +84,7 @@ class YHResignAppointTimeMultipleCell: UITableViewCell {
collectView.dataSource = self
collectView.backgroundColor = .clear
// 注册自定义单元格
collectView.register(YHResignAppointApplicantCell.self, forCellWithReuseIdentifier: YHResignAppointApplicantCell.cellReuseIdentifier)
collectView.register(YHResignSelectApplicantCollectCell.self, forCellWithReuseIdentifier: YHResignSelectApplicantCollectCell.cellReuseIdentifier)
return collectView
}()
......@@ -425,7 +425,7 @@ extension YHResignAppointTimeMultipleCell: UICollectionViewDelegate, UICollectio
// 返回自定义单元格
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 {
let applicant = arr[indexPath.item]
cell.updateApplicantInfo(applicant)
......
......@@ -44,7 +44,7 @@ class YHResignAppointedScheduleLineView: UIView {
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.backgroundColor = .clear
collectionView.register(YHResignAppointedScheduleLineCollectCell.self, forCellWithReuseIdentifier:YHResignAppointedScheduleLineCollectCell.cellReuseIdentifier)
collectionView.register(YHResignScheduleLineCollectCell.self, forCellWithReuseIdentifier:YHResignScheduleLineCollectCell.cellReuseIdentifier)
collectionView.delegate = self
collectionView.dataSource = self
collectionView.bounces = false
......@@ -134,7 +134,7 @@ extension YHResignAppointedScheduleLineView: UICollectionViewDelegate, UICollect
// 返回自定义单元格
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 {
let model = steps[indexPath.item]
model.index = indexPath.item+1
......
//
// YHResignAppointApplicantInfoCell.swift
// YHResignHaveAppointedApplicantsInfoCell.swift
// galaxy
//
// Created by edy on 2024/10/10.
......@@ -9,9 +9,9 @@
import UIKit
import AttributedString
class YHResignAppointApplicantInfoCell: UITableViewCell {
class YHResignHaveAppointedApplicantsInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignAppointApplicantInfoCell"
static let cellReuseIdentifier = "YHResignHaveAppointedApplicantsInfoCell"
lazy var whiteContentView: UIView = {
let view = UIView()
......
//
// YHResignAppointedScheduleLineCell.swift
// YHResignScheduleLineCollectCell.swift
// galaxy
//
// Created by edy on 2024/10/10.
......@@ -8,9 +8,9 @@
import UIKit
class YHResignAppointedScheduleLineCollectCell: UICollectionViewCell {
class YHResignScheduleLineCollectCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHResignAppointedScheduleLineCollectCell"
static let cellReuseIdentifier = "YHResignScheduleLineCollectCell"
lazy var numLabel: UILabel = {
var label = UILabel()
......
//
// YHResignHaveAppointedInfoCellTableViewCell.swift
// YHResignScheduleMultipleInfoCell.swift
// galaxy
//
// Created by edy on 2024/10/10.
......@@ -8,9 +8,9 @@
import UIKit
class YHResignHaveAppointedMultipleInfoCell: UITableViewCell {
class YHResignScheduleMultipleInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignHaveAppointedMultipleInfoCell"
static let cellReuseIdentifier = "YHResignScheduleMultipleInfoCell"
var confirmHKStatus: YHResignConfirmHKStatus = .waitConfirmHK
var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())?
......
//
// YHResignHaveAppointedSingleInfoCell.swift
// YHResignScheduleSingleInfoCell.swift
// galaxy
//
// Created by edy on 2024/10/11.
......@@ -14,9 +14,9 @@ enum YHResignConfirmHKStatus: Int {
case haveConfirmHK = 2 // 已确认在港
}
class YHResignHaveAppointedSingleInfoCell: UITableViewCell {
class YHResignScheduleSingleInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignHaveAppointedSingleInfoCell"
static let cellReuseIdentifier = "YHResignScheduleSingleInfoCell"
var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())?
var modifyBtnBlock: (()->())?
......
//
// YHResignAppointApplicantCell.swift
// YHResignSelectApplicantCollectCell.swift
// galaxy
//
// Created by edy on 2024/10/12.
......@@ -8,9 +8,9 @@
import UIKit
class YHResignAppointApplicantCell: UICollectionViewCell {
class YHResignSelectApplicantCollectCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHResignAppointApplicantCell"
static let cellReuseIdentifier = "YHResignSelectApplicantCollectCell"
lazy var selectImgView:UIImageView = {
let view = UIImageView(image: UIImage(named: ""))
......
......@@ -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 {
......@@ -202,13 +217,21 @@ extension YHResignInfoConfirmModifyViewController: UITableViewDelegate, UITableV
self.isInfoEditing = true
self.detailMember.isNeedCheck = true
self.updateData()
self.requestNamePinYin()
return
}
}
self.isInfoEditing = isEdit
self.updateData()
self.requestNamePinYin()
}
cell.updateNamePinYinBlock = {
[weak self] in
guard let self = self else { return }
self.requestNamePinYin()
}
// 选择出生国家/地区
cell.selectBirthNation = {
[weak self] isInChina in
......
......@@ -143,6 +143,8 @@ class YHResignFamilyInfoListCell: UITableViewCell {
// 是否进入编辑模式
var editBlock:((Bool)->())?
// 更新姓名拼音
var updateNamePinYinBlock:(()->())?
// 选择出生国家
var selectBirthNation:((Bool)->())?
// 姓名更改
......@@ -249,32 +251,12 @@ class YHResignFamilyInfoListCell: UITableViewCell {
guard let self = self else { return }
self.updateList?()
}
// 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
// }
// 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()
//
// }
itemView.updateNamePinYinBlock = {
[weak self] in
guard let self = self else { return }
self.updateNamePinYinBlock?()
}
} else if let itemView = itemView as? YHResignInfoValidTimeItemView {
itemsContentView.addSubview(itemView)
itemView.updateItem(item, familyInfo: familyInfo)
......
......@@ -17,8 +17,8 @@ class YHResignInfoItemView: UIView {
var item: YHResignFamilyInfoItem = YHResignFamilyInfoItem()
var faimilyInfo = YHResignInfoConfirmFamilyModel()
// 姓名更改
var updateName:((String)->())?
// 更新姓名拼音
var updateNamePinYinBlock:(()->())?
var updateList:(()->())?
let rightBtnWidth = 22.0
......@@ -350,11 +350,8 @@ extension YHResignInfoItemView: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) {
if self.item.id == .mainApplicantName || self.item.id == .spouseName || self.item.id == .childName {
// 名称编辑时需防抖请求拼音
debounceTimer?.invalidate()
debounceTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false) { [weak self] _ in
self?.updateNamePinYin()
}
self.updateNamePinYin()
} else {
self.updateList?()
}
......@@ -371,17 +368,7 @@ extension YHResignInfoItemView: UITextFieldDelegate {
self.updateList?()
return
}
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?()
}
self.updateNamePinYinBlock?()
}
}
......@@ -395,6 +382,8 @@ extension YHResignInfoItemView: UITextFieldDelegate {
self.faimilyInfo.familyName = ""
self.faimilyInfo.givenName = ""
self.updateList?()
} else {
}
return
}
......
......@@ -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 _ = YHNetRequest.getRequest(url: strUrl,params: ["name" : name]) { [weak self] json, code in
......@@ -117,19 +117,19 @@ class YHResignInfoConfirmViewModel {
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())
callback?("", "")
callback("", "")
return
}
self.pinyinInfo = resultModel
callback?(resultModel.family_name, resultModel.given_name)
callback(resultModel.family_name, resultModel.given_name)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback?("", "")
callback("", "")
}
} 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