Commit d036f520 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  长期按钮添加 时间选择器标题
  // 学历资格
  // 类名更改
  // 家庭成员
  // 家庭成员
  // 城市选择器
  主申请人国家搜索优化  字段校验优化
  // 字数限制
  主申请人相关bug处理
  // 字数限制
  图片点击放大
  相片裁剪 识别逻辑UI
parents feccbf0e 1c44327b
......@@ -18,7 +18,7 @@
041B52912B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */; };
041B52932B5E6CBA007EBCEB /* YHFormItemTitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52922B5E6CBA007EBCEB /* YHFormItemTitleCell.swift */; };
041B52952B5E7037007EBCEB /* YHFormItemAddCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52942B5E7037007EBCEB /* YHFormItemAddCell.swift */; };
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */; };
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift */; };
041B52D62B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52D52B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift */; };
041B52DB2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */; };
041B52DD2B60A889007EBCEB /* YHTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52DC2B60A889007EBCEB /* YHTest.swift */; };
......@@ -45,6 +45,7 @@
044CC6292B8741AC0083FF76 /* YHSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044CC6282B8741AC0083FF76 /* YHSearchBar.swift */; };
044CC62B2B876A230083FF76 /* YHSheetPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044CC62A2B876A230083FF76 /* YHSheetPickerView.swift */; };
044CC62D2B876C980083FF76 /* YHSheetPickerViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044CC62C2B876C980083FF76 /* YHSheetPickerViewType.swift */; };
045DBF782B96FF5900992CAF /* YHImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045DBF772B96FF5900992CAF /* YHImageViewController.swift */; };
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */; };
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */; };
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */; };
......@@ -74,6 +75,12 @@
0468D47E2B68CEA200CFB916 /* YHImagePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D47D2B68CEA200CFB916 /* YHImagePickerView.swift */; };
0468D4802B6914E600CFB916 /* YHSelectCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D47F2B6914E600CFB916 /* YHSelectCountryViewController.swift */; };
0468D4822B6A2A8500CFB916 /* YHSelectCountryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4812B6A2A8500CFB916 /* YHSelectCountryViewModel.swift */; };
0469750E2B96C0B900A0CB66 /* YHImageClipperViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0469750D2B96C0B900A0CB66 /* YHImageClipperViewController.swift */; };
046975102B96C13700A0CB66 /* YHClipperView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0469750F2B96C13700A0CB66 /* YHClipperView.swift */; };
046975122B96C77000A0CB66 /* YHClipperButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 046975112B96C77000A0CB66 /* YHClipperButton.swift */; };
046975162B96EB2200A0CB66 /* YHImageResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 046975152B96EB2200A0CB66 /* YHImageResultViewController.swift */; };
046975182B96EEB200A0CB66 /* YHResultBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 046975172B96EEB200A0CB66 /* YHResultBottomView.swift */; };
04754A952B96FF3D00F8ADCA /* UITextField+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */; };
04808C062B4686510056D53C /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04808C042B4686510056D53C /* ATAuthSDK.bundle */; };
04808C082B4686C10056D53C /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04808C032B4686510056D53C /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
......@@ -329,7 +336,7 @@
041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemEnterDetailCell.swift; sourceTree = "<group>"; };
041B52922B5E6CBA007EBCEB /* YHFormItemTitleCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemTitleCell.swift; sourceTree = "<group>"; };
041B52942B5E7037007EBCEB /* YHFormItemAddCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemAddCell.swift; sourceTree = "<group>"; };
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberInfoVC.swift; sourceTree = "<group>"; };
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberInfoListVC.swift; sourceTree = "<group>"; };
041B52D52B5F899E007EBCEB /* YHSpousePrimaryInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpousePrimaryInfoVC.swift; sourceTree = "<group>"; };
041B52DA2B5FDF8E007EBCEB /* YHFamilyInitialInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyInitialInfo.swift; sourceTree = "<group>"; };
041B52DC2B60A889007EBCEB /* YHTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTest.swift; sourceTree = "<group>"; };
......@@ -356,6 +363,7 @@
044CC6282B8741AC0083FF76 /* YHSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSearchBar.swift; sourceTree = "<group>"; };
044CC62A2B876A230083FF76 /* YHSheetPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSheetPickerView.swift; sourceTree = "<group>"; };
044CC62C2B876C980083FF76 /* YHSheetPickerViewType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSheetPickerViewType.swift; sourceTree = "<group>"; };
045DBF772B96FF5900992CAF /* YHImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImageViewController.swift; sourceTree = "<group>"; };
0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVerificationCodeLoginController.swift; sourceTree = "<group>"; };
0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPhoneMessageView.swift; sourceTree = "<group>"; };
0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeResultViewController.swift; sourceTree = "<group>"; };
......@@ -385,6 +393,12 @@
0468D47D2B68CEA200CFB916 /* YHImagePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImagePickerView.swift; sourceTree = "<group>"; };
0468D47F2B6914E600CFB916 /* YHSelectCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectCountryViewController.swift; sourceTree = "<group>"; };
0468D4812B6A2A8500CFB916 /* YHSelectCountryViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectCountryViewModel.swift; sourceTree = "<group>"; };
0469750D2B96C0B900A0CB66 /* YHImageClipperViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImageClipperViewController.swift; sourceTree = "<group>"; };
0469750F2B96C13700A0CB66 /* YHClipperView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHClipperView.swift; sourceTree = "<group>"; };
046975112B96C77000A0CB66 /* YHClipperButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHClipperButton.swift; sourceTree = "<group>"; };
046975152B96EB2200A0CB66 /* YHImageResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHImageResultViewController.swift; sourceTree = "<group>"; };
046975172B96EEB200A0CB66 /* YHResultBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResultBottomView.swift; sourceTree = "<group>"; };
04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField+Extension.swift"; sourceTree = "<group>"; };
04808C032B4686510056D53C /* ATAuthSDK_D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ATAuthSDK_D.framework; sourceTree = "<group>"; };
04808C042B4686510056D53C /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ATAuthSDK.bundle; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
......@@ -674,13 +688,11 @@
041B52962B5E8E3B007EBCEB /* C */ = {
isa = PBXGroup;
children = (
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift */,
04C8F4802B720DAB00ADF59B /* Spouse(配偶) */,
04754A962B97286F00F8ADCA /* Certificates(证书上传和证书信息) */,
04754A972B97289200F8ADCA /* Parents&Brothers(父母和兄弟姐妹) */,
04C8F4812B720DCD00ADF59B /* Child(子女) */,
041B52972B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -808,6 +820,24 @@
path = YHAddressPicker;
sourceTree = "<group>";
};
04754A962B97286F00F8ADCA /* Certificates(证书上传和证书信息) */ = {
isa = PBXGroup;
children = (
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
0413A6D72B8C76290006D154 /* YHCertificateUploadVC.swift */,
);
path = "Certificates(证书上传和证书信息)";
sourceTree = "<group>";
};
04754A972B97289200F8ADCA /* Parents&Brothers(父母和兄弟姐妹) */ = {
isa = PBXGroup;
children = (
042FBBC22B63DA4C00F9DE23 /* YHParentInfoVC.swift */,
042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */,
);
path = "Parents&Brothers(父母和兄弟姐妹)";
sourceTree = "<group>";
};
04808C022B4686510056D53C /* Frameworks */ = {
isa = PBXGroup;
children = (
......@@ -934,6 +964,9 @@
04E86E562B848D5A00A35F4B /* YHWorkIntroductionViewController.swift */,
04E86E582B84AD6200A35F4B /* YHWorkExampleViewController.swift */,
04E86E692B87352600A35F4B /* YHCompanySelectViewController.swift */,
0469750D2B96C0B900A0CB66 /* YHImageClipperViewController.swift */,
046975152B96EB2200A0CB66 /* YHImageResultViewController.swift */,
045DBF772B96FF5900992CAF /* YHImageViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -958,6 +991,9 @@
04E86E3D2B834FC100A35F4B /* YHWorkExperienceTextItemView.swift */,
04E86E5A2B84BF2000A35F4B /* YHWorkExampleTypeView.swift */,
04E86E5C2B84CC9700A35F4B /* YHWorkExampleMessageView.swift */,
0469750F2B96C13700A0CB66 /* YHClipperView.swift */,
046975112B96C77000A0CB66 /* YHClipperButton.swift */,
046975172B96EEB200A0CB66 /* YHResultBottomView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -1385,6 +1421,7 @@
A5ACE9022B4564F7002C94D2 /* AppDelegate+Extension.swift */,
A5ACE9032B4564F7002C94D2 /* UILable+Extension.swift */,
A5ACE9042B4564F7002C94D2 /* Array+Extension.swift */,
04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */,
);
path = Extention;
sourceTree = "<group>";
......@@ -1858,12 +1895,14 @@
A5FD63C52B637EE000D1D9DA /* YHSubmitAllInfoCheckView.swift in Sources */,
A5ACE9442B4564F7002C94D2 /* Array+Extension.swift in Sources */,
0468D4282B50D4AF00CFB916 /* YHPrivacyAlertView.swift in Sources */,
046975102B96C13700A0CB66 /* YHClipperView.swift in Sources */,
A58556C22B6C8412003746B2 /* YHScoreResultModel.swift in Sources */,
0468D47A2B68A08600CFB916 /* YHAddressPickViewTableViewCell.swift in Sources */,
0468D4342B56587B00CFB916 /* YHOSSManager.swift in Sources */,
A596C3A42B84D9100067BBB8 /* YHOtherInfoSessionView.swift in Sources */,
A5234E372B70802400A33433 /* YHBasicInfoCellModel.swift in Sources */,
A5C382D12B5FAAB300C5E65C /* YHContactItemModel.swift in Sources */,
046975182B96EEB200A0CB66 /* YHResultBottomView.swift in Sources */,
A5FD63EF2B68902400D1D9DA /* YHPreviewInfoNameAndSubNameItemView.swift in Sources */,
A5ACE9522B4564F7002C94D2 /* YHServiceCenterMainViewController.swift in Sources */,
A5C5B2FD2B55361700A7C5D1 /* YHBannerModel.swift in Sources */,
......@@ -1888,6 +1927,8 @@
04E86E322B81EA1000A35F4B /* YHWorkItemAddView.swift in Sources */,
A5C5B2FB2B5535DF00A7C5D1 /* YHHomeBannerView.swift in Sources */,
A5F78C822B68F39600EEA170 /* YHPreviewInfoCell.swift in Sources */,
046975122B96C77000A0CB66 /* YHClipperButton.swift in Sources */,
0469750E2B96C0B900A0CB66 /* YHImageClipperViewController.swift in Sources */,
A5ACE94B2B4564F7002C94D2 /* YHHUDRotatingImageView.swift in Sources */,
041B52DD2B60A889007EBCEB /* YHTest.swift in Sources */,
04E86E0F2B70DE9400A35F4B /* YHSpouseInfoContainerVC.swift in Sources */,
......@@ -1923,11 +1964,13 @@
04E86E2F2B81EA1000A35F4B /* YHWorkExperienceListViewController.swift in Sources */,
042F88932B84AEF0008B60BD /* YHQuestionInfo.swift in Sources */,
A5ACE93F2B4564F7002C94D2 /* UIViewController+Extension.swift in Sources */,
046975162B96EB2200A0CB66 /* YHImageResultViewController.swift in Sources */,
042FBBD62B67BDD500F9DE23 /* YHBrotherInfoVC.swift in Sources */,
A5ACE9472B4564F7002C94D2 /* YHHUD.swift in Sources */,
A5ACE9412B4564F7002C94D2 /* Dictionary+Extension.swift in Sources */,
A5C5B3102B57677300A7C5D1 /* YHGestureTableView.swift in Sources */,
A5167B272B692CF20084C08F /* YHPreviewInfoCertificatePictureItemView.swift in Sources */,
04754A952B96FF3D00F8ADCA /* UITextField+Extension.swift in Sources */,
A5ACE9312B4564F7002C94D2 /* YHPersonalCenterCell.swift in Sources */,
04E86E5D2B84CC9700A35F4B /* YHWorkExampleMessageView.swift in Sources */,
A5ACE9532B4564F7002C94D2 /* YHBaseViewController.swift in Sources */,
......@@ -1987,6 +2030,7 @@
A5ACE9492B4564F7002C94D2 /* YHHUDSuccessView.swift in Sources */,
A58556BA2B6BCF1A003746B2 /* YHPersonInfoFillStepModel.swift in Sources */,
A5FD63D42B65F99500D1D9DA /* YHScoreItemCell.swift in Sources */,
045DBF782B96FF5900992CAF /* YHImageViewController.swift in Sources */,
A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */,
A596C3A02B84D9100067BBB8 /* YHOtherInfoFillCell.swift in Sources */,
A5ACE9382B4564F7002C94D2 /* UIApplication+Extension.swift in Sources */,
......@@ -2004,7 +2048,7 @@
04E86E5B2B84BF2000A35F4B /* YHWorkExampleTypeView.swift in Sources */,
042FBBBD2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift in Sources */,
A5FD63C32B63438A00D1D9DA /* YHContactMainItemStatusModel.swift in Sources */,
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoVC.swift in Sources */,
041B52982B5E8EA0007EBCEB /* YHFamilyMemberInfoListVC.swift in Sources */,
0468D47B2B68A08600CFB916 /* YHAddressPresentAnimated.swift in Sources */,
A5C382CF2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift in Sources */,
0468D4782B68A08600CFB916 /* YHAddressModel.swift in Sources */,
......
......@@ -368,7 +368,7 @@ extension YHInformationPerfectListVC : UITableViewDelegate,UITableViewDataSource
} else if indexPath.row == 1 {
//家庭程序信息
let vc = YHFamilyMemberInfoVC(orderId: orderId ?? 0)
let vc = YHFamilyMemberInfoListVC(orderId: orderId ?? 0)
vc.orderId = orderId ?? 0
navigationController?.pushViewController(vc)
......
......@@ -70,7 +70,7 @@ class YHEducationDetailVC: YHBaseViewController {
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
saveDetailInfo(isNeedPop: true)
saveDetailInfo(isNeedPop: true, isShowToast: true)
}
bottomView.submitBlock = {
......@@ -228,7 +228,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
if isEditEnd {
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
}
......@@ -311,7 +311,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
}
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
self.navigationController?.pushViewController(vc)
......@@ -323,7 +323,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.teachingFormat = selectType.title
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
......@@ -340,7 +340,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
}
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
......@@ -352,7 +352,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.degree = selectType.title
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
......@@ -364,7 +364,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.degreeType = selectItem.title
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
......@@ -377,7 +377,7 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
detailInfo.schoolAddress.country = country
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
self.navigationController?.pushViewController(vc)
......@@ -390,10 +390,17 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
detailInfo.schoolAddress.area = [string1, string2, string3, string4]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
detailInfo.schoolAddress.area = citys
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false)
saveDetailInfo(isNeedPop: false, isShowToast:false)
}
}
self.present(vc, animated: true)
......@@ -480,7 +487,7 @@ extension YHEducationDetailVC {
YHHUD.flash(message: "资料还未填完")
return
}
saveDetailInfo(isNeedPop: true)
saveDetailInfo(isNeedPop: true, isShowToast: true)
}
// 检查填写信息完整性
......@@ -509,7 +516,7 @@ extension YHEducationDetailVC {
}
// 保存信息 isNeedPop:保存成功后是否退出该页面
func saveDetailInfo(isNeedPop:Bool) {
func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) {
// detailInfo.toDictionary() 对于值为空的字段不会添加 而后台需要 所以如下处理
// let dict:[String : Any] = [
......@@ -531,17 +538,21 @@ extension YHEducationDetailVC {
guard var dict:[String:Any] = detailInfo.toDictionary() else { return }
dict["order_id"] = self.orderId
self.educationRequest.saveEducationInfo(params: dict) {
self.educationRequest.saveEducationInfo(params: dict, isSilent: !isShowToast) {
[weak self] success, error in
guard let self = self else { return }
if success {
YHHUD.flash(message: "保存成功")
if isShowToast {
YHHUD.flash(message: "保存成功")
}
if isNeedPop {
self.navigationController?.popViewController(animated: true)
}
} else {
YHHUD.flash(message: "保存失败")
if isShowToast {
YHHUD.flash(message: "保存失败")
}
}
}
}
......
......@@ -153,7 +153,7 @@ class YHEducationInfoListVC: YHBaseViewController {
let title2 = YHFormTitleItem(type: .edutionalCertificateNameAndBirthday)
var arr2:[YHFormItemProtocol] = [title2]
// 问题集合
let questions = YHQuestionInfo.getEducationQuestion()
let questions = YHQuestionInfo.getEducationQuestion(eduList: educationInfo)
for questionInfo in questions {
if questionInfo.key == "qualification" {
questionInfo.answer = educationInfo.isNameSame
......
......@@ -308,7 +308,14 @@ extension YHQualificationDetailVC : UITableViewDelegate, UITableViewDataSource {
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
detailInfo.issuingAddr.area = [string1, string2, string3, string4]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
detailInfo.issuingAddr.area = citys
loadInfo()
if detailId != 0 {
saveDetailInfo(isNeedPop: false, isShowToast: false)
......@@ -391,12 +398,12 @@ extension YHQualificationDetailVC {
func saveDetailInfo(isNeedPop:Bool, isShowToast:Bool) {
var dict:[String : Any] = ["orderId":self.orderId]
var quaDict:[String : Any] = detailInfo.toDictionary() ?? [:]
let quaDict:[String : Any] = detailInfo.toDictionary() ?? [:]
dict["qua_data"] = quaDict
print(dict)
self.educationRequest.saveQualificationInfo(params: dict) {
self.educationRequest.saveQualificationInfo(params: dict, isSilent:!isShowToast) {
[weak self] success, error in
guard let self = self else { return }
if success {
......
......@@ -17,6 +17,10 @@ class YHEducationListInfo: SmartCodable {
var isSpouseNameSame:Bool?
// 1=已婚,2=未婚,3=离婚,4=分居,5=丧偶,6=事实婚姻,7=鳏寡
var married: Int = 0
func isMarried() ->Bool {
return married != 2
}
enum CodingKeys: String, CodingKey {
case orderId = "order_id"
......
......@@ -71,15 +71,19 @@ class YHEducationRequestViewModel {
}
// 保存学历
func saveEducationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
func saveEducationInfo(params:[String:Any], isSilent:Bool, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
if !isSilent {
YHHUD.show(.progress(message: "数据加载中..."))
}
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Education.saveEducationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
if !isSilent {
YHHUD.hide()
}
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
......@@ -195,15 +199,19 @@ class YHEducationRequestViewModel {
}
// 保存专业信息
func saveQualificationInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
func saveQualificationInfo(params:[String:Any], isSilent:Bool, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
YHHUD.show(.progress(message: "数据加载中..."))
if !isSilent {
YHHUD.show(.progress(message: "数据加载中..."))
}
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Qualification.saveQualificationInfoApi
let _ = YHNetRequest.postRequest(url: strUrl, params:params) {[weak self] json, code in
YHHUD.hide()
if !isSilent {
YHHUD.hide()
}
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == NetWorkCode.success.rawValue {
......
......@@ -37,7 +37,7 @@ class YHQuestionInfo: SmartCodable, YHFormItemProtocol {
extension YHQuestionInfo {
// 【问题】学历证书姓名及出生日期正确性
static func getEducationQuestion() -> [YHQuestionInfo] {
static func getEducationQuestion(eduList:YHEducationListInfo) -> [YHQuestionInfo] {
let path = Bundle.main.path(forResource: "YHQuestionList", ofType: "plist")
let questions:[Dictionary] = NSArray(contentsOfFile:path!) as! [Dictionary<String, Any>]
var res:[YHQuestionInfo] = []
......@@ -45,7 +45,13 @@ extension YHQuestionInfo {
guard let questionInfo = YHQuestionInfo.deserialize(dict: dict as? [AnyHashable : Any]) else {
continue
}
res.append(questionInfo)
if questionInfo.key == "graduate" {
if eduList.isMarried() {
res.append(questionInfo)
}
} else {
res.append(questionInfo)
}
}
return res
}
......
......@@ -153,6 +153,26 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textInputCondtion = {
textField in
var max = -1
if detailItem.type == .chinaIdentityCardNumber { // 身份证
max = 18
} else if detailItem.type == .certificateSignPlace { // 签发地
max = 100
} else if detailItem.type == .traverlPassportNumber ||
detailItem.type == .certificateNumber {
max = 50
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......
......@@ -263,6 +263,32 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textInputCondtion = {
textField in
if detailItem.type == .befourMarryFirstName { // 仅支持输入最多30个大写字母
let regex = "[^A-Z]+"
textField.limitInputWithPattern(pattern:regex, 30)
return true
}
var max = -1
if detailItem.type == .childName ||
detailItem.type == .everName {
max = 30
} else if detailItem.type == .birthCity ||
detailItem.type == .occupationName
{
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......@@ -429,7 +455,14 @@ 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]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.child?.birthPlace.area = citys
self.loadInfo()
save()
}
......
......@@ -13,6 +13,8 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var child:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var isNeedShowError = false
// 是否随行能编辑
var isFollowCanEdit = true
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -54,6 +56,7 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
items.removeAll()
isFollowCanEdit = !child.is18YearsOld()
// 随行
let title0 = YHFormTitleItem(type: .accompany)
let item00 = YHFormDetailItem(type: .ownCustody, value:String(child.isOwnCustody()))
......@@ -205,15 +208,23 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .twoChoice {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.isCanEdit = true
var select = false
if let value = detailItem.value {
select = Bool(value)!
}
if detailItem.type == .isAccompanyToHK, let child = child, child.is18YearsOld() { // 是否随行至香港
// 年满18岁不能随行
select = false
cell.isCanEdit = isFollowCanEdit
}
let answers = [YHFormChoiceItem(title: "是".local, isSelect: select),YHFormChoiceItem(title: "否".local, isSelect: !select)]
cell.answerArr = answers
......@@ -268,10 +279,10 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
cell.textInputCondtion = {
text in
if let textStr = text {
textField in
if let textStr = textField.text {
let max = 100
text = textStr.count > max ? textStr[safe: ..<max] : textStr
textField.text = textStr.count > max ? textStr[safe: ..<max] : textStr
}
return true
}
......@@ -363,23 +374,37 @@ 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]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.child?.address.area = citys
self.loadInfo()
}
self.present(vc, animated: true)
} else if detailItem.type == .birthday { // 出生日期
// 子女选择年满18岁则【是否随行至香港】默认选择否,不可修改
// 如果未年满18岁则【是否随行至香港】可选择【是/否】,可修改
YHDatePickView.show(type: .yyyymmdd) { [weak self] date in
guard let self = self else { return }
if detailItem.type == .birthday {
self.child?.birthday = date
guard let child = child else { return }
child.birthday = date
isFollowCanEdit = !child.is18YearsOld()
}
self.loadInfo()
}
}
}
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
......
......@@ -234,6 +234,23 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
cell.textInputCondtion = {
textField in
var max = -1
if detailItem.type == .brotherName {
max = 30
} else if detailItem.type == .birthCity {
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
......@@ -391,7 +408,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
var isBirthOverSeas = false
if let brotherInfo = brotherInfo {
isBirthOverSeas = brotherInfo.isOverSeasOver1Year()
isBirthOverSeas = brotherInfo.isBirthOverSeas()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
......@@ -401,7 +418,14 @@ 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]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.brotherInfo?.birthPlace.area = citys
self.loadInfo()
saveInfoSilent()
}
......
......@@ -276,6 +276,26 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
cell.textInputCondtion = {
textField in
var max = -1
if detailItem.type == .fatherName ||
detailItem.type == .motherName {
max = 30
} else if detailItem.type == .birthCity ||
detailItem.type == .occupationName
{
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
......@@ -433,7 +453,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
var isBirthOverSeas = false
if let parentInfo = parentInfo {
isBirthOverSeas = parentInfo.isOverSeasOver1Year()
isBirthOverSeas = parentInfo.isBirthOverSeas()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
......@@ -443,7 +463,14 @@ 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]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.parentInfo?.birthPlace.area = citys
self.loadInfo()
saveInfoSilent()
}
......
......@@ -389,7 +389,32 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
cell.textInputCondtion = {
textField in
if detailItem.type == .befourMarryFirstName { // 仅支持输入最多30个大写字母
let regex = "[^A-Z]+"
textField.limitInputWithPattern(pattern:regex, 30)
return true
}
var max = -1
if detailItem.type == .spouseName ||
detailItem.type == .everName {
max = 30
} else if detailItem.type == .birthCity ||
detailItem.type == .occupationName
{
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......@@ -618,7 +643,14 @@ 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]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.spouse?.birthPlace.area = citys
loadInfo()
save()
}
......
......@@ -234,10 +234,10 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textInputCondtion = {
text in
if let textStr = text {
textField in
if let textStr = textField.text {
let max = 100
text = textStr.count > max ? textStr[safe: ..<max] : textStr
textField.text = textStr.count > max ? textStr[safe: ..<max] : textStr
}
return true
}
......@@ -326,7 +326,14 @@ 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]
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.spouse?.address.area = citys
self.loadInfo()
save()
}
......
......@@ -14,7 +14,7 @@ enum YHFormTitleItemEditType:Int {
case canCancel = 3
}
class YHFamilyMemberInfoVC: YHBaseViewController {
class YHFamilyMemberInfoListVC: YHBaseViewController {
var orderId:Int
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
......@@ -230,7 +230,7 @@ class YHFamilyMemberInfoVC: YHBaseViewController {
}
}
extension YHFamilyMemberInfoVC {
extension YHFamilyMemberInfoListVC {
// 请求家庭成员信息
func requestFamilyInfo() {
......@@ -293,7 +293,7 @@ extension YHFamilyMemberInfoVC {
}
}
extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHFamilyMemberInfoListVC : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
......@@ -368,17 +368,30 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.detailLabel.text = "还未开始填写".local
}
if detailItem.relationType == .child || detailItem.relationType == .brother {
if detailItem.subsetName == nil || detailItem.subsetName == "" { // 姓名为空
if detailItem.relationType == .child {
cell.title = String(format: "子女%d".local, indexPath.row)
} else if detailItem.relationType == .brother {
cell.title = String(format: "兄弟姐妹%d".local, indexPath.row)
}
} else {
cell.title = detailItem.subsetName
if isEmptyString(detailItem.subsetName) { // 姓名为空
if detailItem.relationType == .child {
cell.title = String(format: "子女%d".local, indexPath.row)
} else if detailItem.relationType == .brother {
cell.title = String(format: "兄弟姐妹%d".local, indexPath.row)
}
} else {
var name = ""
if detailItem.relationType == .father {
name = "父亲"
} else if detailItem.relationType == .mother {
name = "母亲"
} else if detailItem.relationType == .spouse {
name = "配偶"
} else if detailItem.relationType == .child {
name = "子女"
} else if detailItem.relationType == .brother {
name = "兄弟姐妹"
}
name += "-"
name += detailItem.subsetName
cell.title = name
}
cell.isShowDeleteBtn = false
cell.deleteBlock = nil
if detailItem.relationType == .child || detailItem.relationType == .brother {
......@@ -462,6 +475,7 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
if formItem.type == .addChild || formItem.type == .addBrother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = formItem.getTitle()
cell.clickBlock = { [weak self] in
guard let self = self else { return }
if formItem.type == .addBrother {
......
......@@ -1123,6 +1123,41 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
self.childStepchild.has = (val ? "Y" : "N")
}
// 根据生日推算年龄
func getAge(birthday:String) ->Int {
let arr = birthday.components(separatedBy: YHDatePickView.separator)
if arr.count == 3 {
let year = Int(arr[0]) ?? 0
let month = Int(arr[1]) ?? 0
let day = Int(arr[2]) ?? 0
let now = Date()
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
let current = formatter.string(from: now)
let curArr = current.components(separatedBy:"-")
if curArr.count == 3 {
let cyear = Int(curArr[0]) ?? 0
let cmonth = Int(curArr[1]) ?? 0
let cday = Int(curArr[2]) ?? 0
var age = cyear - year
if cmonth < month {
age -= 1
} else if cmonth == month && cday < day {
age -= 1
}
return age
}
}
return 0
}
func is18YearsOld() -> Bool {
let age = getAge(birthday: birthday)
return age >= 18
}
var relationType:YHFamilyMemberType {
get {
......
......@@ -38,6 +38,13 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
// 是否必须字段
var isMust:Bool = false
var answerBlock:(([YHFormChoiceItem], Int)->Void)?
// 是否能点击两个按钮
var isCanEdit:Bool = true {
didSet {
answer1Btn.isUserInteractionEnabled = isCanEdit
answer2Btn.isUserInteractionEnabled = isCanEdit
}
}
var title:String? {
didSet {
......
......@@ -22,7 +22,7 @@ class YHFormItemInputTextCell: UITableViewCell {
}
// BOOL值表示编辑是否结束
var textChange:((String?, Bool)->Void)?
var textInputCondtion:((inout String?)->Bool)?
var textInputCondtion:((UITextField)->Bool)?
var title:String? {
didSet {
......@@ -165,7 +165,7 @@ class YHFormItemInputTextCell: UITableViewCell {
@objc func textFieldChanged(textField:UITextField) {
if let textChange = textChange {
if let textInputCondtion = textInputCondtion {
if textInputCondtion(&textField.text) {
if textInputCondtion(self.textField) {
textChange(textField.text, false)
}
} else {
......@@ -177,7 +177,7 @@ class YHFormItemInputTextCell: UITableViewCell {
@objc func textFieldEditEnd(textField:UITextField) {
if let textChange = textChange {
if let textInputCondtion = textInputCondtion {
if textInputCondtion(&textField.text) {
if textInputCondtion(self.textField) {
textChange(textField.text, true)
}
} else {
......
......@@ -93,7 +93,7 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
guard let self = self else { return }
if self.viewModel.isCanNext(self.stepView.currentIndex) {
self.viewModel.mainModel.step = self.stepView.currentIndex
self.viewModel.updateMainInformation(.submit, self.orderId) {[weak self] success, error in
self.viewModel.updateMainInformation(.submit, self.orderId, self.stepView.currentIndex) {[weak self] success, error in
guard let self = self else { return }
if let error = error {
YHHUD.flash(message: error.errorMsg )
......@@ -117,7 +117,7 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
}
bottom.saveBlock = { [weak self] in
guard let self = self else { return }
self.viewModel.updateMainInformation(.save, self.orderId) {[weak self] success, error in
self.viewModel.updateMainInformation(.save, self.orderId, self.stepView.currentIndex) {[weak self] success, error in
guard let _ = self else { return }
if let error = error {
YHHUD.flash(message: error.errorMsg )
......
......@@ -138,7 +138,7 @@ extension YHSelectCountryViewController: UITableViewDelegate, UITableViewDataSou
let cell = tableView.dequeueReusableCell(withClass: YHCountryTableViewCell.self)
let cn = searchDataSource?[indexPath.row].name_cn ?? ""
let en = searchDataSource?[indexPath.row].name_en ?? ""
cell.titleLabel.text = cn + en
cell.titleLabel.text = cn + "-" + en
return cell
}
......@@ -149,7 +149,7 @@ extension YHSelectCountryViewController: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cn = searchDataSource?[indexPath.row].name_cn ?? ""
let en = searchDataSource?[indexPath.row].name_en ?? ""
let text = cn + en
let text = cn + "-" + en
if let backLocationStringController = backLocationStringController {
backLocationStringController(text)
self.navigationController?.popViewController()
......
......@@ -62,5 +62,5 @@ class YHCertificatesModel: YHBaseModel {
var issue_date_end_at: String = ""
var img_front: String = ""
var img_back: String = ""
var passport_type: String = ""
var pass_port_type: String = ""
}
......@@ -38,7 +38,11 @@ class YHDatePickView: UIView {
// 日期分割符 eg: 2024-01-01
static let separator: String = "-"
var title: String = "" {
didSet {
titleLabel.text = title
}
}
var type: YHDateType? {
didSet {
guard let type = type else { return }
......@@ -82,7 +86,7 @@ class YHDatePickView: UIView {
titleLabel = {
let label = UILabel()
label.text = "选择出生日期"
label.text = title
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
......@@ -158,6 +162,7 @@ class YHDatePickView: UIView {
make.height.equalTo(220)
make.right.equalTo(-16)
}
pickerView.selectRow(100, inComponent: 0, animated: true)
}
@objc private func handleTap(_ sender: AnyObject?) {
......@@ -165,10 +170,11 @@ class YHDatePickView: UIView {
dismiss()
}
static func show(type:YHDateType, callBack: @escaping ((String) -> Void)) {
static func show(type:YHDateType, title: String? = nil, callBack: @escaping ((String) -> Void)) {
let view = YHDatePickView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.type = type
view.backDate = callBack
view.title = title ?? ""
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
......@@ -183,11 +189,11 @@ class YHDatePickView: UIView {
var date = ""
switch type {
case .yyyymmdd:
date = String(format: "%02ld%@%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0),Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1,Self.separator, self.pickerView.selectedRow(inComponent: 2) + 1)
date = String(format: "%02ld%@%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100,Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1,Self.separator, self.pickerView.selectedRow(inComponent: 2) + 1)
case .yyyymm:
date = String(format: "%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0),Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1)
date = String(format: "%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100 ,Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1)
case .yyyy:
date = String(format: "%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0))
date = String(format: "%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100)
}
if self.backDate != nil {
self.backDate!(date)
......@@ -219,7 +225,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
if component == 0 {
return 100
return 200
} else if component == 1 {
return 12
} else {
......@@ -267,7 +273,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if component == 0 {
return "\((currentDateCom.year!) - row)"
return "\((currentDateCom.year!) - row + 100)"
} else if component == 1 {
return "\(row + 1)"
} else {
......
......@@ -173,8 +173,6 @@ class YHImagePickerView: UIView {
imagePicker.delegate = self
//设置来源
imagePicker.sourceType = .camera
//允许编辑
imagePicker.allowsEditing = true
//打开相机
UIViewController.current?.present(imagePicker, animated: true, completion: { () -> Void in
......@@ -190,7 +188,6 @@ class YHImagePickerView: UIView {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .photoLibrary
imagePicker.allowsEditing = true
// 这一句,开始调用图库
UIViewController.current?.present(imagePicker,animated: true)
}
......@@ -304,7 +301,7 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
"businessCode": "4001001"
]
// 创建MultipartFormData对象
var multipartFormData = MultipartFormData()
let multipartFormData = MultipartFormData()
// 将图片添加到multipartFormData中
multipartFormData.append(imageData, withName: "file", fileName: "image.jpg", mimeType: "image/jpeg")
......
......@@ -18,6 +18,7 @@ class YHItemView: UIView {
var leftButton: UIButton!
var rightButton: UIButton!
var showPromptLabel: UILabel!
var longTimeButton:UIButton!
var dataSource: YHItemModel? {
didSet {
updateAllViews()
......@@ -50,6 +51,7 @@ class YHItemView: UIView {
textField.delegate = self
textField.textColor = UIColor.mainTextColor
textField.font = UIFont.PFSC_M(ofSize: 14)
textField.addTarget(self, action: #selector(textFieldDidChanged), for: .editingChanged)
return textField
}()
addSubview(messageTextField)
......@@ -130,10 +132,51 @@ class YHItemView: UIView {
make.height.equalTo(32)
make.width.equalTo(74)
}
longTimeButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "main_time_normal"), for: .normal)
button.setImage(UIImage(named: "main_time_select"), for: .selected)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.setTitle("长期", for: .normal)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.contentHorizontalAlignment = .right
button.addTarget(self, action: #selector(longTimeButtonClick), for: .touchUpInside)
button.imageEdgeInsets = UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 30)
button.isSelected = false
return button
}()
addSubview(longTimeButton)
longTimeButton.snp.makeConstraints { make in
make.right.equalToSuperview()
make.centerY.equalToSuperview()
make.height.equalTo(32)
make.width.equalTo(43)
}
}
@objc func longTimeButtonClick() {
longTimeButton.isSelected = !longTimeButton.isSelected
if longTimeButton.isSelected {
self.dataSource?.message = "8888-01-01"
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHItemModel())
}
} else {
self.dataSource?.message = ""
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHItemModel())
}
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
if dataSource.id == .id23 {
messageTextField.keyboardType = .asciiCapable
}
if dataSource.isNeed ?? false {
let str = "*" + (dataSource.title ?? "")
let attributes: [NSAttributedString.Key: Any] = [
......@@ -167,6 +210,9 @@ class YHItemView: UIView {
case .time: break
case .image: break
case .id:
if dataSource.message == "0" {
messageTextField.text = ""
}
let arr = YHOtherInfoFillViewModel.arrIdType
arr.forEach { item in
if item["id"] == dataSource.message {
......@@ -175,6 +221,9 @@ class YHItemView: UIView {
}
case .country: break
case .sex:
if dataSource.message == "0" {
messageTextField.text = ""
}
let arr = YHOtherInfoFillViewModel.arrSex
arr.forEach { item in
if item["id"] == dataSource.message {
......@@ -182,6 +231,9 @@ class YHItemView: UIView {
}
}
case .marry:
if dataSource.message == "0" {
messageTextField.text = ""
}
let arr = YHOtherInfoFillViewModel.arrMarry
arr.forEach { item in
if item["id"] == dataSource.message {
......@@ -228,6 +280,33 @@ class YHItemView: UIView {
showPromptLabel.isHidden = true
}
if dataSource.id == .id11 || dataSource.id == .id15 || dataSource.id == .id20 {
longTimeButton.isHidden = false
nextStepImageView.isHidden = true
if dataSource.message == "8888-01-01" {
longTimeButton.isSelected = true
longTimeButton.snp.remakeConstraints { make in
make.left.equalTo(messageTextField.snp.left)
make.centerY.equalToSuperview()
make.height.equalTo(32)
make.width.equalTo(43)
}
centerButton.isHidden = true
messageTextField.isHidden = true
} else {
longTimeButton.isSelected = false
longTimeButton.snp.remakeConstraints { make in
make.right.equalToSuperview()
make.centerY.equalToSuperview()
make.height.equalTo(32)
make.width.equalTo(43)
}
centerButton.isHidden = false
messageTextField.isHidden = false
}
} else {
longTimeButton.isHidden = true
}
}
func buttonState(isLeft: Bool) {
......@@ -310,7 +389,17 @@ class YHItemView: UIView {
}
UIViewController.current?.present(addressPicker, animated: true, completion: nil)
case .time:
YHDatePickView.show(type: .yyyymmdd) { date in
var title = ""
if dataSource?.id == .id10 || dataSource?.id == .id14 || dataSource?.id == .id19 {
title = "请选择签发日期"
}
if dataSource?.id == .id11 || dataSource?.id == .id15 || dataSource?.id == .id20 {
title = "请选择届满日期"
}
if dataSource?.id == .id24 {
title = "请选择出生日期"
}
YHDatePickView.show(type: .yyyymmdd, title: title) { date in
// let arr = date.components(separatedBy: YHDatePickView.separator)
// [yyyy, mm, dd] eg ["2024", "01", "20"]
self.dataSource?.message = date
......@@ -372,6 +461,12 @@ class YHItemView: UIView {
}
}
}
@objc func textFieldDidChanged() {
if dataSource?.id == .id23 {
messageTextField.text = messageTextField.text?.uppercased()
}
}
}
extension YHItemView: UITextFieldDelegate {
......@@ -380,7 +475,7 @@ extension YHItemView: UITextFieldDelegate {
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if (dataSource?.id == .id9 || dataSource?.id == .id21 || dataSource?.id == .id22 || dataSource?.id == .id23) && newText.count > 30 {
return false
}
......@@ -401,6 +496,10 @@ extension YHItemView: UITextFieldDelegate {
return false
}
if dataSource?.id == .id23 {
newText = newText.uppercased()
}
var data = dataSource ?? YHItemModel()
data.message = newText
if let block = block {
......
......@@ -279,10 +279,16 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
@objc func frontImageClick() {
if type == .identity {
if viewModel.mainModel.certificates.cn_identity_card.img_front.count != 0 {
let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.cn_identity_card.img_front
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
} else {
if viewModel.mainModel.certificates.hk_macao_pass.img_front.count != 0 {
let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.hk_macao_pass.img_front
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
}
......@@ -334,10 +340,16 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
@objc func backSurfaceImageClick() {
if type == .identity {
if viewModel.mainModel.certificates.cn_identity_card.img_back.count != 0 {
let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.cn_identity_card.img_back
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
} else {
if viewModel.mainModel.certificates.hk_macao_pass.img_back.count != 0 {
let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.hk_macao_pass.img_back
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
}
......
......@@ -67,7 +67,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let item13 = YHItemModel(id: .id15, isNeed: true, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.hk_macao_pass.issue_date_end_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择届满日期")
let section1 = YHSectionItemModel(title: "港澳通行证", models: [item10, item11, item12, item13])
let item4 = YHItemModel(id: .id16, isNeed: !flag, title: "证件类别", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.passport.passport_type, type: .id, isShowPrompts: isShowPrompt, alertMessage:"请选择件类别")
let item4 = YHItemModel(id: .id16, isNeed: !flag, title: "证件类别", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.passport.pass_port_type, type: .id, isShowPrompts: isShowPrompt, alertMessage:"请选择件类别")
let item5 = YHItemModel(id: .id17, isNeed: !flag, title: "证件号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.passport.number, isShowPrompts: isShowPrompt, alertMessage:"请输入证件号码")
let item6 = YHItemModel(id: .id18, isNeed: !flag, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.passport.issue_at, isShowPrompts: isShowPrompt, alertMessage:"请输入签发地")
let item7 = YHItemModel(id: .id19, isNeed: !flag, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.passport.issue_date_start_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择签发日期")
......@@ -79,7 +79,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
section2String = "护照及其他旅行证件"
}
let section2 = YHSectionItemModel(title: section2String, models: [item4, item5, item6, item7, item8])
if mainModel.has_hk_id == 1 {
if mainModel.is_handled == 1 {
return [section, section1, section2]
} else {
return [section, section2]
......@@ -128,7 +128,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
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.has_hk_id == 1 {
if mainModel.is_handled == 1 {
return [section, section1]
} else {
return [section]
......@@ -170,7 +170,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
case .id15:
mainModel.certificates.hk_macao_pass.issue_date_end_at = item.message ?? ""
case .id16:
mainModel.certificates.passport.passport_type = item.value?.first ?? ""
mainModel.certificates.passport.pass_port_type = item.value?.first ?? ""
case .id17:
mainModel.certificates.passport.number = item.message ?? ""
case .id18:
......@@ -286,10 +286,12 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
}
func requestMainInformation(_ orderID: String, callBackBlock:@escaping (_ success: YHMainInformationModel?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.getInformation + "?order_id=\(orderID)"
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.getInformation
let param: [String: Any] = ["order_id": orderID]
// let strUrl = "http://192.168.25.48:18088/" + YHAllApiName.OrderInformation.getInformation + "?order_id=\(orderID)"
// let params: [String : Any] = ["order_id": orderID]
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
......@@ -309,7 +311,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
}
}
func updateMainInformation(_ saveType: YHSaveType,_ orderID: Int, callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
func updateMainInformation(_ saveType: YHSaveType, _ orderID: Int, _ step: Int, callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
var type = ""
if saveType == .save {
type = "save"
......@@ -344,7 +346,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
"issue_date_end_at": mainModel.certificates.passport.issue_date_end_at,
"issue_date_start_at": mainModel.certificates.passport.issue_date_start_at,
"number": mainModel.certificates.passport.number,
"passport_type": mainModel.certificates.passport.passport_type] as [String : Any]
"passport_type": mainModel.certificates.passport.pass_port_type] as [String : Any]
let params: [String : Any] = ["address": address,
"address_aboard": mainModel.address_aboard,
"age":mainModel.age,
......@@ -362,7 +364,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
"nationality": mainModel.nationality,
"order_id": orderID,
"sex": mainModel.sex,
"step": mainModel.step,
"step": step,
"surname": mainModel.surname,
"used_name": mainModel.used_name,
"username": mainModel.username,
......@@ -479,20 +481,15 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let area = mainModel.address.area
let details = mainModel.address.details
let foreign = mainModel.address.foreign
let is_live_oversea_year = mainModel.is_live_oversea_year
let has_hk_id = mainModel.has_hk_id
guard nationality.count > 0 else { return false }
guard country.count > 0 else { return false }
if country.contains("中国") {
if nationality.count != 0 && country.count != 0 && area.count != 0 && details.count != 0 {
return true
} else {
return false
}
guard area.count > 0 else { return false }
guard details.count > 0 else { return false }
return true
} else {
if nationality.count != 0 && country.count != 0 && foreign.count != 0 {
return true
} else {
return false
}
guard foreign.count > 0 else { return false }
return true
}
} else if step == 1 {
return true
......@@ -505,33 +502,31 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let hk_macao_pass_issue_at = mainModel.certificates.hk_macao_pass.issue_at
let hk_macao_pass_issue_date_start_at = mainModel.certificates.hk_macao_pass.issue_date_start_at
let hk_macao_pass_issue_date_end_at = mainModel.certificates.hk_macao_pass.issue_date_end_at
let passport_type = mainModel.certificates.passport.passport_type
let passport_type = mainModel.certificates.passport.pass_port_type
let passport_number = mainModel.certificates.passport.number
let passport_issue_at = mainModel.certificates.passport.issue_at
let passport_issue_date_start_at = mainModel.certificates.passport.issue_date_start_at
let passport_issue_date_end_at = mainModel.certificates.passport.issue_date_end_at
let nationality = mainModel.nationality
if self.mainModel.is_handled == 1 {
guard hk_macao_pass_number.count > 0 else { return false }
guard hk_macao_pass_issue_at.count > 0 else { return false }
guard hk_macao_pass_issue_date_start_at.count > 0 else { return false }
guard hk_macao_pass_issue_date_end_at.count > 0 else { return false }
}
if nationality.contains("中国") {
if mainModel.has_hk_id == 1 {
if cn_identity_card_number.count != 0 && cn_identity_card_issue_at.count != 0 && cn_identity_card_issue_date_start_at.count != 0 && cn_identity_card_issue_date_end_at.count != 0 && hk_macao_pass_number.count != 0 && hk_macao_pass_issue_at.count != 0 && hk_macao_pass_issue_date_start_at.count != 0 && hk_macao_pass_issue_date_end_at.count != 0 {
return true
} else {
return false
}
} else {
if cn_identity_card_number.count != 0 && cn_identity_card_issue_at.count != 0 && cn_identity_card_issue_date_start_at.count != 0 && cn_identity_card_issue_date_end_at.count != 0 {
return true
} else {
return false
}
}
guard cn_identity_card_number.count > 0 else { return false }
guard cn_identity_card_issue_at.count > 0 else { return false }
guard cn_identity_card_issue_date_start_at.count > 0 else { return false }
guard cn_identity_card_issue_date_end_at.count > 0 else { return false }
} else {
if passport_type.count != 0 && passport_number.count != 0 && passport_issue_at.count != 0 && passport_issue_date_start_at.count != 0 && passport_issue_date_end_at.count != 0 {
return true
} else {
return false
}
guard passport_type.count > 0 else { return false }
guard passport_number.count > 0 else { return false }
guard passport_issue_at.count > 0 else { return false }
guard passport_issue_date_start_at.count > 0 else { return false }
guard passport_issue_date_end_at.count > 0 else { return false }
}
return true
} else {
let username = mainModel.username
let birthday = mainModel.birthday
......@@ -544,35 +539,20 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let email = mainModel.email
let has_hk_id = mainModel.has_hk_id
let hk_id_numbe = mainModel.hk_id_number
guard username.count > 0 else { return false }
guard birthday.count > 0 else { return false }
guard sex > 0 else { return false }
guard email.count > 0 else { return false }
guard mobile.count > 0 else { return false }
if birth_place_aboard == 1 {
if username.count != 0 && birthday.count != 0 && birth_place_foreign.count != 0 && mobile.count != 0 && email.count != 0 {
if has_hk_id == 1 {
if hk_id_numbe.isHKIdentityCardNumber() {
return true
} else {
return false
}
} else {
return true
}
} else {
return false
}
guard birth_place_foreign.count > 0 else { return false }
} else {
if username.count != 0 && birthday.count != 0 && birth_place_area.count != 0 && mobile.count != 0 && email.count != 0 {
if has_hk_id == 1 {
if hk_id_numbe.isHKIdentityCardNumber() {
return true
} else {
return false
}
} else {
return true
}
} else {
return false
}
guard birth_place_area.count > 0 else { return false }
}
if has_hk_id == 1 {
guard hk_id_numbe.count > 0 else { return false }
}
return true
}
}
}
......@@ -14,9 +14,9 @@ class YHSelectCountryViewModel: NSObject {
}
func requestCountry(_ key: String, callBackBlock:@escaping (_ success: [YHCountryMessage?]?, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.countryInformation + "?keyword = \(key)"
YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.OrderInformation.countryInformation
let param: [String: Any] = ["keyword": key]
let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
guard let self = self else { return }
let dic = json.data as? [Any]
guard let resultArray = [YHCountryMessage].deserialize(from: dic) else {
......
......@@ -301,19 +301,19 @@ class YHOtherInfoFillViewModel: YHBaseViewModel {
static let arrMarry : [[String : String]] = [
["title": "已婚",
"id": "0"
"id": "1"
],
["title": "未婚",
"id": "1"
"id": "2"
],
["title": "离婚",
"id": "2"
"id": "3"
],
["title": "分居",
"id": "3"
"id": "4"
],
["title": "丧偶",
"id": "4"
"id": "5"
]
]
}
......
//
// YHImageClipperViewController.swift
// galaxy
//
// Created by EDY on 2024/3/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
/*
let clipperVC = YHImageClipperViewController()
clipperVC.setBaseImg(image, resultImgSize: clippedImgSize!, type: clipperType)
clipperVC.cancelClippedHandler = {
}
clipperVC.successClippedHandler = {[weak self]img in
if self?.clippedImageHandler != nil{
self?.clippedImageHandler!(img)
}
}
self.pushViewController(clipperVC, animated: true)
*/
import UIKit
class YHImageClipperViewController: YHBaseViewController {
typealias CancelClippedHandlerBlock = ()->Void
typealias SuccessClippedHandlerBlock = (_ content: String) -> Void
//MARK Public
public var cancelClippedHandler:CancelClippedHandlerBlock?
public var successClippedHandler:SuccessClippedHandlerBlock?
public func setBaseImg(_ baseImg: UIImage, resultImgSize: CGSize, type: YHClipperType) {
clipperView = YHClipperView(frame: CGRect(x: 0, y: (isIphoneX() ? 88:64), width: KScreenWidth, height: KScreenHeight - k_Height_safeAreaInsetsBottom() - 54 - (isIphoneX() ? 88:64)))
clipperView?.resultImgSize = resultImgSize
clipperView?.baseImg = baseImg
clipperView?.type = type
self.view.addSubview(clipperView!)
}
//MARK Private
private var clipperView: YHClipperView?
private var cannalButton: YHClipperButton!
private var backImageButton: YHClipperButton!
private var sureButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .black
self.hidesBottomBarWhenPushed = true
if #available(iOS 11.0, *) {
} else {
self.automaticallyAdjustsScrollViewInsets = false
}
// Do any additional setup after loading the view.
setView()
}
func setView() {
sureButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.backgroundColor = UIColor(hex: 0x2274ee)
button.contentHorizontalAlignment = .center
button.setTitle("确认", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius6
button.clipsToBounds = true
button.addTarget(self, action: #selector(sureBtnClick), for: .touchUpInside)
return button
}()
view.addSubview(sureButton)
sureButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.bottom.equalTo(-10 - k_Height_safeAreaInsetsBottom())
make.height.equalTo(44)
make.width.equalTo(93)
}
cannalButton = {
let button = YHClipperButton()
button.setContent("image_clipper_cannal", "取消")
button.addTarget(self, action: #selector(cannalBtnClick), for: .touchUpInside)
return button
}()
view.addSubview(cannalButton)
cannalButton.snp.makeConstraints { make in
make.centerY.equalTo(sureButton.snp.centerY)
make.left.equalTo(30)
make.height.equalTo(44)
make.width.equalTo(30)
}
backImageButton = {
let button = YHClipperButton()
button.setContent("image_clipper_back", "复原")
button.addTarget(self, action: #selector(backImageBtnClick), for: .touchUpInside)
return button
}()
view.addSubview(backImageButton)
backImageButton.snp.makeConstraints { make in
make.centerY.equalTo(sureButton.snp.centerY)
make.left.equalTo(80)
make.height.equalTo(44)
make.width.equalTo(30)
}
}
@objc private func cannalBtnClick() {
if cancelClippedHandler != nil {
cancelClippedHandler!()
}
self.navigationController?.popViewController()
}
@objc private func backImageBtnClick() {
// if cancelClippedHandler != nil {
// cancelClippedHandler!()
// }
}
@objc private func sureBtnClick() {
let clippedImg = self.clipperView?.clipImg()
let vc = YHImageResultViewController()
vc.img = clippedImg
vc.successHandlerBlock = { [weak self] result in
guard let self = self else { return }
if successClippedHandler != nil {
successClippedHandler!(result)
}
}
self.navigationController?.pushViewController(vc)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.isNavigationBarHidden = false
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
//
// YHImageResultViewController.swift
// galaxy
//
// Created by EDY on 2024/3/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHImageResultViewController: YHBaseViewController {
typealias SuccessHandlerBlock = (_ relult: String) -> Void
var successHandlerBlock: SuccessHandlerBlock?
var resultView: UIImageView!
var bottomView: YHResultBottomView!
var img: UIImage!
var viewModel: YHWorkExperienceViewModel!
override func viewDidLoad() {
super.viewDidLoad()
viewModel = YHWorkExperienceViewModel()
gk_navTitle = "照片"
setView()
// Do any additional setup after loading the view.
}
func setView() {
resultView = {
let step = UIImageView()
step.contentMode = .scaleAspectFit
step.image = img
return step
}()
view.addSubview(resultView)
resultView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 54)
}
bottomView = {
let bottom = YHResultBottomView()
bottom.nextblock = {[weak self] in
guard let self = self else { return }
YHHUD.show(.progress(message: ""))
self.viewModel.uploadImage(self.img) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.requestFileMessage(url) {[weak self] success, model, error in
guard let self = self else { return }
if success {
YHHUD.hide()
if let block = self.successHandlerBlock {
block(model?.content ?? "")
let mineVC = YHWorkExperienceViewController()
var targetVC : UIViewController!
for controller in self.navigationController!.viewControllers {
if controller.isKind(of: mineVC.classForCoder) {
targetVC = controller
}
}
if targetVC != nil {
self.navigationController?.popToViewController(targetVC, animated: true)
}
}
} else {
YHHUD.hide()
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
}
}
return bottom
}()
view.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalTo(view)
make.height.equalTo(k_Height_safeAreaInsetsBottom() + 64)
}
}
}
//
// YHImageViewController.swift
// galaxy
//
// Created by EDY on 2024/3/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHImageViewController: YHBaseViewController {
var resultView: UIImageView!
var resultButton: UIButton!
var imgString: String!
var viewModel: YHWorkExperienceViewModel!
override func viewDidLoad() {
super.viewDidLoad()
viewModel = YHWorkExperienceViewModel()
view.backgroundColor = .black
self.hidesBottomBarWhenPushed = true
if #available(iOS 11.0, *) {
} else {
self.automaticallyAdjustsScrollViewInsets = false
}
setView()
getData()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.isNavigationBarHidden = false
}
func setView() {
resultView = {
let step = UIImageView()
step.contentMode = .scaleAspectFit
return step
}()
view.addSubview(resultView)
resultView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 54)
}
resultButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(back), for: .touchUpInside)
return button
}()
view.addSubview(resultButton)
resultButton.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 54)
}
}
@objc func back() {
self.navigationController?.popViewController()
}
func getData() {
self.viewModel.getPublicImageUrl(imgString) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.resultView.kf.setImage(with: URL(string: success))
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
......@@ -238,27 +238,14 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
YHHUD.show(.progress(message: ""))
self.viewModel.uploadImage(image) {[weak self] success, error in
let clipperVC = YHImageClipperViewController()
clipperVC.setBaseImg(image, resultImgSize: CGSize(width: 300, height: 300), type: .Stay)
clipperVC.successClippedHandler = {[weak self] result in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.requestFileMessage(url) {[weak self] success, model, error in
guard let self = self else { return }
if success {
YHHUD.hide()
self.viewModel.mainModel.wduty = model?.content ?? ""
cell.dataSource = viewModel.mainModel.wduty
} else {
YHHUD.hide()
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
self.viewModel.mainModel.wduty = result
cell.dataSource = viewModel.mainModel.wduty
}
self.navigationController?.pushViewController(clipperVC, animated: true)
}
}
return cell
......@@ -294,27 +281,14 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
YHHUD.show(.progress(message: ""))
self.viewModel.uploadImage(image) {[weak self] success, error in
let clipperVC = YHImageClipperViewController()
clipperVC.setBaseImg(image, resultImgSize: CGSize(width: 300, height: 300), type: .Stay)
clipperVC.successClippedHandler = {[weak self] result in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.requestFileMessage(url) {[weak self] success, model, error in
guard let self = self else { return }
if success {
YHHUD.hide()
self.viewModel.mainModel.highlights = model?.content ?? ""
cell.dataSource = viewModel.mainModel.highlights
} else {
YHHUD.hide()
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
self.viewModel.mainModel.highlights = result
cell.dataSource = viewModel.mainModel.highlights
}
self.navigationController?.pushViewController(clipperVC, animated: true)
}
}
return cell
......@@ -455,6 +429,10 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
return
}
}
} else {
let vc = YHImageViewController()
vc.imgString = model.fileUrl
UIViewController.current?.navigationController?.pushViewController(vc)
}
}
return cell
......
......@@ -205,27 +205,14 @@ class YHWorkIntroductionViewController: YHBaseViewController {
guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
YHHUD.show(.progress(message: "加载中"))
self.viewModel.uploadImage(image) {[weak self] success, error in
let clipperVC = YHImageClipperViewController()
clipperVC.setBaseImg(image, resultImgSize: CGSize(width: 300, height: 300), type: .Stay)
clipperVC.successClippedHandler = {[weak self] result in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.requestFileMessage(url) {[weak self] success, model, error in
guard let self = self else { return }
if success {
YHHUD.hide()
self.dataSource.project_highlights = model?.content
self.messageTextField.text = model?.content
} else {
YHHUD.hide()
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
self.dataSource.project_highlights = result
self.messageTextField.text = result
}
self.navigationController?.pushViewController(clipperVC, animated: true)
}
}
return view
......
//
// YHClipperButton.swift
// galaxy
//
// Created by EDY on 2024/3/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHClipperButton: UIButton {
var topImageView: UIImageView!
var bottomTitleLabel: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
topImageView = {
let view = UIImageView()
return view
}()
addSubview(topImageView)
topImageView.snp.makeConstraints { make in
make.top.centerX.equalToSuperview()
make.width.height.equalTo(21)
}
bottomTitleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_B(ofSize: 11)
label.textAlignment = .center
label.textColor = UIColor.white
return label
}()
addSubview(bottomTitleLabel)
bottomTitleLabel.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(15)
}
}
func setContent(_ image: String, _ title: String) {
bottomTitleLabel.text = title
topImageView.image = UIImage(named: image)
}
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
}
//
// YHClipperView.swift
// galaxy
//
// Created by EDY on 2024/3/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHClipperType {
case Move
case Stay
}
class YHClipperView: UIView {
public var resultImgSize:CGSize?{
didSet{
self.setClipperView()
}
}
public var type: YHClipperType = .Move
public var baseImg: UIImage?{
didSet{
var width = baseImg?.size.width ?? 0
var height = baseImg?.size.height ?? 0
if width != self.frame.size.width {
width = self.frame.size.width
}
height = (baseImg?.size.height ?? 0)! / (baseImg?.size.width ?? 0)! * width
if height < (self.clipperView?.frame.size.height ?? 0)! {
height = (self.clipperView?.frame.size.height ?? 0)!
}
width = (baseImg?.size.width ?? 0)! / (baseImg?.size.height ?? 0)! * height
let img = baseImg?.scaledToSize(newSize: CGSize(width: width, height: height), withScale: false)
self.baseImgView?.image = img
self.baseImgView?.frame = CGRect(x: 0, y: 0, width: (img?.size.width)!, height: (img?.size.height)!)
correctBackImgView()
}
}
private let minWidth:CGFloat = 60
private var clipperView: UIImageView?
private lazy var baseImgView: UIImageView? = {
let baseImgView = UIImageView()
self.addSubview(baseImgView)
self.sendSubviewToBack(baseImgView)
return baseImgView
}()
private lazy var fillLayer: CAShapeLayer? = {
let fillLayer = CAShapeLayer()
fillLayer.fillRule = CAShapeLayerFillRule.evenOdd
fillLayer.fillColor = UIColor.black.cgColor
fillLayer.opacity = 0.5
self.layer.addSublayer(fillLayer)
return fillLayer
}()
private var panTouch:CGPoint?
private var scaleDistance:CGFloat = 0 //缩放距离
override init(frame: CGRect) {
super.init(frame: frame)
loadSubViews()
}
//MARK Public
public func clipImg() -> UIImage {
let scale = UIScreen.main.scale * (self.baseImgView?.image?.size.width)!/(self.baseImgView?.frame.size.width)!
let rect = self.convert((self.clipperView?.frame)!, to: self.baseImgView)
let rect2 = CGRect(x: rect.origin.x * scale, y: rect.origin.y * scale, width: rect.size.width * scale, height: rect.size.height * scale)
let cgImg = self.baseImgView?.image?.cgImage?.cropping(to: rect2)
let clippedImg = UIImage.init(cgImage: cgImg!)
return clippedImg
}
private func loadSubViews() {
self.layer.contentsGravity = CALayerContentsGravity.resizeAspect
}
private func setClipperView() {
let kscWidth = UIScreen.main.bounds.size.width
let kscHeight = UIScreen.main.bounds.size.height - 64
var width = kscWidth
var height = kscHeight
if (self.resultImgSize?.width)! > ((self.resultImgSize?.height ?? 0)! / height * width) {
height = kscWidth / (self.resultImgSize?.width ?? 0)! * (self.resultImgSize?.height ?? 0)!
}else{
width = kscHeight / (self.resultImgSize?.height ?? 0)! * (self.resultImgSize?.width ?? 0)!
}
let y = (kscHeight - height)/2
let x = (kscWidth - width)/2
clipperView = UIImageView(frame: CGRect(x: x, y: y, width: width, height: height))
clipperView?.layer.borderColor = UIColor.white.cgColor
clipperView?.layer.borderWidth = 2
self.addSubview(clipperView!)
correctFillLayer()
}
//MARK Touches (注意问题::::)
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let allTouches = event?.allTouches
switch allTouches?.count {
case 1?:
panTouch = allTouches?.first?.location(in: self)
break
default:
break
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
self.willChangeValue(forKey: "crop")
let allTouches = event?.allTouches
switch allTouches?.count {
case 1?:
let touchCurrent = allTouches?.first?.location(in: self)
let x = (touchCurrent?.x ?? 0)! - (panTouch?.x ?? 0)!
let y = (touchCurrent?.y ?? 0)! - (panTouch?.y ?? 0)!
switch type {
case .Move:
self.baseImgView?.center = CGPoint(x: (self.baseImgView?.center.x ?? 0)! + x, y: (self.baseImgView?.center.y ?? 0)! + y)
break
case .Stay:
self.clipperView?.center = CGPoint(x: (self.clipperView?.center.x ?? 0)! + x, y: (self.clipperView?.center.y ?? 0)! + y)
break
}
panTouch = touchCurrent
break
case 2?:
switch type {
case .Move:
self.scaleView(self.baseImgView!, touches: (allTouches! as NSSet).allObjects)
break
case .Stay:
self.scaleView(self.clipperView!, touches: (allTouches! as NSSet).allObjects)
break
}
break
default:
break
}
correctFillLayer()
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
switch type {
case .Move:
correctBackImgView()
break
case .Stay:
correctClipperView()
break
}
}
//MARK Correct
private func correctBackImgView(){
var x = self.baseImgView?.frame.origin.x ?? 0
var y = self.baseImgView?.frame.origin.y ?? 0
var height = self.baseImgView?.frame.size.height ?? 0
var width = self.baseImgView?.frame.size.width ?? 0
if width < (self.clipperView?.frame.size.width ?? 0)! {
width = (self.clipperView?.frame.size.width ?? 0)!
height = width / (self.baseImgView?.frame.size.width ?? 0)! * height
}
if height < (self.clipperView?.frame.size.height ?? 0)! {
height = (self.clipperView?.frame.size.height ?? 0)!
width = height / (self.baseImgView?.frame.size.height ?? 0)! * width
}
if x > (self.clipperView?.frame.origin.x ?? 0)! {
x = (self.clipperView?.frame.origin.x ?? 0)!
} else if x < ((self.clipperView?.frame.origin.x ?? 0)! + (self.clipperView?.frame.size.width ?? 0)! - width){
x = (self.clipperView?.frame.origin.x ?? 0)! + (self.clipperView?.frame.size.width ?? 0)! - width
}
if y > (self.clipperView?.frame.origin.y ?? 0)! {
y = (self.clipperView?.frame.origin.y ?? 0)!
} else if y < (self.clipperView?.frame.origin.y ?? 0)! + (self.clipperView?.frame.size.height ?? 0)! - height {
y = (self.clipperView?.frame.origin.y ?? 0)! + (self.clipperView?.frame.size.height ?? 0)! - height
}
self.baseImgView?.frame = CGRect(x: x, y: y, width: width, height: height)
}
private func correctClipperView(){
var width = self.clipperView?.frame.size.width ?? 0
var height:CGFloat = 0.0
if width < minWidth {
width = minWidth
}
if width > UIScreen.main.bounds.size.width {
width = UIScreen.main.bounds.size.width
}
height = width / (self.resultImgSize?.width ?? 0)! * (self.resultImgSize?.height ?? 0)!
var x = self.clipperView?.frame.origin.x ?? 0
var y = self.clipperView?.frame.origin.y ?? 0
if x < (self.baseImgView?.frame.origin.x ?? 0)! {
x = (self.baseImgView?.frame.origin.x ?? 0)!
}
if x > UIScreen.main.bounds.size.width - width {
x = UIScreen.main.bounds.size.width - width
}
if y < (self.baseImgView?.frame.origin.y ?? 0)! {
y = (self.baseImgView?.frame.origin.y ?? 0)!
}
let tempy = (self.baseImgView?.frame.origin.y ?? 0)! + (self.baseImgView?.frame.size.height ?? 0)! - (self.clipperView?.frame.size.height ?? 0)!
if y > tempy{
y = (self.baseImgView?.frame.origin.y ?? 0)! + (self.baseImgView?.frame.size.height ?? 0)! - (self.clipperView?.frame.size.height ?? 0)!
}
self.clipperView?.frame = CGRect(x: x, y: y, width: width, height: height)
correctFillLayer()
}
private func correctFillLayer() {
let path = UIBezierPath.init(roundedRect: self.bounds, cornerRadius: 0)
let circlePath = UIBezierPath.init(roundedRect: (clipperView?.frame)!, cornerRadius: 0)
path.append(circlePath)
path.usesEvenOddFillRule = true
self.fillLayer?.path = path.cgPath
}
//MARK Correct
private func scaleView(_ view:UIView,touches:Array<Any>){
let touch1 = (touches[0] as AnyObject).location(in: self)
let touch2 = (touches[1] as AnyObject).location(in: self)
let distance = self.distanceBetweenTwoPoints(touch1, toPoint: touch2)
if scaleDistance > 0 {
var imgFrame = view.frame
if distance > scaleDistance + 2{
imgFrame.size.width += 10
scaleDistance = distance
}
if distance < scaleDistance - 2 {
imgFrame.size.width -= 10
scaleDistance = distance
}
if type == .Stay{ //图片不动
imgFrame.size.height = view.frame.size.height * imgFrame.size.width / view.frame.size.width
let mainWidth = UIScreen.main.bounds.size.width
let imgWidth = imgFrame.size.width > mainWidth ? mainWidth : imgFrame.size.width
let imgHeight = imgWidth * (resultImgSize?.height ?? 0) / (resultImgSize?.width == 0 ? 1 : (resultImgSize?.width ?? 1)!)
let addwidth = imgWidth - view.frame.size.width
let addheight = imgHeight - view.frame.size.height
if imgHeight != 0 && imgWidth != 0{
view.frame = CGRect(x:imgFrame.origin.x - addwidth/2.0, y: imgFrame.origin.y - addheight/2.0, width: imgWidth, height: imgHeight)
}
}else{ //图片移动
imgFrame.size.height = view.frame.size.height * imgFrame.size.width / view.frame.size.width
let addwidth = imgFrame.size.width - view.frame.size.width
let addheight = imgFrame.size.height - view.frame.size.height
let cripWidth = imgFrame.size.width - (clipperView?.frame.width ?? 0)
let cripHeight = imgFrame.size.height - (clipperView?.frame.height ?? 0)
if imgFrame.size.width != 0 && imgFrame.size.height != 0 && cripWidth > -5 && cripHeight > -5 {
view.frame = CGRect(x:imgFrame.origin.x - addwidth/2.0, y: imgFrame.origin.y - addheight/2.0, width: imgFrame.width, height: imgFrame.height)
}
}
}else{
scaleDistance = distance
}
}
private func distanceBetweenTwoPoints(_ fromPoint:CGPoint,toPoint:CGPoint) -> CGFloat {
let x = toPoint.x - fromPoint.x
let y = toPoint.y - fromPoint.y
return CGFloat(sqrtf(Float(x * x + y * y)))
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension UIImage {
func scaledToSize(newSize:CGSize,withScale:Bool) -> UIImage {
var scale:CGFloat = 1
if withScale {
scale = UIScreen.main.scale
}
let mynewSize = CGSize(width: newSize.width * scale, height: newSize.height * scale)
UIGraphicsBeginImageContextWithOptions(mynewSize, false, 0)
self.draw(in: CGRect(origin: CGPoint.zero, size: mynewSize))
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage ?? UIImage()
}
}
//
// YHResultBottomView.swift
// galaxy
//
// Created by EDY on 2024/3/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResultBottomView: UIView {
typealias Block = () -> ()
var nextblock: Block?
var nextButton: UIButton!
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
nextButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.backgroundColor = UIColor(hex: 0x2274ee)
button.contentHorizontalAlignment = .center
button.setTitle("开始识别", for: .normal)
button.setTitleColor(UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius6
button.clipsToBounds = true
button.addTarget(self, action: #selector(goNext), for: .touchUpInside)
return button
}()
addSubview(nextButton)
nextButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.top.equalTo(10)
make.height.equalTo(44)
make.left.equalTo(16)
}
// nextButton.layoutIfNeeded()
// nextButton.backgroundGradient()
// nextButton.addYinHeGradualLayer()
}
@objc func goNext() {
if let block = nextblock {
block()
}
}
}
......@@ -187,7 +187,6 @@ extension YHWorkResponsibilitiesTableViewCell: UITextViewDelegate {
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newLength = (textView.text as NSString).length + text.count - range.length
return newLength <= 2000
}
}
//
// UITextField+Extension.swift
// galaxy
//
// Created by edy on 2024/3/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
extension UITextField {
/// 限制textField输入
public func limitInputWithPattern(pattern: String, _ limitCount: Int = -1) {
// 非markedText才继续往下处理
guard let _: UITextRange = self.markedTextRange else {
// 当前光标的位置(后面会对其做修改)
let cursorPostion = self.offset(from: self.endOfDocument, to: self.selectedTextRange!.end)
// 替换后的字符串
var str = ""
if pattern == "" {
str = self.text!
} else {
str = self.text!.regularReplace(pattern: pattern, with: "")
}
// 如果长度超过限制则直接截断
if limitCount >= 0, str.count > limitCount {
str = String(str.prefix(limitCount))
}
self.text = str
// 让光标停留在正确位置
let targetPostion = self.position(from: self.endOfDocument, offset: cursorPostion)!
self.selectedTextRange = self.textRange(from: targetPostion, to: targetPostion)
return
}
}
}
extension String {
// 使用正则表达式替换
func regularReplace(pattern: String, with: String, options: NSRegularExpression.Options = []) -> String {
let regex = try! NSRegularExpression(pattern: pattern, options: options)
return regex.stringByReplacingMatches(in: self, options: [],
range: NSMakeRange(0, self.count),
withTemplate: with)
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "main_time_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "main_time_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "main_time_select@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "main_time_select@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "image_clipper_back@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "image_clipper_back@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "image_clipper_cannal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "image_clipper_cannal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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