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

// 证件

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