Commit 057b6c21 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit 'd32f1e31' into xiezhaolin

# Conflicts:
#	galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/WorkExperience/C/YHWorkExperienceViewController.swift
#	galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/WorkExperience/V/YHWorkFileItemView.swift
#	galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
parents b37f681e d32f1e31
......@@ -81,6 +81,8 @@
04A7BC8F2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */; };
04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */; };
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; };
04B0239C2B91F3EF00B83629 /* YHIdentityCardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B0239B2B91F3EF00B83629 /* YHIdentityCardCell.swift */; };
04B0239E2B92C27C00B83629 /* YHFamilyMemberViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B0239D2B92C27C00B83629 /* YHFamilyMemberViewModel.swift */; };
04C693622B723AB8004C1758 /* YHMySettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693612B723AB8004C1758 /* YHMySettingViewController.swift */; };
04C693642B723B56004C1758 /* YHMySettingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693632B723B56004C1758 /* YHMySettingCell.swift */; };
04C693692B73191A004C1758 /* YHEducationInfoListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C693682B73191A004C1758 /* YHEducationInfoListVC.swift */; };
......@@ -220,6 +222,8 @@
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE9252B4564F7002C94D2 /* YHBasicContentView.swift */; };
A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE9262B4564F7002C94D2 /* YHNoDataTipView.swift */; };
A5ACE95E2B4571BF002C94D2 /* YHHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE95D2B4571BF002C94D2 /* YHHomeViewController.swift */; };
A5B4A5832B94555C003EFF8F /* YHPreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5B4A5822B94555C003EFF8F /* YHPreviewViewModel.swift */; };
A5B4A5852B9455F7003EFF8F /* YHPreviewForOtherInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5B4A5842B9455F7003EFF8F /* YHPreviewForOtherInfoModel.swift */; };
A5C382CA2B5E1F4C00C5E65C /* YHLoginTipsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C382C92B5E1F4C00C5E65C /* YHLoginTipsView.swift */; };
A5C382CC2B5EA11800C5E65C /* YHContractCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C382CB2B5EA11800C5E65C /* YHContractCell.swift */; };
A5C382CF2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C382CE2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift */; };
......@@ -380,6 +384,8 @@
04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyRequestViewModel.swift; sourceTree = "<group>"; };
04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTwoOptionAlertView.swift; sourceTree = "<group>"; };
04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; };
04B0239B2B91F3EF00B83629 /* YHIdentityCardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIdentityCardCell.swift; sourceTree = "<group>"; };
04B0239D2B92C27C00B83629 /* YHFamilyMemberViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberViewModel.swift; sourceTree = "<group>"; };
04C693612B723AB8004C1758 /* YHMySettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySettingViewController.swift; sourceTree = "<group>"; };
04C693632B723B56004C1758 /* YHMySettingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySettingCell.swift; sourceTree = "<group>"; };
04C693682B73191A004C1758 /* YHEducationInfoListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEducationInfoListVC.swift; sourceTree = "<group>"; };
......@@ -524,6 +530,8 @@
A5ACE9252B4564F7002C94D2 /* YHBasicContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHBasicContentView.swift; sourceTree = "<group>"; };
A5ACE9262B4564F7002C94D2 /* YHNoDataTipView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHNoDataTipView.swift; sourceTree = "<group>"; };
A5ACE95D2B4571BF002C94D2 /* YHHomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeViewController.swift; sourceTree = "<group>"; };
A5B4A5822B94555C003EFF8F /* YHPreviewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPreviewViewModel.swift; sourceTree = "<group>"; };
A5B4A5842B9455F7003EFF8F /* YHPreviewForOtherInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPreviewForOtherInfoModel.swift; sourceTree = "<group>"; };
A5C382C92B5E1F4C00C5E65C /* YHLoginTipsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLoginTipsView.swift; sourceTree = "<group>"; };
A5C382CB2B5EA11800C5E65C /* YHContractCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHContractCell.swift; sourceTree = "<group>"; };
A5C382CE2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceCenterMainViewModel.swift; sourceTree = "<group>"; };
......@@ -641,6 +649,7 @@
042FBBC02B63B21700F9DE23 /* YHFormItemDegreeInfoCell.swift */,
042FBBC42B64AE3D00F9DE23 /* YHFormItemOnlyDoubleChoiceCell.swift */,
042FBBC82B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift */,
04B0239B2B91F3EF00B83629 /* YHIdentityCardCell.swift */,
04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */,
);
path = V;
......@@ -653,6 +662,7 @@
04C8F4802B720DAB00ADF59B /* Spouse(配偶) */,
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */,
);
......@@ -664,6 +674,7 @@
children = (
041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */,
04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */,
04B0239D2B92C27C00B83629 /* YHFamilyMemberViewModel.swift */,
041B52DC2B60A889007EBCEB /* YHTest.swift */,
);
path = M;
......@@ -834,7 +845,6 @@
children = (
04E86E0E2B70DE9400A35F4B /* YHSpouseInfoContainerVC.swift */,
041B52D52B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */,
);
path = "Spouse(配偶)";
......@@ -1020,6 +1030,7 @@
A5167B2D2B6A23D10084C08F /* PersonInfoList(个人信息预览) */ = {
isa = PBXGroup;
children = (
A5B4A5812B945461003EFF8F /* VM */,
A5167B2E2B6A23F50084C08F /* M */,
A5167B2F2B6A23FC0084C08F /* V */,
A5167B302B6A24010084C08F /* C */,
......@@ -1035,6 +1046,7 @@
A5FD63FB2B68DA6600D1D9DA /* YHPersonInfoCellModel2.swift */,
A5FD63F92B68D95700D1D9DA /* YHPersonInfoIdentityCardModel.swift */,
A5191F612B89E748001069F7 /* YHPreviewQuestionAndAnswerModel.swift */,
A5B4A5842B9455F7003EFF8F /* YHPreviewForOtherInfoModel.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -1207,8 +1219,8 @@
A596C3982B84D9100067BBB8 /* V */ = {
isa = PBXGroup;
children = (
A596C3992B84D9100067BBB8 /* YHOtherResidenceFillView.swift */,
A596C39A2B84D9100067BBB8 /* YHOtherInfoFillCell.swift */,
A596C3992B84D9100067BBB8 /* YHOtherResidenceFillView.swift */,
A596C39B2B84D9100067BBB8 /* YHOtherTextViewItemView.swift */,
A596C39C2B84D9100067BBB8 /* YHOtherYesOrNoItemView.swift */,
A596C39D2B84D9100067BBB8 /* YHOtherSelecteItemView.swift */,
......@@ -1535,6 +1547,14 @@
path = C;
sourceTree = "<group>";
};
A5B4A5812B945461003EFF8F /* VM */ = {
isa = PBXGroup;
children = (
A5B4A5822B94555C003EFF8F /* YHPreviewViewModel.swift */,
);
path = VM;
sourceTree = "<group>";
};
A5C382C82B5E101E00C5E65C /* ServiceProcess(流程) */ = {
isa = PBXGroup;
children = (
......@@ -1940,6 +1960,7 @@
A596C3A02B84D9100067BBB8 /* YHOtherInfoFillCell.swift in Sources */,
A5ACE9382B4564F7002C94D2 /* UIApplication+Extension.swift in Sources */,
041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */,
A5B4A5832B94555C003EFF8F /* YHPreviewViewModel.swift in Sources */,
043955212B70955200955D49 /* YHFormPickerViewType.swift in Sources */,
043955232B70BC2500955D49 /* YHChildInfoContainerVC.swift in Sources */,
04E86E442B8357EC00A35F4B /* YHCountryMessage.swift in Sources */,
......@@ -1960,6 +1981,7 @@
A5C5B2EA2B4ECA4D00A7C5D1 /* YHDavidModel0.swift in Sources */,
04E86E512B847D1B00A35F4B /* YHWorkMessageSelectTableViewCell.swift in Sources */,
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */,
04B0239C2B91F3EF00B83629 /* YHIdentityCardCell.swift in Sources */,
04E86E3E2B834FC100A35F4B /* YHWorkExperienceTextItemView.swift in Sources */,
042FBBC92B64DC8900F9DE23 /* YHFormItemExpireDateCell.swift in Sources */,
A5234E2E2B6E43EA00A33433 /* YHBasicInfoFillView.swift in Sources */,
......@@ -1979,7 +2001,9 @@
042FBBCB2B65058000F9DE23 /* YHChildBasicInfoVC.swift in Sources */,
04E86E6A2B87352700A35F4B /* YHCompanySelectViewController.swift in Sources */,
A5191F602B89E6FA001069F7 /* YHPreviewInfoQuestionAndAnswerItemView.swift in Sources */,
04B0239E2B92C27C00B83629 /* YHFamilyMemberViewModel.swift in Sources */,
04E86E452B8357EC00A35F4B /* YHItemModel.swift in Sources */,
A5B4A5852B9455F7003EFF8F /* YHPreviewForOtherInfoModel.swift in Sources */,
A5ACE9302B4564F7002C94D2 /* Algorithm.swift in Sources */,
A5C5B32B2B57D17600A7C5D1 /* YHDavidCell5.swift in Sources */,
04E86E0B2B70C13300A35F4B /* YHCodeSueecssViewController.swift in Sources */,
......@@ -2164,7 +2188,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -2184,7 +2208,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.1.3;
MARKETING_VERSION = 0.1.4;
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
......@@ -2206,7 +2230,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -2226,7 +2250,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.1.3;
MARKETING_VERSION = 0.1.4;
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
......
......@@ -164,12 +164,20 @@ extension YHServiceCenterSecondViewController : UITableViewDelegate,UITableViewD
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if indexPath.row == 0 {
let model = self.serviceCenterMainReqVM.arrContactStausItmes[indexPath.row]
if model.type == 1 {
let vc = YHInformationPerfectListVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
} else if indexPath.row == 1 {
} else if model.type == 2 {
YHHUD.flash(message: "下个版本完善")
} else if model.type == 3 {
let vc = YHScoreDetailViewController()
vc.orderId = orderId
vc.model = serviceCenterMainReqVM.allInfoScoreModel
navigationController?.pushViewController(vc)
} else {
}
......
......@@ -42,8 +42,8 @@ class YHInformationPerfectModel {
}
var status : String = ""
var color : UIColor = .red
var statusColor : UIColor = .red
var color : UIColor = .failColor
var statusColor : UIColor = .failColor
var isFinished : Bool = false {
didSet {
status = isFinished ? "已完成" : "待完善"
......
......@@ -106,7 +106,7 @@ extension YHBasicInfoFillViewController {
submitAndSaveDataOp(isSaveFlag: false)
} else {
homeTableView.reloadData()
YHHUD.flash(message: "请完善信息")
YHHUD.flash(message: "您还有信息未填写")
}
}
......@@ -163,7 +163,6 @@ extension YHBasicInfoFillViewController {
applicant.updateValue(basicInfoVM.dataModelForBasicInfo?.applicant?.id ?? 0, forKey: "id")
param.updateValue(applicant, forKey: "applicant")
} else if item.sessionTitle == "配偶" {
var applicant : [String : Any] = [:]
for (index0,item0) in item.arrQuestionItem.enumerated() {
if index0 == 0 {
......
......@@ -82,36 +82,23 @@ extension YHBasicInfoFillViewModel {
var arrData : [YHBasicInfoSessionModel] = []
do {
//主申请人
let model1 = YHBasicInfoCellModel(question: "1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?", answer: dataModelForBasicInfo.applicant?.has_conviction?.has ?? "", info: dataModelForBasicInfo.applicant?.has_conviction?.info ?? "")
if let model = dataModelForBasicInfo.applicant {
let model1 = YHBasicInfoCellModel(question: "1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?", answer: model.has_conviction?.has ?? "", info: model.has_conviction?.info ?? "")
let model2 = YHBasicInfoCellModel(question: "2、是否曾在香港或其他地方被拒入境/递解/遣送或要求离境?", answer: dataModelForBasicInfo.applicant?.has_departure?.has ?? "", info: dataModelForBasicInfo.applicant?.has_departure?.info ?? "")
let model2 = YHBasicInfoCellModel(question: "2、是否曾在香港或其他地方被拒入境/递解/遣送或要求离境?", answer: model.has_departure?.has ?? "", info: model.has_departure?.info ?? "")
let model3 = YHBasicInfoCellModel(question: "3、是否曾被拒绝签发香港或其他地方的签证/进入许可?", answer: dataModelForBasicInfo.applicant?.has_deny?.has ?? "", info: dataModelForBasicInfo.applicant?.has_deny?.info ?? "")
let model3 = YHBasicInfoCellModel(question: "3、是否曾被拒绝签发香港或其他地方的签证/进入许可?", answer: model.has_deny?.has ?? "", info: model.has_deny?.info ?? "")
let model4 = YHBasicInfoCellModel(question: "4、是否曾触犯香港或任何地方的入境法例?", answer: dataModelForBasicInfo.applicant?.has_breaking_law?.has ?? "", info: dataModelForBasicInfo.applicant?.has_breaking_law?.info ?? "")
let model4 = YHBasicInfoCellModel(question: "4、是否曾触犯香港或任何地方的入境法例?", answer: model.has_breaking_law?.has ?? "", info: model.has_breaking_law?.info ?? "")
let model5 = YHBasicInfoCellModel(question: "5、是否曾经使用另一个姓名或身份申请香港入境签证/进入许可或进入香港?", answer: dataModelForBasicInfo.applicant?.has_other_id?.has ?? "", info: dataModelForBasicInfo.applicant?.has_other_id?.info ?? "")
let model5 = YHBasicInfoCellModel(question: "5、是否曾经使用另一个姓名或身份申请香港入境签证/进入许可或进入香港?", answer: model.has_other_id?.has ?? "", info: model.has_other_id?.info ?? "")
let arr = [model1,model2,model3,model4,model5]
let sessionModel = YHBasicInfoSessionModel(sessionTitle: "主申请人", arrQuestionItem: arr)
arrData.append(sessionModel)
}
do {
//配偶
if let spouse = dataModelForBasicInfo.spouse {
let model1 = YHBasicInfoCellModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: spouse.child_departure?.has ?? "", info: spouse.child_departure?.info ?? "")
let model2 = YHBasicInfoCellModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: spouse.child_deny?.has ?? "", info: spouse.child_deny?.info ?? "")
let arr = [model1,model2]
let sessionModel = YHBasicInfoSessionModel(sessionTitle: "配偶", arrQuestionItem: arr)
arrData.append(sessionModel)
}
}
do {
//子女 - xxx
if let arrChild = dataModelForBasicInfo.child {
......@@ -129,6 +116,20 @@ extension YHBasicInfoFillViewModel {
}
}
do {
//配偶
if let spouse = dataModelForBasicInfo.spouse {
let model1 = YHBasicInfoCellModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: spouse.child_departure?.has ?? "", info: spouse.child_departure?.info ?? "")
let model2 = YHBasicInfoCellModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: spouse.child_deny?.has ?? "", info: spouse.child_deny?.info ?? "")
let arr = [model1,model2]
let sessionModel = YHBasicInfoSessionModel(sessionTitle: "配偶", arrQuestionItem: arr)
arrData.append(sessionModel)
}
}
do {
//家庭背景
if let model = dataModelForBasicInfo.background {
......@@ -140,7 +141,6 @@ extension YHBasicInfoFillViewModel {
}
}
arrBasicInfoSessionDataForEdit = arrData
}
}
......
......@@ -12,6 +12,7 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var child:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var isNeedShowError = false
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -42,9 +43,8 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "子女基本信息填写".local
createUI()
loadBasicInfo()
loadInfo()
}
func createUI() {
......@@ -60,7 +60,7 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
}
}
func loadBasicInfo() {
func loadInfo() {
guard let child = child else { return }
items.removeAll()
......@@ -118,8 +118,8 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if child.isNowHaveJob() {
let item11 = YHFormDetailItem(type: .occupationName)
item11.value = child.occupationName
item10.tips = "请请输入职业名称".local
item11.placeHolder = "请输入职业名称".local
item11.tips = "请输入职业名称".local
item11.placeHolder = "请输入职业名称".local
arr1.append(item11)
}
......@@ -262,9 +262,9 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.placeHolder = detailItem.placeHolder
cell.setTips(detailItem.tips, isShow: detailItem.isShowTips)
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......@@ -289,10 +289,8 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
}
if isEditEnd {
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.loadInfo()
save()
}
}
return cell
......@@ -304,7 +302,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow: detailItem.isShowTips)
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell
}
......@@ -329,10 +327,8 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
let selectItem = answers[index]
self.child?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.loadInfo()
save()
}
} else if detailItem.type == .isHaveHkIdentityCard || detailItem.type == .isNowInHK || detailItem.type == .isPreviousMarriageChild { // 是否办理过香港身份证 是否在岗 是否前次婚姻子女
var select = false
......@@ -355,10 +351,8 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isPreviousMarriageChild {
self.child?.setPreviousMarriageChild(option)
}
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.loadInfo()
save()
}
}
return cell
......@@ -381,26 +375,8 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormAddItem {
return 70.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
......@@ -437,10 +413,8 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .stayHKDate {
self.child?.childInHk.info = date
}
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.loadInfo()
save()
}
} else if detailItem.type == .birthCity { // 出生城市
......@@ -457,67 +431,57 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.birthPlace.area = [string2, string3, string4]
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.child?.birthPlace.area = [string2, string3]
self.loadInfo()
save()
}
self.present(vc, animated: true)
} else if detailItem.type == .roleInHK { // 在港身份
let identity = self.child?.hkIdentity ?? ""
YHFormPickerView.show(type: .identity, selectTitle:identity ) {
[weak self] selectType in
YHSheetPickerView.show(type:.identity, selectTitle: identity) {
[weak self] selectItem in
guard let self = self else { return }
self.child?.hkIdentity = selectType.title
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.child?.hkIdentity = selectItem.title
self.loadInfo()
save()
}
} else if detailItem.type == .occupation { // 职业
let occupation = self.child?.occupation ?? ""
YHFormPickerView.show(type: .occupation, selectTitle:occupation ) {
[weak self] selectType in
YHSheetPickerView.show(type:.occupation, selectTitle: occupation) {
[weak self] selectItem in
guard let self = self else { return }
self.child?.occupation = selectType.title
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.child?.occupation = selectItem.title
self.loadInfo()
save()
}
} else if detailItem.type == .gender { // 性别
guard let child = child else { return }
let isMale = child.isMale()
let selectType:YHFormPickerViewSubType = isMale ? .gender(.male) : .gender(.female)
YHFormPickerView.show(type: .gender, selectType:selectType) {
[weak self] selectType in
YHSheetPickerView.show(type: .gender, selectTitle:child?.sexName()) {
[weak self] selectItem in
guard let self = self else { return }
let selectMale = (selectType.index == YHFormPickerViewSubType.gender(.male).index)
self.child?.setMale(selectMale)
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.child?.setSexName(selectItem.title)
self.loadInfo()
save()
}
} else if detailItem.type == .marriageState { // 婚姻
let marriage = self.child?.married
YHFormPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectType in
YHSheetPickerView.show(type: .marriage, selectTitle:self.child?.married) {
[weak self] selectItem in
guard let self = self else { return }
self.child?.married = selectType.title
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.child?.married = selectItem.title
self.loadInfo()
save()
}
}
}
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
cell.layer.mask = nil
......@@ -538,8 +502,69 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHChildBasicInfoVC {
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let child = child else { return false}
if isEmptyString(child.subsetName)
|| child.sex == 0
|| isEmptyString(child.married)
|| isEmptyString(child.birthday){
return false
}
if child.isBirthOverSeas() {
if isEmptyString(child.birthPlace.foreign) {
return false
}
} else {
if isEmptyArray(child.birthPlace.area) {
return false
}
}
if isEmptyString(child.occupation) {
return false
}
if child.isNowHaveJob(), isEmptyString(child.occupationName) {
return false
}
if child.isNowInHK() {
if isEmptyString(child.childInHk.info) || isEmptyString(child.hkIdentity) {
return false
}
}
if child.isHaveHKIdentityCard() {
if isEmptyString(child.hkIdentityCard) {
return false
}
if let hkIdentityCard = child.hkIdentityCard, !hkIdentityCard.isHKIdentityCardNumber() {
return false
}
}
return true
}
func nextStep()->Bool {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return false
}
return true
}
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
}
......@@ -23,6 +23,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
var child:YHFamilyMember? {
didSet {
primaryInfoVC.child = child
uploadVC.familyMember = child
certificateVC.familyMember = child
basicInfoVC.child = child
}
......@@ -37,6 +38,12 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
for vcItem in stepVCs {
vcItem.vc.view.isHidden = (vcItem.step != currentStep)
if vcItem.step == currentStep {
// 刷新
if vcItem.vc.responds(to: #selector(YHFamilyMemberProtol.loadInfo)) {
vcItem.vc.loadInfo()
}
}
}
}
}
......@@ -57,6 +64,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "子女信息填写".local
createUI()
}
......@@ -71,6 +79,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
updateStepView()
print("step:\(child.step)")
currentStep = child.step
stepView.maxIndex = child.step
view.addSubview(stepView)
view.addSubview(bottomView)
......@@ -84,7 +93,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
self.saveInfo()
self.saveInfo(isSubmit: false, isShowLoading: true, callBack:nil)
}
stepView.snp.makeConstraints { make in
......@@ -131,6 +140,8 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
titles.append(vcItem.title)
}
stepView.dataSource = titles
let step = currentStep
currentStep = step
stepView.block = {
[weak self] index in
......@@ -150,12 +161,16 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
func submit() {
if let targetVC = getCurrentStepViewController() {
if targetVC.nextStep() {
saveInfo(isSubmit: true, isShowLoading: true) {
[weak self] success, error in
guard let self = self else { return }
if success {
// 当前步骤已是最后一步
if let vc = stepVCs.last, vc.step == currentStep {
YHHUD.flash(message: "已经是最后一步!")
self.navigationController?.popViewController()
return
}
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
}
......@@ -163,6 +178,8 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
}
}
}
}
// 【WARNING!】步骤step和在数组中的下标有时候并不是一一对应
func getArrayIndexOfCurrentStep() ->Int? {
......@@ -194,22 +211,33 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
extension YHChildInfoContainerVC {
func saveInfo() {
// @param isSubmit:是否为提交 false为保存 true为提交
// @param isShowLoading: 是否展示loading和toast
func saveInfo(isSubmit:Bool, isShowLoading:Bool, callBack:((Bool, String?)->Void)?) {
guard let child = child else { return }
guard let info = child.toDictionary() else { return }
let dict:[String: Any] = ["orderId":child.orderId,
"relation":child.relationType.rawValue,
let dict:[String: Any] = ["order_id":child.orderId,
"relation":child.relation,
"step":child.step,
"next":false,
"next":isSubmit,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { [weak self] success, error in
self.familyRequest.addOrSaveFamilyMember(params:dict, isShowLoading: isShowLoading) {
[weak self] success, error in
guard let self = self else { return }
if success {
if isShowLoading {
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
if let callBack = callBack {
callBack(success, error?.errorMsg)
}
}
}
func saveInfoSilent() {
saveInfo(isSubmit:false, isShowLoading:false, callBack:nil)
}
}
......@@ -12,6 +12,7 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var child:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var isNeedShowError = false
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -43,12 +44,11 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "子女信息填写".local
createUI()
loadChildInfo()
loadInfo()
}
func loadChildInfo() {
func loadInfo() {
guard let child = child else { return }
......@@ -56,35 +56,25 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
// 随行
let title0 = YHFormTitleItem(type: .accompany)
let item00 = YHFormDetailItem(type: .ownCustody)
item00.value = String(child.isOwnCustody())
let item01 = YHFormDetailItem(type: .birthday)
item01.value = child.birthday
let item02 = YHFormDetailItem(type: .isAccompanyToHK)
item02.value = String(child.isFollow())
let item00 = YHFormDetailItem(type: .ownCustody, value:String(child.isOwnCustody()))
let item01 = YHFormDetailItem(type: .birthday, value:child.birthday, tips:"请选择出生日期".local)
let item02 = YHFormDetailItem(type: .isAccompanyToHK, value:String(child.isFollow()))
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02]
items.append(arr0)
if child.isFollow() { // 随行才加后面的信息
// 国籍
let title1 = YHFormTitleItem(type: .nationality)
let item10 = YHFormDetailItem(type: .nationOrArea)
item10.value = child.nationality
item10.placeHolder = "请选择".local
let item10 = YHFormDetailItem(type: .nationOrArea, value:child.nationality, tips: "请选择国籍".local)
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
var arr2 = [YHFormItemProtocol]()
let title2 = YHFormTitleItem(type: .liveInfo)
let item20 = YHFormDetailItem(type: .isLiveTother)
item20.value = String(child.isLiveTother())
arr2.append(title2)
arr2.append(item20)
let item20 = YHFormDetailItem(type: .isLiveTother, value:String(child.isLiveTother()))
var arr2: [YHFormItemProtocol] = [title2, item20]
if !child.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea)
item21.value = child.address.country
item21.placeHolder = "请选择".local
let item21 = YHFormDetailItem(type: .nationOrArea, value:child.address.country, tips:"请选择国家/地区".local)
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
......@@ -94,23 +84,20 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = child.address.country.contains("中国".local)
if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity)
var value = ""
if !child.address.area.isEmpty {
item22.value = child.address.area.joined(separator: "/")
value = child.address.area.joined(separator: ",")
}
item22.placeHolder = "请选择城市".local
let item22 = YHFormDetailItem(type: .liveCity, value: value, tips: "请选择现居住城市".local)
arr2.append(item22)
}
let item23 = YHFormDetailItem(type: .detailAddress)
item23.value = child.address.details
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
let placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
let item23 = YHFormDetailItem(type: .detailAddress, value:child.address.details, placeHolder: placeHolder, tips:placeHolder)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(child.isOverSeasOver1Year())
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year, value:String(child.isOverSeasOver1Year()))
arr2.append(item24)
}
}
......@@ -118,8 +105,7 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
// 港澳通信证
let title3 = YHFormTitleItem(type: .hkAndMacaoPassport)
let item30 = YHFormDetailItem(type: .isHandleHKPassPort)
item30.value = String(child.isNeedHandleHKPassPort())
let item30 = YHFormDetailItem(type: .isHandleHKPassPort, value: String(child.isNeedHandleHKPassPort()))
let arr3:[YHFormItemProtocol] = [title3, item30]
items.append(contentsOf:[arr1, arr2, arr3])
}
......@@ -242,8 +228,8 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .isAccompanyToHK { // 是否随行
self.child?.setFollow(option)
if let delegate = self.delegate {
delegate.updateStepView?()
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.updateStepView)) {
delegate.updateStepView()
}
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
......@@ -252,9 +238,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
self.child?.setLiveTother(option)
if option {
self.child?.address.country = ""
self.child?.address.details = ""
self.child?.address.area = []
self.child?.address.clearAddress()
}
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
self.child?.setOverSearsOver1Year(option)
......@@ -262,10 +246,8 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .ownCustody { // 抚养权
self.child?.setOwnCustody(option)
}
self.loadChildInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.loadInfo()
save()
}
return cell
......@@ -275,6 +257,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
return cell
} else if cellType == .inputText { // 输入文字cell
......@@ -283,6 +266,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......@@ -291,10 +275,8 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
if isEditEnd {
self.loadChildInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.loadInfo()
save()
}
}
return cell
......@@ -320,31 +302,8 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .isLiveTother ||
detailItem.type == .isAccompanyToHK ||
detailItem.type == .isHandleHKPassPort ||
detailItem.type == .ownCustody ||
detailItem.type == .isLiveOverSeasMore1Year
{
return UITableView.automaticDimension
}
}
return 52.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
......@@ -385,7 +344,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.child?.address.country = country
}
self.loadChildInfo()
self.loadInfo()
}
self.navigationController?.pushViewController(vc)
......@@ -396,8 +355,8 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.address.area = [string2, string3, string4]
self.loadChildInfo()
self.child?.address.area = [string2, string3]
self.loadInfo()
}
self.present(vc, animated: true)
......@@ -408,7 +367,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .birthday {
self.child?.birthday = date
}
self.loadChildInfo()
self.loadInfo()
}
}
}
......@@ -445,6 +404,10 @@ extension YHChildPrimaryInfoVC {
return true
}
if isEmptyString(child.birthday) {
return false
}
if isEmptyString(child.nationality) {
return false
}
......@@ -461,8 +424,23 @@ extension YHChildPrimaryInfoVC {
}
func nextStep()->Bool {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return false
}
return true
}
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
}
......
//
// YHCertificateUploadVC.swift
// galaxy
//
// Created by edy on 2024/2/26.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateUploadVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .systemPink
// Do any additional setup after loading the view.
}
func nextStep()->Bool {
return true
}
}
......@@ -59,9 +59,8 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "配偶基本信息填写".local
createUI()
loadBasicInfo()
loadInfo()
}
func createUI() {
......@@ -77,7 +76,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
}
}
func loadBasicInfo() {
func loadInfo() {
guard let spouse = spouse else { return }
......@@ -141,7 +140,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let title2 = YHFormTitleItem(type: .degreeInfo)
let item20 = YHFormDetailItem(type: .ownDegree)
item20.placeHolder = "请选择".local
item20.value = spouse.haveDegreeName()
item20.value = spouse.hasDegreeName()
item20.tips = "请选择".local
var arr2:[YHFormItemProtocol] = [title2, item20]
......@@ -241,6 +240,21 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
}
}
}
if spouse.isNowInHK() {
if isEmptyString(spouse.childInHk.info) || isEmptyString(spouse.hkIdentity) {
return false
}
}
if spouse.isHaveHKIdentityCard() {
if isEmptyString(spouse.hkIdentityCard) {
return false
}
if let hkIdentityCard = spouse.hkIdentityCard, !hkIdentityCard.isHKIdentityCardNumber() {
return false
}
}
return true
}
......@@ -249,7 +263,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
......@@ -349,7 +363,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
let newDegree = YHHasDegreeJson()
self.spouse?.hasDegreeJson.append(newDegree)
self.loadBasicInfo()
self.loadInfo()
}
return cell
}
......@@ -394,16 +408,14 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
}
if isEditEnd {
self.loadBasicInfo()
self.loadInfo()
if detailItem.type == .hkIdentityCardNumber {
if let text = text, !text.isHKIdentityCardNumber() {
YHHUD.flash(message: "请输入正确的香港身份证号格式")
return
}
}
if let delegate = delegate {
delegate.saveInfo?()
}
save()
}
}
return cell
......@@ -441,7 +453,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
let selectItem = answers[index]
self.spouse?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
self.loadInfo()
}
} else if detailItem.type == .isHaveHkIdentityCard || detailItem.type == .isNowInHK { // 是否办理过香港身份证 是否在岗
var select = false
......@@ -460,7 +472,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isHaveHkIdentityCard {
self.spouse?.setHaveHKIdentityCard(selectItem.title == "是".local)
}
self.loadBasicInfo()
self.loadInfo()
}
}
......@@ -476,48 +488,55 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
if indexPath.row-2 < degreeArr.count {
let degreeInfo = degreeArr[indexPath.row-2]
cell.title = String(format: "%@%d", "学位信息".local, indexPath.row-1)
cell.degreePlace = degreeInfo.address
// 前两行是 学历学位信息标题 和 是否拥有学位
cell.showDeleteBtn(indexPath.row > 2)
if !degreeInfo.degree.isEmpty {
if let degreeIndex = Int(degreeInfo.degree), let subType = YHPickerViewDegreeType(rawValue: degreeIndex) {
cell.degree = YHFormPickerViewSubType.degree(subType).title
} else {
cell.degree = ""
}
} else {
cell.degree = ""
}
if !degreeInfo.address.isEmpty {
if let addressIndex = Int(degreeInfo.address), let subType = YHPickerViewDegreeLocationType(rawValue: addressIndex) {
cell.degreePlace = YHFormPickerViewSubType.degreeLocation(subType).title
} else {
cell.degreePlace = ""
// 学位
var degreeDesc = ""
if let degreeInt = Int(degreeInfo.degree), let item = YHSheetPickerView.getItem(type:.degree, index:degreeInt)
{
degreeDesc = item.title
}
} else {
cell.degreePlace = ""
cell.degree = degreeDesc
// 颁发地区
var degreeAreaDesc = ""
if let areaInt = Int(degreeInfo.address), let item = YHSheetPickerView.getItem(type:.degreeLocation, index: areaInt)
{
degreeAreaDesc = item.title
}
cell.degreePlace = degreeAreaDesc
let isNeedShowDegreeTips = isNeedShowError && isEmptyString(degreeDesc)
let isNeedShowPlaceTips = isNeedShowError && isEmptyString(degreeAreaDesc)
cell.showTips(isShowDegreeTips:isNeedShowDegreeTips, isShowPlaceTips:isNeedShowPlaceTips)
cell.degreeClickBlock = {
YHFormPickerView.show(type: .degree) { [weak self] selectType in
YHSheetPickerView.show(type: .degree, selectTitle:degreeDesc) {
[weak self] selectItem in
guard let self = self else { return }
degreeInfo.degree = String(selectType.index)
self.loadBasicInfo()
degreeInfo.degree = String(selectItem.index)
loadInfo()
save()
}
}
cell.areaClickBlock = {
YHFormPickerView.show(type: .degreeLocation) { [weak self] selectType in
YHSheetPickerView.show(type: .degreeLocation, selectTitle: degreeAreaDesc) {
[weak self] selectType in
guard let self = self else { return }
degreeInfo.address = String(selectType.index)
self.loadBasicInfo()
loadInfo()
save()
}
}
cell.deleteBlock = {
[weak self] in
guard let self = self else { return }
self.spouse?.hasDegreeJson.remove(at: indexPath.row-2)
self.loadBasicInfo()
loadInfo()
save()
}
}
......@@ -543,25 +562,8 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormAddItem {
return 70.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
......@@ -598,7 +600,8 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .stayHKDate {
self.spouse?.childInHk.info = date
}
self.loadBasicInfo()
loadInfo()
save()
}
} else if detailItem.type == .birthCity { // 出生城市
......@@ -615,39 +618,43 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.spouse?.birthPlace.area = [string2, string3, string4]
self.loadBasicInfo()
self.spouse?.birthPlace.area = [string2, string3]
loadInfo()
save()
}
self.present(vc, animated: true)
} else if detailItem.type == .roleInHK { // 在港身份
let identity = self.spouse?.hkIdentity ?? ""
YHFormPickerView.show(type: .identity, selectTitle:identity ) {
[weak self] selectType in
YHSheetPickerView.show(type:.identity, selectTitle:identity) {
[weak self] selectItem in
guard let self = self else { return }
self.spouse?.hkIdentity = selectType.title
self.loadBasicInfo()
self.spouse?.hkIdentity = selectItem.title
loadInfo()
save()
}
} else if detailItem.type == .occupation {
let occupation = self.spouse?.occupation ?? ""
YHFormPickerView.show(type: .occupation, selectTitle:occupation ) {
[weak self] selectType in
YHSheetPickerView.show(type: .occupation, selectTitle:occupation) {
[weak self] selectItem in
guard let self = self else { return }
self.spouse?.occupation = selectType.title
self.loadBasicInfo()
self.spouse?.occupation = selectItem.title
loadInfo()
save()
}
} else if detailItem.type == .ownDegree {
let hasDegree = self.spouse?.haveDegreeName() ?? "无学位"
YHFormPickerView.show(type: .ownDegree, selectTitle:hasDegree ) {
[weak self] selectType in
YHSheetPickerView.show(type: .ownDegree, selectTitle:self.spouse?.hasDegreeName()) {
[weak self] selectItem in
guard let self = self else { return }
let ownDegree = (selectType.index == YHFormPickerViewSubType.ownDegree(.hasDegree).index)
self.spouse?.setHaveDegree(ownDegree)
self.loadBasicInfo()
let hasDegree = selectItem.index == 1
self.spouse?.setHaveDegree(hasDegree)
self.loadInfo()
save()
}
}
}
}
......@@ -668,4 +675,10 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.layer.mask = nil
}
}
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
}
......@@ -8,14 +8,16 @@
import UIKit
@objc protocol YHSpouseInfoVCProtocol {
@objc protocol YHSpouseInfoVCProtocol:NSObjectProtocol {
@objc optional func updateStepView()
@objc optional func saveInfo()
@objc func updateStepView()
// 静默保存数据(不显示toast)
@objc func saveInfoSilent()
}
@objc protocol YHFamilyMemberProtol {
@objc protocol YHFamilyMemberProtol:NSObjectProtocol {
@objc func nextStep()->Bool
@objc func loadInfo()
}
class YHFaimilyStepItem {
......@@ -41,6 +43,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
didSet {
if let spouse = spouse {
primaryInfoVC.spouse = spouse
uploadVC.familyMember = spouse
certificateVC.familyMember = spouse
basicInfoVC.spouse = spouse
}
......@@ -56,6 +59,12 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
for vcItem in stepVCs {
vcItem.vc.view.isHidden = (vcItem.step != currentStep)
if vcItem.step == currentStep {
// 刷新
if vcItem.vc.responds(to: #selector(YHFamilyMemberProtol.loadInfo)) {
vcItem.vc.loadInfo()
}
}
}
}
}
......@@ -78,6 +87,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "配偶信息填写".local
createUI()
}
......@@ -95,10 +105,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
updateStepView()
print("step:\(spouse.step)")
currentStep = spouse.step
let tap = UITapGestureRecognizer(target: self, action: #selector(tap))
tap.cancelsTouchesInView = false
self.view.addGestureRecognizer(tap)
stepView.maxIndex = spouse.step
bottomView.submitBlock = {
[weak self] in
......@@ -109,7 +116,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
self.saveInfo()
saveInfo(isSubmit: false, isLoading: true, callBack: nil)
}
stepView.snp.makeConstraints { make in
......@@ -157,6 +164,9 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
stepView.dataSource = titles
// 数据源可能会变,所以需要重新设置step
let step = currentStep
currentStep = step
stepView.block = {
[weak self] index in
......@@ -167,8 +177,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
print("index:\(index)")
}
let step = currentStep
currentStep = step
self.view.bringSubviewToFront(stepView)
self.view.bringSubviewToFront(bottomView)
......@@ -177,7 +186,8 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
extension YHSpouseInfoContainerVC {
func saveInfo(isSubmit:Bool, callBack:((Bool, String?)->Void)?) {
// isSubmit:是否为提交 false为保存 true为提交
func saveInfo(isSubmit:Bool, isLoading:Bool, callBack:((Bool, String?)->Void)?) {
guard let spouse = spouse else { return }
guard let info = spouse.toDictionary() else { return }
......@@ -188,30 +198,32 @@ extension YHSpouseInfoContainerVC {
"next":isSubmit,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { [weak self] success, error in
guard let self = self else { return }
self.familyRequest.addOrSaveFamilyMember(params:dict, isShowLoading: isLoading) {
[weak self] success, error in
if isLoading {
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
if let callBack = callBack {
callBack(success, error?.errorMsg)
}
}
}
func saveInfo() {
saveInfo(isSubmit: false, callBack:nil)
func saveInfoSilent() {
saveInfo(isSubmit: false, isLoading: false, callBack: nil)
}
func submit() {
if let targetVC = getCurrentStepViewController() {
if targetVC.nextStep() {
saveInfo(isSubmit: true) {
saveInfo(isSubmit: true, isLoading: true) {
[weak self] success, tips in
guard let self = self else { return }
if success {
// 当前步骤已是最后一步
if let vc = stepVCs.last, vc.step == currentStep {
YHHUD.flash(message: "已经是最后一步!")
self.navigationController?.popViewController()
return
}
......@@ -253,10 +265,3 @@ extension YHSpouseInfoContainerVC {
return nil
}
}
extension YHSpouseInfoContainerVC: UIGestureRecognizerDelegate {
@objc func tap() {
print("点击了parentViewController: YHSpouseInfoContainerVC")
}
}
......@@ -42,12 +42,11 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "配偶信息填写".local
createUI()
loadSponseInfo()
loadInfo()
}
func loadSponseInfo() {
func loadInfo() {
guard let spouse = spouse else { return }
......@@ -63,25 +62,18 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if spouse.isFollow() { // 随行才加后面的信息
// 国籍
let title1 = YHFormTitleItem(type: .nationality)
let item10 = YHFormDetailItem(type: .nationOrArea)
item10.value = spouse.nationality
item10.placeHolder = "请选择".local
item10.tips = "请选择国家/地区".local
let item10 = YHFormDetailItem(type:.nationOrArea, value:spouse.nationality, placeHolder:"请选择".local, tips:"请选择国籍".local)
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
var arr2 = [YHFormItemProtocol]()
let title2 = YHFormTitleItem(type: .liveInfo)
let item20 = YHFormDetailItem(type: .isLiveTother)
item20.value = String(spouse.isLiveTother())
let item20 = YHFormDetailItem(type:.isLiveTother, value:String(spouse.isLiveTother()))
arr2.append(title2)
arr2.append(item20)
if !spouse.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea)
item21.value = spouse.address.country
item21.placeHolder = "请选择".local
item21.tips = "请选择国家/地区".local
let item21 = YHFormDetailItem(type:.nationOrArea, value:spouse.address.country, placeHolder:"请选择".local, tips:"请选择国家/地区".local)
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
......@@ -91,19 +83,17 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = spouse.address.country.contains("中国".local)
if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity)
var value:String? = ""
if !spouse.address.area.isEmpty {
item22.value = spouse.address.area.joined(separator: "/")
value = spouse.address.area.joined(separator: ",")
}
item22.placeHolder = "请选择城市".local
item22.tips = "请请选择城市".local
let item22 = YHFormDetailItem(type:.liveCity, value:value, placeHolder:"请选择城市".local, tips:"请请选择城市".local)
arr2.append(item22)
}
let item23 = YHFormDetailItem(type: .detailAddress)
item23.value = spouse.address.details
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
item23.tips = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
let placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
let tips = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
let item23 = YHFormDetailItem(type:.detailAddress, value:spouse.address.details, placeHolder:placeHolder, tips:tips)
arr2.append(item23)
if !isLiveInChina {// 在国外
......@@ -196,28 +186,27 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .isAccompanyToHK { // 是否随行
self.spouse?.setFollow(option)
self.loadSponseInfo()
if let delegate = self.delegate {
delegate.updateStepView?()
self.loadInfo()
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.updateStepView)) {
delegate.updateStepView()
}
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
self.spouse?.setNeedHandleHKPassPort(option)
self.loadSponseInfo()
self.loadInfo()
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
self.spouse?.setLiveTother(option)
if option {
self.spouse?.address.country = ""
self.spouse?.address.details = ""
self.spouse?.address.area = []
self.spouse?.address.clearAddress()
}
self.loadSponseInfo()
self.loadInfo()
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
self.spouse?.setOverSearsOver1Year(option)
self.loadSponseInfo()
self.loadInfo()
}
save()
}
return cell
......@@ -228,10 +217,9 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.placeHolder = detailItem.placeHolder
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell
}
......@@ -239,19 +227,16 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder
cell.setTips(detailItem.tips, isShow:detailItem.isShowTips)
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
self.spouse?.address.details = text ?? ""
if isEditEnd {
self.loadSponseInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
self.loadInfo()
save()
}
}
return cell
......@@ -276,28 +261,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
return UITableView.automaticDimension
// if item is YHFormDetailItem {
// let detailItem = item as! YHFormDetailItem
// if detailItem.type == .isLiveTother ||
// detailItem.type == .isAccompanyToHK ||
// detailItem.type == .isHandleHKPassPort ||
// detailItem.type == .isLiveOverSeasMore1Year
// {
// return UITableView.automaticDimension
// }
// }
// return 52.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
......@@ -339,7 +303,8 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.spouse?.address.country = country
}
self.loadSponseInfo()
self.loadInfo()
save()
}
self.navigationController?.pushViewController(vc)
......@@ -350,8 +315,9 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.spouse?.address.area = [string2, string3, string4]
self.loadSponseInfo()
self.spouse?.address.area = [string2, string3]
self.loadInfo()
save()
}
self.present(vc, animated: true)
......@@ -387,15 +353,21 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if isEmptyString(spouse.nationality) {
return false
}
if !spouse.isLiveTother() { // 没有与主申请人同住
if isEmptyString(spouse.address.country) {
return false
}
if isEmptyString(spouse.address.details) {
return false
}
if spouse.isBirthOverSeas(), isEmptyArray(spouse.address.area) {
if spouse.address.isInChina() {
if isEmptyArray(spouse.address.area) {
return false
}
}
}
return true
}
......@@ -403,7 +375,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
......@@ -411,5 +383,12 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
return true
}
func save() {
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
}
......@@ -10,14 +10,17 @@ import UIKit
class YHBrotherInfoVC: YHBaseViewController {
var orderId: Int = 0
var brotherInfo: YHFamilyMember?
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
// 是否显示未填写错误提示
var isNeedShowError = false
var bottomView: YHSaveAndSubmitView = {
let view = YHSaveAndSubmitView.createView()
view.isHiddenSubmit = true
view.isHiddenSave = true
view.changeRightBtnTitle("保存")
return view
}()
......@@ -49,7 +52,7 @@ class YHBrotherInfoVC: YHBaseViewController {
super.viewDidLoad()
gk_navTitle = "兄弟姐妹信息填写".local
createUI()
loadBasicInfo()
loadInfo()
}
func createUI() {
......@@ -57,11 +60,15 @@ class YHBrotherInfoVC: YHBaseViewController {
view.addSubview(tableView);
view.addSubview(bottomView)
bottomView.saveBlock = {
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
self.saveInfo()
self.saveInfo(isSubmit: true, isLoading: true) {
[weak self] success, msg in
if success {
self?.navigationController?.popViewController(animated: true)
}
}
}
bottomView.snp.makeConstraints { make in
......@@ -76,10 +83,10 @@ class YHBrotherInfoVC: YHBaseViewController {
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
}
loadBasicInfo()
loadInfo()
}
func loadBasicInfo() {
func loadInfo() {
guard let brotherInfo = brotherInfo else { return }
......@@ -88,55 +95,40 @@ class YHBrotherInfoVC: YHBaseViewController {
// 兄弟姐妹信息
let title1 = YHFormTitleItem(type: .brotherInfo)
let item10 = YHFormDetailItem(type: .brotherName)
item10.value = brotherInfo.subsetName
let item11 = YHFormDetailItem(type: .birthday)
item11.value = brotherInfo.birthday
let item12 = YHFormDetailItem(type: .birthNation)
item12.value = String(brotherInfo.isBirthOverSeas())
let item13 = YHFormDetailItem(type: .birthCity)
let item10 = YHFormDetailItem(type: .brotherName, value:brotherInfo.subsetName, tips:"请输入姓名".local)
let item11 = YHFormDetailItem(type: .birthday, value:brotherInfo.birthday, tips:"请选择出生日期".local )
let item12 = YHFormDetailItem(type: .birthNation, value:String(brotherInfo.isBirthOverSeas()))
var birthCity = ""
if brotherInfo.isBirthOverSeas() {
item13.value = brotherInfo.birthPlace.foreign
item13.placeHolder = "请输入".local
birthCity = brotherInfo.birthPlace.foreign
} else {
item13.value = brotherInfo.birthPlace.area.joined(separator: ",")
item13.placeHolder = "请选择".local
birthCity = brotherInfo.birthPlace.area.joined(separator: ",")
}
let item14 = YHFormDetailItem(type: .gender)
item14.value = brotherInfo.sexName()
let item15 = YHFormDetailItem(type: .marriageState)
item15.value = brotherInfo.married
let item13 = YHFormDetailItem(type: .birthCity, value: birthCity, tips:"请选择出生城市".local)
let item14 = YHFormDetailItem(type: .gender, value:brotherInfo.sexName(), tips:"请选择性别".local)
let item15 = YHFormDetailItem(type: .marriageState, value:brotherInfo.married, tips:"请选择婚姻状况".local)
let arr1:[YHFormItemProtocol] = [title1, item10, item11, item12, item13, item14, item15]
// 职业信息
let title2 = YHFormTitleItem(type: .occupationInfo)
let item20 = YHFormDetailItem(type: .occupation)
item20.value = brotherInfo.occupation
item20.placeHolder = "请输入".local
let item20 = YHFormDetailItem(type: .occupation, value:brotherInfo.occupation, tips:"请选择职业".local)
var arr2:[YHFormItemProtocol] = [title2, item20]
// 居住信息
let title3 = YHFormTitleItem(type: .liveInfo)
let item30 = YHFormDetailItem(type: .liveNationOrArea)
item30.value = brotherInfo.liveCountry
let item30 = YHFormDetailItem(type: .liveNationOrArea, value:brotherInfo.liveCountry, tips:"请选择国家/地区".local)
let arr3:[YHFormItemProtocol] = [title3, item30]
// 香港身份证
let title4 = YHFormTitleItem(type: .hkIdentityCardInfo)
let item40 = YHFormDetailItem(type: .isHaveHkIdentityCard)
item40.value = String(brotherInfo.isHaveHKIdentityCard())
let item40 = YHFormDetailItem(type: .isHaveHkIdentityCard, value:String(brotherInfo.isHaveHKIdentityCard()))
var arr4:[YHFormItemProtocol] = [title4, item40]
if brotherInfo.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber)
item41.value = brotherInfo.hkIdentityCard
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber, value:brotherInfo.hkIdentityCard, tips: "请输入正确的香港身份证号码")
arr4.append(item41)
}
items.append(contentsOf: [arr1, arr2, arr3, arr4])
......@@ -231,7 +223,17 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
if detailItem.type == .hkIdentityCardNumber { // 输入香港身份证号码
let isEmptyValue = isEmptyString(detailItem.value)
var isUnvalidFormat = true
if let value = detailItem.value, value.isHKIdentityCardNumber() {
isUnvalidFormat = false
}
let isNeedShowTips = isEmptyValue || isUnvalidFormat
cell.setTips(detailItem.tips, isShow: isNeedShowError && isNeedShowTips)
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
cell.textChange = {
[weak self] (text, isEditEnd) in
......@@ -250,8 +252,8 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
}
if isEditEnd {
self.loadBasicInfo()
self.saveInfo()
self.loadInfo()
saveInfoSilent()
}
}
return cell
......@@ -262,6 +264,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
return cell
}
......@@ -285,8 +288,8 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
let selectItem = answers[index]
self.brotherInfo?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
self.saveInfo()
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .isHaveHkIdentityCard { // 是否办理过香港身份证
var select = false
......@@ -303,8 +306,8 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .isHaveHkIdentityCard {
self.brotherInfo?.setHaveHKIdentityCard(selectItem.title == "是".local)
}
self.loadBasicInfo()
self.saveInfo()
self.loadInfo()
saveInfoSilent()
}
}
......@@ -322,12 +325,13 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: !isDead),
YHFormChoiceItem(title: "已故".local, isSelect: isDead)]
cell.answerArr = answers
cell.answerBlock = { [weak self]
(arr, selectIndex) in
cell.answerBlock = {
[weak self] (arr, selectIndex) in
guard let self = self else { return }
let selectItem:YHFormChoiceItem = arr[selectIndex]
self?.brotherInfo?.setIsDead(selectItem.title == "已故".local)
self?.loadBasicInfo()
self?.saveInfo()
self.brotherInfo?.setIsDead(selectItem.title == "已故".local)
self.loadInfo()
saveInfoSilent()
}
return cell
}
......@@ -350,25 +354,8 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormAddItem {
return 70.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......@@ -396,8 +383,8 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .birthday {
self.brotherInfo?.birthday = date
}
self.loadBasicInfo()
self.saveInfo()
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .birthCity { // 出生城市
......@@ -414,53 +401,54 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.brotherInfo?.birthPlace.area = [string2, string3, string4]
self.loadBasicInfo()
self.saveInfo()
self.brotherInfo?.birthPlace.area = [string2, string3]
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
} else if detailItem.type == .occupation { // 职业
let occupation = self.brotherInfo?.occupation ?? ""
YHFormPickerView.show(type: .profession, selectTitle:occupation ) {
[weak self] selectType in
YHSheetPickerView.show(type: .profession, selectTitle:occupation) {
[weak self] selectItem in
guard let self = self else { return }
self.brotherInfo?.occupation = selectType.title
self.loadBasicInfo()
self.saveInfo()
self.brotherInfo?.occupation = selectItem.title
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .marriageState { // 婚姻
let marriage = self.brotherInfo?.married
YHFormPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectType in
YHSheetPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectItem in
guard let self = self else { return }
self.brotherInfo?.married = selectType.title
self.loadBasicInfo()
self.saveInfo()
self.brotherInfo?.married = selectItem.title
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
let vc = YHAddressViewController()
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
[weak self] string in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.brotherInfo?.liveCountry = string2
self.loadBasicInfo()
self.saveInfo()
self.brotherInfo?.liveCountry = string
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .gender { // 性别
guard let brotherInfo = brotherInfo else { return }
let isMale = brotherInfo.isMale()
let selectType:YHFormPickerViewSubType = isMale ? .gender(.male) : .gender(.female)
YHFormPickerView.show(type: .gender, selectType:selectType) {
[weak self] selectType in
YHSheetPickerView.show(type: .gender, selectTitle:brotherInfo.sexName()) {
[weak self] selectItem in
guard let self = self else { return }
let selectMale = (selectType.index == YHFormPickerViewSubType.gender(.male).index)
self.brotherInfo?.setMale(selectMale)
self.loadBasicInfo()
self.saveInfo()
self.brotherInfo?.setSexName(selectItem.title)
self.loadInfo()
saveInfoSilent()
}
}
}
......@@ -486,22 +474,90 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHBrotherInfoVC {
func saveInfo() {
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let brotherInfo = brotherInfo else { return false }
if isEmptyString(brotherInfo.subsetName) || isEmptyString(brotherInfo.birthday) || isEmptyString(brotherInfo.married) || isEmptyString(brotherInfo.occupation) {
return false
}
if brotherInfo.isBirthOverSeas() {
if isEmptyString(brotherInfo.birthPlace.foreign) {
return false
}
} else {
if isEmptyArray(brotherInfo.birthPlace.area) {
return false
}
}
if brotherInfo.sex == 0 {
return false
}
if brotherInfo.isNowHaveJob() {
if isEmptyString(brotherInfo.occupationName) {
return false
}
}
if brotherInfo.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
if isEmptyString(brotherInfo.hkIdentityCard) {
return false
}
if let hkIdCard = brotherInfo.hkIdentityCard, !hkIdCard.isHKIdentityCardNumber() {
return false
}
}
return true
}
// isSubmit 是否是提交 isSilent:是否显示toast
func saveInfo(isSubmit:Bool, isLoading:Bool, callBack:((Bool, String?)->Void)?) {
if isSubmit {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return
}
}
guard let brotherInfo = brotherInfo else { return }
guard let info = brotherInfo.toDictionary() else { return }
let dict:[String: Any] = ["orderId":brotherInfo.orderId,
"relation":brotherInfo.relationType.rawValue,
let dict:[String: Any] = ["order_id":orderId,
"relation":brotherInfo.relation,
"step":brotherInfo.step,
"next":false,
"next":isSubmit,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in
if success {
self.familyRequest.addOrSaveFamilyMember(params:dict, isShowLoading: isLoading) { success, error in
if isLoading {
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
if let callBack = callBack {
callBack(success, error?.errorMsg)
}
}
}
// 静默保存 不显示toast和loading
func saveInfoSilent() {
guard let brotherInfo = brotherInfo else { return }
if brotherInfo.id == 0 { return }
saveInfo(isSubmit: false, isLoading: false, callBack: nil)
}
}
......@@ -12,10 +12,9 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
var familyMember:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var certificates:YHCertificates = YHCertificates()
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
// 是否显示未填写错误提示
var isNeedShowError = false
lazy var tableView: UITableView = {
......@@ -45,9 +44,8 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "证件信息填写".local
createUI()
loadCertificateInfo()
loadInfo()
}
func createUI() {
......@@ -63,81 +61,51 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
}
guard let familyMember = familyMember else { return }
if let cer = familyMember.certificates {
certificates = cer
} else {
certificates.cnIdentityCard = YHCNIdentityCard()
certificates.passport = YHCNIdentityCard()
if familyMember.isHandled == 1 { // 要办理港澳通行证
certificates.hkMacaoPass = YHCNIdentityCard()
}
}
loadCertificateInfo()
loadInfo()
}
func loadCertificateInfo() {
func loadInfo() {
guard let familyMember = familyMember else { return }
items.removeAll()
// 中国身份证 信息必有
let title0 = YHFormTitleItem(type: .chinaIdCardInfo)
let item01 = YHFormDetailItem(type: .chinaIdentityCardNumber)
let item02 = YHFormDetailItem(type: .certificateSignPlace)
let item03 = YHFormDetailItem(type: .certificateSignDate)
let item04 = YHFormDetailItem(type: .certificateValidDate)
let item01 = YHFormDetailItem(type: .chinaIdentityCardNumber, value:familyMember.certificates.cnIdentityCard.number, tips: "请输入中国身份证号".local)
let item02 = YHFormDetailItem(type: .certificateSignPlace, value:familyMember.certificates.cnIdentityCard.issueAt, tips: "请输入签发地".local)
let item03 = YHFormDetailItem(type: .certificateSignDate, value:familyMember.certificates.cnIdentityCard.issueDateStartAt, tips: "请选择签发日期".local)
let item04 = YHFormDetailItem(type: .certificateValidDate, value:familyMember.certificates.cnIdentityCard.issueDateEndAt, tips: "请选择签发日期".local)
let arr0:[YHFormItemProtocol] = [title0, item01, item02, item03, item04]
items.append(arr0)
if let cnIdentityCard = certificates.cnIdentityCard {
item01.value = cnIdentityCard.number
item02.value = cnIdentityCard.issueAt
item03.value = cnIdentityCard.issueDateStartAt
item04.value = cnIdentityCard.issueDateEndAt
}
// 港澳通行证 非必须
if certificates.hkMacaoPass != nil {
if familyMember.isNeedHandleHKPassPort() {
let title1 = YHFormTitleItem(type: .hkAndMacaoPassport)
let item10 = YHFormDetailItem(type: .traverlPassportNumber)
let item11 = YHFormDetailItem(type: .certificateSignPlace)
let item12 = YHFormDetailItem(type: .certificateSignDate)
let item13 = YHFormDetailItem(type: .certificateValidDate)
let item10 = YHFormDetailItem(type: .traverlPassportNumber, value: familyMember.certificates.hkMacaoPass.number, tips:"请输入旅行证件号码".local)
let item11 = YHFormDetailItem(type: .certificateSignPlace, value: familyMember.certificates.hkMacaoPass.issueAt, tips:"请输入签发地".local)
let item12 = YHFormDetailItem(type: .certificateSignDate, value: familyMember.certificates.hkMacaoPass.issueDateStartAt, tips:"请选择签发日期".local)
let item13 = YHFormDetailItem(type: .certificateValidDate, value: familyMember.certificates.hkMacaoPass.issueDateEndAt, tips:"请选择届满日期".local)
let arr1:[YHFormItemProtocol] = [title1, item10, item11, item12, item13]
items.append(arr1)
if let hkMacaoPass = certificates.hkMacaoPass {
item10.value = hkMacaoPass.number
item11.value = hkMacaoPass.issueAt
item12.value = hkMacaoPass.issueDateStartAt
item13.value = hkMacaoPass.issueDateEndAt
}
}
// 护照及其他旅行证件 信息必有
let title2 = YHFormTitleItem(type: .passPortOrTravelInfo)
let item20 = YHFormDetailItem(type: .certificateType, isNeed: false)
let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: false)
let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: false)
let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: false)
let item24 = YHFormDetailItem(type: .certificateValidDate, isNeed: false)
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24]
items.append(arr2)
if let passport = certificates.passport {
item20.value = String(passport.passportType)
item21.value = passport.number
item22.value = passport.issueAt
item23.value = passport.issueDateStartAt
item24.value = passport.issueDateEndAt
}
// 证件类别名称
var selectType:YHFormPickerViewSubType = .certificate(.passport)
if let passPortType = self.familyMember?.certificates?.passport?.passportType,
let subType = YHPickerViewCertificateType(rawValue: passPortType)
{
selectType = YHFormPickerViewSubType.certificate(subType)
}
item20.value = selectType.title
var value = ""
let passPortType = self.familyMember?.certificates.passport.passPortType ?? 0
if let item = YHSheetPickerView.getItem(type:.certificate, index:passPortType) {
value = item.title
}
let item20 = YHFormDetailItem(type: .certificateType, isNeed: false, value:value, tips:"请选择证件类别".local)
let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: false, value: familyMember.certificates.passport.number, tips: "请输入证件号码".local)
let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: false, value: familyMember.certificates.passport.issueAt, tips:"请输入签发地".local)
let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: false, value:familyMember.certificates.passport.issueDateStartAt, tips:"请选择签发日期".local)
let item24 = YHFormDetailItem(type: .certificateValidDate, isNeed: false, value:familyMember.certificates.passport.issueDateEndAt,tips:"请选择届满日期".local)
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24]
items.append(arr2)
tableView.reloadData()
}
......@@ -181,33 +149,35 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
if detailItem.type == .chinaIdentityCardNumber {
self.familyMember?.certificates?.cnIdentityCard?.number = text
self.familyMember?.certificates.cnIdentityCard.number = text ?? ""
} else if detailItem.type == .traverlPassportNumber {
self.familyMember?.certificates?.hkMacaoPass?.number = text
self.familyMember?.certificates.hkMacaoPass.number = text ?? ""
} else if detailItem.type == .certificateNumber {
self.familyMember?.certificates?.passport?.number = text
self.familyMember?.certificates.passport.number = text ?? ""
} else if detailItem.type == .certificateSignPlace { // 签发地
if title.type == .chinaIdCardInfo {
self.familyMember?.certificates?.cnIdentityCard?.issueAt = text
self.familyMember?.certificates.cnIdentityCard.issueAt = text ?? ""
} else if title.type == .hkAndMacaoPassport {
self.familyMember?.certificates?.hkMacaoPass?.issueAt = text
self.familyMember?.certificates.hkMacaoPass.issueAt = text ?? ""
} else if title.type == .passPortOrTravelInfo {
self.familyMember?.certificates?.passport?.issueAt = text
self.familyMember?.certificates.passport.issueAt = text ?? ""
}
}
if isEditEnd {
self.loadInfo()
self.save()
}
}
......@@ -220,15 +190,37 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell
}
if detailItem.type == .certificateValidDate {
if detailItem.type == .certificateValidDate { // 届满日期
if title.type == .chinaIdCardInfo { // 身份证
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemExpireDateCell.cellReuseIdentifier, for: indexPath) as! YHFormItemExpireDateCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = (detailItem.value == YHCNIdentityCard.longTime ? "" : detailItem.value)
cell.isLongTime = (detailItem.value == YHCNIdentityCard.longTime)
cell.clickBlock = {
[weak self] isLongTime in
guard let self = self else { return }
if title.type == .chinaIdCardInfo {
self.familyMember?.certificates.cnIdentityCard.issueDateEndAt = (isLongTime ? YHCNIdentityCard.longTime : "")
loadInfo()
save()
}
}
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell
}
}
......@@ -251,21 +243,8 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
......@@ -296,44 +275,40 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
let title = arr[0] as! YHFormTitleItem
if detailItem.type == .certificateValidDate ||
detailItem.type == .certificateSignDate { // 届满日期 签发日期
self.view?.endEditing(true)
YHDatePickView.show(type: .yyyymmdd) { [weak self] date in
YHDatePickView.show(type: .yyyymmdd) {
[weak self] date in
let dataArr = date.components(separatedBy: YHDatePickView.separator)
print(dataArr)
guard let self = self else { return }
guard let familyMember = self.familyMember else { return }
var certificate = familyMember.certificates?.cnIdentityCard
var certificate = familyMember.certificates.cnIdentityCard
if title.type == .chinaIdCardInfo {
certificate = familyMember.certificates?.cnIdentityCard
certificate = familyMember.certificates.cnIdentityCard
} else if title.type == .hkAndMacaoPassport {
certificate = familyMember.certificates?.hkMacaoPass
certificate = familyMember.certificates.hkMacaoPass
} else if title.type == .passPortOrTravelInfo {
certificate = familyMember.certificates?.passport
certificate = familyMember.certificates.passport
}
changeCertificateDate(certificate, type: detailItem.type, date: date)
self.loadCertificateInfo()
self.loadInfo()
save()
}
} else if detailItem.type == .certificateType { // 选择证件类别
var selectType:YHFormPickerViewSubType = .certificate(.passport)
if let passPortType = self.familyMember?.certificates?.passport?.passportType,
let subType = YHPickerViewCertificateType(rawValue: passPortType)
{
selectType = YHFormPickerViewSubType.certificate(subType)
}
YHFormPickerView.show(type: .certificate, selectType:selectType) {
[weak self] selectType in
let type = self.familyMember?.certificates.passport.passPortType ?? 0
YHSheetPickerView.show(type: .certificate, selectIndex:type) {
[weak self] selectItem in
guard let self = self else { return }
self.familyMember?.certificates?.passport?.passportType = selectType.index
self.loadCertificateInfo()
self.familyMember?.certificates.passport.passPortType = selectItem.index
self.loadInfo()
self.save()
}
}
......@@ -343,9 +318,10 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
func changeCertificateDate(_ certificate:YHCNIdentityCard?, type:YHFormDetailItemType, date:String?) {
if type == .certificateSignDate {
certificate?.issueDateStartAt = date
certificate?.issueDateStartAt = date ?? ""
} else if type == .certificateValidDate {
certificate?.issueDateEndAt = date
certificate?.issueDateEndAt = date ?? ""
}
}
......@@ -367,12 +343,49 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
}
func save() {
if let delegate = delegate {
delegate.saveInfo?()
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.saveInfoSilent)) {
delegate.saveInfoSilent()
}
}
func nextStep()->Bool {
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let familyMember = familyMember else { return false}
// 验证身份证
if familyMember.certificates.cnIdentityCard.number.count <= 0
|| familyMember.certificates.cnIdentityCard.issueAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateStartAt.count <= 0
|| familyMember.certificates.cnIdentityCard.issueDateEndAt.count <= 0
{
return false
}
if familyMember.isNeedHandleHKPassPort() {
// 如果选了办理过港澳通行证,则需要验证港澳通行证
if familyMember.certificates.hkMacaoPass.number.count <= 0
|| familyMember.certificates.hkMacaoPass.issueAt.count <= 0
|| familyMember.certificates.hkMacaoPass.issueDateStartAt.count <= 0
|| familyMember.certificates.hkMacaoPass.issueDateEndAt.count <= 0
|| familyMember.certificates.hkMacaoPass.passPortType == -1
{
return false
}
}
return true
}
func nextStep() -> Bool {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return false
}
return true
}
}
......
//
// YHCertificateUploadVC.swift
// galaxy
//
// Created by edy on 2024/2/26.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateUploadVC: YHBaseViewController, YHFamilyMemberProtol {
var tableView: UITableView!
var familyMember:YHFamilyMember? {
didSet {
if let familyMember = familyMember {
viewModel.mainModel = familyMember
}
}
}
var viewModel: YHFamilyMemberViewModel = YHFamilyMemberViewModel()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
createUI()
}
func loadInfo() {
self.tableView.reloadData()
}
func nextStep()->Bool {
return true
}
func createUI() {
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: YHIdentityCardCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + YHStepView.height)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.bottom.equalTo(view)
}
}
}
extension YHCertificateUploadVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return viewModel.getIDCardDataSource(false).count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHIdentityCardCell.self)
cell.type = YHCardType(rawValue: indexPath.row) ?? .identity
cell.viewModel = viewModel
cell.informationBlock = {[weak self] type, image, isLeft in
guard let self = self else { return }
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 217.0
}
}
......@@ -559,6 +559,7 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
// 兄弟姐妹
if detailItem.relationType == .brother {
let vc = YHBrotherInfoVC()
vc.orderId = orderId
vc.brotherInfo = detailItem
self.navigationController?.pushViewController(vc)
return
......
......@@ -20,6 +20,7 @@ class YHParentInfoVC: YHBaseViewController {
var bottomView: YHSaveAndSubmitView = {
let view = YHSaveAndSubmitView.createView()
view.isHiddenSave = true
view.changeRightBtnTitle("保存")
return view
}()
......@@ -53,7 +54,7 @@ class YHParentInfoVC: YHBaseViewController {
gk_navTitle = parentInfo.relationType == .father ? "父亲信息填写".local : "母亲信息填写".local
}
createUI()
loadBasicInfo()
loadInfo()
}
func createUI() {
......@@ -64,7 +65,12 @@ class YHParentInfoVC: YHBaseViewController {
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
self.submitInfo()
self.saveInfo(isSubmit: true, isLoading: true) {
[weak self] success, msg in
if success {
self?.navigationController?.popViewController(animated: true)
}
}
}
bottomView.snp.makeConstraints { make in
......@@ -79,11 +85,11 @@ class YHParentInfoVC: YHBaseViewController {
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
}
loadBasicInfo()
loadInfo()
}
func loadBasicInfo() {
func loadInfo() {
guard let parentInfo = parentInfo else { return }
......@@ -100,41 +106,31 @@ class YHParentInfoVC: YHBaseViewController {
var arr1 = [YHFormItemProtocol]()
if parentInfo.relationType == .father { // 父亲
let title1 = YHFormTitleItem(type: .fatherInfo)
let item10 = YHFormDetailItem(type: .fatherName)
item10.value = parentInfo.subsetName
item10.tips = "请输入姓名".local
item10.placeHolder = "请输入姓名".local
let item10 = YHFormDetailItem(type: .fatherName, value:parentInfo.subsetName, tips:"请输入姓名".local)
arr1.append(title1)
arr1.append(item10)
} else { // 母亲
let title1 = YHFormTitleItem(type: .motherInfo)
let item10 = YHFormDetailItem(type: .motherName)
item10.value = parentInfo.subsetName
item10.tips = "请输入姓名".local
item10.placeHolder = "请输入姓名".local
let item10 = YHFormDetailItem(type: .motherName, value:parentInfo.subsetName, tips:"请输入姓名".local)
arr1.append(title1)
arr1.append(item10)
}
let item11 = YHFormDetailItem(type: .birthday)
item11.value = parentInfo.birthday
item11.tips = "请选择生日日期".local
let item12 = YHFormDetailItem(type: .birthNation)
item12.value = String(parentInfo.isBirthOverSeas())
let item13 = YHFormDetailItem(type: .birthCity)
let item11 = YHFormDetailItem(type: .birthday, value:parentInfo.birthday, tips:"请选择生日日期".local)
let item12 = YHFormDetailItem(type: .birthNation, value:String(parentInfo.isBirthOverSeas()))
var cityValue = parentInfo.birthPlace.area.joined(separator: ",")
var cityPlaceHolder = "请选择".local
var cityTips = "请选择城市".local
if parentInfo.isBirthOverSeas() {
item13.value = parentInfo.birthPlace.foreign
item13.placeHolder = "请输入".local
item13.tips = "请输入城市".local
} else {
item13.value = parentInfo.birthPlace.area.joined(separator: ",")
item13.placeHolder = "请选择".local
item13.tips = "请选择城市".local
cityValue = parentInfo.birthPlace.foreign
cityPlaceHolder = "请输入".local
cityTips = "请输入城市".local
}
let item13 = YHFormDetailItem(type: .birthCity, value:cityValue,placeHolder:cityPlaceHolder, tips:cityTips)
let arr:[YHFormItemProtocol] = [item11, item12, item13]
arr1.append(contentsOf: arr)
......@@ -143,33 +139,22 @@ class YHParentInfoVC: YHBaseViewController {
}
if !parentInfo.isDead() { // 健在
let item14 = YHFormDetailItem(type: .marriageState)
item14.value = parentInfo.married
item14.placeHolder = "请选择".local
item14.tips = "请选择".local
let item14 = YHFormDetailItem(type: .marriageState, value:parentInfo.married, tips:"请选择婚姻状况".local)
arr1.append(item14)
// 职业信息
let title2 = YHFormTitleItem(type: .occupationInfo)
let item20 = YHFormDetailItem(type: .occupation)
item20.value = parentInfo.occupation
item20.placeHolder = "请选择".local
item20.tips = "请选择".local
let item20 = YHFormDetailItem(type: .occupation, value:parentInfo.occupation, tips:"请选择职业".local)
var arr2:[YHFormItemProtocol] = [title2, item20]
if parentInfo.isNowHaveJob() {
let item21 = YHFormDetailItem(type: .occupationName)
item21.value = parentInfo.occupationName
item21.placeHolder = "请输入".local
item21.tips = "请输入".local
let item21 = YHFormDetailItem(type: .occupationName, value:parentInfo.occupationName, tips:"请输入职业名称".local)
arr2.append(item21)
}
// 居住信息
let title3 = YHFormTitleItem(type: .liveInfo)
let item30 = YHFormDetailItem(type: .liveNationOrArea)
item30.value = parentInfo.liveCountry
item30.tips = "请选择国家/地区".local
let item30 = YHFormDetailItem(type: .liveNationOrArea, value:parentInfo.liveCountry, tips:"请选择国家/地区".local)
let arr3:[YHFormItemProtocol] = [title3, item30]
// 香港身份证
......@@ -179,9 +164,7 @@ class YHParentInfoVC: YHBaseViewController {
var arr4:[YHFormItemProtocol] = [title4, item40]
if parentInfo.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber)
item41.value = parentInfo.hkIdentityCard
item41.tips = "请输入正确的香港身份证号码".local
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber, value:parentInfo.hkIdentityCard, tips: "请输入正确的香港身份证号码".local)
arr4.append(item41)
}
items.append(contentsOf: [arr0, arr1, arr2, arr3, arr4])
......@@ -311,8 +294,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
}
if isEditEnd {
self.loadBasicInfo()
self.submitInfo()
self.loadInfo()
saveInfoSilent()
}
}
return cell
......@@ -347,7 +330,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
let selectItem = answers[index]
self.parentInfo?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .isHaveHkIdentityCard { // 是否办理过香港身份证
var select = false
......@@ -364,7 +348,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .isHaveHkIdentityCard {
self.parentInfo?.setHaveHKIdentityCard(selectItem.title == "是".local)
}
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
}
......@@ -382,11 +367,13 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: !isDead),
YHFormChoiceItem(title: "已故".local, isSelect: isDead)]
cell.answerArr = answers
cell.answerBlock = { [weak self]
(arr, selectIndex) in
cell.answerBlock = {
[weak self] (arr, selectIndex) in
guard let self = self else { return }
let selectItem:YHFormChoiceItem = arr[selectIndex]
self?.parentInfo?.setIsDead(selectItem.title == "已故")
self?.loadBasicInfo()
self.parentInfo?.setIsDead(selectItem.title == "已故")
self.loadInfo()
saveInfoSilent()
}
return cell
}
......@@ -409,25 +396,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormAddItem {
return 70.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......@@ -455,7 +425,8 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .birthday {
self.parentInfo?.birthday = date
}
self.loadBasicInfo()
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .birthCity { // 出生城市
......@@ -472,38 +443,42 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.birthPlace.area = [string2, string3, string4]
self.loadBasicInfo()
self.parentInfo?.birthPlace.area = [string2, string3]
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
} else if detailItem.type == .occupation { // 职业
let occupation = self.parentInfo?.occupation ?? ""
YHFormPickerView.show(type: .occupation, selectTitle:occupation ) {
[weak self] selectType in
YHSheetPickerView.show(type: .occupation, selectTitle:occupation) {
[weak self] selectItem in
guard let self = self else { return }
self.parentInfo?.occupation = selectType.title
self.loadBasicInfo()
self.parentInfo?.occupation = selectItem.title
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .marriageState { // 婚姻
let marriage = self.parentInfo?.married
YHFormPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectType in
YHSheetPickerView.show(type: .marriage, selectTitle:self.parentInfo?.married) {
[weak self] selectItem in
guard let self = self else { return }
self.parentInfo?.married = selectType.title
self.loadBasicInfo()
self.parentInfo?.married = selectItem.title
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
let vc = YHAddressViewController()
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
[weak self] string in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.liveCountry = string2
self.loadBasicInfo()
self.parentInfo?.liveCountry = string
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
self.navigationController?.pushViewController(vc, animated: true)
}
}
}
......@@ -580,17 +555,20 @@ extension YHParentInfoVC {
return true
}
func submitInfo() {
// isSubmit 是否是提交 isSilent:是否显示toast
func saveInfo(isSubmit:Bool, isLoading:Bool, callBack:((Bool, String?)->Void)?) {
// let isChecked = checkIntegrity()
// isNeedShowError = !isChecked
//
// self.tableView .reloadData()
//
// if !isChecked {
// YHHUD.flash(message: "资料还未填完")
// return
// }
if isSubmit {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return
}
}
guard let parentInfo = parentInfo else { return }
guard let info = parentInfo.toDictionary() else { return }
......@@ -598,13 +576,23 @@ extension YHParentInfoVC {
let dict:[String: Any] = ["order_id":orderId,
"relation":parentInfo.relation,
"step":parentInfo.step,
"next":false,
"next":isSubmit,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in
self.familyRequest.addOrSaveFamilyMember(params:dict, isShowLoading: isLoading) { success, error in
if isLoading {
YHHUD.flash(message: success ? "保存成功" : "保存失败")
}
if let callBack = callBack {
callBack(success, error?.errorMsg)
}
}
}
// 静默保存 不显示toast和loading
func saveInfoSilent() {
guard let parentInfo = parentInfo else { return }
if parentInfo.id == 0 { return }
saveInfo(isSubmit: false, isLoading: false, callBack: nil)
}
}
......@@ -399,9 +399,12 @@ class YHFormDetailItem : YHFormItemProtocol {
return true
}
init(type: YHFormDetailItemType, isNeed:Bool = true) {
init(type: YHFormDetailItemType, isNeed:Bool = true, value:String? = "", placeHolder:String? = "", tips:String? = "") {
self.type = type
self.isNeed = isNeed
self.value = value
self.placeHolder = placeHolder
self.tips = tips
}
......@@ -912,7 +915,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var step: Int = 0
var isHandled: Int = 0
var notFillNumber: Int = -1
var certificates: YHCertificates?
var certificates: YHCertificates = YHCertificates()
var usedName: String = ""
var hkIdentityOther: String = ""
var isHkHandled: Int = 0
......@@ -1041,12 +1044,11 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
}
// 是否拥有学位
func haveDegreeName() -> String? {
func hasDegreeName() -> String {
if hasDegree == "1" {
return "有学位"
} else {
return "无学位"
return "有学位".local
}
return "无学位".local
}
func isHaveDegree() ->Bool {
......@@ -1098,6 +1100,15 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
return ""
}
func setSexName(_ sexName:String?) {
guard let sexName = sexName else { return }
if sexName == "男".local {
self.sex = 1
} else if sexName == "女".local {
self.sex = 2
}
}
// 是否前一次婚姻子女
func isPreviousMarriageChild() -> Bool {
return self.childStepchild.has == "Y"
......@@ -1183,6 +1194,24 @@ class YHAddress: SmartCodable {
required init() {
}
// 是否在中国
func isInChina() ->Bool {
// 默认在中国
if isEmptyString(country) { return true }
if country.contains("中国") {
return true
}
return false
}
// 清空地址信息
func clearAddress() {
self.area = []
self.country = ""
self.details = ""
self.foreign = ""
}
}
// MARK: - YHChildStepchildClass
......@@ -1218,9 +1247,9 @@ class YHSubsetNamePinyin: SmartCodable {
// MARK: - YHCertificates
class YHCertificates: SmartCodable {
var cnIdentityCard: YHCNIdentityCard?
var passport: YHCNIdentityCard?
var hkMacaoPass: YHCNIdentityCard?
var cnIdentityCard: YHCNIdentityCard = YHCNIdentityCard()
var passport: YHCNIdentityCard = YHCNIdentityCard()
var hkMacaoPass: YHCNIdentityCard = YHCNIdentityCard()
enum CodingKeys: String, CodingKey {
case cnIdentityCard = "cnIdentityCard"
......@@ -1231,25 +1260,20 @@ class YHCertificates: SmartCodable {
required init() {
}
init(cnIdentityCard: YHCNIdentityCard?, passport: YHCNIdentityCard?, hkMacaoPass: YHCNIdentityCard?) {
self.cnIdentityCard = cnIdentityCard
self.passport = passport
self.hkMacaoPass = hkMacaoPass
}
}
// MARK: - YHCNIdentityCard
class YHCNIdentityCard: SmartCodable {
static let longTime = "8888-01-01"
var id: Int = 0
var number: String?
var issueAt: String?
var issueDateStartAt: String?
var issueDateEndAt: String?
var imgFront: String?
var imgBack: String?
var passportType: Int = 0
var number: String = ""
var issueAt: String = ""
var issueDateStartAt: String = ""
var issueDateEndAt: String = ""
var imgFront: String = ""
var imgBack: String = ""
var passPortType: Int = -1
enum CodingKeys: String, CodingKey {
case id = "id"
......@@ -1259,22 +1283,12 @@ class YHCNIdentityCard: SmartCodable {
case issueDateEndAt = "issue_date_end_at"
case imgFront = "img_front"
case imgBack = "img_back"
case passportType = "passport_type"
case passPortType = "pass_port_type"
}
required init() {
}
init(id:Int, number: String?, issueAt:String?, issueDateStartAt: String?, imgFront: String?, imgBack: String?, passportType: Int) {
self.id = id
self.number = number
self.issueAt = issueAt
self.issueDateStartAt = issueDateStartAt
self.imgFront = imgFront
self.imgBack = imgBack
self.passportType = passportType
}
}
// MARK: - YHHasDegreeJson
......
//
// YHFamilyMemberViewModel.swift
// galaxy
//
// Created by edy on 2024/3/2.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import Alamofire
class YHFamilyMemberViewModel {
var mainModel: YHFamilyMember = YHFamilyMember()
func getIDCardDataSource(_ isShowPrompt: Bool) -> [YHSectionItemModel] {
let item = YHItemModel(id: .id5, isNeed: true, title: "身份证", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt)
let section = YHSectionItemModel(title: "中国身份证(选填)", models: [item])
let item1 = YHItemModel(id: .id6, isNeed: true, title: "港澳通行证(选填)", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt)
let section1 = YHSectionItemModel(title: "中国身份证(选填)", models: [item1])
if mainModel.isNeedHandleHKPassPort() {
return [section, section1]
} else {
return [section]
}
}
func updateModel(_ item: YHItemModel) {
guard let type = item.id else { return }
if item.id == .id8 {
mainModel.certificates.cnIdentityCard.number = item.message ?? ""
} else if item.id == .id9 {
mainModel.certificates.cnIdentityCard.issueAt = item.message ?? ""
} else if item.id == .id10 {
mainModel.certificates.cnIdentityCard.issueDateStartAt = item.message ?? ""
} else if item.id == .id11 {
mainModel.certificates.cnIdentityCard.issueDateEndAt = item.message ?? ""
} else if item.id == .id12 {
mainModel.certificates.hkMacaoPass.number = item.message ?? ""
} else if item.id == .id13 {
mainModel.certificates.hkMacaoPass.issueAt = item.message ?? ""
} else if item.id == .id14 {
mainModel.certificates.hkMacaoPass.issueDateStartAt = item.message ?? ""
} else if item.id == .id15 {
mainModel.certificates.hkMacaoPass.issueDateEndAt = item.message ?? ""
} else if item.id == .id16 {
// mainModel.certificates.passport.passportType = item.value?.first ?? ""
} else if item.id == .id17 {
mainModel.certificates.passport.number = item.message ?? ""
} else if item.id == .id18 {
mainModel.certificates.passport.issueAt = item.message ?? ""
} else if item.id == .id19 {
mainModel.certificates.passport.issueDateStartAt = item.message ?? ""
} else if item.id == .id20 {
mainModel.certificates.passport.issueDateEndAt = item.message ?? ""
}
}
// 更新身份证
func updateModel(_ model: YHCNIDCardModel) {
if model.name.count != 0 {
mainModel.subsetName = model.name
}
if model.birth.count != 0 {
mainModel.birthday = model.birth.toTimeString()
}
if model.gender.count != 0 {
if model.gender == "女" {
mainModel.setMale(false)
} else {
mainModel.setMale(true)
}
}
if model.term_begins.count != 0 {
mainModel.certificates.hkMacaoPass.issueDateStartAt = model.term_begins.toTimeString()
}
if model.end_of_term.count != 0 {
mainModel.certificates.hkMacaoPass.issueDateEndAt = model.end_of_term.toTimeString()
}
if model.issuing_authority.count != 0 {
mainModel.certificates.hkMacaoPass.issueAt = model.issuing_authority
}
if model.card_num.count != 0 {
mainModel.certificates.hkMacaoPass.number = model.card_num
}
}
// 更新港澳通行证
func updateModel(_ model: YHHKIDCardModel) {
if model.name.count != 0 {
mainModel.subsetName = model.name
}
if model.birth.count != 0 {
mainModel.birthday = model.birth.toTimeString()
}
if model.gender.count != 0 {
if model.gender == "女" {
mainModel.setMale(false)
} else {
mainModel.setMale(true)
}
}
if model.term_begins.count != 0 {
mainModel.certificates.hkMacaoPass.issueDateStartAt = model.term_begins.toTimeString()
}
if model.end_of_term.count != 0 {
mainModel.certificates.hkMacaoPass.issueDateEndAt = model.end_of_term.toTimeString()
}
if model.issuing_authority.count != 0 {
mainModel.certificates.hkMacaoPass.issueAt = model.issuing_authority
}
if model.card_num.count != 0 {
mainModel.certificates.hkMacaoPass.number = model.card_num
}
}
func updateModel(_ type: YHCardType, isFront: Bool, url: String) {
switch type {
case .identity:
if isFront {
mainModel.certificates.cnIdentityCard.imgFront = url
} else {
mainModel.certificates.cnIdentityCard.imgBack = url
}
case .passport:
if isFront {
mainModel.certificates.hkMacaoPass.imgFront = url
} else {
mainModel.certificates.hkMacaoPass.imgBack = url
}
}
}
// 上传方法
func uploadImage(_ image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let strUrl = "https://test-comserver.galaxy-immi.com/oss/upload/storage"
let boundary = UUID().uuidString
let headers: HTTPHeaders = [
"Content-type": "multipart/form-data; boundary=\(boundary)",
"businessCode": "4001001"
]
let _ = YHNetRequest.uplaodRequest(url: strUrl, headers: headers, image: image) { [weak self] json, code in
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(json.data as? String, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(nil, error)
}
} failBlock: { err in
callBackBlock(nil, err)
}
}
func getPublicImageUrl(_ url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let strUrl = "https://test-comserver.galaxy-immi.com/oss/storage/convertToPublicURL" + "?fileUrl=\(url)"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(json.data as? String, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(nil, error)
}
} failBlock: { err in
callBackBlock(nil,err)
}
}
func requestCnIDCardMessage(_ url: String, callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.cnIdCard
let params: [String : Any] = ["url": url]
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHCNIDCardModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false, nil)
return
}
self.updateModel(result)
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
func requestHkIDCardMessage(_ url: String, callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.hkIdCard
let params: [String : Any] = ["url": url]
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHHKIDCardModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false, nil)
return
}
self.updateModel(result)
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
......@@ -14,8 +14,8 @@ class YHFamilyRequestViewModel {
//请求所有家庭成员信息
func getFamilyInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
// let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
// let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
YHHUD.show(.progress(message: "数据加载中..."))
......@@ -41,15 +41,20 @@ class YHFamilyRequestViewModel {
}
// 添加家庭成员
func addOrSaveFamilyMember(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
func addOrSaveFamilyMember(params:[String:Any], isShowLoading:Bool = true, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
if isShowLoading {
YHHUD.show(.progress(message: "数据加载中..."))
}
let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Family.familyInfoApi
// let strUrl = "http://192.168.34.187:8808/" + YHAllApiName.Family.familyInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
if isShowLoading {
YHHUD.hide()
}
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
......
......@@ -108,9 +108,9 @@ enum YHPicerViewProfessionType: Int {
enum YHPickerViewGenderType: Int {
// 男
case male = 0
case male = 1
// 女
case female = 1
case female = 2
}
enum YHPickerViewCertificateType: Int {
......
......@@ -10,14 +10,15 @@
/*
// (1) 直接传index 此处的index是后台的数值,并非行数
YHSheetPickerView.show(type: .degree, selectIndex: 1) {
selectItem in
YHSheetPickerView.show(type: .occupation, selectIndex:0) {
[weak self] selectItem in
guard let self = self else { return }
}
// (2) 直接传字符串值
YHSheetPickerView.show(type: .degree, selectTitle:"博士学位") {
selectItem in
YHSheetPickerView.show(type: .occupation, selectTitle:"在职") {
[weak self] selectItem in
guard let self = self else { return }
}
// 如何扩展新类型
......@@ -124,7 +125,7 @@ class YHSheetPickerView: UIView {
}
func showSelectRow() {
if let arr = dataSource[type], selectRow < arr.count {
if let arr = Self.dataSource[type], selectRow < arr.count {
pickerView.selectRow(selectRow, inComponent: 0, animated: true)
} else {
......@@ -148,16 +149,16 @@ class YHSheetPickerView: UIView {
picker.show()
}
lazy var dataSource:[YHSheetPickerViewType: [YHSheetPickerViewItem]] = {
return [
static var dataSource:[YHSheetPickerViewType: [YHSheetPickerViewItem]] =
[
// 默认无
.none:[],
// 学位
.degree:
[YHSheetPickerViewItem(title:"学士学位".local, index:0),
YHSheetPickerViewItem(title:"硕士学位".local, index:1),
YHSheetPickerViewItem(title:"博士学位".local, index:2)
[YHSheetPickerViewItem(title:"学士学位".local, index:1),
YHSheetPickerViewItem(title:"硕士学位".local, index:2),
YHSheetPickerViewItem(title:"博士学位".local, index:3)
],
// 婚姻
......@@ -202,8 +203,8 @@ class YHSheetPickerView: UIView {
// 性别
.gender:
[YHSheetPickerViewItem(title:"男".local, index:0),
YHSheetPickerViewItem(title:"女".local, index:1),
[YHSheetPickerViewItem(title:"男".local, index:1),
YHSheetPickerViewItem(title:"女".local, index:2),
],
// 证件
......@@ -235,8 +236,8 @@ class YHSheetPickerView: UIView {
// 学位颁发地区
.degreeLocation:
[YHSheetPickerViewItem(title:"国内 (颁发)".local, index:0),
YHSheetPickerViewItem(title:"国外 (颁发)".local, index:1),
[YHSheetPickerViewItem(title:"国内 (颁发)".local, index:1),
YHSheetPickerViewItem(title:"国外 (颁发)".local, index:2),
],
// 专业证书
......@@ -272,7 +273,6 @@ class YHSheetPickerView: UIView {
YHSheetPickerViewItem(title:"其他".local, index:10),
],
]
}()
func createUI() {
......@@ -370,7 +370,7 @@ extension YHSheetPickerView {
// 返回所在行的数据
func getPickerViewItem(row:Int) -> YHSheetPickerViewItem? {
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
for (index, item) in arr.enumerated() {
if index == row {
return item
......@@ -382,7 +382,7 @@ extension YHSheetPickerView {
// 返回对应index的数据所在行
func getRowOfPickerViewItem(index:Int) -> Int {
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
for (row, item) in arr.enumerated() {
if item.index == index {
return row
......@@ -396,7 +396,7 @@ extension YHSheetPickerView {
func getRowOfPickerViewItem(title:String?) -> Int {
guard let title = title else { return 0 }
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
for (row, item) in arr.enumerated() {
if item.title == title {
return row
......@@ -406,6 +406,29 @@ extension YHSheetPickerView {
return 0
}
// 根据index获取item
static func getItem(type:YHSheetPickerViewType, index:Int)-> YHSheetPickerViewItem? {
if let arr = dataSource[type], arr.count > 0 {
for item in arr {
if item.index == index {
return item
}
}
}
return nil
}
// 根据名称获取item
static func getItem(type:YHSheetPickerViewType, title:String)-> YHSheetPickerViewItem? {
if let arr = dataSource[type], arr.count > 0 {
for item in arr {
if item.title == title {
return item
}
}
}
return nil
}
}
// MARK: - UIPickerViewDelegate
......@@ -416,14 +439,14 @@ extension YHSheetPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
if let arr = dataSource[type], !arr.isEmpty {
if let arr = Self.dataSource[type], !arr.isEmpty {
return arr.count
}
return 0
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
if 0 <= row && row < arr.count {
let item :YHSheetPickerViewItem = arr[row]
return item.title
......@@ -433,7 +456,7 @@ extension YHSheetPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
if 0 <= row && row < arr.count {
let item :YHSheetPickerViewItem = arr[row]
print(item.title)
......@@ -458,7 +481,7 @@ extension YHSheetPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
label.numberOfLines = 2
label.font = UIFont.PFSC_R(ofSize: 14)
label.text = ""
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
if 0 <= row && row < arr.count {
let item :YHSheetPickerViewItem = arr[row]
label.text = item.title
......
......@@ -35,7 +35,7 @@ class YHFormItemDegreeInfoCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
if isNeed {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
}
titleLabel.attributedText = questionAttrStr
......@@ -57,6 +57,11 @@ class YHFormItemDegreeInfoCell: UITableViewCell {
}
}
func showTips(isShowDegreeTips:Bool, isShowPlaceTips:Bool) {
degreeView.setTips("请选择学位".local, isShow:isShowDegreeTips)
areaView.setTips("请选择颁发地区".local, isShow: isShowPlaceTips)
}
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor
......@@ -163,7 +168,7 @@ class HKDegreeInfoItemView: UIView {
.foregroundColor: UIColor.mainTextColor]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
} else {
......
......@@ -49,7 +49,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
}
titleLabel.attributedText = questionAttrStr
......
......@@ -44,7 +44,7 @@ class YHFormItemEnterDetailCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
......
......@@ -20,7 +20,7 @@ class YHFormItemExpireDateCell: UITableViewCell {
var isMust = false
var placeHolder:String? = "请选择"
var clickBlock:(()->Void)?
var clickBlock:((Bool)->Void)?
// 是否隐藏顶部分割线
var isHiddenTopLine:Bool = false {
didSet {
......@@ -38,7 +38,7 @@ class YHFormItemExpireDateCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
......@@ -47,7 +47,7 @@ class YHFormItemExpireDateCell: UITableViewCell {
}
}
var isLontTime:Bool = false {
var isLongTime:Bool = false {
didSet {
updateUI()
}
......@@ -184,13 +184,17 @@ class YHFormItemExpireDateCell: UITableViewCell {
func updateUI() {
detailLabel.isHidden = isLontTime
tipsLabel.isHidden = isLontTime
detailLabel.isHidden = isLongTime
if isLongTime {
tipsLabel.isHidden = true
} else {
tipsLabel.isHidden = !isEmptyString(detail)
}
longTimeBtn.isSelected = isLongTime
longTimeBtn.snp.remakeConstraints { make in
make.size.equalTo(CGSizeMake(longTimeBtnWidth, 40))
make.centerY.equalToSuperview()
if isLontTime {
make.centerY.equalTo(titleLabel)
if isLongTime {
make.left.equalTo(detailLabel)
} else {
make.right.equalToSuperview().offset(-16)
......@@ -200,11 +204,10 @@ class YHFormItemExpireDateCell: UITableViewCell {
@objc func didClickLongTimeBtn() {
longTimeBtn.isSelected = !longTimeBtn.isSelected
isLontTime = longTimeBtn.isSelected
isLongTime = !isLongTime
if let clickBlock = clickBlock {
clickBlock()
clickBlock(isLongTime)
}
}
}
......@@ -35,7 +35,7 @@ class YHFormItemInputTextCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
......@@ -46,7 +46,7 @@ class YHFormItemInputTextCell: UITableViewCell {
var placeHolder:String? {
didSet {
if let placeHolder = placeHolder {
if let placeHolder = placeHolder, !placeHolder.isEmpty {
textField.attributedPlaceholder = NSAttributedString(string: placeHolder, attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
} else {
textField.attributedPlaceholder = NSAttributedString(string: "请输入", attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
......
......@@ -35,7 +35,7 @@ class YHFormItemQuestionsCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
}
titleLabel.attributedText = questionAttrStr
......
......@@ -34,7 +34,7 @@ class YHFormItemSelectSheetCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
......@@ -51,7 +51,7 @@ class YHFormItemSelectSheetCell: UITableViewCell {
detailLabel.text = detail
detailLabel.textColor = detailColor
} else {
detailLabel.text = placeHolder
detailLabel.text = isEmptyString(placeHolder) ? "请选择" : placeHolder
detailLabel.textColor = placeHolderColor
}
}
......
//
// YHIdentityCardCell.swift
// galaxy
//
// Created by edy on 2024/3/1.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
// YHMainInformationCardTableViewCell
import UIKit
class YHIdentityCardCell: UITableViewCell {
typealias InformationBlock = (_ type: YHCardType, _ image: UIImage, _ isleft: Bool) -> ()
var informationBlock: InformationBlock?
var centerView: UIView!
var titleLabel: UILabel!
var exampleButton: UIButton!
var frontLabel: UILabel!
var backSurfaceLabel: UILabel!
var frontImageButton: UIButton!
var backSurfaceImageButton: UIButton!
var frontDeleteButton: UIButton!
var backSurfaceDeleteButton: UIButton!
var activityIndicator: UIActivityIndicatorView!
var viewModel: YHFamilyMemberViewModel! {
didSet {
if type == .identity {
if viewModel.mainModel.certificates.cnIdentityCard.imgFront.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.cnIdentityCard.imgFront) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.frontImageButton.kf.setBackgroundImage(with: URL(string: success), for: .normal)
self.frontDeleteButton.isHidden = false
}
}
if viewModel.mainModel.certificates.cnIdentityCard.imgBack.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.cnIdentityCard.imgBack) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.backSurfaceImageButton.kf.setBackgroundImage(with: URL(string: success), for: .normal)
self.backSurfaceDeleteButton.isHidden = false
}
}
} else {
if viewModel.mainModel.certificates.hkMacaoPass.imgFront.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.hkMacaoPass.imgFront) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.frontImageButton.kf.setBackgroundImage(with: URL(string: success), for: .normal)
self.frontDeleteButton.isHidden = false
}
}
if viewModel.mainModel.certificates.hkMacaoPass.imgBack.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.hkMacaoPass.imgBack) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.backSurfaceImageButton.kf.setBackgroundImage(with: URL(string: success), for: .normal)
self.backSurfaceDeleteButton.isHidden = false
}
}
}
}
}
var type: YHCardType = .identity {
didSet {
switch type {
case .identity:
titleLabel.text = "中国身份证(选填)"
frontLabel.text = "身份证人像面"
backSurfaceLabel.text = "身份证国徽面"
case .passport:
titleLabel.text = "港澳通行证(选填)"
frontLabel.text = "港澳通行证正面"
backSurfaceLabel.text = "港澳通行证反面"
}
}
}
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() {
contentView.backgroundColor = .clear
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(7)
make.bottom.equalTo(-16)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(20)
}
exampleButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.08)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 10)
button.contentHorizontalAlignment = .center
button.setTitle("示例模板", for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.layer.cornerRadius = 4
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
return button
}()
centerView.addSubview(exampleButton)
exampleButton.snp.makeConstraints { make in
make.left.equalTo(titleLabel.snp.right)
make.centerY.equalTo(titleLabel.snp.centerY)
make.height.equalTo(14)
make.width.equalTo(48)
}
let lineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52)
make.height.equalTo(1)
make.right.equalTo(-18)
}
frontLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.subTextColor
label.textAlignment = .center
return label
}()
centerView.addSubview(frontLabel)
frontLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(centerView.snp.centerX)
make.top.equalTo(64)
make.height.equalTo(20)
}
backSurfaceLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.subTextColor
label.textAlignment = .center
return label
}()
centerView.addSubview(backSurfaceLabel)
backSurfaceLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(centerView.snp.centerX)
make.top.equalTo(64)
make.height.equalTo(20)
}
frontImageButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_front"), for: .normal)
button.addTarget(self, action: #selector(frontImageClick), for: .touchUpInside)
return button
}()
centerView.addSubview(frontImageButton)
frontImageButton.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(96)
make.height.equalTo(91)
make.width.equalTo(147)
}
frontDeleteButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_delete"), for: .normal)
button.addTarget(self, action: #selector(frontDeleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
centerView.addSubview(frontDeleteButton)
frontDeleteButton.snp.makeConstraints { make in
make.centerX.equalTo(frontImageButton.snp.right)
make.centerY.equalTo(frontImageButton.snp.top)
make.height.equalTo(21)
make.width.equalTo(21)
}
backSurfaceImageButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_back"), for: .normal)
button.addTarget(self, action: #selector(backSurfaceImageClick), for: .touchUpInside)
return button
}()
centerView.addSubview(backSurfaceImageButton)
backSurfaceImageButton.snp.makeConstraints { make in
make.right.equalTo(-18)
make.top.equalTo(96)
make.height.equalTo(91)
make.width.equalTo(147)
}
backSurfaceDeleteButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_delete"), for: .normal)
button.addTarget(self, action: #selector(backSurfaceDeleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
centerView.addSubview(backSurfaceDeleteButton)
backSurfaceDeleteButton.snp.makeConstraints { make in
make.centerX.equalTo(backSurfaceImageButton.snp.right)
make.centerY.equalTo(backSurfaceImageButton.snp.top)
make.height.equalTo(21)
make.width.equalTo(21)
}
activityIndicator = {
let view = UIActivityIndicatorView()
view.style = .medium
return view
}()
centerView.addSubview(activityIndicator)
activityIndicator.snp.makeConstraints { make in
make.center.equalTo(backSurfaceImageButton.snp.center)
make.height.equalTo(25)
make.width.equalTo(25)
}
}
@objc func exampleClick() {
let view = YHCardExampleView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.type = type
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
@objc func frontImageClick() {
if type == .identity {
if viewModel.mainModel.certificates.cnIdentityCard.imgFront.count != 0 {
return
}
} else {
if viewModel.mainModel.certificates.hkMacaoPass.imgFront.count != 0 {
return
}
}
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
self.activityIndicator.snp.remakeConstraints { make in
make.center.equalTo(self.frontImageButton.snp.center)
make.height.equalTo(25)
make.width.equalTo(25)
}
self.activityIndicator.startAnimating()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.updateModel(self.type, isFront: true, url: url)
self.frontImageButton.setBackgroundImage(image, for: .normal)
self.frontDeleteButton.isHidden = false
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url) {[weak self] success, error in
guard let self = self else { return }
self.activityIndicator.stopAnimating()
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
} else {
self.viewModel.requestHkIDCardMessage(url) {[weak self] success, error in
guard let self = self else { return }
self.activityIndicator.stopAnimating()
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
}
}
// if let block = self.informationBlock {
// block(self.type, image, false)
// }
}
}
@objc func backSurfaceImageClick() {
if type == .identity {
if viewModel.mainModel.certificates.cnIdentityCard.imgBack.count != 0 {
return
}
} else {
if viewModel.mainModel.certificates.hkMacaoPass.imgBack.count != 0 {
return
}
}
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
self.activityIndicator.snp.remakeConstraints { make in
make.center.equalTo(self.backSurfaceImageButton.snp.center)
make.height.equalTo(25)
make.width.equalTo(25)
}
self.activityIndicator.startAnimating()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.backSurfaceImageButton.setBackgroundImage(image, for: .normal)
self.viewModel.updateModel(self.type, isFront: false, url: url)
self.backSurfaceDeleteButton.isHidden = false
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url) {[weak self] success, error in
guard let self = self else { return }
self.activityIndicator.stopAnimating()
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
} else {
self.viewModel.requestHkIDCardMessage(url) {[weak self] success, error in
guard let self = self else { return }
self.activityIndicator.stopAnimating()
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
}
}
// if let block = self.informationBlock {
// block(self.type, image, true)
// }
}
}
func updataData() {
titleLabel.text = "中国身份证(选填)"
frontLabel.text = "身份证人像面"
backSurfaceLabel.text = "身份证国徽面"
}
@objc func frontDeleteClick() {
viewModel.updateModel(self.type, isFront: true, url: "")
frontDeleteButton.isHidden = true
frontImageButton.setBackgroundImage(UIImage(named: "service_card_front"), for: .normal)
}
@objc func backSurfaceDeleteClick() {
viewModel.updateModel(self.type, isFront: false, url: "")
backSurfaceDeleteButton.isHidden = true
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_card_back"), for: .normal)
}
}
......@@ -32,6 +32,9 @@ class YHMainInformationModel: YHBaseModel {
var birth_place: YHAddressModel = YHAddressModel()
var address: YHAddressModel = YHAddressModel()
var certificates: YHCertificatesModels = YHCertificatesModels()
var live_address: String = ""
var live_address_detail: String = ""
}
class YHUserNameModel: YHBaseModel {
......
......@@ -60,7 +60,7 @@ class YHItemView: UIView {
showPromptLabel = {
let label = UILabel()
label.textColor = UIColor.red
label.textColor = UIColor.failColor
label.font = UIFont.PFSC_M(ofSize: 12)
return label
}()
......@@ -142,7 +142,7 @@ class YHItemView: UIView {
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
} else {
let str = dataSource.title ?? ""
......
......@@ -50,6 +50,10 @@ class YHScoreDetailViewController: YHBaseViewController {
//2.0
loadData()
//3.保存orderId 提供给后续UI使用
UserDefaults.standard.set(orderId, forKey: "orderIdForPreview")
UserDefaults.standard.synchronize()
}
}
......
......@@ -55,9 +55,6 @@ extension YHOtherInfoFillViewController {
bottomView.block = { tag in
if tag == 0 {
//点击了保存按钮
// let arr = self.basicInfoVM.arrBasicInfoSessionDataForEdit
// printLog(arr)
printLog("点击了保存按钮")
self.saveData()
} else {
......@@ -94,12 +91,28 @@ extension YHOtherInfoFillViewController {
private func saveData() {
//保存
submitDataOp(flag: false)
}
private func submitData() {
//提交
if dataIsOK() == true {
submitDataOp(flag: true)
} else {
let model = otherInfoVM.otherInfoFillData
model?.needCheckFlag = true
YHHUD.flash(message: "您还有信息未填写")
homeTableView.reloadData()
}
}
model?.is_update = false
let str = model?.toJSONString()
printLog(str)
private func submitDataOp(flag : Bool) {
//提交
let model = otherInfoVM.otherInfoFillData
model?.is_update = flag
//保存
if let param = model?.toDictionary() {
......@@ -109,6 +122,11 @@ extension YHOtherInfoFillViewController {
otherInfoVM.saveOtherInfo(params: param) { success, error in
if success == true {
YHHUD.flash(message: "操作成功")
if flag == true {
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 1.5) {[weak self] in
self?.navigationController?.popViewController(animated: true)
}
}
} else {
let msg = error?.errorMsg ?? "操作失败"
YHHUD.flash(message: msg)
......@@ -119,27 +137,56 @@ extension YHOtherInfoFillViewController {
}
}
private func submitData() {
//提交
let model = otherInfoVM.otherInfoFillData
model?.is_update = true
//保存
if let param = model?.toDictionary() {
printLog("param ==>")
printLog(param)
//检查数据是否合法
private func dataIsOK() -> Bool {
var returnValue : Bool = true
if let model = otherInfoVM.otherInfoFillData {
//1.居住信息
for item in model.residences {
if item.country.isEmpty || item.start_time.isEmpty || item.end_time.isEmpty {
returnValue = false
return returnValue
}
}
otherInfoVM.saveOtherInfo(params: param) { success, error in
if success == true {
YHHUD.flash(message: "操作成功")
} else {
let msg = error?.errorMsg ?? "操作失败"
YHHUD.flash(message: msg)
//2.语言水平
if model.language_detail?.levelDes.isEmpty == true {
returnValue = false
return returnValue
}
//3.专业技能行业
if model.profession?.optionDes.isEmpty == true {
returnValue = false
return returnValue
}
} else {
printLog("error: 参数 转换 出错")
//4.辅助资料
if let model = model.question {
//问题1
if model.professional_qualification < 1 {
returnValue = false
return returnValue
}
//问题2
if model.paper < 1 {
returnValue = false
return returnValue
}
//问题3
if model.scholarship < 1 {
returnValue = false
return returnValue
}
//问题4
if model.media_interview < 1 {
returnValue = false
return returnValue
}
}
}
return returnValue
}
}
......@@ -184,4 +231,3 @@ extension YHOtherInfoFillViewController : UITableViewDelegate,UITableViewDataSou
return cell
}
}
......@@ -15,7 +15,11 @@ class YHOtherInfoFillModel: SmartCodable {
var language_detail: LanguageDetail?
var profession: Profession?
var question: Question?
var is_update : Bool = false
var is_update : Bool = false //true-提交 false-保存
//以下为本地使用的参数
var needCheckFlag : Bool = false //是否检查有效性
required init() {
......@@ -32,6 +36,11 @@ class Residence : SmartCodable {
var order_id: Int = -1
var end_time_checked: Bool = false //是否勾选 至今
//以下为本地使用的参数
var needCheckFlag : Bool = false //是否检查有效性
required init() {
}
}
......@@ -44,6 +53,10 @@ class LanguageDetail : SmartCodable {
var name: String = ""
var remark: String = ""
//以下为本地使用的参数
var needCheckFlag : Bool = false //是否检查有效性
required init() {
}
......@@ -55,6 +68,10 @@ class Profession : SmartCodable{
var optionDes : String = ""
var remark: String = ""
//以下为本地使用的参数
var needCheckFlag : Bool = false //是否检查有效性
required init() {
}
}
......@@ -69,6 +86,10 @@ class Question : SmartCodable {
var professional_awards : String = ""
var other_information: String = ""
//以下为本地使用的参数
var needCheckFlag : Bool = false //是否检查有效性
required init() {
}
}
......@@ -22,17 +22,6 @@ class YHOtherInfoFillCell: UITableViewCell {
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func layoutSubviews() {
super.layoutSubviews()
// dotLineLayer.path = UIBezierPath(roundedRect: addBtn.bounds, cornerRadius: kCornerRadius6).cgPath
}
lazy var addBtn: UIButton = {
let btn = UIButton()
btn.setTitle("新增居住信息".local, for: .normal)
......@@ -107,6 +96,7 @@ extension YHOtherInfoFillCell {
}
let residenceView = YHOtherResidenceFillView(frame: .zero)
item.needCheckFlag = dataModel.needCheckFlag
residenceView.dataModel = item
holdView1.addSubview(residenceView)
......@@ -139,6 +129,7 @@ extension YHOtherInfoFillCell {
}
let residenceView = YHOtherResidenceFillView(frame: .zero)
item.needCheckFlag = dataModel.needCheckFlag
residenceView.dataModel = item
holdView1.addSubview(residenceView)
residenceView.snp.makeConstraints { make in
......@@ -165,7 +156,11 @@ extension YHOtherInfoFillCell {
let residenceView = YHOtherResidenceFillView(frame: .zero)
if dataModel.residences.count > 0 {
residenceView.dataModel = dataModel.residences[0] //for test hjl
let item = dataModel.residences[0]
item.needCheckFlag = dataModel.needCheckFlag
residenceView.dataModel = item
} else {
printLog("error: 数据源有问题")
}
holdView1.addSubview(residenceView)
......@@ -220,6 +215,7 @@ extension YHOtherInfoFillCell {
let view = languageView
view.updateKeyName(name: "您的语言水平与下列哪一项符合", keyValue:dataModel.language_detail?.levelDes ?? "")
view.needCheckFlag = dataModel.needCheckFlag
view.type = 2
holdView2.addSubview(view)
view.snp.makeConstraints { make in
......@@ -227,7 +223,6 @@ extension YHOtherInfoFillCell {
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 2))
make.bottom.equalToSuperview()
}
......@@ -235,6 +230,7 @@ extension YHOtherInfoFillCell {
view.addGestureRecognizer(tap)
}
holdView2.layoutIfNeeded()
//3.专业技能行业
......@@ -259,14 +255,13 @@ extension YHOtherInfoFillCell {
let view = skillView
view.updateKeyName(name: "最能代表你的专业技能的行业", keyValue: dataModel.profession?.optionDes ?? "")
view.needCheckFlag = dataModel.needCheckFlag
view.type = 2
holdView3.addSubview(view)
view.snp.makeConstraints { make in
make.top.equalTo(sessionView.snp.bottom)
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 2))
make.bottom.equalToSuperview()
}
......@@ -275,6 +270,7 @@ extension YHOtherInfoFillCell {
skillView.addGestureRecognizer(tap)
}
holdView3.layoutIfNeeded()
//4.辅助资料
......@@ -301,6 +297,7 @@ extension YHOtherInfoFillCell {
//1、您是否有行业内的专业资格证书?
let fzView1 = YHOtherYesOrNoItemView(frame: .zero)
fzView1.updateUI(title: "1、您是否有行业内的专业资格证书?", answer: dataModel.question?.professional_qualification ?? -1)
fzView1.needCheckFlag = dataModel.needCheckFlag
fzView1.block = { answer in
dataModel.question?.professional_qualification = answer
}
......@@ -315,6 +312,7 @@ extension YHOtherInfoFillCell {
// 2、您是否在期刊或杂志上发表过论文、文章、书籍等(与工作、资质有关的)?
let fzView2 = YHOtherYesOrNoItemView(frame: .zero)
fzView2.updateUI(title: "2、您是否在期刊或杂志上发表过论文、文章、书籍等(与工作、资质有关的)?", answer: dataModel.question?.paper ?? -1)
fzView2.needCheckFlag = dataModel.needCheckFlag
fzView2.block = { answer in
dataModel.question?.paper = answer
}
......@@ -328,6 +326,7 @@ extension YHOtherInfoFillCell {
// 3、您是否有大学奖学金证明、专利证书、获奖证书(工作单位颁发的可以)?
let fzView3 = YHOtherYesOrNoItemView(frame: .zero)
fzView3.updateUI(title: "3、您是否有大学奖学金证明、专利证书、获奖证书(工作单位颁发的可以)?", answer: dataModel.question?.scholarship ?? -1)
fzView3.needCheckFlag = dataModel.needCheckFlag
fzView3.block = { answer in
dataModel.question?.scholarship = answer
}
......@@ -341,6 +340,7 @@ extension YHOtherInfoFillCell {
// 4、您是否被媒体采访过,专访您的文章被发表在杂志上或网络上?
let fzView4 = YHOtherYesOrNoItemView(frame: .zero)
fzView4.updateUI(title: "4、您是否被媒体采访过,专访您的文章被发表在杂志上或网络上?", answer: dataModel.question?.media_interview ?? -1)
fzView4.needCheckFlag = dataModel.needCheckFlag
fzView4.block = { answer in
dataModel.question?.media_interview = answer
}
......
......@@ -26,22 +26,42 @@ class YHOtherResidenceFillView: UIView {
}
}
let nationView : YHOtherSelecteItemView = YHOtherSelecteItemView()
let startView : YHOtherSelecteItemView = YHOtherSelecteItemView()
let endView : YHOtherSelecteItemView = YHOtherSelecteItemView()
override func layoutSubviews() {
super.layoutSubviews()
nationView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
}
startView.snp.makeConstraints { make in
make.top.equalTo(nationView.snp.bottom)
make.left.right.equalToSuperview()
}
endView.snp.makeConstraints { make in
make.top.equalTo(startView.snp.bottom)
make.left.right.equalToSuperview()
make.bottom.equalToSuperview()
}
}
}
extension YHOtherResidenceFillView {
func setupUI() {
//1.国家
let view = nationView
view.updateKeyName(name: "国家", keyValue: "")
view.type = 1
addSubview(view)
view.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 1))
}
let tap1 = UITapGestureRecognizer(target: self, action: #selector(tapCountry))
......@@ -50,24 +70,26 @@ extension YHOtherResidenceFillView {
//2.开始时间
let view2 = startView
view2.type = 1
view2.updateKeyName(name: "开始时间", keyValue: "")
addSubview(view2)
view2.snp.makeConstraints { make in
make.top.equalTo(view.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 1))
// make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 1))
}
let tap2 = UITapGestureRecognizer(target: self, action: #selector(tapStartDate))
view2.addGestureRecognizer(tap2)
//3.结束时间
let view3 = endView
view3.type = 1
view3.updateKeyName(name: "结束时间", keyValue: "")
addSubview(view3)
view3.snp.makeConstraints { make in
make.top.equalTo(view2.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 1))
// make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 1))
make.bottom.equalToSuperview()
}
......@@ -80,10 +102,19 @@ extension YHOtherResidenceFillView {
func updateUI() {
guard let dataModel = dataModel else { return }
nationView.updateKeyName(name: "国家", keyValue: dataModel.country)
nationView.needCheckFlag = dataModel.needCheckFlag
startView.updateKeyName(name: "开始时间", keyValue: dataModel.start_time)
startView.needCheckFlag = dataModel.needCheckFlag
endView.updateKeyName(name: "结束时间", keyValue: dataModel.end_time)
endView.needCheckFlag = dataModel.needCheckFlag
layoutIfNeeded()
}
}
extension YHOtherResidenceFillView {
......@@ -93,6 +124,8 @@ extension YHOtherResidenceFillView {
printLog(country)
self.nationView.updateKeyName(name: "国家", keyValue: country)
self.dataModel?.country = country
self.layoutIfNeeded()
}
self.parentViewController?.navigationController?.pushViewController(vc)
}
......@@ -104,6 +137,7 @@ extension YHOtherResidenceFillView {
self.startView.updateKeyName(name: "开始时间", keyValue: date)
self.dataModel?.start_time = date
self.layoutIfNeeded()
}
}
......@@ -112,6 +146,7 @@ extension YHOtherResidenceFillView {
printLog(date)
self.endView.updateKeyName(name: "结束时间", keyValue: date)
self.dataModel?.end_time = date
self.layoutIfNeeded()
}
}
}
......@@ -27,6 +27,12 @@ class YHOtherSelecteItemView: UIView {
}
}
var needCheckFlag : Bool = false {
didSet {
layoutIfNeeded()
}
}
//获取高度
static func getViewHBy(type : Int)->CGFloat {
return type == 1 ? viewH : viewH2
......@@ -66,6 +72,15 @@ class YHOtherSelecteItemView: UIView {
return view
}()
//提示lable
private lazy var noTextTipsLable: UILabel = {
let label = UILabel()
label.textColor = .failColor
label.font = UIFont.PFSC_R(ofSize: 12)
label.text = "请选择x"
return label
}()
var title:String? {
didSet {
if let question = title {
......@@ -90,42 +105,7 @@ class YHOtherSelecteItemView: UIView {
override func layoutSubviews() {
super.layoutSubviews()
if type == 1 {
bottomLine.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
titleLabel.snp.makeConstraints { make in
make.top.left.bottom.equalToSuperview()
make.width.equalTo(80)
}
subHoldView.snp.makeConstraints { make in
make.top.right.bottom.equalToSuperview()
make.left.equalTo(titleLabel.snp.right).offset(40)
}
} else if type == 2 {
bottomLine.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
subHoldView.snp.makeConstraints { make in
make.bottom.equalTo(bottomLine.snp.top)
make.right.left.equalToSuperview()
make.height.equalTo(52)
}
titleLabel.snp.makeConstraints { make in
make.bottom.equalTo(subHoldView.snp.top)
make.left.right.equalToSuperview()
make.height.equalTo(20)
}
} else {
}
layoutMyUI()
}
}
......@@ -135,10 +115,9 @@ extension YHOtherSelecteItemView {
addSubview(bottomLine)
addSubview(titleLabel)
addSubview(subHoldView)
addSubview(noTextTipsLable)
title = "开始时间"
let rightIcon = UIImageView()
rightIcon.image = UIImage(named: "form_right_arrow")
rightIcon.contentMode = .scaleAspectFill
......@@ -159,7 +138,164 @@ extension YHOtherSelecteItemView {
extension YHOtherSelecteItemView {
func updateKeyName(name : String, keyValue : String) {
if type == 1 {
noTextTipsLable.text = "请选择" + name
} else {
noTextTipsLable.text = "请选择"
}
title = name
textField.text = keyValue
layoutMyUI()
}
func layoutMyUI() {
titleLabel.snp.removeConstraints()
subHoldView.snp.removeConstraints()
bottomLine.snp.removeConstraints()
noTextTipsLable.snp.removeConstraints()
if type == 1 {
if needCheckFlag == true {
titleLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(kMargin)
make.left.equalToSuperview()
make.width.equalTo(80)
make.height.equalTo(20)
}
subHoldView.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.top)
make.bottom.equalTo(titleLabel.snp.bottom)
make.right.equalToSuperview()
make.left.equalTo(titleLabel.snp.right).offset(40)
}
if textField.isEmpty == true {
noTextTipsLable.isHidden = false
noTextTipsLable.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(6)
make.height.equalTo(20)
make.left.equalTo(subHoldView.snp.left)
make.right.equalTo(subHoldView.snp.right)
}
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(noTextTipsLable.snp.bottom).offset(6)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
}
else {
noTextTipsLable.isHidden = true
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(kMargin)
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
}
} else {
noTextTipsLable.isHidden = true
titleLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(kMargin)
make.left.equalToSuperview()
make.width.equalTo(80)
make.height.equalTo(20)
}
subHoldView.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.top)
make.bottom.equalTo(titleLabel.snp.bottom)
make.right.equalToSuperview()
make.left.equalTo(titleLabel.snp.right).offset(40)
}
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(kMargin)
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
}
} else if type == 2 {
if needCheckFlag == true {
titleLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(20)
}
subHoldView.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(kMargin)
make.height.equalTo(20)
make.right.equalToSuperview()
make.left.equalToSuperview()
}
if textField.isEmpty == true {
noTextTipsLable.isHidden = false
noTextTipsLable.snp.remakeConstraints { make in
make.top.equalTo(subHoldView.snp.bottom).offset(6)
make.height.equalTo(20)
make.left.equalTo(subHoldView.snp.left)
make.right.equalTo(subHoldView.snp.right)
}
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(noTextTipsLable.snp.bottom).offset(6)
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
}
else {
noTextTipsLable.isHidden = true
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(subHoldView.snp.bottom).offset(kMargin)
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
}
} else {
noTextTipsLable.isHidden = true
titleLabel.snp.remakeConstraints { make in
make.top.equalToSuperview().offset(kMargin)
make.left.right.equalToSuperview()
make.height.equalTo(20)
}
subHoldView.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(kMargin)
make.height.equalTo(20)
make.right.equalToSuperview()
make.left.equalToSuperview()
}
bottomLine.snp.remakeConstraints { make in
make.top.equalTo(subHoldView.snp.bottom).offset(kMargin)
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
}
} else {
printLog("error: 未处理的类型")
}
}
}
......@@ -135,9 +135,6 @@ private extension YHOtherTextViewItemView {
make.left.equalTo(16)
make.right.equalTo(-12)
}
// tipsLabel.text = kTipsString
addSubview(bottomLine)
bottomLine.snp.makeConstraints { make in
......@@ -157,6 +154,16 @@ extension YHOtherTextViewItemView : UITextFieldDelegate {
}
self.block?(textView.text)
}
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if !text.isEmpty {
if textView.text.count > 999 {
return false
}
}
return true
}
}
extension YHOtherTextViewItemView {
......
......@@ -99,6 +99,26 @@ class YHOtherYesOrNoItemView: UIView, UITextViewDelegate {
}
}
private var lastSelectedBtn : UIButton?
var needCheckFlag : Bool = false {
didSet {
layoutMyUI()
}
}
//提示lable
private lazy var noTextTipsLable: UILabel = {
let label = UILabel()
label.textColor = .failColor
label.font = UIFont.PFSC_R(ofSize: 12)
label.text = "请选择"
label.isHidden = true
return label
}()
}
......@@ -109,6 +129,7 @@ private extension YHOtherYesOrNoItemView {
addSubview(titleLabel)
addSubview(answer2Btn)
addSubview(answer1Btn)
addSubview(noTextTipsLable)
titleLabel.snp.makeConstraints { make in
make.top.equalTo(kMargin)
......@@ -134,6 +155,9 @@ private extension YHOtherYesOrNoItemView {
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
layoutMyUI()
}
@objc func didClickResponseBtn(btn: UIButton) {
......@@ -156,7 +180,9 @@ private extension YHOtherYesOrNoItemView {
answer1Btn.isSelected = false
updateAnswerButton(answer1Btn, false)
}
self.block?(answer2Btn.isSelected == true ? 2 : 1)
self.block?(answer2Btn.isSelected == true ? 1 : 2)
layoutMyUI()
}
// 更新答案按钮选中状态
......@@ -176,5 +202,40 @@ extension YHOtherYesOrNoItemView {
} else if answer == 1 {
didClickResponseBtn(btn: answer1Btn)
}
layoutMyUI()
}
private func layoutMyUI() {
bottomLine.snp.removeConstraints()
if needCheckFlag == true {
if answer1Btn.isSelected == false && answer2Btn.isSelected == false {
noTextTipsLable.isHidden = false
noTextTipsLable.snp.removeConstraints()
noTextTipsLable.snp.remakeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(6)
make.left.right.equalToSuperview()
make.height.equalTo(20)
}
bottomLine.snp.makeConstraints { make in
make.top.equalTo(noTextTipsLable.snp.bottom).offset(6)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
return
}
}
noTextTipsLable.isHidden = true
bottomLine.snp.makeConstraints { make in
make.top.equalTo(answer1Btn.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
}
}
......@@ -12,7 +12,8 @@ class YHOtherInfoFillViewModel: YHBaseViewModel {
var otherInfoFillData : YHOtherInfoFillModel?
static let arrLanguage : [[String : String]] = [
["id":"1",
[
"id":"1",
"title": "中文及英文",
"dec": "国外大学(英语国家)毕业,英文授课,获得学位证。(如为中外联合办学,在中国上课的,不算)",
],
......@@ -134,49 +135,64 @@ class YHOtherInfoFillViewModel: YHBaseViewModel {
]
static let arrNature : [[String : String]] = [
[ "title": "有限责任公司",
[
"title": "有限责任公司",
"id": "有限责任公司"
],
[ "title": "股份有限公司",
[
"title": "股份有限公司",
"id": "股份有限公司"
],
[ "title": "跨国有限责任公司",
[
"title": "跨国有限责任公司",
"id": "跨国有限责任公司"
],
[ "title": "跨国股份有限公司",
[
"title": "跨国股份有限公司",
"id": "跨国股份有限公司"
],
[ "title": "上市公司",
[
"title": "上市公司",
"id": "上市公司"
],
[ "title": "上市跨国公司",
[
"title": "上市跨国公司",
"id": "上市跨国公司"
],
[ "title": "教育机构",
[
"title": "教育机构",
"id": "教育机构"
],
[ "title": "半公营企业",
[
"title": "半公营企业",
"id": "半公营企业"
],
[ "title": "政府机构",
[
"title": "政府机构",
"id": "政府机构"
],
[ "title": "跨国合伙企业",
[
"title": "跨国合伙企业",
"id": "跨国合伙企业"
],
[ "title": "跨国个人独资企业",
[
"title": "跨国个人独资企业",
"id": "跨国个人独资企业"
],
[ "title": "个人独资企业",
[
"title": "个人独资企业",
"id": "个人独资企业"
],
[ "title": "国家/政府间组织",
[
"title": "国家/政府间组织",
"id": "国家/政府间组织"
],
[ "title": "志愿/慈善/宗教团体",
[
"title": "志愿/慈善/宗教团体",
"id": "志愿/慈善/宗教团体"
],
[ "title": "其他(请备注)",
[
"title": "其他(请备注)",
"id": "其他(请备注)"
]
]
......@@ -306,27 +322,34 @@ extension YHOtherInfoFillViewModel {
//获取其他资料信息
func getOtherInfo( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
// createOrgBasiceInfoData()
// callBackBlock(true,nil)//先返回数据 让界面展示相关的UI
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.otherInfoFillApi
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data
guard let resultModel = YHOtherInfoFillModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
if resultModel.residences.isEmpty {
resultModel.residences.append(Residence())
}
self.otherInfoFillData = resultModel
handleData()
//根据返回值 组装 真实的数据
callBackBlock(true,nil)
} else {
let err : YHErrorModel = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
......
......@@ -11,91 +11,38 @@ import UIKit
*基本资料信息 预览
*/
class YHPreviewBasiceInformationViewController: YHPreviewBaseViewController {
var arrData : [YHPreviewInfoSessionModel] = []
private let previewVM : YHPreviewViewModel = YHPreviewViewModel()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
loadData()
}
}
private extension YHPreviewBasiceInformationViewController {
func installData() {
do {
//主申请人
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、是否曾在香港或其他地方因任何罪行或违法行为被被定罪:", answer: "是",remark: "这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、是否曾在香港或其他地方被拒入境/递解/遣送或要求离境?", answer: "否")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "3、是否曾被拒绝签发香港或其他地方的签证/进入许可?", answer: "否")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "4、是否曾触犯香港或任何地方的入境法例?", answer: "是",remark: "我是测试数据哈我是测试数据哈我是测试数据哈我是测试数据哈我是测试数据哈我是测试数据哈我是测试数据哈我是测试数据哈")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "5、是否曾经使用另一个姓名或身份申请香港入境签证/进入许可或进入香港?", answer: "否")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "主申请人", cellData0: arr)
arrData.append(model1)
}
do {
//配偶
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: "是",remark: "这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: "否")
let arr = [tmp0,tmp1]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "配偶", cellData0: arr)
arrData.append(model1)
}
do {
//子女-1
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: "是",remark: "这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: "否")
let arr = [tmp0,tmp1]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "子女-1", cellData0: arr)
arrData.append(model1)
func setupUI() {
self.homeTableView.register(YHPreviewInfoCell.self,forCellReuseIdentifier: YHPreviewInfoCell.cellReuseIdentifier)
self.homeTableView.reloadData()
}
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
previewVM.getPreviewForBasicInfo(params: ["order_id" : orderID]) { success, error in
if success == true {
do {
//子女-2
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: "是",remark: "这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。这里是详细的犯罪记录或违法行为说明,这里是详细的犯罪记录或违法行为说明。")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: "否")
let arr = [tmp0,tmp1]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "子女-2", cellData0: arr)
arrData.append(model1)
}
} else {
do {
//家庭背景
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、至少一名直系家庭成员(已婚配偶、父母、兄弟姐妹、子女)是现居于香港的香港永久性居民", answer: "不满足")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "家庭背景", cellData0: arr)
arrData.append(model1)
}
do {
//家庭背景2
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、至少一名直系家庭成员(已婚配偶、父母、兄弟姐妹、子女)是现居于香港的香港永久性居民", answer: "满足",remark: "张三、李四、王五")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "家庭背景2-测试满足的情况", cellData0: arr)
arrData.append(model1)
self.homeTableView.reloadData()
}
} else {
printLog("error : orderID 为空")
}
func setupUI() {
installData()
self.homeTableView.register(YHPreviewInfoCell.self,forCellReuseIdentifier: YHPreviewInfoCell.cellReuseIdentifier)
self.homeTableView.reloadData()
}
}
......@@ -104,13 +51,13 @@ private extension YHPreviewBasiceInformationViewController {
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHPreviewBasiceInformationViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrData.count
return previewVM.arrDataForBasicInfo.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHPreviewInfoCell.self)
cell.selectionStyle = .none
cell.model = arrData[indexPath.row]
cell.model = previewVM.arrDataForBasicInfo[indexPath.row]
return cell
}
}
......@@ -11,21 +11,16 @@ import UIKit
*家庭成员信息 预览
*/
class YHPreviewFamilyMemberViewController: YHPreviewBaseViewController {
var arrData : [YHPreviewInfoSessionModel] = [] //用于数据展示
var arrDataForParents : [YHPreviewInfoSessionModel] = []
var arrDataForSpouse : [YHPreviewInfoSessionModel] = []
var arrDataForChildren : [YHPreviewInfoSessionModel] = []
var arrDataForBrother : [YHPreviewInfoSessionModel] = []
private let previewVM : YHPreviewViewModel = YHPreviewViewModel()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
loadData()
}
private var buttonHoldView : UIView = {
let view = UIView()
// view.backgroundColor = .red
return view
}()
......@@ -39,9 +34,6 @@ class YHPreviewFamilyMemberViewController: YHPreviewBaseViewController {
private extension YHPreviewFamilyMemberViewController {
func setupUI() {
installData()
view.addSubview(buttonHoldView)
buttonHoldView.snp.makeConstraints { make in
make.top.equalToSuperview()
......@@ -50,9 +42,6 @@ private extension YHPreviewFamilyMemberViewController {
make.height.equalTo(56)
}
parentButton = createButton()
parentButton.setTitle("父母", for: .normal)
buttonHoldView.addSubview(parentButton)
......@@ -147,338 +136,35 @@ private extension YHPreviewFamilyMemberViewController {
sender.layoutIfNeeded()
if sender == parentButton {
arrData = arrDataForParents
previewVM.arrDataForMainApplicationInfo = previewVM.arrDataForParents
} else if sender == childrenButton {
arrData = arrDataForChildren
previewVM.arrDataForMainApplicationInfo = previewVM.arrDataForChildren
} else if sender == brotherButton {
arrData = arrDataForBrother
previewVM.arrDataForMainApplicationInfo = previewVM.arrDataForBrother
} else if sender == spouseButton {
arrData = arrDataForSpouse
previewVM.arrDataForMainApplicationInfo = previewVM.arrDataForSpouse
} else {
arrData = []
previewVM.arrDataForMainApplicationInfo = []
}
homeTableView.reloadData()
}
func installData() {
//父母
installDataForParents()
//配偶
installDataForSpouse()
//子女
installDataForChildren()
//兄弟姐妹
installDataForBrother()
}
//父母 数据
func installDataForParents() {
do {
//父亲信息-已故
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "父亲姓名:", answer: "父亲姓名父亲姓名:父亲姓名:父亲姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "是否已故:", answer: "是")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let arr = [tmp0,tmp1,tmp2,tmp3]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "父亲信息-已故", cellData0: arr)
arrDataForParents.append(model1)
}
do {
//母亲信息-已故
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "母亲信息:", answer: "父亲姓名父亲姓名:父亲姓名:父亲姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "是否已故:", answer: "是")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let arr = [tmp0,tmp1,tmp2,tmp3]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "母亲信息-已故", cellData0: arr)
arrDataForParents.append(model1)
}
do {
//父亲信息-健在
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "父亲姓名:", answer: "父亲姓名父亲姓名:父亲姓名:父亲姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "是否已故:", answer: "否")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: "未婚")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: "在职")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: "设计师")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "现居住国家/地区:", answer: "国内 吉林省/吉林市")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "国内 吉林省/吉林市")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "p102987(1)")
let arr = [tmp0,tmp1,tmp11,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "父亲信息-健在", cellData0: arr)
arrDataForParents.append(model1)
}
do {
//母亲信息-健在
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "母亲姓名:", answer: "母亲姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "是否已故:", answer: "否")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: "未婚")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: "在职")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: "设计师")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "现居住国家/地区:", answer: "国内 吉林省/吉林市")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "国内 吉林省/吉林市")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "p102987(1)")
let arr = [tmp0,tmp1,tmp11,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "母亲信息-健在", cellData0: arr)
arrDataForParents.append(model1)
}
arrData = arrDataForParents
}
//配偶 数据
func installDataForSpouse() {
do {
//随行信息-否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "否")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息-否", cellData0: arr)
arrDataForSpouse.append(model1)
}
do {
//配偶信息-否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "配偶姓名:", answer: "配偶姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: "曾用名:")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: "婚前姓氏:")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "否")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "否")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "否")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "配偶信息-否", cellData0: arr)
arrDataForSpouse.append(model1)
}
do {
//随行信息 - 是
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "否")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "国家/国籍:", answer: "中国-China")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: "未办理")
let arr = [tmp0,tmp1,tmp2]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息-否", cellData0: arr)
arrDataForSpouse.append(model1)
}
do {
//基本信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "配偶姓名:", answer: "DavidHuang")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: "--")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: "--")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: "职业")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: "职业名称")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否拥有学位:", answer: "是否拥有学位")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "学位证:", answer: "学位证:")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "学位证颁发地区:", answer: "职业名称")
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "是否和主申请人同住:", answer: "职业名称")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer: "职业名称")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "是否在海外居住满1年及以上:", answer: "职业名称")
let tmp13 = YHPreviewQuestionAndAnswerModel(question: "目前是否在港:", answer: "职业名称")
let tmp14 = YHPreviewQuestionAndAnswerModel(question: "获准逗留至:", answer: "职业名称")
let tmp15 = YHPreviewQuestionAndAnswerModel(question: "在港身份:", answer: "职业名称")
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "职业名称")
let tmp17 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "职业名称")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9,tmp10,tmp11,tmp12,tmp13,tmp14,tmp15,tmp16,tmp17]
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "基本信息", cellData0: arr)
arrDataForSpouse.append(model2)
}
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
previewVM.getPreviewForFamilyInfo(params: ["order_id" : orderID]) { success, error in
if success == true {
} else {
do {
//证件信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: "2203381990287633390")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: "c2345639")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: "护照")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: "p2345639")
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2028-07-31")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
let arr = [model0,model1,model2]
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息", cellData1: arr)
arrDataForSpouse.append(model3)
}
do {
//证件照片
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: "", backUrl: "", idType: 1)
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: "", backUrl: "", idType: 2)
let arr = [model1,model2]
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片", cellData2: arr)
arrDataForSpouse.append(model4)
}
arrData = arrDataForSpouse
}
//子女 数据
func installDataForChildren() {
do {
//随行信息-否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "该子女是否随行至香港:", answer: "否")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息-否", cellData0: arr)
arrDataForChildren.append(model1)
}
do {
//子女信息-否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "子女姓名:", answer: "子女姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: "曾用名:")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: "婚前姓氏:")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: "性别")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "否")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "否")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: "否")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: "否")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "否")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "子女信息-否", cellData0: arr)
arrDataForChildren.append(model1)
}
do {
//随行信息 - 是
let tmp00 = YHPreviewQuestionAndAnswerModel(question: "主申请人或现配偶是否拥有孩子护养权:", answer: "否")
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "否")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "国家/国籍:", answer: "中国-China")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: "未办理")
let arr = [tmp00,tmp0,tmp1,tmp2]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息-是", cellData0: arr)
arrDataForChildren.append(model1)
}
do {
//基本信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "子女姓名:", answer: "子女姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: "--")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: "--")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let tmp44 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: "婚姻状况")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: "职业")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: "职业名称")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否拥有学位:", answer: "是否拥有学位")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "学位证:", answer: "学位证:")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "学位证颁发地区:", answer: "职业名称")
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "是否和主申请人同住:", answer: "职业名称")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer: "职业名称")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "是否在海外居住满1年及以上:", answer: "职业名称")
let tmp122 = YHPreviewQuestionAndAnswerModel(question: "是否为前次婚姻的子女:", answer: "是否为前次婚姻的子女")
let tmp13 = YHPreviewQuestionAndAnswerModel(question: "目前是否在港:", answer: "职业名称")
let tmp14 = YHPreviewQuestionAndAnswerModel(question: "获准逗留至:", answer: "职业名称")
let tmp15 = YHPreviewQuestionAndAnswerModel(question: "在港身份:", answer: "职业名称")
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "职业名称")
let tmp17 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "p102987(1)")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp44,tmp5,tmp6,tmp7,tmp8,tmp9,tmp10,tmp11,tmp12,tmp122,tmp13,tmp14,tmp15,tmp16,tmp17]
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "基本信息", cellData0: arr)
arrDataForChildren.append(model2)
}
do {
//证件信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: "2203381990287633390")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: "c2345639")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: "护照")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: "p2345639")
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2028-07-31")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
let arr = [model0,model1,model2]
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息", cellData1: arr)
arrDataForChildren.append(model3)
}
do {
//证件照片
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: "", backUrl: "", idType: 1)
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: "", backUrl: "", idType: 2)
let arr = [model1,model2]
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片", cellData2: arr)
arrDataForChildren.append(model4)
}
arrData = arrDataForChildren
self.homeTableView.reloadData()
return
}
//兄弟姐妹 数据
func installDataForBrother() {
do {
//兄弟姐妹信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "姓名:", answer: "姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: "未婚")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: "在职")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: "设计师")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "现居住国家/地区:", answer: "国内 吉林省/吉林市")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "国内 吉林省/吉林市")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "p102987(1)")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "兄弟姐妹信息", cellData0: arr)
arrDataForBrother.append(model1)
} else {
printLog("error : orderID 为空")
}
arrData = arrDataForBrother
self.homeTableView.reloadData()
}
}
......@@ -487,13 +173,13 @@ private extension YHPreviewFamilyMemberViewController {
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHPreviewFamilyMemberViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrData.count
return previewVM.arrDataForMainApplicationInfo.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHPreviewInfoCell.self)
cell.selectionStyle = .none
cell.model = arrData[indexPath.row]
cell.model = previewVM.arrDataForMainApplicationInfo[indexPath.row]
return cell
}
}
......
......@@ -11,95 +11,34 @@ import UIKit
*主申请人信息 预览
*/
class YHPreviewMainApplicantInfoViewController: YHPreviewBaseViewController {
var arrData : [YHPreviewInfoSessionModel] = []
private let previewVM : YHPreviewViewModel = YHPreviewViewModel()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
loadData()
}
}
private extension YHPreviewMainApplicantInfoViewController {
func installData() {
do {
//国家信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "国家/国籍:", answer: "中国-China")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: "未办理")
let arr = [tmp0,tmp1]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "国籍信息", cellData0: arr)
arrData.append(model1)
}
do {
//基本信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "主申请人:", answer: "DavidHuang")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: "--")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: "--")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: "男")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: "已婚")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "手机号:", answer: "13572984488")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "邮箱:", answer: "13572984488@nn.com")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer: "现居住地址:现居住地址:现居住地址:现居住地址:现居住地址:现居住地址:")
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "详细地址:", answer: "锐度公园世家北区10-1-701锐度公园世家北区10-1-701")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "香港身份证:", answer: "否")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9,tmp10,tmp11,tmp12]
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "基本信息", cellData0: arr)
arrData.append(model2)
func setupUI() {
self.homeTableView.register(YHPreviewInfoCell.self,forCellReuseIdentifier: YHPreviewInfoCell.cellReuseIdentifier)
self.homeTableView.reloadData()
}
do {
//证件信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: "2203381990287633390")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
previewVM.getPreviewForMainApplicationInfo(params: ["order_id" : orderID]) { success, error in
if success == true {
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: "c2345639")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
} else {
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: "护照")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: "p2345639")
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2028-07-31")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
let arr = [model0,model1,model2]
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息", cellData1: arr)
arrData.append(model3)
}
do {
//证件照片
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: "", backUrl: "", idType: 1)
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: "", backUrl: "", idType: 2)
let arr = [model1,model2]
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片", cellData2: arr)
arrData.append(model4)
self.homeTableView.reloadData()
}
} else {
printLog("error : orderID 为空")
}
func setupUI() {
installData()
self.homeTableView.register(YHPreviewInfoCell.self,forCellReuseIdentifier: YHPreviewInfoCell.cellReuseIdentifier)
self.homeTableView.reloadData()
}
}
......@@ -108,13 +47,13 @@ private extension YHPreviewMainApplicantInfoViewController {
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHPreviewMainApplicantInfoViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrData.count
return previewVM.arrDataForMainApplicationInfo.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHPreviewInfoCell.self)
cell.selectionStyle = .none
cell.model = arrData[indexPath.row]
cell.model = previewVM.arrDataForMainApplicationInfo[indexPath.row]
return cell
}
}
......@@ -11,77 +11,37 @@ import UIKit
*其他信息 预览
*/
class YHPreviewOtherInformationViewController: YHPreviewBaseViewController {
var arrData : [YHPreviewInfoSessionModel] = []
private let previewVM : YHPreviewViewModel = YHPreviewViewModel()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
loadData()
}
}
private extension YHPreviewOtherInformationViewController {
func installData() {
do {
//居住信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "开始时间:", answer: "1990年8月")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "结束时间:", answer: "2013年7月")
let model0 = YHPersonInfoCellModel1(cellTitle: "国家1:中国", cellData: [tmp0,tmp1])
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "开始时间:", answer: "1990年8月")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "结束时间:", answer: "2013年7月")
let model1 = YHPersonInfoCellModel1(cellTitle: "国家1:中国2", cellData: [tmp2,tmp3])
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "开始时间:", answer: "1990年8月")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "结束时间:", answer: "2013年7月")
let model2 = YHPersonInfoCellModel1(cellTitle: "国家1:中国3", cellData: [tmp4,tmp5])
func setupUI() {
let arr = [model0,model1,model2]
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "居住信息", cellData1: arr)
arrData.append(model3)
self.homeTableView.register(YHPreviewInfoCell.self,forCellReuseIdentifier: YHPreviewInfoCell.cellReuseIdentifier)
self.homeTableView.reloadData()
}
func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
previewVM.getPreviewForOtherInfo(params: ["order_id" : orderID]) { success, error in
if success == true {
do {
//语言能力
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中文及英文", answer: "国外大学(英语国家)毕业,英文授课,获得学位证。(如为中外联合办学,在中国上课的,不算)")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "语言能力", cellData0: arr)
arrData.append(model1)
}
} else {
do {
//专业技能行业
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、最能代表你的专业技能的行业是?(单选)", answer: "无",remark: "我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业我的自定义专业")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "专业技能行业", cellData0: arr)
arrData.append(model1)
}
do {
//专业技能行业
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、您是否有行业内的专业资格证书?", answer: "否")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、您是否在期刊或杂志上发表论文、文章、书籍等(与工作、资质有关的)?", answer: "是")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "3、您是否有大学奖学金证明、专利证书、获奖证书(工作单位颁发的可以)?", answer: "是")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "4、您是否被媒体采访过,专访您的文章被发表在杂志上或网络上?", answer: "是")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "5、专业奖项:", answer: "这里是一片文案说明说明示例,这里是一片文案说明说明示例,这里是一片文案说明说明示例,这里是一片文案说明说明示例,这里是一片文案说明说明示例,这里是一片文案说明说明示例")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "6、学业奖项:", answer: "--")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "7、其他资料:", answer: "这里是一片文案说明说明示例,这里是一片文案说明说明示例,这里是一片文案说明说明示例,这里是一片文案说明说明示例,这里是一片文案说明说明示例,这里是一片文案说明。")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "辅助资料", cellData0: arr)
arrData.append(model1)
self.homeTableView.reloadData()
}
} else {
printLog("error : orderID 为空")
}
func setupUI() {
installData()
self.homeTableView.register(YHPreviewInfoCell.self,forCellReuseIdentifier: YHPreviewInfoCell.cellReuseIdentifier)
self.homeTableView.reloadData()
}
}
......@@ -90,13 +50,13 @@ private extension YHPreviewOtherInformationViewController {
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHPreviewOtherInformationViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrData.count
return previewVM.arrDataForOtherInfo.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHPreviewInfoCell.self)
cell.selectionStyle = .none
cell.model = arrData[indexPath.row]
cell.model = previewVM.arrDataForOtherInfo[indexPath.row]
return cell
}
}
//
// YHPreviewForOtherInfoModel.swift
// galaxy
//
// Created by davidhuangA on 2024/3/3.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
struct YHPreviewForOtherInfoModel: SmartCodable {
var list: [Residence]?
var language: LanguageDetail?
var profession: Profession?
var question: Question?
}
......@@ -54,6 +54,7 @@ class YHPreviewInfoNameAndSubNameItemView: UIView {
make.top.equalTo(nameLable.snp.top)
make.right.equalToSuperview()
make.left.equalTo(nameLable.snp.right).offset(10)
make.height.greaterThanOrEqualTo(20)
make.bottom.equalToSuperview()
}
......
//
// YHPreviewViewModel.swift
// galaxy
//
// Created by davidhuangA on 2024/3/3.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHPreviewViewModel: YHBaseViewModel {
//家庭成员信息 预览
var familyInfoPreviewModel : YHFamilyMemberGroupInfo?
var arrDataForFamilyInfo : [YHPreviewInfoSessionModel] = [] //用于展示
var arrDataForParents : [YHPreviewInfoSessionModel] = []//父亲
var arrDataForSpouse : [YHPreviewInfoSessionModel] = []//配偶
var arrDataForChildren : [YHPreviewInfoSessionModel] = []//子女
var arrDataForBrother : [YHPreviewInfoSessionModel] = []//兄弟姐妹
//主申请人信息 预览 - 未完成
var mainApplicationInfoPreviewModel : YHMainInformationModel?
var arrDataForMainApplicationInfo : [YHPreviewInfoSessionModel] = []
//其他信息 预览
private var otherInfoPreviewModel : YHPreviewForOtherInfoModel?
var arrDataForOtherInfo : [YHPreviewInfoSessionModel] = []
//基本资料 预览
private var basiceInfoPreviewModel : YHBasicInfoFillModel?
var arrDataForBasicInfo : [YHPreviewInfoSessionModel] = []
}
extension YHPreviewViewModel {
//获取家庭成员 预览数据
func getPreviewForFamilyInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Preview.previewFamilyInfoApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data as? [AnyHashable : Any]
guard let resultModel = YHFamilyMemberGroupInfo.deserialize(dict: dic) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
familyInfoPreviewModel = resultModel
installDataForFamilyInfo()
callBackBlock(true,nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
//获取主申请人 预览数据
func getPreviewForMainApplicationInfo( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Preview.previewMainApplicationInfoApi
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHMainInformationModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.mainApplicationInfoPreviewModel = result
installDataForMainApplicationInfo()
callBackBlock(true, nil)
} else {
installDataForMainApplicationInfo() //for test hjl
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
self.installDataForMainApplicationInfo()//for test hjl
callBackBlock(false,err)
}
}
//获取基本资料预览 数据
func getPreviewForBasicInfo( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Preview.previewBasicInfoApi
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data
guard let resultModel = YHBasicInfoFillModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
self.basiceInfoPreviewModel = resultModel
//根据返回值 组装 真实的数据
installDataForBasicInfo()
callBackBlock(true,nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code),errorMsg: json.msg)
callBackBlock(false,error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
//获取其他信息预览 数据
func getPreviewForOtherInfo( params:[String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Preview.previewOtherInfoApi
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let resultModel = YHPreviewForOtherInfoModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
self.otherInfoPreviewModel = resultModel
installDataForOtherInfo()
//根据返回值 组装 真实的数据
callBackBlock(true,nil)
} else {
let err : YHErrorModel = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
private extension YHPreviewViewModel {
//组装 主申请人预览 数据
func installDataForMainApplicationInfo() {
guard let model = mainApplicationInfoPreviewModel else { return }
do {
//国家信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "国家/国籍:", answer: model.nationality)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: model.is_handled == 0 ? "未办理" : "已办理")
let arr = [tmp0,tmp1]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "国籍信息", cellData0: arr)
arrDataForMainApplicationInfo.append(model1)
}
do {
//基本信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "主申请人:", answer: model.username)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.used_name)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname)
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: model.birth_place.area.description) //mainData.birth_place for test hjl todo
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: model.sex.description)//mainData.birth_place for test hjl todo
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married.description)//for test hjl todo
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "手机号:", answer: model.mobile)
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "邮箱:", answer: model.email)
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer:model.live_address)
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "详细地址:", answer: model.live_address_detail)
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")//model.hk_id.has //for test hjl todo
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "香港身份证:", answer: "-")//model.hk_id.number //for test hjl todo
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9,tmp10,tmp11,tmp12]
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "基本信息", cellData0: arr)
arrDataForMainApplicationInfo.append(model2)
}
do {
//证件信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: "2203381990287633390")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: "c2345639")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: "护照")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: "p2345639")
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2028-07-31")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
let arr = [model0,model1,model2]
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息", cellData1: arr)
arrDataForMainApplicationInfo.append(model3)
}
do {
//证件照片
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: "", backUrl: "", idType: 1)
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: "", backUrl: "", idType: 2)
let arr = [model1,model2]
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片", cellData2: arr)
arrDataForMainApplicationInfo.append(model4)
}
}
//组装 基本资料预览 数据
func installDataForBasicInfo() {
do {
//主申请人
if let model = basiceInfoPreviewModel?.applicant {
let answer0 = model.has_conviction?.has == "Y" ? "是" : "否"
let remark0 = answer0 == "是" ? (model.has_conviction?.info ?? "") : nil
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、是否曾在香港或其他地方因任何罪行或违法行为被被定罪:", answer: answer0,remark: remark0)
let answer1 = model.has_departure?.has == "Y" ? "是" : "否"
let remark1 = answer1 == "是" ? (model.has_conviction?.info ?? "") : nil
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、是否曾在香港或其他地方被拒入境/递解/遣送或要求离境?", answer: answer1,remark: remark1)
let answer2 = model.has_deny?.has == "Y" ? "是" : "否"
let remark2 = answer2 == "是" ? (model.has_deny?.info ?? "") : nil
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "3、是否曾被拒绝签发香港或其他地方的签证/进入许可?", answer: answer2,remark: remark2)
let answer3 = model.has_breaking_law?.has == "Y" ? "是" : "否"
let remark3 = answer3 == "是" ? (model.has_breaking_law?.info ?? "") : nil
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "4、是否曾触犯香港或任何地方的入境法例?", answer: answer3,remark:remark3)
let answer4 = model.has_other_id?.has == "Y" ? "是" : "否"
let remark4 = answer4 == "是" ? (model.has_other_id?.info ?? "") : nil
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "5、是否曾经使用另一个姓名或身份申请香港入境签证/进入许可或进入香港?", answer: answer4,remark: remark4)
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "主申请人", cellData0: arr)
arrDataForBasicInfo.append(model1)
}
}
do {
//子女 - xxx
if let arrChild = basiceInfoPreviewModel?.child {
for (_,model) in arrChild.enumerated() {
let answer0 = model.child_departure?.has == "Y" ? "是" : "否"
let remark0 = answer0 == "是" ? (model.child_departure?.info ?? "") : nil
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: answer0,remark:remark0)
let answer1 = model.child_deny?.has == "Y" ? "是" : "否"
let remark1 = answer1 == "是" ? (model.child_deny?.info ?? "") : nil
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: answer1,remark: remark1)
let arr = [tmp0,tmp1]
let title = "子女" + "-" + model.subset_name
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: title, cellData0: arr)
arrDataForBasicInfo.append(model1)
}
}
}
do {
//配偶
if let model = basiceInfoPreviewModel?.spouse {
let answer0 = model.child_departure?.has == "Y" ? "是" : "否"
let remark0 = answer0 == "是" ? (model.child_departure?.info ?? "") : nil
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、是否曾被拒绝入境/递解/遣送或要求离开香港?", answer: answer0,remark:remark0)
let answer1 = model.child_deny?.has == "Y" ? "是" : "否"
let remark1 = answer1 == "是" ? (model.child_deny?.info ?? "") : nil
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、是否曾被拒绝签发签证/进入许可以入境香港?", answer: answer1,remark: remark1)
let arr = [tmp0,tmp1]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "配偶", cellData0: arr)
arrDataForBasicInfo.append(model1)
}
}
do {
//家庭背景
if let model = basiceInfoPreviewModel?.background {
let answer0 = model.background_member?.has == "Y" ? "满足" : "不满足"
let remark0 = answer0 == "满足" ? (model.background_member?.info ?? "") : nil
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、至少一名直系家庭成员(已婚配偶、父母、兄弟姐妹、子女)是现居于香港的香港永久性居民", answer:answer0,remark: remark0) //需要完善 for test hjl todo???
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "家庭背景", cellData0: arr)
arrDataForBasicInfo.append(model1)
}
}
}
//组装 其他信息预览 数据
func installDataForOtherInfo() {
guard let model = otherInfoPreviewModel else {
return
}
handleDataForOtherInfo()
do {
if let arr1 = model.list,arr1.isEmpty == false {
var arr : [YHPersonInfoCellModel1] = []
for (index,item) in arr1.enumerated() {
//居住信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "开始时间:", answer: item.start_time)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "结束时间:", answer: item.end_time)
let title = "国家" + String(index + 1) + ":" + item.country
let model0 = YHPersonInfoCellModel1(cellTitle: title, cellData: [tmp0,tmp1])
arr.append(model0)
}
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "居住信息", cellData1: arr)
arrDataForOtherInfo.append(model3)
}
}
do {
//语言能力
if let model = otherInfoPreviewModel?.language {
let tmp0 = YHPreviewQuestionAndAnswerModel(question: model.levelDes, answer: model.remark)
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "语言能力", cellData0: arr)
arrDataForOtherInfo.append(model1)
}
}
do {
//专业技能行业
if let model = otherInfoPreviewModel?.profession {
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、最能代表你的专业技能的行业是?(单选)", answer: model.optionDes,remark: model.remark)
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "专业技能行业", cellData0: arr)
arrDataForOtherInfo.append(model1)
}
}
do {
//其他问题
if let model = otherInfoPreviewModel?.question {
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "1、您是否有行业内的专业资格证书?", answer: model.professional_qualification == 1 ? "是" : "否")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "2、您是否在期刊或杂志上发表论文、文章、书籍等(与工作、资质有关的)?", answer: model.paper == 1 ? "是" : "否")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "3、您是否有大学奖学金证明、专利证书、获奖证书(工作单位颁发的可以)?", answer: model.scholarship == 1 ? "是" : "否")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "4、您是否被媒体采访过,专访您的文章被发表在杂志上或网络上?", answer: model.media_interview == 1 ? "是" : "否")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "5、专业奖项:", answer: model.professional_awards)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "6、学业奖项:", answer: model.academic_awards)
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "7、其他资料:", answer: model.other_information)
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6]
let model1 = YHPreviewInfoSessionModel(cellType: .questionAndAnswer, cellTitle: "辅助资料", cellData0: arr)
arrDataForOtherInfo.append(model1)
}
}
}
}
private extension YHPreviewViewModel {
//特殊处理 其他信息预览 需要的数据
func handleDataForOtherInfo() {
if let language = otherInfoPreviewModel?.language {
if language.level > 0 {
let target = String(language.level)
for(_,item) in YHOtherInfoFillViewModel.arrLanguage.enumerated() {
if target == item["id"] {
language.levelDes = item["title"] ?? "--"
language.remark = item["dec"] ?? "--"
break
}
}
}
}
if let profession = otherInfoPreviewModel?.profession {
if profession.option > 0 {
let target = String(profession.option)
for(_,item) in YHOtherInfoFillViewModel.arrSkill.enumerated() {
if target == item["value"] {
profession.optionDes = item["title"] ?? "--"
break
}
}
}
}
}
}
private extension YHPreviewViewModel {
func installDataForFamilyInfo() {
//父母
installDataForParents()
//配偶
installDataForSpouse()
//子女
installDataForChildren()
//兄弟姐妹
installDataForBrother()
}
//父母 数据
func installDataForParents() {
do {
if let model = familyInfoPreviewModel?.father {
if model.deceased == 0 {
//父亲信息-健在
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "父亲姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "是否已故:", answer: "否")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married)
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName)
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "现居住国家/地区:", answer: model.liveCountry)
var arr = [tmp0,tmp1,tmp2,tmp3,tmp11,tmp4,tmp5,tmp6]
if let card = model.hkIdentityCard,card.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "父亲信息", cellData0: arr)
arrDataForParents.append(model1)
} else {
//父亲信息-已故
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "父亲姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "是否已故:", answer: "是")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let arr = [tmp0,tmp1,tmp2,tmp3]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "父亲信息", cellData0: arr)
arrDataForParents.append(model1)
}
} else {
printLog("error:父亲数据不存在")
}
}
do {
if let model = familyInfoPreviewModel?.mother {
if model.deceased == 0 {
//母亲信息-健在
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "母亲姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "是否已故:", answer: "否")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married)
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName)
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "现居住国家/地区:", answer: model.liveCountry)
var arr = [tmp0,tmp1,tmp2,tmp3,tmp11,tmp4,tmp5,tmp6]
if let card = model.hkIdentityCard,card.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "母亲信息-健在", cellData0: arr)
arrDataForParents.append(model1)
} else {
//母亲信息-已故
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "母亲信息:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "是否已故:", answer: "是")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let arr = [tmp0,tmp1,tmp2,tmp3]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "母亲信息", cellData0: arr)
arrDataForParents.append(model1)
}
} else {
printLog("error:母亲数据不存在")
}
}
arrDataForFamilyInfo = arrDataForParents
}
private func installDataForSpouseOp(model : YHFamilyMember) {
var arrTemp : [YHPreviewInfoSessionModel] = []
do {
if model.follow == 0 {
do {
//随行信息 - 否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "否")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息", cellData0: arr)
arrTemp.append(model1)
}
do {
//配偶信息-否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "配偶姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.usedName)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname)
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
var arr = [tmp0,tmp1,tmp2,tmp3,tmp4]
if let card = model.hkIdentityCard,card.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "配偶信息", cellData0: arr)
arrTemp.append(model1)
}
} else {
do {
//随行信息 - 是
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "是")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "国家/国籍:", answer: model.nationality)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: model.isHandled == 1 ? "已办理" : "未办理")
let arr = [tmp0,tmp1,tmp2]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息", cellData0: arr)
arrTemp.append(model1)
}
do {
//配偶信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "配偶姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.usedName)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname)
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation)
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName)
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否拥有学位:", answer: model.hasDegree == "1" ? "有学位" : "无学位")
var arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7]
if model.hasDegree == "1" {
for(index,item) in model.hasDegreeJson.enumerated() {
let title = "学位证" + String(index + 1) + ":"
let tmp8 = YHPreviewQuestionAndAnswerModel(question: title, answer: item.degree)
arr.append(tmp8)
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "学位证颁发地区:", answer: item.address)
arr.append(tmp9)
}
}
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "是否和主申请人同住:", answer: model.nows == 1 ? "是" : "否")
arr.append(tmp10)
var liveAbord = false //海外
var address = ""
if model.nows == 0 {
var title = ""
if model.address.country.contains("中国") {
//国内
title = "国内 "
if model.address.area.count > 1 {
title = title + model.address.area[0] + "/" + model.address.area[1]
} else {
title = "国内 --"
}
address = model.address.details
} else {
//国外
title = model.address.country
liveAbord = true
address = model.address.foreign
}
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer: title)
arr.append(tmp11)
}
if liveAbord == true {
let title = model.isLiveOverseaYear == 1 ? "是" : "否"
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "是否在海外居住满1年及以上:", answer: title)
arr.append(tmp12)
}
let tmp133 = YHPreviewQuestionAndAnswerModel(question: "详细地址:", answer: address)
arr.append(tmp133)
let tmp13 = YHPreviewQuestionAndAnswerModel(question: "目前是否在港:", answer: model.hkIdentity.isEmpty == false ? "是" : "否")
arr.append(tmp13)
if model.hkIdentity.isEmpty == false {
let tmp14 = YHPreviewQuestionAndAnswerModel(question: "获准逗留至:", answer: model.childInHk.info)
let tmp15 = YHPreviewQuestionAndAnswerModel(question: "在港身份:", answer: model.hkIdentity == "其他" ? (model.hkIdentityOther.isEmpty ? "其他" : model.hkIdentityOther) : model.hkIdentity)
arr.append(contentsOf: [tmp14,tmp15])
}
if let tmp = model.hkIdentityCard,tmp.isEmpty == false {
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
arr.append(tmp16)
let tmp17 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: tmp)
arr.append(tmp17)
} else {
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp16)
}
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "基本信息", cellData0: arr)
arrTemp.append(model2)
}
}
}
if model.isFollow() {
//1.跟随 证件信息
do {
//中国身份证
var str = model.certificates.cnIdentityCard.number
if str.isEmpty {
str = "无"
}
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: str)
str = model.certificates.cnIdentityCard.issueAt
if str.isEmpty {
str = "无"
}
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: str)
str = model.certificates.cnIdentityCard.issueAt
if str.isEmpty {
str = "无"
}
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.cnIdentityCard.issueDateEndAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
var arr = [model0]
//港澳通行证
if model.isHandled == 1 {
str = model.certificates.hkMacaoPass.number
if str.isEmpty {
str = "无"
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: str)
str = model.certificates.hkMacaoPass.issueAt
if str.isEmpty {
str = "无"
}
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: str)
str = model.certificates.hkMacaoPass.issueDateEndAt
if str.isEmpty {
str = "无"
}
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.hkMacaoPass.issueDateStartAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
arr.append(model1)
}
if model.nationality != "中国-China" {
//护照及其他旅行证件
var str = String(model.certificates.passport.passPortType)//for test hjl todo
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: str)
str = model.certificates.passport.number
if str.isEmpty {
str = "--"
}
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: str)
str = model.certificates.passport.issueAt
if str.isEmpty {
str = "无"
}
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
str = model.certificates.passport.issueDateStartAt
if str.isEmpty {
str = "无"
}
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.passport.issueDateEndAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
arr.append(model2)
}
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息", cellData1: arr)
arrTemp.append(model3)
}
//2.跟随 证件照
do {
//证件照片
let front = model.certificates.cnIdentityCard.imgFront
let back = model.certificates.cnIdentityCard.imgBack
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: front, backUrl: back, idType: 1)
var arr = [model1]
if model.isHandled == 1 {
let front = model.certificates.hkMacaoPass.imgFront
let back = model.certificates.hkMacaoPass.imgBack
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: front, backUrl: back, idType: 2)
arr.append(model2)
}
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片", cellData2: arr)
arrTemp.append(model4)
}
}
arrDataForSpouse = arrTemp
}
//配偶 数据
func installDataForSpouse() {
guard let model = familyInfoPreviewModel?.spouse else {
printLog("error:配偶数据不存在")
return
}
arrDataForSpouse.removeAll()
installDataForSpouseOp(model: model)
}
private func installDataForChildOp(model : YHFamilyMember,childIndex : Int) {
var arrTemp : [YHPreviewInfoSessionModel] = []
do {
if model.follow != 1 {
do {
//随行信息 - 否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "否")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息" + String(childIndex + 1), cellData0: arr)
arrTemp.append(model1)
}
do {
//配偶信息-否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "配偶姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.usedName.isEmpty ? "--" : model.usedName)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname.isEmpty ? "--" : model.surname)
let tmp22 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: String(model.sex))//for test hjl todo
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp44 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married.isEmpty ? "--" : model.married)
let tmp444 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation.isEmpty ? "--" : model.occupation)
var arr = [tmp0,tmp1,tmp2,tmp22,tmp3,tmp4,tmp44,tmp444]
if model.occupation != "无职业" {
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName.isEmpty ? "--" : model.occupationName)
arr.append(tmp6)
}
if let card = model.hkIdentityCard,card.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "子女信息" + String(childIndex + 1), cellData0: arr)
arrTemp.append(model1)
}
} else {
do {
//随行信息 - 是
let tmp00 = YHPreviewQuestionAndAnswerModel(question: "主申请人或现配偶是否拥有孩子护养权:", answer:model.custody == 1 ? "是" : "否")
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "该子女是否随行至香港:", answer: "是")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "国家/国籍:", answer: model.nationality)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: model.isHandled == 1 ? "已办理" : "未办理")
let arr = [tmp00,tmp0,tmp1,tmp2]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息" + String(childIndex + 1), cellData0: arr)
arrTemp.append(model1)
}
do {
//配偶信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "子女姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.usedName)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname)
let tmp22 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: String(model.sex)) //for test hjl todo
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married)
let tmp55 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation)
var arr = [tmp0,tmp1,tmp2,tmp22,tmp3,tmp4,tmp5,tmp55]
if model.occupation != "无职业" {
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName.isEmpty ? "--" : model.occupationName)
arr.append(tmp6)
}
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否拥有学位:", answer: model.hasDegree == "1" ? "有学位" : "无学位")
arr.append(tmp7)
if model.hasDegree == "1" {
for(index,item) in model.hasDegreeJson.enumerated() {
let title = "学位证" + String(index + 1) + ":"
let tmp8 = YHPreviewQuestionAndAnswerModel(question: title, answer: item.degree)
arr.append(tmp8)
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "学位证颁发地区:", answer: item.address)
arr.append(tmp9)
}
}
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "是否和主申请人同住:", answer: model.nows == 1 ? "是" : "否")
arr.append(tmp10)
var liveAbord = false //海外
var address = ""
if model.nows == 0 {
var title = ""
if model.address.country.contains("中国") {
//国内
title = "国内 "
if model.address.area.count > 1 {
title = title + model.address.area[0] + "/" + model.address.area[1]
} else {
title = "国内 --"
}
address = model.address.details
} else {
//国外
title = model.address.country
liveAbord = true
address = model.address.foreign
}
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer: title)
arr.append(tmp11)
}
if liveAbord == true {
let title = model.isLiveOverseaYear == 1 ? "是" : "否"
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "是否在海外居住满1年及以上:", answer: title)
arr.append(tmp12)
}
if model.nows == 0 {
let tmp133 = YHPreviewQuestionAndAnswerModel(question: "详细地址:", answer: address)
arr.append(tmp133)
}
let tmp13 = YHPreviewQuestionAndAnswerModel(question: "目前是否在港:", answer: model.hkIdentity.isEmpty == false ? "是" : "否")
arr.append(tmp13)
if model.hkIdentity.isEmpty == false {
let tmp14 = YHPreviewQuestionAndAnswerModel(question: "获准逗留至:", answer: model.childInHk.info)
let tmp15 = YHPreviewQuestionAndAnswerModel(question: "在港身份:", answer: model.hkIdentity == "其他" ? (model.hkIdentityOther.isEmpty ? "其他" : model.hkIdentityOther) : model.hkIdentity)
arr.append(contentsOf: [tmp14,tmp15])
}
if let tmp = model.hkIdentityCard,tmp.isEmpty == false {
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
arr.append(tmp16)
let tmp17 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: tmp)
arr.append(tmp17)
} else {
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp16)
}
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "子女信息" + String(childIndex + 1), cellData0: arr)
arrTemp.append(model2)
}
}
}
if model.isFollow() {
//1.跟随 证件信息
do {
//中国身份证
var str = model.certificates.cnIdentityCard.number
if str.isEmpty {
str = "无"
}
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: str)
str = model.certificates.cnIdentityCard.issueAt
if str.isEmpty {
str = "无"
}
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: str)
str = model.certificates.cnIdentityCard.issueAt
if str.isEmpty {
str = "无"
}
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.cnIdentityCard.issueDateEndAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
var arr = [model0]
//港澳通行证
if model.isHandled == 1 {
str = model.certificates.hkMacaoPass.number
if str.isEmpty {
str = "无"
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: str)
str = model.certificates.hkMacaoPass.issueAt
if str.isEmpty {
str = "无"
}
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: str)
str = model.certificates.hkMacaoPass.issueDateEndAt
if str.isEmpty {
str = "无"
}
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.hkMacaoPass.issueDateStartAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
arr.append(model1)
}
if model.nationality != "中国-China" {
//护照及其他旅行证件
var str = String(model.certificates.passport.passPortType)//for test hjl todo
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: str)
str = model.certificates.passport.number
if str.isEmpty {
str = "--"
}
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: str)
str = model.certificates.passport.issueAt
if str.isEmpty {
str = "无"
}
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
str = model.certificates.passport.issueDateStartAt
if str.isEmpty {
str = "无"
}
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.passport.issueDateEndAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
arr.append(model2)
}
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息" + String(childIndex + 1), cellData1: arr)
arrTemp.append(model3)
}
//2.跟随 证件照
do {
//证件照片
let front = model.certificates.cnIdentityCard.imgFront
let back = model.certificates.cnIdentityCard.imgBack
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: front, backUrl: back, idType: 1)
var arr = [model1]
if model.isHandled == 1 {
let front = model.certificates.hkMacaoPass.imgFront
let back = model.certificates.hkMacaoPass.imgBack
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: front, backUrl: back, idType: 2)
arr.append(model2)
}
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片" + String(childIndex + 1), cellData2: arr)
arrTemp.append(model4)
}
}
arrDataForChildren.append(contentsOf: arrTemp)
}
//子女 数据
func installDataForChildren() {
guard let model1 = familyInfoPreviewModel?.child else {
return
}
arrDataForChildren.removeAll()
for(index,model) in model1.enumerated() {
installDataForChildOp(model: model, childIndex:index)
}
}
//兄弟姐妹 数据
func installDataForBrother() {
guard let model1 = familyInfoPreviewModel?.brother else {
return
}
do {
//兄弟姐妹信息
for model in model1 {
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation)
var arr = [tmp0,tmp1,tmp2,tmp3,tmp4]
if model.occupation == "在职" {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName)
arr.append(tmp5)
}
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "现居住国家/地区:", answer: model.liveCountry)
arr.append(tmp6)
if let str = model.hkIdentityCard,str.isEmpty == false {
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
arr.append(tmp7)
arr.append(tmp8)
} else {
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp7)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "兄弟姐妹信息", cellData0: arr)
arrDataForBrother.append(model1)
}
}
}
}
......@@ -77,12 +77,13 @@ class YHWorkExperienceListViewController: YHBaseViewController {
bottomButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x2274ee)
// button.backgroundColor = UIColor(hex:0x2274ee)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("提交", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = 6
button.layer.cornerRadius = kCornerRadius6
button.clipsToBounds = true
button.addTarget(self, action: #selector(submit), for: .touchUpInside)
return button
}()
......@@ -93,6 +94,9 @@ class YHWorkExperienceListViewController: YHBaseViewController {
make.height.equalTo(48)
make.left.equalTo(16)
}
bottomButton.layoutIfNeeded()
bottomButton.addYinHeGradualLayer()
}
@objc func submit() {
......@@ -162,6 +166,8 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa
self.navigationController?.pushViewController(vc, animated: true)
}
}
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
}
......
......@@ -60,7 +60,7 @@ class YHWorkActionView: UIView {
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 13)
button.contentHorizontalAlignment = .center
button.setTitle("参考示例", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.setImage(UIImage(named: "work_experience_example"), for: .normal)
button.imageEdgeInsets = UIEdgeInsets(top: 2, left: 0, bottom: 2, right: 58)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
......
......@@ -75,11 +75,11 @@ class YHWorkExampleMessageTableViewCell: UITableViewCell {
useButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x2f7ef6).withAlphaComponent(0.08)
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.08)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 12)
button.contentHorizontalAlignment = .center
button.setTitle("使用此模板", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.layer.cornerRadius = 3
button.addTarget(self, action: #selector(submit), for: .touchUpInside)
return button
......
......@@ -101,6 +101,7 @@ class YHWorkExperienceItemView: UIView {
button.setTitleColor(UIColor.brandMainColor, for: .selected)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.layer.cornerRadius = 16
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13)
button.layer.borderWidth = 1
button.layer.borderColor = UIColor.brandMainColor.cgColor
button.isSelected = true
......@@ -121,6 +122,7 @@ class YHWorkExperienceItemView: UIView {
button.setTitleColor(UIColor.brandMainColor, for: .selected)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.layer.cornerRadius = 16
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 13)
button.addTarget(self, action: #selector(leftClick), for: .touchUpInside)
return button
}()
......@@ -143,7 +145,7 @@ class YHWorkExperienceItemView: UIView {
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
} else {
let str = dataSource.title ?? ""
......@@ -266,6 +268,9 @@ class YHWorkExperienceItemView: UIView {
leftButton.layer.borderWidth = 0
dataSource?.message = "0"
dataSource?.value = ["0"]
rightButton.titleLabel?.font = UIFont.PFSC_M(ofSize: 13)
leftButton.titleLabel?.font = UIFont.PFSC_R(ofSize: 13)
if let block = block {
block(dataSource ?? YHWorkExperienceModel())
}
......@@ -281,6 +286,9 @@ class YHWorkExperienceItemView: UIView {
rightButton.layer.borderWidth = 0
dataSource?.message = "1"
dataSource?.value = ["1"]
leftButton.titleLabel?.font = UIFont.PFSC_M(ofSize: 13)
rightButton.titleLabel?.font = UIFont.PFSC_R(ofSize: 13)
if let block = block {
block(dataSource ?? YHWorkExperienceModel())
}
......
......@@ -51,7 +51,7 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
}
func setupUI() {
backgroundColor = UIColor(hex: 0xe9e9e9)
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
......@@ -68,7 +68,7 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 16)
label.font = UIFont.PFSC_M(ofSize: 17)
label.text = "主申请人工作经历"
label.textColor = UIColor.mainTextColor
return label
......@@ -85,7 +85,7 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.text = "(从最近一份全职工作开始,直至毕业后的第一份工作)"
label.textColor = UIColor.subTextColor
label.textColor = UIColor.labelTextColor2
return label
}()
centerView.addSubview(subTitleLabel)
......@@ -101,7 +101,7 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("取消操作", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.addTarget(self, action: #selector(cannal), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -41,7 +41,7 @@ class YHWorkExperienceTableViewCell: UITableViewCell {
}
func setupUI() {
backgroundColor = UIColor(hex: 0xe9e9e9)
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
......
......@@ -50,6 +50,7 @@ class YHWorkExperienceTextItemView: UIView {
textField.backgroundColor = UIColor.contentBkgColor
textField.layer.cornerRadius = 4
textField.delegate = self
textField.font = UIFont.PFSC_R(ofSize: 14)
return textField
}()
addSubview(messageTextField)
......@@ -62,7 +63,7 @@ class YHWorkExperienceTextItemView: UIView {
promptsLabel = {
let textField = UILabel()
textField.font = UIFont.PFSC_R(ofSize: 14)
textField.textColor = UIColor(hex: 0xc0c0c0)
textField.textColor = UIColor.labelTextColor
return textField
}()
addSubview(promptsLabel)
......@@ -95,7 +96,7 @@ class YHWorkExperienceTextItemView: UIView {
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
} else {
let str = dataSource.title ?? ""
......
......@@ -45,7 +45,7 @@ class YHWorkFileSyncTableViewCell: UITableViewCell {
}
func setupUI() {
backgroundColor = UIColor(hex: 0xe9e9e9)
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
......@@ -69,7 +69,7 @@ class YHWorkFileSyncTableViewCell: UITableViewCell {
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr
return label
}()
......
......@@ -52,7 +52,7 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
}
func setupUI() {
backgroundColor = UIColor(hex: 0xe9e9e9)
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
......@@ -73,7 +73,7 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr
return label
}()
......
......@@ -91,7 +91,7 @@ class YHWorkIntroductionItemView: UIView {
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("删除", for: .normal)
button.setTitleColor( UIColor(hex:0xf81d22), for: .normal)
button.setTitleColor( UIColor.failColor, for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -50,7 +50,7 @@ class YHWorkIntroductionTableViewCell: UITableViewCell {
}
func setupUI() {
backgroundColor = UIColor(hex: 0xe9e9e9)
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
......@@ -85,7 +85,7 @@ class YHWorkIntroductionTableViewCell: UITableViewCell {
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("取消操作", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.addTarget(self, action: #selector(cannal), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -22,9 +22,9 @@ class YHWorkItemView: UIView {
var showPrompt: Bool = false {
didSet {
if showPrompt {
explainLabel.textColor = .red
explainLabel.textColor = UIColor.failColor
} else {
explainLabel.textColor = UIColor.subTextColor
explainLabel.textColor = UIColor.labelTextColor2
}
}
}
......@@ -47,7 +47,7 @@ class YHWorkItemView: UIView {
func setUpView() {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.font = UIFont.PFSC_B(ofSize: 14)
label.textAlignment = .left
label.textColor = UIColor.mainTextColor
return label
......@@ -64,7 +64,7 @@ class YHWorkItemView: UIView {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 12)
label.textAlignment = .left
label.textColor = UIColor.subTextColor
label.textColor = UIColor.labelTextColor2
return label
}()
addSubview(subTitleLabel)
......@@ -76,9 +76,9 @@ class YHWorkItemView: UIView {
explainLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.font = UIFont.PFSC_R(ofSize: 12)
label.textAlignment = .right
label.textColor = UIColor.subTextColor
label.textColor = UIColor.labelTextColor2
return label
}()
addSubview(explainLabel)
......@@ -118,7 +118,7 @@ class YHWorkItemView: UIView {
button.contentHorizontalAlignment = .center
button.setTitle("删除", for: .normal)
button.contentHorizontalAlignment = .right
button.setTitleColor( UIColor(hex:0xf81d22), for: .normal)
button.setTitleColor(UIColor.failColor, for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -49,7 +49,7 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
}
func setupUI() {
backgroundColor = UIColor(hex: 0xe9e9e9)
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
......@@ -101,7 +101,7 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr
return label
}()
......
......@@ -48,7 +48,7 @@ class YHWorkResponsibilitiesTableViewCell: UITableViewCell {
}
func setupUI() {
backgroundColor = UIColor(hex: 0xe9e9e9)
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
......@@ -69,7 +69,7 @@ class YHWorkResponsibilitiesTableViewCell: UITableViewCell {
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr
return label
}()
......
......@@ -40,9 +40,13 @@ extension YHServiceCenterMainViewModel {
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data
guard let resultModel = YHScoreResultModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,err)
return
}
self.myScoreResultData = resultModel
......@@ -54,8 +58,21 @@ extension YHServiceCenterMainViewModel {
localScoreData.work_experience_score!.resultData = resultModel.work_experience_score
localScoreData.education_score!.resultData = resultModel.education_score
localScoreData.talent_list_score!.resultData = resultModel.talent_list_score
}
callBackBlock(true,nil)
} else {
let err = YHErrorModel(errorCode: YHErrorCode.unknowError.rawValue, errorMsg: YHErrorCode.unknowError.description())
callBackBlock(false,err)
}
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
......
......@@ -23,7 +23,7 @@ extension YHLoginViewModel {
let params: [String : Any] = ["type": "Phone",
"value": phone,
"extend":"register"]
let strUrl = "http://test-cuser.galaxy-immi.com/" + "user/verify-code"
let strUrl = "http://test-cuser.galaxy-immi.com/" + YHAllApiName.User.verifyCode
let _ = YHNetRequest.postRequest(url: strUrl, params: params) {[weak self] json, code in
guard let self = self else { return }
......@@ -44,10 +44,7 @@ extension YHLoginViewModel {
let params: [String : Any] = ["mobile": phone,
"sms_code": code,
"client": "super_app"]
let strUrl = "http://test.api.diymanager.galaxy-immi.com/" + "infoflow/auth/login"
// http:test.api.diymanager.galaxy-immi.com/infoflow/auth/login
// let strUrl = "http://192.168.34.106:18088/" + "infoflow/auth/login"
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Auth.login
let _ = YHNetRequest.postRequest(url: strUrl, params: params) {[weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
......
......@@ -59,205 +59,5 @@ extension UIViewController {
return classType.init()
}
func bs_popToRootViewController(animated: Bool) {
let vcs = self.navigationController?.popToRootViewController(animated: true)
if vcs != nil {
self.tabBarController?.tabBar.isHidden = false
}
}
}
// MARK: - 创建RightBarButtonItem
extension UIViewController {
public func bs_setupRightButton(title: String? = nil, color: UIColor? = nil, image: UIImage? = nil, font: UIFont? = nil, imageColor: UIColor? = nil, reset: Bool = false) {
var button: UIButton?
if let rightBarButtonItems = self.navigationItem.rightBarButtonItems,
rightBarButtonItems.count > 0,
reset == false {
for view in rightBarButtonItems {
if let rightButton = view.customView as? UIButton {
button = rightButton
}
}
} else {
let rightButton = UIButton(type: .custom)
rightButton.frame = CGRect(x: 0, y: 0, width: 70, height: 44)
rightButton.addTarget(self, action: #selector(clickedNavRight), for: .touchUpInside)
rightButton.contentHorizontalAlignment = .right
let rightItem = UIBarButtonItem(customView: rightButton)
let negativeSeperator = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
negativeSeperator.width = -0
self.navigationItem.rightBarButtonItems = [negativeSeperator,rightItem]
button = rightButton
}
if font == nil {
button?.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
} else {
button?.titleLabel?.font = font
}
if var image = image {
if let imageColor = imageColor {
image = image.withRenderingMode(.alwaysTemplate)
button?.tintColor = imageColor
} else {
image = image.withRenderingMode(.alwaysOriginal)
}
button?.setImage(image, for: .normal)
button?.setImage(image, for: .highlighted)
}
button?.setTitle(title, for: .normal)
button?.setTitleColor(color, for: .normal)
}
@objc func clickedNavRight() {
}
}
// MARK: - 配置导航栏
extension UIViewController {
public func bs_config() {
self.navigationController?.navigationBar.isTranslucent = false
self.navigationController?.setNavigationBarHidden(false, animated: true)
self.bs_setupNavigationAttributed(.white)
self.bs_setupTitleAttributedAll()
self.bs_setupLeftButton()
self.bs_openPopGesture()
}
///设置导航条属性
func bs_setupNavigationAttributed(_ color: UIColor = UIColor.white) {
//设置状态栏
//UIApplication.shared.statusBarStyle = .default
//self.preferredStatusBarStyle = .default
self.navigationController?.navigationBar.barTintColor = color
self.navigationController?.navigationBar.setBackgroundImage(UIImage.from(color: color), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage() //隐藏下划线
}
///设置全局标题属性
func bs_setupTitleAttributedAll(font: UIFont = UIFont.PFSC_M(ofSize: 16), color: UIColor = .black) {
let titleDict = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: color]
self.navigationController?.navigationBar.titleTextAttributes = titleDict
}
///设置独立标题属性
func bs_setupTitleAttributed(title: String, font: UIFont = UIFont.PFSC_M(ofSize: 16), color: UIColor = .black, reset: Bool = false) {
var titleLabel: UILabel?
if let label = self.navigationItem.titleView as? UILabel,
reset == false {
titleLabel = label
} else {
let label = UILabel()
titleLabel = label
}
titleLabel?.font = font
titleLabel?.textColor = color
titleLabel?.text = title
self.navigationItem.titleView = titleLabel
}
///返回按钮
func bs_setupLeftButton(title: String? = nil, color: UIColor? = nil, image: UIImage? = UIImage(named: "back_icon"), reset: Bool = false) {
var button: UIButton?
if let leftBarButtonItems = self.navigationItem.leftBarButtonItems,
leftBarButtonItems.count > 0,
reset == false {
for view in leftBarButtonItems {
if let leftButton = view.customView as? UIButton {
button = leftButton
}
}
} else {
let leftButton = UIButton(type: .custom)
leftButton.frame = CGRect(x: 0, y: 0, width: 44, height: 44)
leftButton.addTarget(self, action: #selector(callBackAction), for: .touchUpInside)
leftButton.contentHorizontalAlignment = .left
leftButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: -4, bottom: 0, right: 0)
let leftItem = UIBarButtonItem(customView: leftButton)
let negativeSeperator = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
negativeSeperator.width = -0
self.navigationItem.leftBarButtonItems = [negativeSeperator,leftItem]
button = leftButton
}
var image = image
if color != nil {
image = image?.withRenderingMode(.alwaysTemplate)
} else {
image = image?.withRenderingMode(.alwaysOriginal)
}
button?.setImage(image, for: .normal)
button?.setImage(image, for: .highlighted)
button?.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button?.setTitle(title, for: .normal)
button?.setTitleColor(color, for: .normal)
button?.tintColor = color
}
///返回按钮响应
@objc func callBackAction() {
let selector = NSSelectorFromString("onCallBackAction")
if self.responds(to: selector) == true {
self.performSelector(onMainThread: selector, with: nil, waitUntilDone: false)
} else {
self.navigationController?.popViewController(animated: true)
}
}
/**
打开系统手势返回
*/
@objc func bs_openPopGesture() {
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
/**
关闭系统手势返回
*/
@objc func bs_closePopGesture() {
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
}
///修改导航栏背景色(全局)
public func bs_navBackgroundColor(_ color: UIColor) {
self.navigationController?.view.backgroundColor = color
//解决iOS13后backgroundColor设置无效的问题,参考https://developer.apple.com/forums/thread/682420
if #available(iOS 13.0, *) {
let newAppearance = UINavigationBarAppearance()
newAppearance.configureWithOpaqueBackground()
newAppearance.backgroundColor = color
newAppearance.shadowImage = UIImage()
newAppearance.shadowColor = nil
//newAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 20, weight: .medium)]
let appearance = self.navigationController?.navigationBar ?? UINavigationBar.appearance()
appearance.standardAppearance = newAppearance
appearance.scrollEdgeAppearance = appearance.standardAppearance
} else {
bs_setupNavigationAttributed(color)
}
}
}
......@@ -147,11 +147,6 @@ class YhConstant {
static let userProtocalURL = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/subpages/personal/pages/protocol/index?classify=agreement"
}
// MARK: - 登录信息
static let KLoginedInfoKey = "KLoginedInfoKey"
......
......@@ -36,7 +36,8 @@ class YHAllApiName {
//我的评分结果
static let scoreDetailApi = "frontend/order-assessment/score_detail"
static let scoreDetailApi = "infoflow/orderAssessment/scoreDetail"
//获取其他资料填写信息
// static let otherInfoFillApi = "frontend/order/getOrderOtherInformation"
......@@ -49,31 +50,24 @@ class YHAllApiName {
struct Family {
// 获取家庭成员信息 添加家庭成员也用这个
// static let familyInfoApi = "frontend/order/information/family"
static let familyInfoApi = "infoflow/information/family"
// 删除家庭成员信息
static let deleteFamilyMemberApi = "infoflow/family/delete"
// 提交家庭成员信息
static let submitAllFamilyInfoApi = "family/submit"
static let submitAllFamilyInfoApi = "/infoflow/family/submit"
}
struct Education {
// 获取教育和专业资格列表
static let getEducationAndQulificationInfoListApi = "infoflow/getEducationList"
// 获取学历详情信息
static let getEducationDetailInfoApi = "infoflow/getEducationDetail"
// 保存学历信息
static let saveEducationInfoApi = "infoflow/saveEducationData"
// 删除学历
static let deleteEducationInfoApi = "infoflow/delEducationData"
// 保存所有信息
static let saveAllEduAndQuaInfoApi = "infoflow/submitEducert"
// 搜索大学名称
static let searchCollegeNameApi = "infoflow/getSchools"
......@@ -148,4 +142,27 @@ class YHAllApiName {
//识别附件
static let ocrFileContent = "infoflow/work/getOcrFileContent"
}
//登录
struct Auth {
static let login = "infoflow/auth/login"
}
//获取验证
struct User {
static let verifyCode = "user/verify-code"
}
//预览相关接口
struct Preview {
//其他信息
static let previewOtherInfoApi = "infoflow/residence/preview"
//基本资料
static let previewBasicInfoApi = "infoflow/basics/get_basics"
//主申请人信息
static let previewMainApplicationInfoApi = "infoflow/order-information/get_information"
//家庭成员信息
static let previewFamilyInfoApi = "infoflow/information/family"
}
}
......@@ -95,7 +95,6 @@ class YHNetRequest: NSObject {
requestHeader.add(name:"sign",value:sign)
requestHeader.add(name: "token", value: YHLoginManager.shared.userModel?.token ?? "-")
// testToken(&requestHeader) //for test hjl 使用固定token
headers = requestHeader
}
......@@ -150,6 +149,12 @@ class YHNetRequest: NSObject {
}
let requestHeaders = getHeader()
#if DEBUG
printLog("网络请求头数据:" )
printLog(requestHeaders)
#endif
///不使用缓存
AF.sessionConfiguration.requestCachePolicy = .reloadIgnoringCacheData
AF.sessionConfiguration.timeoutIntervalForRequest = 20
......
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