Commit 1f0551ff authored by David黄金龙's avatar David黄金龙

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

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  编辑在港记录提示加粗
  编辑在港记录增加时间判断
  改按钮文字
parents 7ca8b1ee a2fd0907
......@@ -70,11 +70,7 @@ class YHHKRecordsEditContentVC: YHBaseViewController {
private lazy var saveButton: UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
var buttonName = "保存在港记录"
if pageType == .add {
buttonName = "新增在港记录"
}
let buttonName = "保存在港记录"
button.setTitle(buttonName, for: .normal)
button.setTitle(buttonName, for: .highlighted)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
......@@ -395,16 +391,29 @@ extension YHHKRecordsEditContentVC: UITableViewDelegate, UITableViewDataSource {
let row = sectionArr[indexPath.row]
if case let .selectTime(title, detail, placeholder, timeType) = row {
YHDatePickView.show(type: .yyyymmdd, title:title, lastIsTaday: false, currentDay: detail ?? "") { [weak self] dateStr in
guard let self = self else { return }
var sections = self.datas[indexPath.section]
sections[indexPath.row] = .selectTime(title, dateStr, placeholder, timeType)
self.datas[indexPath.section] = sections
guard let self = self, dateStr.count > 0 else { return }
if timeType == .fromTime {
self.editModel.start_date = dateStr
if self.editModel.end_date.count > 0, self.compareDateStrings(dateStr, self.editModel.end_date) == .orderedDescending {
YHHUD.flash(message: "入境时间不能晚于离境时间")
} else {
var sections = self.datas[indexPath.section]
sections[indexPath.row] = .selectTime(title, dateStr, placeholder, timeType)
self.datas[indexPath.section] = sections
self.editModel.start_date = dateStr
tableView.reloadRows(at: [indexPath], with: .automatic)
}
} else {
self.editModel.end_date = dateStr
if self.editModel.start_date.count > 0, self.compareDateStrings(self.editModel.start_date, dateStr) == .orderedDescending {
YHHUD.flash(message: "离境时间不能早于入境时间")
} else {
var sections = self.datas[indexPath.section]
sections[indexPath.row] = .selectTime(title, dateStr, placeholder, timeType)
self.datas[indexPath.section] = sections
self.editModel.end_date = dateStr
tableView.reloadRows(at: [indexPath], with: .automatic)
}
}
tableView.reloadRows(at: [indexPath], with: .automatic)
}
}
......@@ -453,7 +462,18 @@ extension YHHKRecordsEditContentVC {
let attText = "间隔不能超出180天"
let normalTextLast = "(红线)如超出,递交续签时需向港府解释说明连续180未赴港原因。主申请人赴港频率越高,逗留时间越长,续签成功率越高哦~"
let attStr = NSMutableAttributedString(string: normalTextFirst + attText + normalTextLast)
attStr.setAttributes([.foregroundColor: UIColor.brandMainColor], range: NSRange(location: normalTextFirst.count, length: attText.count))
attStr.setAttributes([.foregroundColor: UIColor.brandMainColor, .font: UIFont.PFSC_B(ofSize: 12)], range: NSRange(location: normalTextFirst.count, length: attText.count))
return attStr
}
private func compareDateStrings(_ date1: String, _ date2: String) -> ComparisonResult? {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd" // 根据你的日期字符串格式调整
guard let firstDate = dateFormatter.date(from: date1),
let secondDate = dateFormatter.date(from: date2) else {
YHHUD.flash(message:"日期字符串格式无效")
return nil
}
return firstDate.compare(secondDate)
}
}
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