Commit bbf153c1 authored by pete谢兆麟's avatar pete谢兆麟

主申请人 修改逻辑

parent 379921ee
......@@ -149,6 +149,8 @@ class YHFamilyMemberViewModel : YHBaseViewModel{
} else {
mainModel.certificates.hkMacaoPass.imgBack = url
}
case .other:
mainModel.certificates.passport.imgFront = url
}
if let saveInfoSilentBlock = saveInfoSilentBlock {
saveInfoSilentBlock()
......
......@@ -83,6 +83,8 @@ class YHIdentityCardCell: UITableViewCell {
backSurfaceLabel.text = "港澳通行证反面"
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
case .other:
break
}
}
}
......@@ -422,6 +424,8 @@ class YHIdentityCardCell: UITableViewCell {
frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal)
case .passport:
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
case .other:
break
}
frontImageButton.setContent("card_upload", "点击上传")
}
......@@ -434,6 +438,8 @@ class YHIdentityCardCell: UITableViewCell {
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal)
case .passport:
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
case .other:
break
}
backSurfaceImageButton.setContent("card_upload", "点击上传")
}
......
......@@ -166,14 +166,18 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if stepView.currentIndex == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHMainInformationCardTableViewCell.self)
cell.type = YHCardType(rawValue: indexPath.row) ?? .identity
if dataSource?[indexPath.row].models?.first?.id == .id5 {
cell.type = .identity
}
if dataSource?[indexPath.row].models?.first?.id == .id6 {
cell.type = .passport
}
if dataSource?[indexPath.row].models?.first?.id == .id7 {
cell.type = .other
}
cell.viewModel = viewModel
cell.backSurfaceDeleteButton.isHidden = true
cell.frontDeleteButton.isHidden = true
cell.informationBlock = {[weak self] type, image, isLeft in
guard let self = self else { return }
}
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHMainInformationTableViewCell.self)
......
......@@ -38,6 +38,7 @@ class YHCardExampleView: UIView {
make.height.equalTo(207)
make.top.equalTo(109)
}
case .other: break
}
}
}
......
......@@ -13,6 +13,7 @@ import Kingfisher
enum YHCardType: Int {
case identity = 0 //中国身份证
case passport = 1 //港澳通行证
case other = 2 //护照
}
class YHMainInformationCardTableViewCell: UITableViewCell {
......@@ -51,7 +52,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
self.backSurfaceImageButton.setContent("", "")
}
}
} else {
} else if type == .passport {
if viewModel.mainModel.certificates.hk_macao_pass.img_front.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.hk_macao_pass.img_front) {[weak self] success, error in
guard let self = self else { return }
......@@ -72,6 +73,17 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
self.backSurfaceImageButton.setContent("", "")
}
}
} else {
if viewModel.mainModel.certificates.passport.img_front.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.passport.img_front) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.frontImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in
self.frontDeleteButton.isHidden = false
})
self.frontImageButton.setContent("", "")
}
}
}
}
}
......@@ -84,12 +96,22 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
backSurfaceLabel.text = "身份证国徽面"
frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal)
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal)
backSurfaceLabel.isHidden = false
backSurfaceImageButton.isHidden = false
case .passport:
titleLabel.text = "港澳通行证(选填)"
frontLabel.text = "港澳通行证正面"
backSurfaceLabel.text = "港澳通行证反面"
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
backSurfaceLabel.isHidden = false
backSurfaceImageButton.isHidden = false
case .other:
titleLabel.text = "护照(选填)"
frontLabel.text = "护照资料页"
backSurfaceLabel.isHidden = true
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
backSurfaceImageButton.isHidden = true
}
}
}
......@@ -289,10 +311,14 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
}
@objc func exampleClick() {
let view = YHCardExampleView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.type = type
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
if type == .other {
YHAdopterCardExampleView.exampleView(type: .chinaTravel).show()
} else {
let view = YHCardExampleView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.type = type
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
}
@objc func frontImageClick() {
......@@ -309,7 +335,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
}
return
}
} else {
} else if type == .passport {
if viewModel.mainModel.certificates.hk_macao_pass.img_front.count != 0 {
// let vc = YHImageViewController()
// vc.imgString = viewModel.mainModel.certificates.hk_macao_pass.img_front
......@@ -321,6 +347,17 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
UIViewController.current?.navigationController?.pushViewController(vc)
}
return
}
} else {
if viewModel.mainModel.certificates.passport.img_front.count != 0 {
if viewModel.mainModel.certificates.passport.img_front.isEmpty == false {
let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.passport.img_front
UIViewController.current?.navigationController?.pushViewController(vc)
}
return
}
}
......@@ -345,7 +382,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url, isBack: 0) {[weak self] success, error in
}
} else {
} else if self.type == .passport {
self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
}
}
......@@ -425,6 +462,8 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal)
case .passport:
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
case .other:
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
}
frontImageButton.setContent("card_upload", "点击上传")
}
......@@ -437,6 +476,8 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal)
case .passport:
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
case .other:
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
}
backSurfaceImageButton.setContent("card_upload", "点击上传")
}
......
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