Commit ad60d466 authored by Steven杜宇's avatar Steven杜宇

// 证件

parent 10cbac0d
...@@ -100,7 +100,7 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol { ...@@ -100,7 +100,7 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
if familyMember.nationality.contains("中国") { // 中国国籍 if familyMember.nationality.contains("中国") { // 中国国籍
let isLiveInChina = familyMember.address.country.contains("中国".local) let isLiveInChina = familyMember.address.country.contains("中国".local)
if isLiveInChina { // 居住国内 if isLiveInChina { // 居住国内
if !familyMember.certificates.hkMacaoPass.number.isEmpty { // 没办理过港澳通行证 if familyMember.isHandled == 0 { // 没办理过港澳通行证
// 证件信息:港澳通行证非必填(无身份证、护照) // 证件信息:港澳通行证非必填(无身份证、护照)
showHK = true showHK = true
isHKMust = false isHKMust = false
...@@ -113,7 +113,7 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol { ...@@ -113,7 +113,7 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
} else { // 居住国外 } else { // 居住国外
if !familyMember.isOverSeasOver1Year() { // 居住国外不满一年 if !familyMember.isOverSeasOver1Year() { // 居住国外不满一年
if !familyMember.certificates.hkMacaoPass.number.isEmpty { // 没办理过港澳通行证 if familyMember.isHandled == 0 { // 没办理过港澳通行证
// 证件信息:港澳通行证非必填(无身份证、护照) // 证件信息:港澳通行证非必填(无身份证、护照)
showHK = true showHK = true
isHKMust = false isHKMust = false
......
...@@ -78,20 +78,29 @@ extension YHCertificateUploadVC: UITableViewDelegate, UITableViewDataSource { ...@@ -78,20 +78,29 @@ extension YHCertificateUploadVC: UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHIdentityCardCell.self) let cell = tableView.dequeueReusableCell(withClass: YHIdentityCardCell.self)
cell.type = YHCardType(rawValue: indexPath.row) ?? .identity let dataSource = viewModel.getIDCardDataSource(false)
cell.viewModel = viewModel
cell.backSurfaceDeleteButton.isHidden = true if indexPath.row < dataSource.count {
cell.frontDeleteButton.isHidden = true if dataSource[indexPath.row].models?.first?.id == .id5 {
cell.informationBlock = {[weak self] type, image, isLeft in cell.type = .identity
guard let self = self else { return } }
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
} }
return cell return cell
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension return 217
} }
} }
...@@ -637,7 +637,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -637,7 +637,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var birthPlaceAboard: Int = 0 var birthPlaceAboard: Int = 0
// 是否与主申请人同住 1:是 0:否 // 是否与主申请人同住 1:是 0:否
var nows: Int = 0 var nows: Int = 0
// 是否要办理港澳通行证 1:是 0:否 // 是否办理过港澳通行证 1:是 0:否
var isHandled: Int = 0 var isHandled: Int = 0
// notFillNumber = -1 表示还没开始填写任意数据项 // notFillNumber = -1 表示还没开始填写任意数据项
var notFillNumber: Int = -1 var notFillNumber: Int = -1
......
...@@ -20,10 +20,21 @@ class YHFamilyMemberViewModel : YHBaseViewModel{ ...@@ -20,10 +20,21 @@ class YHFamilyMemberViewModel : YHBaseViewModel{
let section = YHSectionItemModel(title: "中国身份证(选填)", models: [item]) let section = YHSectionItemModel(title: "中国身份证(选填)", models: [item])
let item1 = YHItemModel(id: .id6, isNeed: true, title: "港澳通行证(选填)", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt) let item1 = YHItemModel(id: .id6, isNeed: true, title: "港澳通行证(选填)", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt)
let section1 = YHSectionItemModel(title: "中国身份证(选填)", models: [item1]) let section1 = YHSectionItemModel(title: "中国身份证(选填)", models: [item1])
if mainModel.isNeedHandleHKPassPort() { let item2 = YHItemModel(id: .id7, isNeed: true, title: "护照(选填)", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt)
return [section, section1] let section2 = YHSectionItemModel(title: "护照(选填)", models: [item2])
let addressCountry = mainModel.address.country
let nationality = mainModel.nationality
let is_live_oversea_year = mainModel.isOverSeasOver1Year()
if (nationality.contains("中国") && addressCountry.contains("中国")) || (nationality.contains("中国") && !is_live_oversea_year) {
if mainModel.isHandled == 1 {
return [section, section1]
} else {
return [section]
}
} else if nationality.contains("中国") && is_live_oversea_year {
return [section, section2]
} else { } else {
return [section] return [section2]
} }
} }
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
// YHMainInformationCardTableViewCell // YHMainInformationCardTableViewCell
import UIKit import UIKit
import Alamofire
import Kingfisher
class YHIdentityCardCell: UITableViewCell { class YHIdentityCardCell: UITableViewCell {
typealias InformationBlock = (_ type: YHCardType, _ image: UIImage, _ isleft: Bool) -> () typealias InformationBlock = (_ type: YHCardType, _ image: UIImage, _ isleft: Bool) -> ()
...@@ -44,7 +46,7 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -44,7 +46,7 @@ class YHIdentityCardCell: UITableViewCell {
self.backSurfaceImageButton.setContent("", "") self.backSurfaceImageButton.setContent("", "")
} }
} }
} else { } else if type == .passport {
if viewModel.mainModel.certificates.hkMacaoPass.imgFront.count != 0 { if viewModel.mainModel.certificates.hkMacaoPass.imgFront.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.hkMacaoPass.imgFront) {[weak self] success, error in self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.hkMacaoPass.imgFront) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
...@@ -65,6 +67,17 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -65,6 +67,17 @@ class YHIdentityCardCell: UITableViewCell {
self.backSurfaceImageButton.setContent("", "") self.backSurfaceImageButton.setContent("", "")
} }
} }
} else {
if viewModel.mainModel.certificates.passport.imgFront.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.passport.imgFront) {[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("", "")
}
}
} }
} }
} }
...@@ -77,14 +90,22 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -77,14 +90,22 @@ class YHIdentityCardCell: UITableViewCell {
backSurfaceLabel.text = "身份证国徽面" backSurfaceLabel.text = "身份证国徽面"
frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal)
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal)
backSurfaceLabel.isHidden = false
backSurfaceImageButton.isHidden = false
case .passport: case .passport:
titleLabel.text = "港澳通行证(选填)" titleLabel.text = "港澳通行证(选填)"
frontLabel.text = "港澳通行证正面" frontLabel.text = "港澳通行证正面"
backSurfaceLabel.text = "港澳通行证反面" backSurfaceLabel.text = "港澳通行证反面"
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
backSurfaceLabel.isHidden = false
backSurfaceImageButton.isHidden = false
case .other: case .other:
break titleLabel.text = "护照(选填)"
frontLabel.text = "护照资料页"
backSurfaceLabel.isHidden = true
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
backSurfaceImageButton.isHidden = true
} }
} }
} }
...@@ -123,10 +144,10 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -123,10 +144,10 @@ class YHIdentityCardCell: UITableViewCell {
contentView.addSubview(centerView) contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in centerView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16) make.left.equalTo(16)
make.right.equalToSuperview().offset(-16) make.right.equalTo(-16)
make.top.equalToSuperview().offset(14) make.top.equalTo(7)
make.bottom.equalToSuperview() make.bottom.equalTo(-16)
} }
titleLabel = { titleLabel = {
...@@ -169,7 +190,7 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -169,7 +190,7 @@ class YHIdentityCardCell: UITableViewCell {
centerView.addSubview(lineView) centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in lineView.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.top.equalTo(titleLabel.snp.bottom).offset(12) make.top.equalTo(52)
make.height.equalTo(1) make.height.equalTo(1)
make.right.equalTo(-18) make.right.equalTo(-18)
} }
...@@ -185,7 +206,7 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -185,7 +206,7 @@ class YHIdentityCardCell: UITableViewCell {
frontLabel.snp.makeConstraints { make in frontLabel.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.right.equalTo(centerView.snp.centerX) make.right.equalTo(centerView.snp.centerX)
make.top.equalTo(lineView.snp.bottom).offset(12) make.top.equalTo(64)
make.height.equalTo(20) make.height.equalTo(20)
} }
...@@ -200,7 +221,7 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -200,7 +221,7 @@ class YHIdentityCardCell: UITableViewCell {
backSurfaceLabel.snp.makeConstraints { make in backSurfaceLabel.snp.makeConstraints { make in
make.right.equalTo(-18) make.right.equalTo(-18)
make.left.equalTo(centerView.snp.centerX) make.left.equalTo(centerView.snp.centerX)
make.top.equalTo(lineView.snp.bottom).offset(12) make.top.equalTo(64)
make.height.equalTo(20) make.height.equalTo(20)
} }
...@@ -216,10 +237,9 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -216,10 +237,9 @@ class YHIdentityCardCell: UITableViewCell {
centerView.addSubview(frontImageButton) centerView.addSubview(frontImageButton)
frontImageButton.snp.makeConstraints { make in frontImageButton.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.top.equalTo(frontLabel.snp.bottom).offset(12) make.top.equalTo(96)
make.height.equalTo(91) make.height.equalTo(91)
make.width.equalTo(147) make.width.equalTo(147)
make.bottom.equalToSuperview().offset(-16)
} }
frontDeleteButton = { frontDeleteButton = {
...@@ -249,7 +269,7 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -249,7 +269,7 @@ class YHIdentityCardCell: UITableViewCell {
centerView.addSubview(backSurfaceImageButton) centerView.addSubview(backSurfaceImageButton)
backSurfaceImageButton.snp.makeConstraints { make in backSurfaceImageButton.snp.makeConstraints { make in
make.right.equalTo(-18) make.right.equalTo(-18)
make.top.equalTo(frontLabel.snp.bottom).offset(12) make.top.equalTo(96)
make.height.equalTo(91) make.height.equalTo(91)
make.width.equalTo(147) make.width.equalTo(147)
} }
...@@ -280,13 +300,19 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -280,13 +300,19 @@ class YHIdentityCardCell: UITableViewCell {
make.height.equalTo(25) make.height.equalTo(25)
make.width.equalTo(25) make.width.equalTo(25)
} }
exampleButton.YH_clickEdgeInsets = UIEdgeInsets(top: 50, left: 50, bottom: 50, right: 50)
} }
@objc func exampleClick() { @objc func exampleClick() {
let view = YHCardExampleView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight)) if type == .other {
view.type = type YHAdopterCardExampleView.exampleView(type: .chinaTravel).show()
let window = UIApplication.shared.yhKeyWindow() } else {
window?.addSubview(view) 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() { @objc func frontImageClick() {
...@@ -296,7 +322,6 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -296,7 +322,6 @@ class YHIdentityCardCell: UITableViewCell {
// vc.imgString = viewModel.mainModel.certificates.cnIdentityCard.imgFront // vc.imgString = viewModel.mainModel.certificates.cnIdentityCard.imgFront
// UIViewController.current?.navigationController?.pushViewController(vc) // UIViewController.current?.navigationController?.pushViewController(vc)
if viewModel.mainModel.certificates.cnIdentityCard.imgFront.isEmpty == false { if viewModel.mainModel.certificates.cnIdentityCard.imgFront.isEmpty == false {
let vc = YHImageViewController() let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.cnIdentityCard.imgFront vc.imgString = viewModel.mainModel.certificates.cnIdentityCard.imgFront
...@@ -304,19 +329,29 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -304,19 +329,29 @@ class YHIdentityCardCell: UITableViewCell {
} }
return return
} }
} else { } else if type == .passport {
if viewModel.mainModel.certificates.hkMacaoPass.imgFront.count != 0 { if viewModel.mainModel.certificates.hkMacaoPass.imgFront.count != 0 {
// let vc = YHImageViewController() // let vc = YHImageViewController()
// vc.imgString = viewModel.mainModel.certificates.hkMacaoPass.imgFront // vc.imgString = viewModel.mainModel.certificates.hkMacaoPass.imgFront
// UIViewController.current?.navigationController?.pushViewController(vc) // UIViewController.current?.navigationController?.pushViewController(vc)
if viewModel.mainModel.certificates.hkMacaoPass.imgFront.isEmpty == false { if viewModel.mainModel.certificates.hkMacaoPass.imgFront.isEmpty == false {
let vc = YHImageViewController() let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.hkMacaoPass.imgFront vc.imgString = viewModel.mainModel.certificates.hkMacaoPass.imgFront
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
} }
return
}
} else {
if viewModel.mainModel.certificates.passport.imgFront.count != 0 {
if viewModel.mainModel.certificates.passport.imgFront.isEmpty == false {
let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.passport.imgFront
UIViewController.current?.navigationController?.pushViewController(vc)
}
return return
} }
} }
...@@ -333,17 +368,16 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -333,17 +368,16 @@ class YHIdentityCardCell: UITableViewCell {
self.viewModel.updateModel(self.type, isFront: true, url: url) self.viewModel.updateModel(self.type, isFront: true, url: url)
self.frontImageButton.setBackgroundImage(image, for: .normal) self.frontImageButton.setBackgroundImage(image, for: .normal)
self.frontDeleteButton.isHidden = false self.frontDeleteButton.isHidden = false
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 }
if self.type == .identity { if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url, isBack: 0) {[weak self] success, error in self.viewModel.requestCnIDCardMessage(url, isBack: 0) {[weak self] success, error in
guard self != nil else { return }
} }
} else { } else if self.type == .passport {
self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
guard self != nil else { return }
} }
} }
} }
...@@ -398,11 +432,9 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -398,11 +432,9 @@ class YHIdentityCardCell: UITableViewCell {
guard let url = success else { return } guard let url = success else { return }
if self.type == .identity { if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url, isBack: 1) {[weak self] success, error in self.viewModel.requestCnIDCardMessage(url, isBack: 1) {[weak self] success, error in
guard self != nil else { return }
} }
} else { } else {
self.viewModel.requestHkIDCardMessage(url, isBack: 1 ) {[weak self] success, error in self.viewModel.requestHkIDCardMessage(url, isBack: 1 ) {[weak self] success, error in
guard self != nil else { return }
} }
} }
} }
...@@ -425,7 +457,7 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -425,7 +457,7 @@ class YHIdentityCardCell: UITableViewCell {
case .passport: case .passport:
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
case .other: case .other:
break frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
} }
frontImageButton.setContent("card_upload", "点击上传") frontImageButton.setContent("card_upload", "点击上传")
} }
...@@ -439,7 +471,7 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -439,7 +471,7 @@ class YHIdentityCardCell: UITableViewCell {
case .passport: case .passport:
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
case .other: case .other:
break backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
} }
backSurfaceImageButton.setContent("card_upload", "点击上传") 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