Commit 4a309832 authored by pete谢兆麟's avatar pete谢兆麟

Merge branch '0927' into develop

parents 287ec07c 79019a42
...@@ -209,6 +209,8 @@ ...@@ -209,6 +209,8 @@
044EE2482C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2472C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift */; }; 044EE2482C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2472C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift */; };
044EE24A2C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2492C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift */; }; 044EE24A2C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2492C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift */; };
044EE24C2C94396E00A2FE3A /* YHResignCertificatePassportTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE24B2C94396D00A2FE3A /* YHResignCertificatePassportTableViewCell.swift */; }; 044EE24C2C94396E00A2FE3A /* YHResignCertificatePassportTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE24B2C94396D00A2FE3A /* YHResignCertificatePassportTableViewCell.swift */; };
044EE2512C955CDE00A2FE3A /* YHResignGuidelinesExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2502C955CDD00A2FE3A /* YHResignGuidelinesExampleViewController.swift */; };
044EE2532C9565FF00A2FE3A /* YHResignGuidelinesExampleShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044EE2522C9565FF00A2FE3A /* YHResignGuidelinesExampleShareViewController.swift */; };
04506F552C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04506F542C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift */; }; 04506F552C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04506F542C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift */; };
045A08C02C37ABF500BCBABA /* YHSegmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08BF2C37ABF500BCBABA /* YHSegmentView.swift */; }; 045A08C02C37ABF500BCBABA /* YHSegmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08BF2C37ABF500BCBABA /* YHSegmentView.swift */; };
045A08C22C37EB8B00BCBABA /* YHMyFileListNoneCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */; }; 045A08C22C37EB8B00BCBABA /* YHMyFileListNoneCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */; };
...@@ -1011,6 +1013,8 @@ ...@@ -1011,6 +1013,8 @@
044EE2472C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateHKTableViewCell.swift; sourceTree = "<group>"; }; 044EE2472C93E49C00A2FE3A /* YHResignCertificateHKTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateHKTableViewCell.swift; sourceTree = "<group>"; };
044EE2492C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateDetailPassPortViewController.swift; sourceTree = "<group>"; }; 044EE2492C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificateDetailPassPortViewController.swift; sourceTree = "<group>"; };
044EE24B2C94396D00A2FE3A /* YHResignCertificatePassportTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificatePassportTableViewCell.swift; sourceTree = "<group>"; }; 044EE24B2C94396D00A2FE3A /* YHResignCertificatePassportTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignCertificatePassportTableViewCell.swift; sourceTree = "<group>"; };
044EE2502C955CDD00A2FE3A /* YHResignGuidelinesExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignGuidelinesExampleViewController.swift; sourceTree = "<group>"; };
044EE2522C9565FF00A2FE3A /* YHResignGuidelinesExampleShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignGuidelinesExampleShareViewController.swift; sourceTree = "<group>"; };
04506F542C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberInfoCell.swift; sourceTree = "<group>"; }; 04506F542C6F57E600738EA1 /* YHFamilyMemberInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyMemberInfoCell.swift; sourceTree = "<group>"; };
045A08BF2C37ABF500BCBABA /* YHSegmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSegmentView.swift; sourceTree = "<group>"; }; 045A08BF2C37ABF500BCBABA /* YHSegmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSegmentView.swift; sourceTree = "<group>"; };
045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFileListNoneCell.swift; sourceTree = "<group>"; }; 045A08C12C37EB8B00BCBABA /* YHMyFileListNoneCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFileListNoneCell.swift; sourceTree = "<group>"; };
...@@ -2029,6 +2033,7 @@ ...@@ -2029,6 +2033,7 @@
0449EEE52C8EE99000A397FD /* Resign(续签) */ = { 0449EEE52C8EE99000A397FD /* Resign(续签) */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
044EE24D2C955C4300A2FE3A /* ResignGuidelines(续期身份指引) */,
044EE2302C9290D800A2FE3A /* ResignCertificateManage(续期证件管理) */, 044EE2302C9290D800A2FE3A /* ResignCertificateManage(续期证件管理) */,
04B4B8D82C9068F500ED82BC /* ResignDocumentManagement(续签文书管理) */, 04B4B8D82C9068F500ED82BC /* ResignDocumentManagement(续签文书管理) */,
0449EEE62C8EEA2B00A397FD /* ResignMaterialManage(续期资料管理) */, 0449EEE62C8EEA2B00A397FD /* ResignMaterialManage(续期资料管理) */,
...@@ -2220,6 +2225,31 @@ ...@@ -2220,6 +2225,31 @@
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
044EE24D2C955C4300A2FE3A /* ResignGuidelines(续期身份指引) */ = {
isa = PBXGroup;
children = (
044EE24F2C955CA700A2FE3A /* C */,
044EE24E2C955C9900A2FE3A /* V */,
);
path = "ResignGuidelines(续期身份指引)";
sourceTree = "<group>";
};
044EE24E2C955C9900A2FE3A /* V */ = {
isa = PBXGroup;
children = (
);
path = V;
sourceTree = "<group>";
};
044EE24F2C955CA700A2FE3A /* C */ = {
isa = PBXGroup;
children = (
044EE2502C955CDD00A2FE3A /* YHResignGuidelinesExampleViewController.swift */,
044EE2522C9565FF00A2FE3A /* YHResignGuidelinesExampleShareViewController.swift */,
);
path = C;
sourceTree = "<group>";
};
045EED972B9F171A0022A143 /* ServiceProcess(我的信息流程) */ = { 045EED972B9F171A0022A143 /* ServiceProcess(我的信息流程) */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -4800,6 +4830,7 @@ ...@@ -4800,6 +4830,7 @@
0468D4262B495A5400CFB916 /* YHPickPhoneAddressViewController.swift in Sources */, 0468D4262B495A5400CFB916 /* YHPickPhoneAddressViewController.swift in Sources */,
A5FD45232C523DD300908AD9 /* YHJsApi.swift in Sources */, A5FD45232C523DD300908AD9 /* YHJsApi.swift in Sources */,
04B360E32C60A346001EB053 /* YHPrinciplePhotoListCell.swift in Sources */, 04B360E32C60A346001EB053 /* YHPrinciplePhotoListCell.swift in Sources */,
044EE2512C955CDE00A2FE3A /* YHResignGuidelinesExampleViewController.swift in Sources */,
04213B292C48EF5300797900 /* YHHomeInformationViewController.swift in Sources */, 04213B292C48EF5300797900 /* YHHomeInformationViewController.swift in Sources */,
A5DF9C692C78BE6000CE48E6 /* YHUploadCertificateDetailModel.swift in Sources */, A5DF9C692C78BE6000CE48E6 /* YHUploadCertificateDetailModel.swift in Sources */,
044EE2442C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift in Sources */, 044EE2442C92F48200A2FE3A /* YHResignCertificateEvisaTableViewCell.swift in Sources */,
...@@ -5066,6 +5097,7 @@ ...@@ -5066,6 +5097,7 @@
045EEEC02B9F171A0022A143 /* YHOtherInfoFillViewModel.swift in Sources */, 045EEEC02B9F171A0022A143 /* YHOtherInfoFillViewModel.swift in Sources */,
045EEEF22B9F171A0022A143 /* YHChildBasicInfoVC.swift in Sources */, 045EEEF22B9F171A0022A143 /* YHChildBasicInfoVC.swift in Sources */,
A567E5A22BD7643D00D5D5A0 /* YHConfigManager.swift in Sources */, A567E5A22BD7643D00D5D5A0 /* YHConfigManager.swift in Sources */,
044EE2532C9565FF00A2FE3A /* YHResignGuidelinesExampleShareViewController.swift in Sources */,
0418921F2C91BAAC00B9FB94 /* YHBaseDynamicCornerRadiusView.swift in Sources */, 0418921F2C91BAAC00B9FB94 /* YHBaseDynamicCornerRadiusView.swift in Sources */,
047AA3E02C4A63B2009C4554 /* YHLifeSectionView.swift in Sources */, 047AA3E02C4A63B2009C4554 /* YHLifeSectionView.swift in Sources */,
0430E67E2C75872E000511E2 /* YHAdopterOtherViewController.swift in Sources */, 0430E67E2C75872E000511E2 /* YHAdopterOtherViewController.swift in Sources */,
......
...@@ -23,6 +23,7 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController { ...@@ -23,6 +23,7 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
var urls: [String] = [""] var urls: [String] = [""]
var data: [YHItemModel] = [] var data: [YHItemModel] = []
var isShowPrompt = false var isShowPrompt = false
var failString: String = ""
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
...@@ -129,6 +130,8 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController { ...@@ -129,6 +130,8 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
@objc func didSaveBtnClicked() { @objc func didSaveBtnClicked() {
if !checkInfo() { if !checkInfo() {
isShowPrompt = true
updateData()
return return
} }
...@@ -136,81 +139,17 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController { ...@@ -136,81 +139,17 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
} }
func checkInfo() -> Bool { func checkInfo() -> Bool {
var errorItemCount = 0 if urls.first?.count == 0 {
// if item.type == .certificate { failString = "请上传护照"
// var hasSubmitError = false return false
// var isDateValidate = true }
// item.cerDetailModel.isNeedCheckCer = false
// item.cerDetailModel.isNeedCheckDate = false
//
// if item.cerDetailModel.isOCR_failed {
// // 无法识别不能当做无法提交的错误 所以 此处 hasError 不必设置为true
// item.cerDetailModel.isNeedCheckCer = true
// item.cerDetailModel.checkTips = "无法识别,请核查文件"
//
// } else {
// var noCerInfo = false
// if item.cerDetailModel.type == 3 { // 只有港澳通行证有正反面
// noCerInfo = (item.cerDetailModel.img_front.isEmpty || item.cerDetailModel.img_back.isEmpty)
// } else {
// noCerInfo = item.cerDetailModel.img_front.isEmpty
// }
//
// if noCerInfo {
// hasSubmitError = true
// item.cerDetailModel.isNeedCheckCer = true
// if item.cerDetailModel.type == 3 { // 港澳通行证
// item.cerDetailModel.checkTips = item.cerDetailModel.img_front.isEmpty ? "请上传港澳通行证正面" : "请上传港澳通行证反面"
//
// } else if item.cerDetailModel.type == 1 { // 中国护照
// item.cerDetailModel.checkTips = "请上传护照"
//
// } else if item.cerDetailModel.type == 2 { // 中国居留许可签证
// item.cerDetailModel.checkTips = "请上传中国居留许可签证"
// }
//
// } else {
// item.cerDetailModel.isNeedCheckDate = false
// if item.cerDetailModel.issue_start.isEmpty || item.cerDetailModel.issue_end.isEmpty {
// hasSubmitError = true
// item.cerDetailModel.isNeedCheckDate = true
//
// } else {
// let isValidCertificate = item.cerDetailModel.isValidCer()
// if !isValidCertificate {
// if item.cerDetailModel.type == 2, item.cerDetailModel.china_travel_latest_validaty_date.isEmpty {
// // 这个情况直接弹toast
// hasSubmitError = true
// YHHUD.flash(message: "赴港行程尚未成功预约,请前往检查")
//
// } else {
// // 有效期不足也能提交
// isDateValidate = false
// item.cerDetailModel.isNeedCheckCer = true
// let deadDate: String = (item.cerDetailModel.type == 2 ? item.cerDetailModel.china_travel_latest_validaty_date : item.cerDetailModel.latest_validaty_date)
// item.cerDetailModel.checkTips = "有效期不足,需要为\(deadDate)或以后"
// }
// }
// }
// }
// }
// if !hasSubmitError {
// // 无法识别或有效期不足也要可以提交
// if !item.cerDetailModel.isOCR_failed && isDateValidate {
// item.cerDetailModel.isNeedCheckCer = false
// item.cerDetailModel.isNeedCheckDate = false
// }
//
// } else {
// errorItemCount += 1
// }
// }
self.tableView.reloadData()
if self.viewModel.dataModel.cert_info.issue_start.count == 0 {
return false
}
if self.viewModel.dataModel.cert_info.issue_end.count == 0 {
return false
}
return true return true
} }
} }
...@@ -219,31 +158,30 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController { ...@@ -219,31 +158,30 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
private extension YHResignCertificateDetailPassPortViewController { private extension YHResignCertificateDetailPassPortViewController {
//1、获取详情信息 //1、获取详情信息
func loadDetailInfo() { func loadDetailInfo() {
self.updateData()
// let params = [
// "order_id": orderId,
// "user_id": dataModel.id,
// "user_type": dataModel.type
// ] as [String : Any]
//
// YHHUD.show(.progress(message: "加载中..."))
// viewModel.getTravelDocsDetailInfo(param: params) { success, error in
// YHHUD.hide()
// if success {
// // TODO: 杜宇哥 UI刷新
self.updateData()
//
// } else {
//
// }
// }
} }
//2、保存旅行证件 //2、保存旅行证件
func saveAllTravelCertificate() { func saveAllTravelCertificate() {
let passPort: [String: Any] = ["name": "护照",
"issue_start": self.viewModel.dataModel.cert_info.issue_start,
"issue_end": self.viewModel.dataModel.cert_info.issue_end,
"img_front": urls[0]]
let params : [String : Any] = [
"passPort": passPort,
"id": dataModel.id
]
viewModel.submitResignCertificateUpdate(params) { success, error in
if success {
YHHUD.flash(message: "保存成功")
self.navigationController?.popViewController()
} else {
let msg = error?.errorMsg ?? "保存失败,请重试"
YHHUD.flash(message: msg)
}
}
} }
} }
...@@ -269,19 +207,18 @@ extension YHResignCertificateDetailPassPortViewController: UITableViewDelegate, ...@@ -269,19 +207,18 @@ extension YHResignCertificateDetailPassPortViewController: UITableViewDelegate,
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignCertificatePassportTableViewCell.cellReuseIdentifier, for: indexPath) as! YHResignCertificatePassportTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: YHResignCertificatePassportTableViewCell.cellReuseIdentifier, for: indexPath) as! YHResignCertificatePassportTableViewCell
cell.firstImageName = "service_adopter_card_china_travel_front" cell.firstImageName = "service_adopter_card_china_travel_front"
cell.firstLabelName = "护照资料页" cell.firstLabelName = "护照资料页"
cell.failString = failString
cell.urls = urls cell.urls = urls
cell.data = data cell.data = data
cell.dataModel = dataModel
cell.urlBlock = { [weak self] url, index in cell.urlBlock = { [weak self] url, index in
guard let self = self else { return } guard let self = self else { return }
self.urls[index] = url self.urls[index] = url
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
guard let url = success else { return } guard let url = success else { return }
// self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in self.data = viewModel.getPassPortDataSource(isShowPrompt)
// guard let self = self else { return } self.tableView.reloadData()
// self.data = viewModel.getBaseDataSource(isShowPrompt)
// self.tableView.reloadData()
// }
} }
} }
cell.deleteBlock = { [weak self] url, index in cell.deleteBlock = { [weak self] url, index in
...@@ -290,12 +227,7 @@ extension YHResignCertificateDetailPassPortViewController: UITableViewDelegate, ...@@ -290,12 +227,7 @@ extension YHResignCertificateDetailPassPortViewController: UITableViewDelegate,
} }
cell.block = {[weak self] model in cell.block = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
// self.viewModel.updateModel(model) self.viewModel.updateModel(model)
// let id = model.id
// if id != .id2 && id != .id3 && id != .id4 {
// self.data = viewModel.getBaseDataSource(isShowPrompt)
// self.tableView.reloadData()
// }
} }
return cell return cell
} }
......
...@@ -30,6 +30,12 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -30,6 +30,12 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
var viewModel: YHBaseViewModel = YHBaseViewModel() var viewModel: YHBaseViewModel = YHBaseViewModel()
var firstUrl: String = "" var firstUrl: String = ""
var lastUrl: String = "" var lastUrl: String = ""
var dataModel: YHResignCertificateModel = YHResignCertificateModel()
var failString: String = "" {
didSet {
showMessageLabel.text = failString
}
}
var firstImageName: String = "" { var firstImageName: String = "" {
didSet { didSet {
frontImageButton.setBackgroundImage(UIImage(named: firstImageName), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
...@@ -140,7 +146,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -140,7 +146,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
titleLabel = { titleLabel = {
let label = UILabel() let label = UILabel()
// label.font = UIFont.PFSC_M(ofSize: 17)
let str = "* " + "港澳通行证 (逗留D签注)" let str = "* " + "港澳通行证 (逗留D签注)"
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_M(ofSize: 17), .font: UIFont.PFSC_M(ofSize: 17),
...@@ -150,7 +155,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -150,7 +155,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
let starRange = NSRange(location: 0, length: 2) let starRange = NSRange(location: 0, length: 2)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange) questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr label.attributedText = questionAttrStr
// label.textColor = UIColor.mainTextColor
return label return label
}() }()
centerView.addSubview(titleLabel) centerView.addSubview(titleLabel)
...@@ -307,6 +311,11 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -307,6 +311,11 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
guard let self = self else { return } guard let self = self else { return }
if let block = self.block { if let block = self.block {
block(model) block(model)
if self.compareDates(dateString1: model.message ?? "", dateString2: self.dataModel.valid_date) {
} else {
failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后"
}
} }
} }
centerView.addSubview(cardEndView) centerView.addSubview(cardEndView)
...@@ -358,4 +367,18 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -358,4 +367,18 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
} }
} }
func compareDates(dateString1: String, dateString2: String) -> Bool {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
guard let date1 = dateFormatter.date(from: dateString1),
let date2 = dateFormatter.date(from: dateString2) else {
return false
}
if date1 < date2 {
return false
}
return true
}
} }
...@@ -42,4 +42,20 @@ class YHResignCertificateDetailViewModel: YHBaseViewModel { ...@@ -42,4 +42,20 @@ class YHResignCertificateDetailViewModel: YHBaseViewModel {
let item2 = YHItemModel(id: .id2, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间") let item2 = YHItemModel(id: .id2, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
return [item1, item2] return [item1, item2]
} }
func updateModel(_ item: YHItemModel) {
guard let type = item.id else { return }
switch type {
case .id1:
dataModel.cert_info.issue_start = item.message ?? ""
case .id2:
dataModel.cert_info.issue_end = item.message ?? ""
case .id3:
dataModel.cert_info.issue_start = item.message ?? ""
case .id4:
dataModel.cert_info.issue_end = item.message ?? ""
default:
break
}
}
} }
//
// YHResignGuidelinesExampleShareViewController.swift
// galaxy
//
// Created by EDY on 2024/9/14.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import Photos
class YHResignGuidelinesExampleShareViewController: YHBaseViewController {
var bottomView: UIView!
var leftButton: YHShareButton!
var centerButton: YHShareButton!
var rightButton: YHShareButton!
var centerImageView: UIImageView!
var imageView: UIImageView!
var logoImageView: UIImageView!
var centerImageName: String = ""
var url: String = " "
override func viewDidLoad() {
super.viewDidLoad()
setView()
loadData()
}
}
extension YHResignGuidelinesExampleShareViewController {
func getData() {
}
func updateDataSource() {
}
func setView() {
view.backgroundColor = .contentBkgColor
gk_navTitle = "分享活动"
bottomView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
view.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(148)
}
leftButton = {
let button = YHShareButton()
button.setContent("invitation_with_gifts_share_left", "保存海报")
button.addTarget(self, action: #selector(saveBtnClick), for: .touchUpInside)
return button
}()
bottomView.addSubview(leftButton)
leftButton.snp.makeConstraints { make in
make.top.equalTo(20)
make.left.equalTo(42)
make.height.equalTo(74)
make.width.equalTo(52)
}
centerButton = {
let button = YHShareButton()
button.setContent("invitation_with_gifts_share_center", "微信好友")
button.addTarget(self, action: #selector(wxClick), for: .touchUpInside)
return button
}()
bottomView.addSubview(centerButton)
centerButton.snp.makeConstraints { make in
make.top.equalTo(20)
make.centerX.equalToSuperview()
make.height.equalTo(74)
make.width.equalTo(52)
}
rightButton = {
let button = YHShareButton()
button.setContent("invitation_with_gifts_share_right", "朋友圈")
button.addTarget(self, action: #selector(peopleClick), for: .touchUpInside)
return button
}()
bottomView.addSubview(rightButton)
rightButton.snp.makeConstraints { make in
make.top.equalTo(20)
make.right.equalTo(-42)
make.height.equalTo(74)
make.width.equalTo(52)
}
centerImageView = {
let view = UIImageView()
view.image = UIImage(named: centerImageName)
return view
}()
view.addSubview(centerImageView)
centerImageView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 46.fix)
make.centerX.equalToSuperview()
make.height.equalTo(466)
make.width.equalTo(270)
}
imageView = {
let view = UIImageView()
return view
}()
centerImageView.addSubview(imageView)
imageView.snp.makeConstraints { make in
make.bottom.equalTo(-18)
make.right.equalTo(-18)
make.width.height.equalTo(77)
}
logoImageView = {
let view = UIImageView()
view.image = UIImage(named: "share_icon")
return view
}()
imageView.addSubview(logoImageView)
logoImageView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.height.equalTo(21)
}
let qrString = url
if let qrCode = qrString.generateQRCode() {
// 可以将qrCode设置为UIImageView的image属性来显示二维码
imageView.image = qrCode
}
}
func loadData() {
}
@objc func saveBtnClick() {
guard let combinedImage = combinedImageFrom(imageView: centerImageView) else { return }
saveImageToPhotosAlbum(image: combinedImage)
}
func saveImageToPhotosAlbum(image: UIImage) {
// 确保应用有权访问相册
PHPhotoLibrary.requestAuthorization { status in
if status == .authorized {
// 保存图片到相册
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
DispatchQueue.main.async {
YHHUD.flash(message: "保存成功")
}
} else {
YHHUD.flash(message: "保存失败,请检查系统权限")
}
}
}
@objc func wxClick() {
// YHShareManager.shared.sendLinkContent("香港身份规划专属礼包,限时领取!", "1000元折扣福利券,资深银河规划专家1V1评估方案", UIImage(named: "invitation_with_gifts_share_other") ?? UIImage(), link: YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/evaluation?channel=lkhtj-app&customer_id=\(YHLoginManager.shared.userModel?.id ?? "")&scene_id=30")
}
@objc func peopleClick() {
// YHShareManager.shared.sendLinkContent("香港身份规划专属礼包,限时领取!", "1000元折扣福利券,资深银河规划专家1V1评估方案", UIImage(named: "invitation_with_gifts_share_other") ?? UIImage(), link: YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/evaluation?channel=lkhtj-app&customer_id=\(YHLoginManager.shared.userModel?.id ?? "")&scene_id=30", WXSceneTimeline)
}
func combinedImageFrom(imageView: UIImageView) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, false, 0.0)
// 首先绘制 imageView 的内容
imageView.layer.render(in: UIGraphicsGetCurrentContext()!)
// 获取合成后的图像
let combinedImage = UIGraphicsGetImageFromCurrentImageContext()
// 结束绘图上下文
UIGraphicsEndImageContext()
return combinedImage
}
func currentPage(collectionView: UICollectionView) -> Int {
let pageWidth = collectionView.frame.width
let offset = collectionView.contentOffset
return Int(offset.x / pageWidth)
}
}
//
// YHResignGuidelinesExampleViewController.swift
// galaxy
//
// Created by EDY on 2024/9/14.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHResignGuidelinesExampleType: Int {
case house
case work
case taxation
case noWork
}
class YHResignGuidelinesExampleViewController: YHBaseViewController {
var tableView: UITableView!
var nextButton: UIButton!
var url: String = ""
var imageName: String = ""
var type: YHResignGuidelinesExampleType = .house
// var viewModel = YHResignCertificateListViewModel()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "银河续签案例分享"
gk_navBackgroundColor = .white
gk_navBarAlpha = 1.0
setView()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
getData()
}
func getData() {
if type == .house {
imageName = "resign_guidelines_example_house"
} else if type == .work {
imageName = "resign_guidelines_example_work"
} else if type == .taxation {
imageName = "resign_guidelines_example_taxation"
} else {
imageName = "resign_guidelines_example_nowork"
}
tableView.reloadData()
}
func setView() {
tableView = {
let tableView = UITableView(frame:.zero, style:.plain)
tableView.contentInsetAdjustmentBehavior = .never
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.showsVerticalScrollIndicator = false
tableView.showsHorizontalScrollIndicator = false
tableView.register(cellWithClass: YHResignGuidelinesExampleTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.bottom.equalTo(-98)
}
let bottonView = UIView()
bottonView.backgroundColor = .white
bottonView.isHidden = true
view.addSubview(bottonView)
bottonView.snp.makeConstraints { make in
make.height.equalTo(98)
make.bottom.left.right.equalTo(view)
}
nextButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor
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 = kCornerRadius3
button.addTarget(self, action: #selector(nextStep), for: .touchUpInside)
return button
}()
view.addSubview(nextButton)
nextButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-8 - k_Height_safeAreaInsetsBottom())
make.height.equalTo(48)
}
}
@objc func nextStep() {
var imageName = ""
if type == .house {
imageName = "resign_guidelines_example_house_share"
} else if type == .work {
imageName = "resign_guidelines_example_work_share"
} else if type == .taxation {
imageName = "resign_guidelines_example_taxation_share"
} else {
imageName = "resign_guidelines_example_nowork_share"
}
let vc = YHResignGuidelinesExampleShareViewController()
vc.centerImageName = imageName
vc.url = "https://baidu.com"
self.navigationController?.pushViewController(vc)
}
}
extension YHResignGuidelinesExampleViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHResignGuidelinesExampleTableViewCell.self)
cell.imageName = imageName
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if type == .house {
return 986.fix
} else if type == .work {
return 925.fix
} else if type == .taxation {
return 946.fix
} else {
return 1069.fix
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
}
class YHResignGuidelinesExampleTableViewCell: UITableViewCell {
var bgImageView: UIImageView!
var imageName: String? {
didSet {
bgImageView.image = UIImage(named: imageName ?? "")
}
}
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() {
backgroundColor = .clear
bgImageView = {
let imageView = UIImageView()
return imageView
}()
contentView.addSubview(bgImageView)
bgImageView.snp.makeConstraints { make in
make.top.left.right.bottom.equalToSuperview()
}
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_house@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_house@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_house_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_house_share@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_nowork@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_nowork@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_nowork_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_nowork_share@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_taxation@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_taxation@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_taxation_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_taxation_share@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_work@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_work@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_work_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_work_share@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