Commit 8dc576d5 authored by David黄金龙's avatar David黄金龙

Merge commit '3257c54a' into davidhuang

* commit '3257c54a':
  解决冲突
  主申请人 获取信息接口
parents aa84852a 3257c54a
......@@ -59,6 +59,10 @@
0468D47B2B68A08600CFB916 /* YHAddressPresentAnimated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4752B68A08600CFB916 /* YHAddressPresentAnimated.swift */; };
0468D47C2B68A08600CFB916 /* YHAddressPickView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4762B68A08600CFB916 /* YHAddressPickView.swift */; };
0468D47E2B68CEA200CFB916 /* YHImagePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D47D2B68CEA200CFB916 /* YHImagePickerView.swift */; };
0468D4802B6914E600CFB916 /* YHSelectCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D47F2B6914E600CFB916 /* YHSelectCountryViewController.swift */; };
0468D4822B6A2A8500CFB916 /* YHSelectCountryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4812B6A2A8500CFB916 /* YHSelectCountryViewModel.swift */; };
0468D4842B6A2F0D00CFB916 /* YHCountryMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4832B6A2F0D00CFB916 /* YHCountryMessage.swift */; };
0468D4862B6A41F300CFB916 /* YHMainInformationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4852B6A41F300CFB916 /* YHMainInformationModel.swift */; };
04808C062B4686510056D53C /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04808C042B4686510056D53C /* ATAuthSDK.bundle */; };
04808C082B4686C10056D53C /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04808C032B4686510056D53C /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
......@@ -266,6 +270,10 @@
0468D4752B68A08600CFB916 /* YHAddressPresentAnimated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressPresentAnimated.swift; sourceTree = "<group>"; };
0468D4762B68A08600CFB916 /* YHAddressPickView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHAddressPickView.swift; sourceTree = "<group>"; };
0468D47D2B68CEA200CFB916 /* YHImagePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImagePickerView.swift; sourceTree = "<group>"; };
0468D47F2B6914E600CFB916 /* YHSelectCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectCountryViewController.swift; sourceTree = "<group>"; };
0468D4812B6A2A8500CFB916 /* YHSelectCountryViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectCountryViewModel.swift; sourceTree = "<group>"; };
0468D4832B6A2F0D00CFB916 /* YHCountryMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCountryMessage.swift; sourceTree = "<group>"; };
0468D4852B6A41F300CFB916 /* YHMainInformationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMainInformationModel.swift; sourceTree = "<group>"; };
04808C032B4686510056D53C /* ATAuthSDK_D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ATAuthSDK_D.framework; sourceTree = "<group>"; };
04808C042B4686510056D53C /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ATAuthSDK.bundle; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
......@@ -543,6 +551,7 @@
isa = PBXGroup;
children = (
0468D4422B61F76800CFB916 /* YHMainApplicantInformationViewController.swift */,
0468D47F2B6914E600CFB916 /* YHSelectCountryViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -551,6 +560,8 @@
isa = PBXGroup;
children = (
0468D44A2B625AAB00CFB916 /* YHItemModel.swift */,
0468D4832B6A2F0D00CFB916 /* YHCountryMessage.swift */,
0468D4852B6A41F300CFB916 /* YHMainInformationModel.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -575,6 +586,7 @@
isa = PBXGroup;
children = (
0468D44E2B634E8A00CFB916 /* YHMainApplicantInformationViewModel.swift */,
0468D4812B6A2A8500CFB916 /* YHSelectCountryViewModel.swift */,
);
path = VM;
sourceTree = "<group>";
......@@ -1306,11 +1318,14 @@
A5ACE9542B4564F7002C94D2 /* YHNavigationController.swift in Sources */,
A5FD63DF2B6639AD00D1D9DA /* YHScoreDataModel.swift in Sources */,
A5ACE95E2B4571BF002C94D2 /* YHHomeViewController.swift in Sources */,
0468D4842B6A2F0D00CFB916 /* YHCountryMessage.swift in Sources */,
A5FD63BD2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift in Sources */,
041B52932B5E6CBA007EBCEB /* YHFormItemTitleCell.swift in Sources */,
0468D4822B6A2A8500CFB916 /* YHSelectCountryViewModel.swift in Sources */,
041B52952B5E7037007EBCEB /* YHFormItemAddCell.swift in Sources */,
A5ACE93D2B4564F7002C94D2 /* UIButton+Extension.swift in Sources */,
041B528D2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift in Sources */,
0468D4802B6914E600CFB916 /* YHSelectCountryViewController.swift in Sources */,
A5ACE9292B4564F7002C94D2 /* YHSmsCodeInputView.swift in Sources */,
A5ACE9452B4564F7002C94D2 /* YHHUDContainerView.swift in Sources */,
A5ACE93A2B4564F7002C94D2 /* NSAttributedString+Extension.swift in Sources */,
......@@ -1371,6 +1386,7 @@
A5FD63D82B6603A500D1D9DA /* YHScoreResultView.swift in Sources */,
A5ACE9342B4564F7002C94D2 /* YHAllApiName.swift in Sources */,
A5ACE9502B4564F7002C94D2 /* YhCacheTool.swift in Sources */,
0468D4862B6A41F300CFB916 /* YHMainInformationModel.swift in Sources */,
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */,
A5FD63EA2B67D95100D1D9DA /* YHFamilyMemberViewController.swift in Sources */,
A5ACE93F2B4564F7002C94D2 /* UIViewController+Extension.swift in Sources */,
......
......@@ -109,7 +109,7 @@ extension AppDelegate {
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.enableAutoToolbar = true
IQKeyboardManager.shared.resignOnTouchOutside = true // 控制点击背景是否收起键盘
IQKeyboardManager.shared.resignOnTouchOutside = true //控制点击背景是否收起键盘
}
}
......
......@@ -26,17 +26,19 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
}
func getData() {
if stepView.currentIndex == 0 {
dataSource = viewModel.getBaseDataSource()
} else if stepView.currentIndex == 1 {
dataSource = viewModel.getIDCardDataSource()
} else if stepView.currentIndex == 2 {
dataSource = viewModel.getDocumentInformation()
} else if stepView.currentIndex == 3 {
dataSource = viewModel.getDetailDataSource()
viewModel.requestMainInformation("133969") {[weak self] success, error in
guard let self = self else { return }
if self.stepView.currentIndex == 0 {
self.dataSource = self.viewModel.getBaseDataSource()
} else if self.stepView.currentIndex == 1 {
self.dataSource = self.viewModel.getIDCardDataSource()
} else if self.stepView.currentIndex == 2 {
self.dataSource = self.viewModel.getDocumentInformation()
} else if self.stepView.currentIndex == 3 {
self.dataSource = self.viewModel.getDetailDataSource()
}
self.tableView.reloadData()
}
tableView.reloadData()
}
func setView() {
......
//
// YHSelectCountryViewController.swift
// galaxy
//
// Created by EDY on 2024/1/30.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSelectCountryViewController: YHBaseViewController {
var searchView: UITextField!
var flagLabel: UILabel!
var tableView: UITableView!
var collectionView: UICollectionView!
var hotDataSource = ["中国-China","中国香港-Hong Kong","中国澳门-Macau","中国台湾-Taiwan","新加坡-Singapore","澳大利亚-Australia","美国-United States"]
var searchDataSource: [YHCountryMessage]?
var viewModel: YHSelectCountryViewModel?
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "国家/地区"
viewModel = YHSelectCountryViewModel()
setView()
getData()
}
func getData() {
tableView.reloadData()
}
func setView() {
view.backgroundColor = .white
searchView = {
let searchBar = UITextField()
searchBar.placeholder = "搜索国家/地区"
searchBar.backgroundColor = UIColor(hex: 0xf8f9fb)
searchBar.keyboardType = .default
searchBar.delegate = self
searchBar.layer.cornerRadius = 21
searchBar.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 16, height: 42))
searchBar.leftViewMode = .always
return searchBar
}()
view.addSubview(searchView)
searchView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 16)
make.height.equalTo(42)
make.left.equalTo(16)
make.right.equalTo(-16)
}
tableView = {
let tableView = UITableView(frame:.zero, style:.plain)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHCountryTableViewCell.self)
tableView.isHidden = true
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 78)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.equalTo(view)
}
flagLabel = {
let label = UILabel()
label.text = "热门国家/地区"
label.textColor = UIColor(hex: 0x222222)
label.font = kFont(size: 14)
return label
}()
view.addSubview(flagLabel)
flagLabel.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 78)
make.left.equalTo(21)
make.height.equalTo(20)
}
collectionView = {
let layout = UICollectionViewFlowLayout()
layout.minimumInteritemSpacing = 12 // 设置水平间距
layout.minimumLineSpacing = 16 // 设置垂直间距
layout.scrollDirection = .vertical
// 初始化UICollectionView对象
let collection = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
collection.dataSource = self
collection.delegate = self
// 注册自定义单元格类型
collection.register(cellWithClass: YHCountryCollectionViewCell.self)
return collection
}()
view.addSubview(collectionView)
collectionView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 114)
make.left.equalTo(21)
make.right.equalTo(-21)
make.bottom.equalToSuperview()
}
}
}
extension YHSelectCountryViewController: UITextFieldDelegate {
func textFieldDidChangeSelection(_ textField: UITextField) {
if textField.text == "" {
tableView.isHidden = true
flagLabel.isHidden = false
collectionView.isHidden = false
} else {
viewModel?.requestCountry(textField.text ?? "") { [weak self] success, error in
guard let self = self else { return }
self.searchDataSource = success as? [YHCountryMessage]
self.tableView.isHidden = false
self.flagLabel.isHidden = true
self.collectionView.isHidden = true
self.tableView.reloadData()
}
}
}
}
extension YHSelectCountryViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return searchDataSource?.count ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHCountryTableViewCell.self)
let cn = searchDataSource?[indexPath.row].name_cn ?? ""
let en = searchDataSource?[indexPath.row].name_en ?? ""
cell.titleLabel.text = cn + en
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 44
}
}
extension YHSelectCountryViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return hotDataSource.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let collectionCell = collectionView.dequeueReusableCell(withClass: YHCountryCollectionViewCell.self, for: indexPath)
collectionCell.label.text = hotDataSource[indexPath.row]
return collectionCell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let string = hotDataSource[indexPath.row]
let size = (string as NSString).size(withAttributes: [NSAttributedString.Key.font : kFont(size: 13)])
return CGSize(width: size.width + 25, height: 32) // 这里可以根据需求设置不同的尺寸
}
}
class YHCountryCollectionViewCell: UICollectionViewCell {
var label: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
label = {
let view = UILabel()
view.textAlignment = .center
view.font = kFont(size: 13)
view.textColor = UIColor(hex: 0x222222)
view.backgroundColor = UIColor(hex: 0xf8f9fb)
view.layer.masksToBounds = true
view.layer.cornerRadius = 16
return view
}()
contentView.addSubview(label)
label.snp.makeConstraints { make in
make.top.bottom.right.left.equalToSuperview()
}
}
}
class YHCountryTableViewCell: UITableViewCell {
var titleLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
titleLabel = {
let label = UILabel()
label.font = kFont(size: 13)
label.textColor = UIColor(hex:0x222222)
return label
}()
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.centerY.equalToSuperview()
make.height.equalTo(20)
}
}
}
//
// YHCountryModel.swift
// galaxy
//
// Created by EDY on 2024/1/31.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
import SmartCodable
struct YHCountryMessage: SmartCodable {
var name_cn: String?
var name_en: String?
var code: String?
init(name_cn: String? = nil, name_en: String? = nil, code: String? = nil) {
self.name_cn = name_cn
self.name_en = name_en
self.code = code
}
init() {
}
}
......@@ -8,6 +8,17 @@
import UIKit
enum YHItemSelectType: Int {
case normal = 0
case address = 1
case time = 2
case image = 3
case id = 4
case country = 5
case sex = 6
case marry = 7
}
struct YHItemModel {
var isNeed: Bool?
var title: String?
......@@ -16,8 +27,9 @@ struct YHItemModel {
var message: String?
var leftButtonString: String?
var rightButtonString: String?
var type: YHItemSelectType?
init(isNeed: Bool? = nil, title: String? = nil, isUserKeyBoard: Bool? = nil, prompts: String? = nil, message: String? = nil, leftButtonString: String? = nil, rightButtonString: String? = nil) {
init(isNeed: Bool? = nil, title: String? = nil, isUserKeyBoard: Bool? = nil, prompts: String? = nil, message: String? = nil, leftButtonString: String? = nil, rightButtonString: String? = nil, type: YHItemSelectType? = nil) {
self.isNeed = isNeed
self.title = title
self.isUserKeyBoard = isUserKeyBoard
......@@ -25,6 +37,7 @@ struct YHItemModel {
self.message = message
self.leftButtonString = leftButtonString
self.rightButtonString = rightButtonString
self.type = type
}
}
......
//
// YHMainInformationModel.swift
// galaxy
//
// Created by EDY on 2024/1/31.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
import SmartCodable
struct YHMainInformationModel: SmartCodable {
var id: Int?
var order_id: String?
var nationality: String?
var is_handled: Int?
var username: String?
var used_name: String?
var birthday: String?
var age: String?
var birth_place_aboard: Int?
var sex: String?
var married: String?
var mobile: String?
var email: String?
var address_aboard: Int?
var has_hk_id: Int?
var hk_id_number: String?
var step: Int?
var surname: String?
var is_live_oversea_year: Int?
var username_pinyin: YHUserNameModel?
var birth_place: YHAddressModel?
var address: YHAddressModel?
var certificates: YHCertificatesModels?
}
struct YHUserNameModel: SmartCodable {
var family_name: String?
var given_name: String?
}
struct YHAddressModel: SmartCodable {
var area: [String]?
var country: String?
var details: String?
var foreign: String?
}
struct YHCertificatesModels: SmartCodable {
var hk_macao_pass: YHCertificatesModel?
var passport: YHCertificatesModel?
var cn_identity_card: YHCertificatesModel?
}
struct YHCertificatesModel: SmartCodable {
var number: String?
var issue_at: String?
var issue_date_start_at: String?
var issue_date_end_at: String?
var img_front: String?
var img_back: String?
var passport_type: String?
}
......@@ -199,7 +199,6 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
// 将图片显示给UIImageView
if let block = backImage {
block(image)
self.dismiss()
......
......@@ -9,6 +9,8 @@
import UIKit
class YHItemView: UIView {
typealias Block = (_ model: YHItemModel) -> ()
var block: Block?
var titleLabel: UILabel!
var messageTextField: UITextField!
var nextStepImageView: UIImageView!
......@@ -45,6 +47,7 @@ class YHItemView: UIView {
messageTextField = {
let textField = UITextField()
textField.delegate = self
return textField
}()
addSubview(messageTextField)
......@@ -67,6 +70,7 @@ class YHItemView: UIView {
centerButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(centerClick), for: .touchUpInside)
return button
}()
addSubview(centerButton)
......@@ -84,6 +88,7 @@ class YHItemView: UIView {
button.layer.borderWidth = 1
button.layer.borderColor = UIColor(hex: 0x4487f9).cgColor
button.isSelected = true
button.addTarget(self, action: #selector(rightClick), for: .touchUpInside)
return button
}()
addSubview(rightButton)
......@@ -100,6 +105,7 @@ class YHItemView: UIView {
button.setTitleColor(UIColor(hex: 0x4487f9), for: .selected)
button.setTitleColor(UIColor(hex: 0x222222), for: .normal)
button.layer.cornerRadius = 16
button.addTarget(self, action: #selector(leftClick), for: .touchUpInside)
return button
}()
addSubview(leftButton)
......@@ -147,6 +153,12 @@ class YHItemView: UIView {
leftButton.isHidden = false
leftButton.setTitle(dataSource.leftButtonString, for: .normal)
nextStepImageView.isHidden = true
messageTextField.isHidden = true
if dataSource.message == "0" {
rightClick()
} else {
leftClick()
}
} else {
leftButton.isHidden = true
}
......@@ -155,8 +167,44 @@ class YHItemView: UIView {
rightButton.isHidden = false
rightButton.setTitle(dataSource.rightButtonString, for: .normal)
nextStepImageView.isHidden = true
messageTextField.isHidden = true
} else {
rightButton.isHidden = true
}
}
@objc func rightClick() {
rightButton.isSelected = true
leftButton.isSelected = false
rightButton.layer.borderWidth = 1
rightButton.layer.borderColor = UIColor(hex: 0x4487f9).cgColor
rightButton.backgroundColor = UIColor(hex: 0x4487f9).withAlphaComponent(0.08)
leftButton.backgroundColor = UIColor(hex: 0xf8f9fb)
leftButton.layer.borderWidth = 0
dataSource?.message = "0"
}
@objc func leftClick() {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
leftButton.layer.borderColor = UIColor(hex: 0x4487f9).cgColor
leftButton.backgroundColor = UIColor(hex: 0x4487f9).withAlphaComponent(0.08)
rightButton.backgroundColor = UIColor(hex: 0xf8f9fb)
rightButton.layer.borderWidth = 0
dataSource?.message = "1"
}
@objc func centerClick() {
}
}
extension YHItemView: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) {
dataSource?.message = textField.text
if let block = block {
block(dataSource ?? YHItemModel())
}
}
}
......@@ -9,58 +9,78 @@
import UIKit
class YHMainApplicantInformationViewModel: YHBaseViewModel {
var mainModel: YHMainInformationModel = YHMainInformationModel()
override init() {
super.init()
}
func getBaseDataSource() -> [YHSectionItemModel] {
let item = YHItemModel(isNeed: true, title: "国家/地区", isUserKeyBoard: false, prompts: "请选择")
let item = YHItemModel(isNeed: true, title: "国家/地区", isUserKeyBoard: false, prompts: "请选择", message: mainModel.nationality, type: .country)
let section = YHSectionItemModel(title: "国籍", models: [item])
let item1 = YHItemModel(isNeed: true, title: "省市地区", isUserKeyBoard: false, prompts: "请选择")
let item2 = YHItemModel(isNeed: true, title: "详细地址", isUserKeyBoard: true, prompts: "请填写小区、楼栋、单元室等")
let section1 = YHSectionItemModel(title: "现居住地址", models: [item, item1, item2])
let item4 = YHItemModel(isNeed: true, title: "国家/地区", isUserKeyBoard: false, prompts: "请选择", message: mainModel.address?.country, type: .country)
var string = ""
if let array = mainModel.address?.area {
for item in array {
string = string + item
}
}
let item1 = YHItemModel(isNeed: true, title: "省市地区", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address)
let item2 = YHItemModel(isNeed: true, title: "详细地址", isUserKeyBoard: true, prompts: "请填写小区、楼栋、单元室等", message: mainModel.address?.details)
let section1 = YHSectionItemModel(title: "现居住地址", models: [item4, item1, item2])
let item3 = YHItemModel(isNeed: true, title: "是否办理", isUserKeyBoard: false, prompts: "", message: nil, leftButtonString: "是", rightButtonString: "否")
let item3 = YHItemModel(isNeed: true, title: "是否办理", isUserKeyBoard: false, prompts: "", message: "\(mainModel.has_hk_id ?? 0)", leftButtonString: "是", rightButtonString: "否")
let section2 = YHSectionItemModel(title: "港澳通行证", models: [item3])
return [section, section1, section2]
}
func getDocumentInformation() -> [YHSectionItemModel] {
let item = YHItemModel(isNeed: true, title: "身份证号码", isUserKeyBoard: true, prompts: "请输入", message: nil)
let item1 = YHItemModel(isNeed: true, title: "签发地", isUserKeyBoard: false, prompts: "请输入", message: nil)
let item2 = YHItemModel(isNeed: true, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: nil)
let item3 = YHItemModel(isNeed: true, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: nil)
let item = YHItemModel(isNeed: true, title: "身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.cn_identity_card?.number)
let item1 = YHItemModel(isNeed: true, title: "签发地", isUserKeyBoard: false, prompts: "请输入", message: mainModel.certificates?.cn_identity_card?.issue_at)
let item2 = YHItemModel(isNeed: true, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.cn_identity_card?.issue_date_start_at, type: .time)
let item3 = YHItemModel(isNeed: true, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.cn_identity_card?.issue_date_end_at, type: .time)
let section = YHSectionItemModel(title: "中国身份证", models: [item, item1, item2, item3])
let section1 = YHSectionItemModel(title: "港澳通行证", models: [item, item1, item2, item3])
let item10 = YHItemModel(isNeed: true, title: "身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.hk_macao_pass?.number)
let item11 = YHItemModel(isNeed: true, title: "签发地", isUserKeyBoard: false, prompts: "请输入", message: mainModel.certificates?.hk_macao_pass?.issue_at)
let item12 = YHItemModel(isNeed: true, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.hk_macao_pass?.issue_date_start_at, type: .time)
let item13 = YHItemModel(isNeed: true, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.hk_macao_pass?.issue_date_end_at, type: .time)
let section1 = YHSectionItemModel(title: "港澳通行证", models: [item10, item11, item12, item13])
let item4 = YHItemModel(isNeed: false, title: "证件类别", isUserKeyBoard: false, prompts: "请选择", message: nil)
let item5 = YHItemModel(isNeed: false, title: "证件号码", isUserKeyBoard: true, prompts: "请输入", message: nil)
let item6 = YHItemModel(isNeed: false, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: nil)
let item7 = YHItemModel(isNeed: false, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: nil)
let item8 = YHItemModel(isNeed: false, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: nil)
let item4 = YHItemModel(isNeed: false, title: "证件类别", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.passport?.passport_type, type: .id)
let item5 = YHItemModel(isNeed: false, title: "证件号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.passport?.number)
let item6 = YHItemModel(isNeed: false, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates?.passport?.issue_at)
let item7 = YHItemModel(isNeed: false, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.passport?.issue_date_start_at, type: .time)
let item8 = YHItemModel(isNeed: false, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates?.passport?.issue_date_end_at, type: .time)
let section2 = YHSectionItemModel(title: "护照及其他旅行证件(选填)", models: [item4, item5, item6, item7, item8])
return [section, section1, section2]
}
func getDetailDataSource() -> [YHSectionItemModel] {
let item = YHItemModel(isNeed: true, title: "主申请人姓名", isUserKeyBoard: true, prompts: "请输入", message: nil)
let item1 = YHItemModel(isNeed: false, title: "曾用名", isUserKeyBoard: true, prompts: "请与户口本一致,若无则不填", message: nil)
let item2 = YHItemModel(isNeed: false, title: "婚前姓氏", isUserKeyBoard: true, prompts: "如有则填写,仅支持输入字母", message: nil)
let item3 = YHItemModel(isNeed: true, title: "出生日期", isUserKeyBoard: false, prompts: "请选择", message: nil)
let item = YHItemModel(isNeed: true, title: "主申请人姓名", isUserKeyBoard: true, prompts: "请输入", message: mainModel.username)
let item1 = YHItemModel(isNeed: false, title: "曾用名", isUserKeyBoard: true, prompts: "请与户口本一致,若无则不填", message: mainModel.used_name)
let item2 = YHItemModel(isNeed: false, title: "婚前姓氏", isUserKeyBoard: true, prompts: "如有则填写,仅支持输入字母", message: mainModel.surname)
let item3 = YHItemModel(isNeed: true, title: "出生日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.birthday)
let item4 = YHItemModel(isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: nil, leftButtonString: "国内", rightButtonString: "国外")
let item5 = YHItemModel(isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: nil)
let item6 = YHItemModel(isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: nil)
let item7 = YHItemModel(isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: nil)
var string = ""
if let array = mainModel.birth_place?.area {
for item in array {
string = string + item
}
}
let item5 = YHItemModel(isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address)
let item6 = YHItemModel(isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: mainModel.sex, type: .sex)
let item7 = YHItemModel(isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: mainModel.married, type: .marry)
let section = YHSectionItemModel(title: "主申请人信息", models: [item, item1, item2, item3, item4, item5, item6, item7])
let item8 = YHItemModel(isNeed: true, title: "手机号码", isUserKeyBoard: true, prompts: "请输入", message: nil)
let item9 = YHItemModel(isNeed: true, title: "电子邮箱", isUserKeyBoard: true, prompts: "请输入", message: nil)
let item8 = YHItemModel(isNeed: true, title: "手机号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.mobile)
let item9 = YHItemModel(isNeed: true, title: "电子邮箱", isUserKeyBoard: true, prompts: "请输入", message: mainModel.email)
let section1 = YHSectionItemModel(title: "联系方式", models: [item8, item9])
let item10 = YHItemModel(isNeed: true, title: "是否办理过", isUserKeyBoard: false, prompts: nil, message: nil, leftButtonString: "是", rightButtonString: "否")
let item10 = YHItemModel(isNeed: true, title: "是否办理过", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.has_hk_id ?? 0)", leftButtonString: "是", rightButtonString: "否")
let section2 = YHSectionItemModel(title: "香港身份证", models: [item10])
return [section, section1, section2]
}
......@@ -72,4 +92,27 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let section1 = YHSectionItemModel(title: "中国身份证(选填)", models: [item])
return [section, section1]
}
func requestMainInformation(_ orderID: String, callBackBlock:@escaping (_ success: YHMainInformationModel?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/order-information/get_information?order_id=\(orderID)"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(nil,error)
return
}
let dic = model.data?.peel
guard let result = YHMainInformationModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(nil,nil)
return
}
self.mainModel = result
callBackBlock(result, nil)
} failBlock: { err in
callBackBlock(nil,err)
}
}
}
//
// YHSelectCountryViewModel.swift
// galaxy
//
// Created by EDY on 2024/1/31.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSelectCountryViewModel: NSObject {
override init() {
super.init()
}
func requestCountry(_ key: String, callBackBlock:@escaping (_ success: [YHCountryMessage?]?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + "frontend/country?keyword=\(key)"
YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
guard let model = NetBaseModel.deserialize(dict: json) else {
let error : YHErrorModel = YHErrorModel(errorCode:YHErrorCode.dictParseError.rawValue,errorMsg: YHErrorCode.dictParseError.description())
callBackBlock([],error)
return
}
//// printLog("model 是 ==> \(model)")
let dic = model.data?.peel
guard let resultArray = [YHCountryMessage].deserialize(array: dic as? [Any]) else {
callBackBlock([],nil)
return
}
callBackBlock(resultArray, nil)
} failBlock: { err in
callBackBlock([],err)
}
}
}
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