Commit 5b400ad7 authored by Steven杜宇's avatar Steven杜宇

// 旅行

parent 269163df
......@@ -212,7 +212,7 @@ class YHTravelDocsPreparationDetailVC: YHBaseViewController {
return
}
// saveAllTravelCertificate()
saveAllTravelCertificate()
}
func checkInfo() -> Bool {
......
......@@ -55,7 +55,10 @@ class YHTravelDocsPreparationDetailItemModel: SmartCodable {
var isCanEdit: Bool = true
// OCR识别失败
var isOCR_failed: Bool = false
//
var frontUrlDate: TimeInterval = 0
var backUrlDate: TimeInterval = 0
required init() {
}
......
......@@ -120,6 +120,8 @@ class YHTravelCertificateUploadCell: UITableViewCell {
view.urlBlock = {
[weak self] url, index in
guard let self = self else { return }
self.dataModel.frontUrlDate = Date().timeIntervalSince1970
if self.dataModel.type == 3 { // 港澳通行证
self.dataModel.img_front = url
self.getOCR(url: url, isBack: 0)
......@@ -146,6 +148,7 @@ class YHTravelCertificateUploadCell: UITableViewCell {
self.dataModel.img_back = ""
}
self.dataModel.status = 0
self.dataModel.frontUrlDate = 0
self.updateBlock?(false)
}
return view
......@@ -158,6 +161,7 @@ class YHTravelCertificateUploadCell: UITableViewCell {
[weak self] url, index in
guard let self = self else { return }
self.dataModel.backUrlDate = Date().timeIntervalSince1970
if self.dataModel.type == 3 { // 港澳通行证
self.dataModel.img_back = url
self.updateBlock?(false)
......@@ -184,6 +188,7 @@ class YHTravelCertificateUploadCell: UITableViewCell {
self.dataModel.img_back = ""
}
self.dataModel.status = 0
self.dataModel.backUrlDate = 0
self.updateBlock?(false)
}
return view
......@@ -313,15 +318,35 @@ class YHTravelCertificateUploadCell: UITableViewCell {
certificateBackView.state = !model.isCanEdit
var frontDefaultImg = "credentials_default_front"
var backDefaultImg = "credentials_default_back"
let backDefaultImg = "credentials_default_back"
if model.type == 2 { // 中国居留许可证
frontDefaultImg = "credentials_default_residence_front"
}
certificateFrontView.defaultImageName = frontDefaultImg
certificateBackView.defaultImageName = backDefaultImg
certificateFrontView.url = model.img_front
certificateBackView.url = model.img_back
// certificateFrontView.defaultImageName = frontDefaultImg
// certificateBackView.defaultImageName = backDefaultImg
//
// certificateFrontView.url = model.img_front
// certificateBackView.url = model.img_back
if !model.img_front.isEmpty, certificateFrontView.url == model.img_front {
if model.frontUrlDate - Date().timeIntervalSince1970 > 5*60 {
certificateFrontView.url = model.img_front
}
} else {
certificateFrontView.defaultImageName = frontDefaultImg
certificateFrontView.url = model.img_front
}
if !model.img_back.isEmpty, certificateBackView.url == model.img_back {
if model.backUrlDate - Date().timeIntervalSince1970 > 5*60 {
certificateBackView.url = model.img_back
}
} else {
certificateBackView.defaultImageName = backDefaultImg
certificateBackView.url = model.img_back
}
// 除了港澳通行证需要上传正反面 其他都是上传正面
certificateBackView.isHidden = model.type != 3
......
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