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

修复主申请人bug

parent 42c5890a
...@@ -192,7 +192,7 @@ class YHlifeCollectionReusableViewTableViewCell: UITableViewCell { ...@@ -192,7 +192,7 @@ class YHlifeCollectionReusableViewTableViewCell: UITableViewCell {
guard let dataSource = dataSource else { return } guard let dataSource = dataSource else { return }
self.titleLabel.text = dataSource.title self.titleLabel.text = dataSource.title
self.subTitleLabel.text = dataSource.account self.subTitleLabel.text = dataSource.account
self.timelabel.text = dataSource.start_time self.timelabel.text = dataSource.time_appointment
flagLabel.isHidden = false flagLabel.isHidden = false
actionButton.isSelected = dataSource.is_schedule_live actionButton.isSelected = dataSource.is_schedule_live
guard let url = URL(string: dataSource.image) else { return } guard let url = URL(string: dataSource.image) else { return }
......
...@@ -32,6 +32,7 @@ class YHLiveListModel: SmartCodable { ...@@ -32,6 +32,7 @@ class YHLiveListModel: SmartCodable {
var account: String = "" var account: String = ""
var image: String = "" var image: String = ""
var is_schedule_live: Bool = false var is_schedule_live: Bool = false
var time_appointment: String = ""
required init() { required init() {
} }
} }
......
...@@ -482,8 +482,13 @@ class YHItemView: UIView { ...@@ -482,8 +482,13 @@ class YHItemView: UIView {
title = "请选择出生日期" title = "请选择出生日期"
isLastDay = true isLastDay = true
} }
var type: YHDateType = .yyyymmdd
YHDatePickView.show(type: .yyyymmdd, title: title, lastIsTaday: isLastDay, currentDay: dataSource?.message ?? "") { date in if dataSource?.id == .id41 {
title = "海外居留开始时间"
isLastDay = true
type = .yyyymm
}
YHDatePickView.show(type: type, title: title, lastIsTaday: isLastDay, currentDay: dataSource?.message ?? "") { date in
self.dataSource?.message = date self.dataSource?.message = date
self.updateAllViews() self.updateAllViews()
if let block = self.block { if let block = self.block {
......
...@@ -48,12 +48,12 @@ class YHGCMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -48,12 +48,12 @@ class YHGCMainApplicantInformationViewModel: YHBaseViewModel {
if nationality.contains("中国") && !addressCountry.contains("中国") { if nationality.contains("中国") && !addressCountry.contains("中国") {
if have_permanent_residency == 1 { if have_permanent_residency == 1 {
return [section, section111, section2] return [section, section111]
} else if have_permanent_residency == 0 { } else if have_permanent_residency == 0 {
if isOneYearAgo(yearMonth: mainModel.residence_time) { if isOneYearAgo(yearMonth: mainModel.residence_time) {
return [section, section1111, section2]
} else {
return [section, section1111] return [section, section1111]
} else {
return [section, section1111, section2]
} }
} else { } else {
return [section, section111] return [section, section111]
...@@ -395,23 +395,27 @@ class YHGCMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -395,23 +395,27 @@ class YHGCMainApplicantInformationViewModel: YHBaseViewModel {
} }
func isOneYearAgo(yearMonth: String) -> Bool { func isOneYearAgo(yearMonth: String) -> Bool {
// 创建日期格式化器
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM" dateFormatter.dateFormat = "yyyy-MM"
// 将字符串转换为日期 // 将字符串转换为日期
guard let inputDate = dateFormatter.date(from: yearMonth) else { guard let date = dateFormatter.date(from: yearMonth) else {
return false // 如果转换失败,返回 false return false // 如果日期格式不正确,返回 nil
} }
// 获取当前日期
let currentDate = Date()
// 获取日历实例
let calendar = Calendar.current let calendar = Calendar.current
let oneYearAgo = calendar.date(byAdding: .year, value: -1, to: Date())!
// 获取输入日期的年份和月份 // 计算一年前的日期
let inputYearMonth = calendar.date(from: calendar.dateComponents([.year, .month], from: inputDate))! if let oneYearAgo = calendar.date(byAdding: .year, value: -1, to: currentDate) {
// 比较日期,判断是否大于一年
return date < oneYearAgo
}
// 比较输入日期与一年前的日期 return false
return calendar.isDate(inputYearMonth, inSameDayAs: oneYearAgo)
} }
func updateModel(_ type: YHCardType, isFront: Bool, url: String) { func updateModel(_ type: YHCardType, isFront: Bool, url: String) {
......
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