Commit f5cf58cb authored by David黄金龙's avatar David黄金龙

Merge branch 'youhua-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into youhua-dev

* 'youhua-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  强制升级 token 失效的errorBlock 引出
  时间选择器修改
  // 配偶标识
  //  去掉OCR loading
parents db1668dd 52564d3e
...@@ -301,7 +301,7 @@ class YHFormTitleItem : YHFormItemProtocol { ...@@ -301,7 +301,7 @@ class YHFormTitleItem : YHFormItemProtocol {
func getSubTitle() -> String { func getSubTitle() -> String {
switch self.type { switch self.type {
case .sponse: case .sponse:
return String(format: " (%@)", "如未婚、离婚、丧偶可不填".local) return "".local
case .parent: case .parent:
return String(format: " (%@)", "包含已故".local) return String(format: " (%@)", "包含已故".local)
case .brother: case .brother:
......
...@@ -305,6 +305,9 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -305,6 +305,9 @@ class YHIdentityCardCell: UITableViewCell {
self.frontImageButton.startRotationAnimation() self.frontImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
guard let url = success else { return } guard let url = success else { return }
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)
...@@ -312,24 +315,18 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -312,24 +315,18 @@ class YHIdentityCardCell: UITableViewCell {
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 let self = self else { return } guard let self = self else { return }
self.frontImageButton.stopRotationAnimation() if !success {
self.frontImageButton.setContent("", "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "") YHHUD.flash(message: error?.errorMsg ?? "")
} }
} }
} else { } else {
self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.frontImageButton.stopRotationAnimation() if !success {
self.frontImageButton.setContent("", "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "") YHHUD.flash(message: error?.errorMsg ?? "")
} }
} }
...@@ -361,6 +358,9 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -361,6 +358,9 @@ class YHIdentityCardCell: UITableViewCell {
self.backSurfaceImageButton.startRotationAnimation() self.backSurfaceImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
guard let url = success else { return } guard let url = success else { return }
self.backSurfaceImageButton.setBackgroundImage(image, for: .normal) self.backSurfaceImageButton.setBackgroundImage(image, for: .normal)
self.viewModel.updateModel(self.type, isFront: false, url: url) self.viewModel.updateModel(self.type, isFront: false, url: url)
...@@ -371,22 +371,14 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -371,22 +371,14 @@ class YHIdentityCardCell: UITableViewCell {
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 let self = self else { return } guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation() if !success {
self.backSurfaceImageButton.setContent("", "") YHHUD.flash(message: error?.errorMsg ?? "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
} }
} }
} 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 let self = self else { return } guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation() if !success {
self.backSurfaceImageButton.setContent("", "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "") YHHUD.flash(message: error?.errorMsg ?? "")
} }
} }
......
...@@ -34,32 +34,17 @@ class YHDatePickView: UIView { ...@@ -34,32 +34,17 @@ class YHDatePickView: UIView {
var pickerView: UIPickerView! var pickerView: UIPickerView!
var lastIsTaday: Bool = false { var lastIsTaday: Bool = false {
didSet { didSet {
if lastIsTaday { guard let type = type else { return }
guard let type = type else { return } switch type {
switch type { case .yyyymmdd:
case .yyyymmdd: pickerView.selectRow(99, inComponent: 0, animated: true)
pickerView.selectRow(0, inComponent: 0, animated: true) pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true) pickerView.selectRow(self.currentDateCom.day! - 1, inComponent: 2, animated: true)
pickerView.selectRow(self.currentDateCom.day! - 1, inComponent: 2, animated: true) case .yyyymm:
case .yyyymm: pickerView.selectRow(99, inComponent: 0, animated: true)
pickerView.selectRow(0, inComponent: 0, animated: true) pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true) case .yyyy:
case .yyyy: pickerView.selectRow(99, inComponent: 0, animated: true)
pickerView.selectRow(0, inComponent: 0, animated: true)
}
} else {
guard let type = type else { return }
switch type {
case .yyyymmdd:
pickerView.selectRow(100, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(self.currentDateCom.day! - 1, inComponent: 2, animated: true)
case .yyyymm:
pickerView.selectRow(100, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
case .yyyy:
pickerView.selectRow(100, inComponent: 0, animated: true)
}
} }
} }
} }
...@@ -226,23 +211,11 @@ class YHDatePickView: UIView { ...@@ -226,23 +211,11 @@ class YHDatePickView: UIView {
var date = "" var date = ""
switch type { switch type {
case .yyyymmdd: case .yyyymmdd:
if lastIsTaday { date = String(format: "%02ld%@%02ld%@%02ld", (self.currentDateCom.year!) + self.pickerView.selectedRow(inComponent: 0) - 99, Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1,Self.separator, self.pickerView.selectedRow(inComponent: 2) + 1)
date = String(format: "%02ld%@%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0),Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1,Self.separator, self.pickerView.selectedRow(inComponent: 2) + 1)
} else {
date = String(format: "%02ld%@%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100,Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1,Self.separator, self.pickerView.selectedRow(inComponent: 2) + 1)
}
case .yyyymm: case .yyyymm:
if lastIsTaday { date = String(format: "%02ld%@%02ld", (self.currentDateCom.year!) + self.pickerView.selectedRow(inComponent: 0) - 99, Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1)
date = String(format: "%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) ,Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1)
} else {
date = String(format: "%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100 ,Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1)
}
case .yyyy: case .yyyy:
if lastIsTaday { date = String(format: "%02ld", (self.currentDateCom.year!) + self.pickerView.selectedRow(inComponent: 0) - 99)
date = String(format: "%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0))
} else {
date = String(format: "%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100)
}
} }
if self.backDate != nil { if self.backDate != nil {
self.backDate!(date) self.backDate!(date)
...@@ -279,7 +252,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource { ...@@ -279,7 +252,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
} }
return 200 return 200
} else if component == 1 { } else if component == 1 {
if self.pickerView.selectedRow(inComponent: 0) == 0 { if self.pickerView.selectedRow(inComponent: 0) == 99 {
if lastIsTaday { if lastIsTaday {
return self.currentDateCom.month! return self.currentDateCom.month!
} }
...@@ -290,7 +263,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource { ...@@ -290,7 +263,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
if type == .yyyy { if type == .yyyy {
return 0 return 0
} }
if self.pickerView.selectedRow(inComponent: 0) == 0 && self.pickerView.selectedRow(inComponent: 1) == self.currentDateCom.month! - 1 { if self.pickerView.selectedRow(inComponent: 0) == 99 && self.pickerView.selectedRow(inComponent: 1) == self.currentDateCom.month! - 1 {
if lastIsTaday { if lastIsTaday {
return self.currentDateCom.day! return self.currentDateCom.day!
} }
...@@ -338,10 +311,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource { ...@@ -338,10 +311,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if component == 0 { if component == 0 {
if lastIsTaday { return "\((currentDateCom.year!) + row - 99)"
return "\((currentDateCom.year!) - row)"
}
return "\((currentDateCom.year!) - row + 100)"
} else if component == 1 { } else if component == 1 {
return "\(row + 1)" return "\(row + 1)"
} else { } else {
...@@ -351,11 +321,18 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource { ...@@ -351,11 +321,18 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if component == 1, self.type == .yyyymmdd { if component == 1, self.type == .yyyymmdd {
pickerView.reloadComponent(2) pickerView.reloadComponent(1)
} }
if component == 0, lastIsTaday { if component == 0, lastIsTaday {
pickerView.reloadComponent(1) pickerView.reloadComponent(1)
if self.type == .yyyymmdd {
pickerView.reloadComponent(2)
}
}
if component == 1, lastIsTaday, self.type == .yyyymmdd {
pickerView.reloadComponent(2)
} }
} }
} }
...@@ -313,31 +313,27 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -313,31 +313,27 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
self.frontImageButton.startRotationAnimation() self.frontImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
guard let url = success else { return } guard let url = success else { return }
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 let self = self else { return } if !success {
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "") YHHUD.flash(message: error?.errorMsg ?? "")
} }
} }
} else { } else {
self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
guard let self = self else { return } if !success {
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "") YHHUD.flash(message: error?.errorMsg ?? "")
} }
} }
...@@ -369,6 +365,9 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -369,6 +365,9 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
self.backSurfaceImageButton.startRotationAnimation() self.backSurfaceImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
guard let url = success else { return } guard let url = success else { return }
self.backSurfaceImageButton.setBackgroundImage(image, for: .normal) self.backSurfaceImageButton.setBackgroundImage(image, for: .normal)
self.viewModel.updateModel(self.type, isFront: false, url: url) self.viewModel.updateModel(self.type, isFront: false, url: url)
...@@ -378,23 +377,13 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -378,23 +377,13 @@ class YHMainInformationCardTableViewCell: 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 let self = self else { return } if !success {
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "") YHHUD.flash(message: error?.errorMsg ?? "")
} }
} }
} 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 let self = self else { return } if !success {
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "") YHHUD.flash(message: error?.errorMsg ?? "")
} }
} }
......
...@@ -320,6 +320,9 @@ class YHNetRequest: NSObject { ...@@ -320,6 +320,9 @@ class YHNetRequest: NSObject {
// 发送强制更新通知 // 发送强制更新通知
NotificationCenter.default.post(name: YhConstant.YhNotification.didForceUpgradeNotifiction, object: nil) NotificationCenter.default.post(name: YhConstant.YhNotification.didForceUpgradeNotifiction, object: nil)
YHHUD.hide() YHHUD.hide()
guard let errorBlock = self.failure else { return }
let errorModel = YHErrorModel(errorCode: Int32(statusCode), errorMsg: errorResponseMsg)
errorBlock(errorModel)
} }
return return
} }
...@@ -333,6 +336,9 @@ class YHNetRequest: NSObject { ...@@ -333,6 +336,9 @@ class YHNetRequest: NSObject {
UIViewController.current?.navigationController?.popToRootViewController(animated: false) UIViewController.current?.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .home) goTabBarBy(tabType: .home)
YHHUD.hide() YHHUD.hide()
guard let errorBlock = self.failure else { return }
let errorModel = YHErrorModel(errorCode: Int32(statusCode), errorMsg: errorResponseMsg)
errorBlock(errorModel)
} }
return return
} }
......
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