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

上传逻辑添加

parent b82edf49
...@@ -14,7 +14,7 @@ class YHAdopterNewPeopleViewController: YHBaseViewController { ...@@ -14,7 +14,7 @@ class YHAdopterNewPeopleViewController: YHBaseViewController {
var tableView: UITableView! var tableView: UITableView!
var viewModel: YHAdopterNewPeopleViewModel! var viewModel: YHAdopterNewPeopleViewModel!
var dataSource: [YHSectionItemModel] = [] var dataSource: [YHSectionItemModel] = []
var cardDataSource: [YHAdopterCardModel] = [] var cardDataSource: [YHAdopterDependentDataDocModel] = []
var isShowPrompt: Bool = false var isShowPrompt: Bool = false
var id: Int = 0 var id: Int = 0
...@@ -25,10 +25,15 @@ class YHAdopterNewPeopleViewController: YHBaseViewController { ...@@ -25,10 +25,15 @@ class YHAdopterNewPeopleViewController: YHBaseViewController {
gk_navBackgroundColor = .white gk_navBackgroundColor = .white
gk_navBarAlpha = 1 gk_navBarAlpha = 1
setView() setView()
getData() // getData()
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
getData()
}
func getData() { func getData() {
self.updateDataSource() self.updateDataSource()
viewModel.getDependentsData(id: id) {[weak self] success, error in viewModel.getDependentsData(id: id) {[weak self] success, error in
...@@ -42,7 +47,7 @@ class YHAdopterNewPeopleViewController: YHBaseViewController { ...@@ -42,7 +47,7 @@ class YHAdopterNewPeopleViewController: YHBaseViewController {
self.dataSource = self.viewModel.getBaseDataSource(isShowPrompt) self.dataSource = self.viewModel.getBaseDataSource(isShowPrompt)
self.bottomView.nextButton.setTitle("下一步", for: .normal) self.bottomView.nextButton.setTitle("下一步", for: .normal)
} else if self.stepView.currentIndex == 1 { } else if self.stepView.currentIndex == 1 {
self.cardDataSource = self.viewModel.getIdCardInformation() self.cardDataSource = self.viewModel.mainModel.docList
// self.bottomView.nextButton.setTitle("下一步", for: .normal) // self.bottomView.nextButton.setTitle("下一步", for: .normal)
} }
self.tableView.reloadData() self.tableView.reloadData()
...@@ -113,36 +118,17 @@ class YHAdopterNewPeopleViewController: YHBaseViewController { ...@@ -113,36 +118,17 @@ class YHAdopterNewPeopleViewController: YHBaseViewController {
make.left.equalTo(bottom.saveButton.snp.right).offset(10) make.left.equalTo(bottom.saveButton.snp.right).offset(10)
} }
self.stepView.currentIndex = self.stepView.currentIndex + 1 self.stepView.currentIndex = self.stepView.currentIndex + 1
self.updateDataSource()
if self.viewModel.mainModel.info.is_read_agreement == 0 {
let view = YHAdopterCardOtherGuideView.sheetView() let view = YHAdopterCardOtherGuideView.sheetView()
view.ischeckBeforeFlag = false view.ischeckBeforeFlag = false
view.block = { view.block = {
self.viewModel.postIsReadAgreement(id: self.id) { success, error in
}
} }
view.show() view.show()
} }
}
// self.viewModel.mainModel.step = self.stepView.currentIndex
// self.viewModel.updateMainInformation(.submit, self.orderId, self.stepView.currentIndex) {[weak self] success, error in
// guard let self = self else { return }
// if let error = error {
// YHHUD.flash(message: error.errorMsg )
// } else {
// YHHUD.hideFlashMessage()
// self.stepView.currentIndex = self.stepView.currentIndex + 1
// self.isShowPrompt = false
// self.stepView.currentIndex = self.stepView.currentIndex
// if self.stepView.currentIndex == 3 {
// self.bottomView.nextButton.setTitle("提交", for: .normal)
// } else {
// self.bottomView.nextButton.setTitle("下一步", for: .normal)
// }
// if self.stepView.currentIndex == self.stepView.dataSource?.count {
// YHHUD.flash(message: "提交成功")
// self.navigationController?.popViewController()
// } else {
// self.updateDataSource()
// }
// }
// }
} else { } else {
bottom.nextButton.isEnabled = true bottom.nextButton.isEnabled = true
self.isShowPrompt = true self.isShowPrompt = true
...@@ -203,7 +189,7 @@ extension YHAdopterNewPeopleViewController: UITableViewDelegate, UITableViewData ...@@ -203,7 +189,7 @@ extension YHAdopterNewPeopleViewController: UITableViewDelegate, UITableViewData
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if stepView.currentIndex == 1 { if stepView.currentIndex == 1 {
let model = cardDataSource[indexPath.row] let model = cardDataSource[indexPath.row]
if model.type == .china || model.type == .resident { if model.dep_id == 1 || model.dep_id == 2 {
return 90 return 90
} else { } else {
return 78 return 78
...@@ -254,34 +240,37 @@ extension YHAdopterNewPeopleViewController: UITableViewDelegate, UITableViewData ...@@ -254,34 +240,37 @@ extension YHAdopterNewPeopleViewController: UITableViewDelegate, UITableViewData
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if stepView.currentIndex == 1 { if stepView.currentIndex == 1 {
let model = cardDataSource[indexPath.row] let model = cardDataSource[indexPath.row]
switch model.type { switch model.dep_type {
case .travel: case 0://旅行证件(港澳通行证/护照)
let vc = YHAdopterTravelViewController() let vc = YHAdopterTravelViewController()
vc.model = model
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .china: case 1://身份证(正反面)
let vc = YHAdopterChinaViewController() let vc = YHAdopterChinaViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .resident: case 2://户口信息页
let vc = YHAdopterResidentViewController() let vc = YHAdopterResidentViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .birth: case 3://结婚证信息页
let vc = YHAdopterBirthViewController() let vc = YHAdopterMarryViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .id: case 4://证件照片
let vc = YHAdopterIdCardViewController() let vc = YHAdopterIdCardViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .other: case 5://出生医学证明
let vc = YHAdopterOtherViewController() let vc = YHAdopterBirthViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .marry: case 6://中国居留许可签证(有效期内)
let vc = YHAdopterMarryViewController() let vc = YHAdopterChinaLifeViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .chinaTravel: case 7://中国旅行证
let vc = YHAdoptedChinaTravelViewController() let vc = YHAdoptedChinaTravelViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .chinaLife: case 8://其他证件(请致电客服咨询后上传相关证件)
let vc = YHAdopterChinaLifeViewController() let vc = YHAdopterOtherViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
default:
break
} }
} }
} }
......
...@@ -15,7 +15,9 @@ class YHAdopterTravelViewController: YHBaseViewController { ...@@ -15,7 +15,9 @@ class YHAdopterTravelViewController: YHBaseViewController {
var clickIndex = -1 var clickIndex = -1
var data: [YHItemModel] = [] var data: [YHItemModel] = []
var viewModel = YHYHAdopterTravelViewModel() var viewModel = YHYHAdopterTravelViewModel()
var model: YHAdopterDependentDataDocModel = YHAdopterDependentDataDocModel()
var isShowPrompt = false
var urls : [String] = ["",""]
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
gk_navTitle = "上传旅行证件" gk_navTitle = "上传旅行证件"
...@@ -26,7 +28,11 @@ class YHAdopterTravelViewController: YHBaseViewController { ...@@ -26,7 +28,11 @@ class YHAdopterTravelViewController: YHBaseViewController {
} }
func getData() { func getData() {
data = viewModel.getBaseDataSource(false) data = viewModel.getBaseDataSource(isShowPrompt)
urls = model.url
if urls.count == 0 {
urls = ["", ""]
}
tableView.reloadData() tableView.reloadData()
} }
...@@ -73,11 +79,13 @@ class YHAdopterTravelViewController: YHBaseViewController { ...@@ -73,11 +79,13 @@ class YHAdopterTravelViewController: YHBaseViewController {
} }
@objc func nextStep() { @objc func nextStep() {
if self.viewModel.isCanNext(1) {
} else {
self.isShowPrompt = true
self.getData()
YHHUD.flash(message: "您还有信息未填写")
} }
@objc func submit() {
} }
} }
...@@ -98,10 +106,17 @@ extension YHAdopterTravelViewController: UITableViewDelegate, UITableViewDataSou ...@@ -98,10 +106,17 @@ extension YHAdopterTravelViewController: UITableViewDelegate, UITableViewDataSou
if indexPath.section == 0 { if indexPath.section == 0 {
if indexPath.row == 0 { if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeTitleTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeTitleTableViewCell.self)
cell.docDataSource = model
return cell return cell
} }
if indexPath.row == 1 { if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterTravelCardTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHAdopterTravelCardTableViewCell.self)
cell.urls = urls
cell.urlBlock = { [weak self] url, index in
guard let self = self else { return }
self.urls[index] = url
self.tableView.reloadData()
}
return cell return cell
} }
} }
...@@ -109,11 +124,11 @@ extension YHAdopterTravelViewController: UITableViewDelegate, UITableViewDataSou ...@@ -109,11 +124,11 @@ extension YHAdopterTravelViewController: UITableViewDelegate, UITableViewDataSou
cell.dataSource = data[indexPath.row] cell.dataSource = data[indexPath.row]
cell.informationBlock = {[weak self] model in cell.informationBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
// self.viewModel.updateModel(model) self.viewModel.updateModel(model)
// let id = model.id let id = model.id
// if id != .id32 && id != .id4 && id != .id8 && id != .id9 && id != .id12 && id != .id13 && id != .id17 && id != .id18 && id != .id21 && id != .id22 && id != .id23 && id != .id34 && id != .id29 && id != .id30 && id != .id35 { if id != .id2 && id != .id3 && id != .id4 {
// self.updateDataSource() self.getData()
// } }
} }
return cell return cell
} }
...@@ -121,7 +136,11 @@ extension YHAdopterTravelViewController: UITableViewDelegate, UITableViewDataSou ...@@ -121,7 +136,11 @@ extension YHAdopterTravelViewController: UITableViewDelegate, UITableViewDataSou
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 { if indexPath.section == 0 {
if indexPath.row == 0 { if indexPath.row == 0 {
if model.reject_reason.count != 0 {
return 119 return 119
} else {
return 86
}
} }
if indexPath.row == 1 { if indexPath.row == 1 {
return 173 return 173
......
...@@ -31,6 +31,7 @@ class YHAdopterDependentDataInfoModel: SmartCodable { ...@@ -31,6 +31,7 @@ class YHAdopterDependentDataInfoModel: SmartCodable {
var deleted_at : String = "" var deleted_at : String = ""
var is_spouse : Int = 0 var is_spouse : Int = 0
var sync_subset_id : Int = 0 var sync_subset_id : Int = 0
var is_read_agreement : Int = 0
required init() { required init() {
} }
...@@ -49,10 +50,38 @@ class YHAdopterDependentDataDocModel: SmartCodable { ...@@ -49,10 +50,38 @@ class YHAdopterDependentDataDocModel: SmartCodable {
var updated_at : String = "" var updated_at : String = ""
var deleted_at : String = "" var deleted_at : String = ""
var reject_reason : String = "" var reject_reason : String = ""
var require : String = "" var require : Int = 0
var certificates_info : String = "" var certificates_info : YHAdopterDependentDataDocCertificatesModel = YHAdopterDependentDataDocCertificatesModel()
var url : [String] = [] var url : [String] = []
required init() { required init() {
} }
} }
class YHAdopterDependentDataDocCertificatesModel: SmartCodable {
var gender : Int = 0 // 1男,2女
var marital_status : Int = 0 //婚姻状况
var travel_papers_type : Int = 0 // 旅行证件类型
var current_place : String = "" // 现居地址
var is_forever_identiry : Int = 0 //是否永久身份:1是,2否
var is_live_hk : Int = 0 // 是否正在港:1否,2是
var hk_identity : Int = 0 // 在港身份
var en_name : String = "" // 英文名称
var former_name : String = "" // 曾用名
var before_marriage_name : String = "" // 婚前姓氏
var birthday : String = "" // 出生日期
var birth_place : String = "" // 出生地点
var idcard : String = "" // 身份证号
var hk_idcard : String = "" //香港身份证号
var travel_papers_number : String = "" //旅行证件号码
var sign_address : String = "" // 签发地点
var sign_date : String = "" //签发时间
var sign_expire_date : String = "" //签发届满时间
var live_time : String = "" // 定居居留时间
var approve_date : String = "" //批准逗留日期
var will_to_hk_date : String = "" //打算赴港日期
var will_live_time : String = "" //打算在港逗留时间
required init() {
}
}
...@@ -16,7 +16,7 @@ class YHAdopterCardTableViewCell: UITableViewCell { ...@@ -16,7 +16,7 @@ class YHAdopterCardTableViewCell: UITableViewCell {
var titleLabel: UILabel! var titleLabel: UILabel!
var selectLabel: UILabel! var selectLabel: UILabel!
var moreButton: UIButton! var moreButton: UIButton!
var dataSource: YHAdopterCardModel? { var dataSource: YHAdopterDependentDataDocModel? {
didSet { didSet {
updateContent() updateContent()
} }
...@@ -130,8 +130,8 @@ class YHAdopterCardTableViewCell: UITableViewCell { ...@@ -130,8 +130,8 @@ class YHAdopterCardTableViewCell: UITableViewCell {
func updateContent() { func updateContent() {
guard let data = dataSource else { return } guard let data = dataSource else { return }
if data.type == .travel || data.type == .marry || data.type == .id { if data.require == 1 {
let str = "*" + data.title let str = "*" + data.dep_name
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 16), .font: UIFont.PFSC_R(ofSize: 16),
.foregroundColor: UIColor.mainTextColor .foregroundColor: UIColor.mainTextColor
...@@ -141,7 +141,7 @@ class YHAdopterCardTableViewCell: UITableViewCell { ...@@ -141,7 +141,7 @@ class YHAdopterCardTableViewCell: UITableViewCell {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange) questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
} else { } else {
let str = data.title let str = data.dep_name
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 16), .font: UIFont.PFSC_R(ofSize: 16),
.foregroundColor: UIColor.mainTextColor .foregroundColor: UIColor.mainTextColor
...@@ -150,7 +150,7 @@ class YHAdopterCardTableViewCell: UITableViewCell { ...@@ -150,7 +150,7 @@ class YHAdopterCardTableViewCell: UITableViewCell {
titleLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
} }
if data.type == .china { if data.dep_type == 1 {
let a: ASAttributedString = .init("如有", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50)) let a: ASAttributedString = .init("如有", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
let b: ASAttributedString = .init("中国身份证", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.brandMainColor)) let b: ASAttributedString = .init("中国身份证", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.brandMainColor))
let c: ASAttributedString = .init(",需要供用做证明", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50)) let c: ASAttributedString = .init(",需要供用做证明", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
...@@ -161,7 +161,7 @@ class YHAdopterCardTableViewCell: UITableViewCell { ...@@ -161,7 +161,7 @@ class YHAdopterCardTableViewCell: UITableViewCell {
make.height.equalTo(22) make.height.equalTo(22)
make.right.equalTo(-18) make.right.equalTo(-18)
} }
} else if data.type == .resident { } else if data.dep_type == 2 {
let a: ASAttributedString = .init("如曾更名,需要供用做证明", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50)) let a: ASAttributedString = .init("如曾更名,需要供用做证明", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor50))
selectLabel.attributed.text = a selectLabel.attributed.text = a
titleLabel.snp.remakeConstraints { make in titleLabel.snp.remakeConstraints { make in
...@@ -181,5 +181,25 @@ class YHAdopterCardTableViewCell: UITableViewCell { ...@@ -181,5 +181,25 @@ class YHAdopterCardTableViewCell: UITableViewCell {
} }
} }
if data.status == 0 {
moreButton.setTitle("待上传", for: .normal)
moreButton.setTitleColor(UIColor.brandMainColor, for: .normal)
moreButton.setImage(UIImage(named: "service_adopter_income_start"), for: .normal)
}
if data.status == 1 {
moreButton.setTitle("审核中", for: .normal)
moreButton.setTitleColor(UIColor(hex: 0xff8000), for: .normal)
moreButton.setImage(UIImage(named: "service_adopter_income_wait"), for: .normal)
}
if data.status == 2 {
moreButton.setTitle("已驳回", for: .normal)
moreButton.setTitleColor(UIColor.failColor, for: .normal)
moreButton.setImage(UIImage(named: "service_adopter_income_fail"), for: .normal)
}
if data.status == 3 {
moreButton.setTitle("已完成", for: .normal)
moreButton.setTitleColor(UIColor(hex: 0x3cc694), for: .normal)
moreButton.setImage(UIImage(named: "service_adopter_income_success"), for: .normal)
}
} }
} }
...@@ -20,6 +20,12 @@ class YHAdopterIncomeTitleTableViewCell: UITableViewCell { ...@@ -20,6 +20,12 @@ class YHAdopterIncomeTitleTableViewCell: UITableViewCell {
} }
} }
var docDataSource: YHAdopterDependentDataDocModel? {
didSet {
updateDocContent()
}
}
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
// Initialization code // Initialization code
...@@ -159,4 +165,37 @@ class YHAdopterIncomeTitleTableViewCell: UITableViewCell { ...@@ -159,4 +165,37 @@ class YHAdopterIncomeTitleTableViewCell: UITableViewCell {
} }
failLabel.text = data.remark failLabel.text = data.remark
} }
func updateDocContent() {
guard let data = docDataSource else { return }
if data.status == 0 {
subTitleLabel.textColor = UIColor.brandMainColor
subTitleLabel.backgroundColor = UIColor(hex: 0xf0f4fb)
failImageView.isHidden = true
failLabel.isHidden = true
subTitleLabel.text = "待上传"
}
if data.status == 1 {
subTitleLabel.textColor = UIColor(hex: 0xff8000)
subTitleLabel.backgroundColor = UIColor(hex: 0xfff5eb)
failImageView.isHidden = true
failLabel.isHidden = true
subTitleLabel.text = "审核中"
}
if data.status == 2 {
subTitleLabel.textColor = UIColor(hex: 0x3cc694)
subTitleLabel.backgroundColor = UIColor(hex: 0xf0fbf7)
failImageView.isHidden = true
failLabel.isHidden = true
subTitleLabel.text = "已完成"
}
if data.status == 3 {
subTitleLabel.textColor = UIColor(hex: 0xf81d22)
subTitleLabel.backgroundColor = UIColor(hex: 0xfff2f2)
failImageView.isHidden = false
failLabel.isHidden = false
subTitleLabel.text = "已驳回"
}
failLabel.text = data.reject_reason
}
} }
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
import UIKit import UIKit
class YHAdopterTravelCardTableViewCell: UITableViewCell { class YHAdopterTravelCardTableViewCell: UITableViewCell {
typealias InformationBlock = (_ type: YHCardType, _ image: UIImage, _ isleft: Bool) -> () typealias UrlBlock = (_ url: String, _ index: Int) -> ()
var informationBlock: InformationBlock? var urlBlock: UrlBlock?
var frontLabel: UILabel! var frontLabel: UILabel!
var backSurfaceLabel: UILabel! var backSurfaceLabel: UILabel!
var frontImageButton: YHCardButton! var frontImageButton: YHCardButton!
...@@ -18,10 +18,13 @@ class YHAdopterTravelCardTableViewCell: UITableViewCell { ...@@ -18,10 +18,13 @@ class YHAdopterTravelCardTableViewCell: UITableViewCell {
var frontDeleteButton: UIButton! var frontDeleteButton: UIButton!
var backSurfaceDeleteButton: UIButton! var backSurfaceDeleteButton: UIButton!
var activityIndicator: UIActivityIndicatorView! var activityIndicator: UIActivityIndicatorView!
var viewModel: YHMainApplicantInformationViewModel! { var viewModel: YHBaseViewModel = YHBaseViewModel()
var firstUrl: String = ""
var lastUrl: String = ""
var urls: [String]? {
didSet { didSet {
if viewModel.mainModel.certificates.cn_identity_card.img_front.count != 0 { guard let firstUrl = urls?.first else { return }
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.cn_identity_card.img_front) {[weak self] success, error in self.viewModel.getPublicImageUrl(firstUrl) {[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 }
self.frontImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in self.frontImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in
...@@ -29,9 +32,8 @@ class YHAdopterTravelCardTableViewCell: UITableViewCell { ...@@ -29,9 +32,8 @@ class YHAdopterTravelCardTableViewCell: UITableViewCell {
}) })
self.frontImageButton.setContent("", "") self.frontImageButton.setContent("", "")
} }
} guard let lastUrl = urls?.last else { return }
if viewModel.mainModel.certificates.cn_identity_card.img_back.count != 0 { self.viewModel.getPublicImageUrl(lastUrl) {[weak self] success, error in
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.cn_identity_card.img_back) {[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 }
self.backSurfaceImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in self.backSurfaceImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in
...@@ -39,7 +41,7 @@ class YHAdopterTravelCardTableViewCell: UITableViewCell { ...@@ -39,7 +41,7 @@ class YHAdopterTravelCardTableViewCell: UITableViewCell {
}) })
self.backSurfaceImageButton.setContent("", "") self.backSurfaceImageButton.setContent("", "")
} }
}
} }
} }
...@@ -192,70 +194,64 @@ class YHAdopterTravelCardTableViewCell: UITableViewCell { ...@@ -192,70 +194,64 @@ class YHAdopterTravelCardTableViewCell: UITableViewCell {
} }
@objc func frontImageClick() { @objc func frontImageClick() {
// if viewModel.mainModel.certificates.cn_identity_card.img_front.count != 0 { if firstUrl.count != 0 {
// if viewModel.mainModel.certificates.cn_identity_card.img_front.isEmpty == false { let vc = YHImageViewController()
// let vc = YHImageViewController() vc.imgString = firstUrl
// vc.imgString = viewModel.mainModel.certificates.cn_identity_card.img_front UIViewController.current?.navigationController?.pushViewController(vc)
// UIViewController.current?.navigationController?.pushViewController(vc) return
// } }
// return YHImagePickerView.show() {[weak self] image in
// } guard let self = self else { return }
// YHImagePickerView.show() {[weak self] image in self.frontImageButton.setContent("card_loading", "上传中")
// guard let self = self else { return } self.frontImageButton.startRotationAnimation()
// self.frontImageButton.setContent("card_loading", "上传中") self.viewModel.uploadImage(image) {[weak self] success, error in
// self.frontImageButton.startRotationAnimation() guard let self = self else { return }
// self.viewModel.uploadImage(image) {[weak self] success, error in self.frontImageButton.stopRotationAnimation()
// guard let self = self else { return } self.frontImageButton.setContent("", "")
// self.frontImageButton.stopRotationAnimation()
// self.frontImageButton.setContent("", "") guard let url = success else { return }
// self.frontImageButton.setBackgroundImage(image, for: .normal)
// guard let url = success else { return } self.frontDeleteButton.isHidden = false
//// self.viewModel.updateModel(self.type, isFront: true, url: url)
// self.frontImageButton.setBackgroundImage(image, for: .normal) self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
// self.frontDeleteButton.isHidden = false guard let self = self else { return }
// guard let url = success else { return }
// self.viewModel.getPublicImageUrl(url) {[weak self] success, error in if let block = self.urlBlock {
// guard let self = self else { return } block(url, 0)
// guard let url = success else { return } }
// }
// }
// self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in }
// }
// }
// }
// }
} }
@objc func backSurfaceImageClick() { @objc func backSurfaceImageClick() {
// if viewModel.mainModel.certificates.hk_macao_pass.img_back.count != 0 { if lastUrl.count != 0 {
// if viewModel.mainModel.certificates.hk_macao_pass.img_back.isEmpty == false { let vc = YHImageViewController()
// let vc = YHImageViewController() vc.imgString = lastUrl
// vc.imgString = viewModel.mainModel.certificates.hk_macao_pass.img_back UIViewController.current?.navigationController?.pushViewController(vc)
// UIViewController.current?.navigationController?.pushViewController(vc) return
// } }
// return YHImagePickerView.show() {[weak self] image in
// } guard let self = self else { return }
// YHImagePickerView.show() {[weak self] image in self.backSurfaceImageButton.setContent("card_loading", "上传中")
// guard let self = self else { return } self.backSurfaceImageButton.startRotationAnimation()
// self.backSurfaceImageButton.setContent("card_loading", "上传中") self.viewModel.uploadImage(image) {[weak self] success, error in
// self.backSurfaceImageButton.startRotationAnimation() guard let self = self else { return }
// self.viewModel.uploadImage(image) {[weak self] success, error in self.backSurfaceImageButton.stopRotationAnimation()
// guard let self = self else { return } self.backSurfaceImageButton.setContent("", "")
// self.backSurfaceImageButton.stopRotationAnimation()
// self.backSurfaceImageButton.setContent("", "") guard let url = success else { return }
// self.backSurfaceImageButton.setBackgroundImage(image, for: .normal)
// guard let url = success else { return } self.backSurfaceDeleteButton.isHidden = false
// self.backSurfaceImageButton.setBackgroundImage(image, for: .normal) self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
//// self.viewModel.updateModel(self.type, isFront: false, url: url) guard let self = self else { return }
// self.backSurfaceDeleteButton.isHidden = false guard let url = success else { return }
// self.viewModel.getPublicImageUrl(url) {[weak self] success, error in if let block = self.urlBlock {
// guard let self = self else { return } block(url, 1)
// guard let url = success else { return } }
// self.viewModel.requestHkIDCardMessage(url, isBack: 1 ) {[weak self] success, error in }
// } }
// } }
// }
// }
} }
@objc func frontDeleteClick() { @objc func frontDeleteClick() {
......
...@@ -130,4 +130,27 @@ class YHAdopterNewPeopleViewModel: YHBaseViewModel { ...@@ -130,4 +130,27 @@ class YHAdopterNewPeopleViewModel: YHBaseViewModel {
callBackBlock(false,err) callBackBlock(false,err)
} }
} }
func postIsReadAgreement(id: Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let params: [String: Any] = ["id": id,
"is_read_agreement": 1,
"order_id": mainModel.info.order_id]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Adopter.isReadAgreement
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
callBackBlock(true,nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
} }
...@@ -485,6 +485,8 @@ class YHAllApiName { ...@@ -485,6 +485,8 @@ class YHAllApiName {
static let dependents = "super-app/order/information/dependents/get" static let dependents = "super-app/order/information/dependents/get"
static let dependentsAdd = "super-app/order/information/dependents/add" static let dependentsAdd = "super-app/order/information/dependents/add"
static let isReadAgreement = "super-app/order/is-read-agreement"
} }
} }
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