Commit c013e97d 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:
  // 消息
  //  签字
  修改共有方案私转公字符串处理方案 解决部分私转公失败的问题
  //  签字
  不冲续签逻辑
parents eb9df27a 3396c808
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
0419A0A42C49184300A5FCFA /* YHInvitationNumberItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0419A0A32C49184300A5FCFA /* YHInvitationNumberItemView.swift */; }; 0419A0A42C49184300A5FCFA /* YHInvitationNumberItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0419A0A32C49184300A5FCFA /* YHInvitationNumberItemView.swift */; };
042092B32C9D4884001184F0 /* YHURLEncodeHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042092B22C9D4884001184F0 /* YHURLEncodeHelper.swift */; }; 042092B32C9D4884001184F0 /* YHURLEncodeHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042092B22C9D4884001184F0 /* YHURLEncodeHelper.swift */; };
042092B52C9D48FC001184F0 /* YHRealNameHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042092B42C9D48FC001184F0 /* YHRealNameHelper.swift */; }; 042092B52C9D48FC001184F0 /* YHRealNameHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042092B42C9D48FC001184F0 /* YHRealNameHelper.swift */; };
042092B72C9D6719001184F0 /* YHSignatureWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042092B62C9D6719001184F0 /* YHSignatureWebViewController.swift */; };
04213B202C47ADEA00797900 /* ATAuthSDK_D.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */; }; 04213B202C47ADEA00797900 /* ATAuthSDK_D.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */; };
04213B212C47AE0100797900 /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 04213B212C47AE0100797900 /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
04213B232C48B7F700797900 /* YHIdentityTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04213B222C48B7F700797900 /* YHIdentityTabBar.swift */; }; 04213B232C48B7F700797900 /* YHIdentityTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04213B222C48B7F700797900 /* YHIdentityTabBar.swift */; };
...@@ -876,6 +877,7 @@ ...@@ -876,6 +877,7 @@
0419A0A32C49184300A5FCFA /* YHInvitationNumberItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInvitationNumberItemView.swift; sourceTree = "<group>"; }; 0419A0A32C49184300A5FCFA /* YHInvitationNumberItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInvitationNumberItemView.swift; sourceTree = "<group>"; };
042092B22C9D4884001184F0 /* YHURLEncodeHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHURLEncodeHelper.swift; sourceTree = "<group>"; }; 042092B22C9D4884001184F0 /* YHURLEncodeHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHURLEncodeHelper.swift; sourceTree = "<group>"; };
042092B42C9D48FC001184F0 /* YHRealNameHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRealNameHelper.swift; sourceTree = "<group>"; }; 042092B42C9D48FC001184F0 /* YHRealNameHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRealNameHelper.swift; sourceTree = "<group>"; };
042092B62C9D6719001184F0 /* YHSignatureWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSignatureWebViewController.swift; sourceTree = "<group>"; };
04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ATAuthSDK_D.framework; path = framework/ATAuthSDK_D.framework; sourceTree = "<group>"; }; 04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ATAuthSDK_D.framework; path = framework/ATAuthSDK_D.framework; sourceTree = "<group>"; };
04213B222C48B7F700797900 /* YHIdentityTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIdentityTabBar.swift; sourceTree = "<group>"; }; 04213B222C48B7F700797900 /* YHIdentityTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIdentityTabBar.swift; sourceTree = "<group>"; };
04213B242C48C15400797900 /* YHHomeIdentityViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeIdentityViewController.swift; sourceTree = "<group>"; }; 04213B242C48C15400797900 /* YHHomeIdentityViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeIdentityViewController.swift; sourceTree = "<group>"; };
...@@ -3387,6 +3389,7 @@ ...@@ -3387,6 +3389,7 @@
children = ( children = (
04B4B8DB2C90696E00ED82BC /* YHResignDocumentManagementVC.swift */, 04B4B8DB2C90696E00ED82BC /* YHResignDocumentManagementVC.swift */,
04F243282C942A5500DF2C74 /* YHResignDocumentDetailViewController.swift */, 04F243282C942A5500DF2C74 /* YHResignDocumentDetailViewController.swift */,
042092B62C9D6719001184F0 /* YHSignatureWebViewController.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -5172,6 +5175,7 @@ ...@@ -5172,6 +5175,7 @@
04256DEE2C73338200A37BA4 /* YHGrabingNumberListCell.swift in Sources */, 04256DEE2C73338200A37BA4 /* YHGrabingNumberListCell.swift in Sources */,
045EEEEC2B9F171A0022A143 /* YHBrotherInfoVC.swift in Sources */, 045EEEEC2B9F171A0022A143 /* YHBrotherInfoVC.swift in Sources */,
0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */, 0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */,
042092B72C9D6719001184F0 /* YHSignatureWebViewController.swift in Sources */,
A5CA3F5A2C74B64A00EB22F5 /* YHSmallWhiteNoteTemplateView.swift in Sources */, A5CA3F5A2C74B64A00EB22F5 /* YHSmallWhiteNoteTemplateView.swift in Sources */,
045EEF242B9F171A0022A143 /* YHStepView.swift in Sources */, 045EEF242B9F171A0022A143 /* YHStepView.swift in Sources */,
04CE1AD62C2AD91F001CB80A /* YHApplyActivityResultViewController.swift in Sources */, 04CE1AD62C2AD91F001CB80A /* YHApplyActivityResultViewController.swift in Sources */,
......
...@@ -87,7 +87,8 @@ class YHResignCertificateDetailEVisaViewController: YHBaseViewController { ...@@ -87,7 +87,8 @@ class YHResignCertificateDetailEVisaViewController: YHBaseViewController {
if file.count != 0 { if file.count != 0 {
let eVisa: [String: Any] = ["name": file.first?.fileName ?? "", let eVisa: [String: Any] = ["name": file.first?.fileName ?? "",
"e_visa_url": file.first?.fileUrl ?? "", "e_visa_url": file.first?.fileUrl ?? "",
"upload_at": file.first?.uploadedAt ?? ""] "upload_at": file.first?.uploadedAt ?? "",
"submit": true]
let params : [String : Any] = [ let params : [String : Any] = [
"eVisa": eVisa, "eVisa": eVisa,
"id": data.id "id": data.id
......
...@@ -167,6 +167,24 @@ class YHResignCertificateDetailHkViewController: YHBaseViewController { ...@@ -167,6 +167,24 @@ class YHResignCertificateDetailHkViewController: YHBaseViewController {
} }
return true return true
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if dataModel.cert_info.is_show {
} else {
YHAdopterCardExampleView.exampleView(type: .travel).show()
let hkPassPort: [String: Any] = ["is_show": true,
"submit": false
]
let params : [String : Any] = [
"hkPassPort": hkPassPort,
"id":dataModel.id
]
viewModel.submitResignCertificateUpdate(params) { success, error in
}
}
}
} }
...@@ -185,7 +203,9 @@ private extension YHResignCertificateDetailHkViewController { ...@@ -185,7 +203,9 @@ private extension YHResignCertificateDetailHkViewController {
"img_back": urls[1], "img_back": urls[1],
"validate_start": self.viewModel.dataModel.cert_info.validate_start, "validate_start": self.viewModel.dataModel.cert_info.validate_start,
"validate_end": self.viewModel.dataModel.cert_info.validate_end, "validate_end": self.viewModel.dataModel.cert_info.validate_end,
"sign_type": "D"] "sign_type": "D",
"submit": true,
"is_show": true]
let params : [String : Any] = [ let params : [String : Any] = [
"hkPassPort": hkPassPort, "hkPassPort": hkPassPort,
"id": dataModel.id "id": dataModel.id
...@@ -227,9 +247,9 @@ extension YHResignCertificateDetailHkViewController: UITableViewDelegate, UITabl ...@@ -227,9 +247,9 @@ extension YHResignCertificateDetailHkViewController: UITableViewDelegate, UITabl
cell.firstLabelName = "港澳通行证正面" cell.firstLabelName = "港澳通行证正面"
cell.lastLabelName = "港澳通行证倍面" cell.lastLabelName = "港澳通行证倍面"
cell.failString = failString cell.failString = failString
cell.urls = urls
cell.data = data cell.data = data
cell.dataModel = dataModel cell.dataModel = dataModel
cell.urls = urls
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
......
...@@ -152,6 +152,24 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController { ...@@ -152,6 +152,24 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
} }
return true return true
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if dataModel.cert_info.is_show {
} else {
YHAdopterCardExampleView.exampleView(type: .chinaTravel).show()
let passPort: [String: Any] = ["is_show": true,
"submit": false
]
let params : [String : Any] = [
"passPort": passPort,
"id":dataModel.id
]
viewModel.submitResignCertificateUpdate(params) { success, error in
}
}
}
} }
...@@ -167,7 +185,9 @@ private extension YHResignCertificateDetailPassPortViewController { ...@@ -167,7 +185,9 @@ private extension YHResignCertificateDetailPassPortViewController {
let passPort: [String: Any] = ["name": "护照", let passPort: [String: Any] = ["name": "护照",
"issue_start": self.viewModel.dataModel.cert_info.issue_start, "issue_start": self.viewModel.dataModel.cert_info.issue_start,
"issue_end": self.viewModel.dataModel.cert_info.issue_end, "issue_end": self.viewModel.dataModel.cert_info.issue_end,
"img_front": urls[0]] "img_front": urls[0],
"submit": true,
"is_show": true]
let params : [String : Any] = [ let params : [String : Any] = [
"passPort": passPort, "passPort": passPort,
"id": dataModel.id "id": dataModel.id
...@@ -207,10 +227,10 @@ extension YHResignCertificateDetailPassPortViewController: UITableViewDelegate, ...@@ -207,10 +227,10 @@ 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.dataModel = dataModel
cell.failString = failString 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
......
...@@ -149,6 +149,27 @@ class YHResignCertificateDetailViewController: YHBaseViewController { ...@@ -149,6 +149,27 @@ class YHResignCertificateDetailViewController: YHBaseViewController {
} }
return data return data
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if dataModel.cert_info.is_show {
} else {
if detailType == .SmallWhiteNote {
let view = YHSmallWhiteNoteTemplateView.sheetView()
view.show()
let smallWhiteBar: [String: Any] = ["is_show": true,
"submit": false
]
let params : [String : Any] = [
"smallWhiteBar": smallWhiteBar,
"id":dataModel.id
]
viewModel.submitResignCertificateUpdate(params) { success, error in
}
}
}
}
} }
// MARK: - 私有方法 // MARK: - 私有方法
...@@ -220,7 +241,9 @@ private extension YHResignCertificateDetailViewController { ...@@ -220,7 +241,9 @@ private extension YHResignCertificateDetailViewController {
let smallWhiteBar: [String: Any] = ["name": "小白条", let smallWhiteBar: [String: Any] = ["name": "小白条",
"small_white_note_url":uploadImageUrl, "small_white_note_url":uploadImageUrl,
"small_white_note_validity_start":startDateStr, "small_white_note_validity_start":startDateStr,
"small_white_note_validity_end":endDateStr "small_white_note_validity_end":endDateStr,
"submit": true,
"is_show": true
] ]
let params : [String : Any] = [ let params : [String : Any] = [
"smallWhiteBar": smallWhiteBar, "smallWhiteBar": smallWhiteBar,
...@@ -239,7 +262,8 @@ private extension YHResignCertificateDetailViewController { ...@@ -239,7 +262,8 @@ private extension YHResignCertificateDetailViewController {
func submitHKIDCarInfo() { func submitHKIDCarInfo() {
let hkIdCard: [String: Any] = ["name": "香港身份证", let hkIdCard: [String: Any] = ["name": "香港身份证",
"idcard_url":uploadImageUrl] "idcard_url":uploadImageUrl,
"submit": true]
let params : [String : Any] = [ let params : [String : Any] = [
"hkIdCard": hkIdCard, "hkIdCard": hkIdCard,
"id":dataModel.id "id":dataModel.id
......
...@@ -63,6 +63,7 @@ class YHResignCertificateInfoModel: SmartCodable { ...@@ -63,6 +63,7 @@ class YHResignCertificateInfoModel: SmartCodable {
var validate_end: String = "" var validate_end: String = ""
var is_show: Bool = false var is_show: Bool = false
var submit: Bool = true
required init() { required init() {
} }
} }
...@@ -133,6 +133,11 @@ class YHResignCertificateHKTableViewCell: UITableViewCell { ...@@ -133,6 +133,11 @@ class YHResignCertificateHKTableViewCell: UITableViewCell {
make.height.equalTo(52) make.height.equalTo(52)
} }
} }
if self.compareDates(dateString1: item.message ?? "", dateString2: self.dataModel.valid_date) {
failString = ""
} else {
failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后"
}
} }
if item.id == .id3 { if item.id == .id3 {
signBeginView.dataSource = item signBeginView.dataSource = item
...@@ -157,6 +162,11 @@ class YHResignCertificateHKTableViewCell: UITableViewCell { ...@@ -157,6 +162,11 @@ class YHResignCertificateHKTableViewCell: UITableViewCell {
make.height.equalTo(52) make.height.equalTo(52)
} }
} }
if self.compareDates(dateString1: item.message ?? "", dateString2: self.dataModel.valid_date) {
failString = ""
} else {
failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后"
}
} }
} }
} }
...@@ -419,7 +429,7 @@ class YHResignCertificateHKTableViewCell: UITableViewCell { ...@@ -419,7 +429,7 @@ class YHResignCertificateHKTableViewCell: UITableViewCell {
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) { if self.compareDates(dateString1: model.message ?? "", dateString2: self.dataModel.valid_date) {
failString = ""
} else { } else {
failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后" failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后"
} }
......
...@@ -24,7 +24,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -24,7 +24,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
var frontDeleteButton: UIButton! var frontDeleteButton: UIButton!
var activityIndicator: UIActivityIndicatorView! var activityIndicator: UIActivityIndicatorView!
var showMessageLabel: UILabel! var showMessageLabel: UILabel!
var cardLabel: UILabel!
var cardBeginView: YHItemView! var cardBeginView: YHItemView!
var cardEndView: YHItemView! var cardEndView: YHItemView!
var viewModel: YHBaseViewModel = YHBaseViewModel() var viewModel: YHBaseViewModel = YHBaseViewModel()
...@@ -51,12 +50,10 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -51,12 +50,10 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
var urls: [String]? { var urls: [String]? {
didSet { didSet {
guard let firstUrl = urls?.first, firstUrl.count != 0 else { guard let firstUrl = urls?.first, firstUrl.count != 0 else {
cardLabel.isHidden = true
cardBeginView.isHidden = true cardBeginView.isHidden = true
cardEndView.isHidden = true cardEndView.isHidden = true
return return
} }
cardLabel.isHidden = false
cardBeginView.isHidden = false cardBeginView.isHidden = false
cardEndView.isHidden = false cardEndView.isHidden = false
self.firstUrl = firstUrl self.firstUrl = firstUrl
...@@ -100,6 +97,11 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -100,6 +97,11 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
make.height.equalTo(52) make.height.equalTo(52)
} }
} }
if self.compareDates(dateString1: item.message ?? "", dateString2: self.dataModel.valid_date) {
failString = ""
} else {
failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后"
}
} }
} }
} }
...@@ -271,20 +273,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -271,20 +273,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
make.height.equalTo(20) make.height.equalTo(20)
} }
cardLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.text = "卡片有效期"
return label
}()
centerView.addSubview(cardLabel)
cardLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(229)
make.height.equalTo(20)
}
cardBeginView = { cardBeginView = {
let view = YHItemView() let view = YHItemView()
return view return view
...@@ -298,7 +286,7 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -298,7 +286,7 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
centerView.addSubview(cardBeginView) centerView.addSubview(cardBeginView)
cardBeginView.snp.makeConstraints { make in cardBeginView.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.top.equalTo(cardLabel.snp.bottom) make.top.equalTo(229)
make.height.equalTo(52) make.height.equalTo(52)
make.right.equalTo(-18) make.right.equalTo(-18)
} }
...@@ -312,7 +300,7 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell { ...@@ -312,7 +300,7 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
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) { if self.compareDates(dateString1: model.message ?? "", dateString2: self.dataModel.valid_date) {
failString = ""
} else { } else {
failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后" failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后"
} }
......
...@@ -38,8 +38,8 @@ class YHResignCertificateDetailViewModel: YHBaseViewModel { ...@@ -38,8 +38,8 @@ class YHResignCertificateDetailViewModel: YHBaseViewModel {
} }
func getPassPortDataSource(_ isShowPrompt: Bool) -> [YHItemModel] { func getPassPortDataSource(_ isShowPrompt: Bool) -> [YHItemModel] {
let item1 = YHItemModel(id: .id1, isNeed: true, title: "开始时间", isUserKeyBoard: false, prompts: "请选择", message: getResultString(dataModel.cert_info.issue_start), type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择开始时间") let item1 = YHItemModel(id: .id1, isNeed: true, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: getResultString(dataModel.cert_info.issue_start), type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择开始时间")
let item2 = YHItemModel(id: .id2, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: getResultString(dataModel.cert_info.issue_end), type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间") let item2 = YHItemModel(id: .id2, isNeed: true, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: getResultString(dataModel.cert_info.issue_end), type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
return [item1, item2] return [item1, item2]
} }
......
//
// YHSignatureWebViewController.swift
// galaxy
//
// Created by edy on 2024/9/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSignatureWebViewController: YHBaseViewController {
var realNameUrl: String = ""
lazy var webView: WKWebView = {
let webView = WKWebView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: KScreenHeight-k_Height_NavigationtBarAndStatuBar), configuration: self.configuaration)
webView.navigationDelegate = self
return webView
}()
lazy var configuaration: WKWebViewConfiguration = {
let config = WKWebViewConfiguration()
let preferences = WKPreferences()
preferences.javaScriptCanOpenWindowsAutomatically = true
config.preferences = preferences
config.userContentController = self.userContentController
config.allowsInlineMediaPlayback = true
config.defaultWebpagePreferences.preferredContentMode = .mobile
return config
}()
lazy var userContentController = {
let vc = WKUserContentController()
return vc
}()
lazy var progressBar: UIProgressView = {
let progBar = UIProgressView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 30))
progBar.progress = 0.0
progBar.tintColor = UIColor.brandMainColor
return progBar
}()
deinit {
webView.removeObserver(self, forKeyPath: "estimatedProgress")
NotificationCenter.default.removeObserver(self)
}
override func viewDidLoad() {
super.viewDidLoad()
createUI()
}
func createUI() {
webView.addSubview(progressBar)
self.view.addSubview(webView)
// 监听网页加载的进度
webView.addObserver(self, forKeyPath: "estimatedProgress", options: .new, context: nil)
if let url = URL(string: realNameUrl) {
webView.load(URLRequest(url: url))
}
}
func handleRequest(_ request: URLRequest) -> Bool {
if let url = request.url {
let handleResult = YHRealNameHelper.handleRealnameURL(url, delegate: self)
return handleResult != .cancel
}
return false
}
// MARK: - KVO
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "estimatedProgress" {
self.progressBar.alpha = 1.0
progressBar.setProgress(Float(webView.estimatedProgress), animated: true)
//进度条的值最大为1.0
if(self.webView.estimatedProgress >= 1.0) {
UIView.animate(withDuration: 0.3, delay: 0.1, options: .curveEaseInOut, animations: { () -> Void in
self.progressBar.alpha = 0.0
}, completion: { (finished:Bool) -> Void in
self.progressBar.progress = 0
})
}
}
}
}
extension YHSignatureWebViewController: YHRealNameDelegate {
func realnameJumptoAlipay() {
}
func realnameResult(_ result: YHRealnameResult) {
}
func signResult(_ status: Bool) {
}
}
extension YHSignatureWebViewController : WKNavigationDelegate {
// 开始加载
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
YHHUD.flash(message: "开始加载")
}
// 加载完成
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
YHHUD.flash(message: "加载完成")
}
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
YHHUD.flash(message: "加载失败: \(error.localizedDescription)")
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.url {
let absoluteString = url.absoluteString
printLog("\(absoluteString)")
}
let isAllow = self.handleRequest(navigationAction.request)
if (isAllow) {
decisionHandler(.allow)
} else {
decisionHandler(.cancel)
}
}
func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
// 判断服务器采用的验证方法
if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
// 如果没有错误的情况下 创建一个凭证,并使用证书
if (challenge.previousFailureCount == 0), let serverTrust = challenge.protectionSpace.serverTrust {
let credential = URLCredential(trust: serverTrust)
completionHandler(.useCredential, credential)
} else {
// 验证失败,取消本次验证
completionHandler(.cancelAuthenticationChallenge, nil)
}
} else {
completionHandler(.cancelAuthenticationChallenge, nil)
}
}
}
...@@ -342,6 +342,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -342,6 +342,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
// status 1 申请阶段 2办证阶段 3续期阶段 // status 1 申请阶段 2办证阶段 3续期阶段
self.handleRouter(message: item, stage: status) { self.handleRouter(message: item, stage: status) {
// 没有满足相应跳转条件默认跳转到服务页 // 没有满足相应跳转条件默认跳转到服务页
UIViewController.current?.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .service) goTabBarBy(tabType: .service)
} }
} }
...@@ -417,9 +418,10 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -417,9 +418,10 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
// 根据订单状态获取其可以进入的路由数组 // 根据订单状态获取其可以进入的路由数组
let routers = self.getRoutersForOrderStage(stage) let routers = self.getRoutersForOrderStage(stage)
var routerStringArr = routers.map { page in let routerStringArr = routers.map { page in
return page.rawValue return page.rawValue
} }
printLog("\(message.redirectPage)")
if routerStringArr.contains(message.redirectPage) { if routerStringArr.contains(message.redirectPage) {
self.routeToPage(message) self.routeToPage(message)
......
...@@ -215,17 +215,11 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -215,17 +215,11 @@ class YHOSSManager: NSObject, URLSessionDelegate {
DispatchQueue.global().async { DispatchQueue.global().async {
let bucketName = self.getBucket(url) let bucketName = self.getBucket(url)
let pathComponents = url.pathComponents
var objectKey = "" guard let resultUrl = URL(string: url) else { return }
for i in 0..<pathComponents.count { var objectKey = resultUrl.path
if i == 0 || i == 1 { objectKey.removeFirst()
} else if i == pathComponents.count - 1 {
objectKey = objectKey + pathComponents[i]
} else {
objectKey = objectKey + pathComponents[i] + "/"
}
}
let task = self.mClient.presignConstrainURL(withBucketName: bucketName, withObjectKey: objectKey, withExpirationInterval: 60 * 5) let task = self.mClient.presignConstrainURL(withBucketName: bucketName, withObjectKey: objectKey, withExpirationInterval: 60 * 5)
task.continue({ (t) -> Any? in task.continue({ (t) -> Any? in
let result = t let result = t
......
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