Commit 117605e1 authored by Steven杜宇's avatar Steven杜宇

// 配偶基本信息

parent afe744f0
......@@ -79,34 +79,94 @@ class YHSpouseBasicInfoVC: YHBaseViewController {
func loadBasicInfo() {
guard let spouse = spouse else { return }
items.removeAll()
// 配偶信息
let title0 = YHFormTitleItem(type: .spouseInfo)
let item01 = YHFormDetailItem(type: .everName)
let item02 = YHFormDetailItem(type: .befourMarryFirstName)
let item00 = YHFormDetailItem(type: .spouseName)
item00.placeHolder = "请输入".local
item00.value = spouse.subsetName
let item01 = YHFormDetailItem(type: .everName, isNeed: false)
item01.placeHolder = "选填".local
item01.value = spouse.usedName
let item02 = YHFormDetailItem(type: .befourMarryFirstName, isNeed: false)
item02.placeHolder = "如有则填写,仅支持输入字".local
item02.value = spouse.surname
let item03 = YHFormDetailItem(type: .birthday)
item03.placeHolder = "请选择".local
item03.value = spouse.birthday
let item04 = YHFormDetailItem(type: .birthNation)
item04.value = String(spouse.isBirthOverSeas())
let item05 = YHFormDetailItem(type: .birthCity)
let arr0:[YHFormItemProtocol] = [title0, item01, item02, item03, item04, item05]
if spouse.isBirthOverSeas() {
item05.value = spouse.birthPlace?.foreign
item05.placeHolder = "请输入".local
} else {
item05.value = spouse.birthPlace?.area?.joined(separator: ",")
item05.placeHolder = "请选择".local
}
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02, item03, item04, item05]
// 职业信息
let title1 = YHFormTitleItem(type: .occupationInfo)
let item10 = YHFormDetailItem(type: .occupation)
item10.value = spouse.occupation
item10.placeHolder = "请输入".local
let item11 = YHFormDetailItem(type: .occupationName)
item11.value = spouse.occupationName
item11.placeHolder = "请输入".local
let arr1:[YHFormItemProtocol] = [title1, item10, item11]
// 职业信息
let title2 = YHFormTitleItem(type: .degreeInfo)
let item20 = YHFormDetailItem(type: .ownDegree)
let item21 = YHFormDetailItem(type: .degreeDetailInfo)
let item22 = YHFormDetailItem(type: .degreeDetailInfo)
// let item21 = YHFormDetailItem(type: .degreeDetailInfo)
// let item22 = YHFormDetailItem(type: .degreeDetailInfo)
let item23 = YHFormAddItem(type: .addDegree)
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23]
let arr2:[YHFormItemProtocol] = [title2, item20, item23]
// 在港信息
let title3 = YHFormTitleItem(type: .inHongKongInfo)
let item30 = YHFormDetailItem(type: .isNowInHK)
item30.value = String(spouse.isNowInHK())
var arr3:[YHFormItemProtocol] = [title3, item30]
if spouse.isNowInHK() { // 目前在港才显示 逗留期限和在港身份
let item31 = YHFormDetailItem(type: .stayHKDate)
item31.placeHolder = "请选择".local
item31.value = spouse.childInHk?.info
let title3 = YHFormTitleItem(type: .hkIdentityCardInfo)
let item30 = YHFormDetailItem(type: .isHaveHkIdentityCard)
let item31 = YHFormDetailItem(type: .hkIdentityCardNumber)
let arr3:[YHFormItemProtocol] = [title3, item30, item31]
let item32 = YHFormDetailItem(type: .roleInHK)
item32.placeHolder = "请选择".local
item32.value = spouse.hkIdentity
items.append(contentsOf: [arr0, arr1, arr2, arr3])
arr3.append(contentsOf: [item31, item32])
}
// 香港身份证
let title4 = YHFormTitleItem(type: .hkIdentityCardInfo)
let item40 = YHFormDetailItem(type: .isHaveHkIdentityCard)
item40.value = String(spouse.isHaveHKIdentityCard())
var arr4:[YHFormItemProtocol] = [title4, item40]
if spouse.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber)
item41.value = spouse.hkIdentityCard
arr4.append(item41)
}
items.append(contentsOf: [arr0, arr1, arr2, arr3, arr4])
tableView.reloadData()
}
......@@ -120,6 +180,19 @@ class YHSpouseBasicInfoVC: YHBaseViewController {
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthCity {
var isBirthOverSeas = false
if let spouse = spouse {
isBirthOverSeas = spouse.isBirthOverSeas()
}
if isBirthOverSeas {
return .inputText
} else {
return .selectSheet
}
}
if detailItem.type == .spouseName
|| detailItem.type == .everName
|| detailItem.type == .befourMarryFirstName
......@@ -129,7 +202,6 @@ class YHSpouseBasicInfoVC: YHBaseViewController {
return .inputText
}
if detailItem.type == .birthday
|| detailItem.type == .birthCity
|| detailItem.type == .occupation
|| detailItem.type == .stayHKDate
|| detailItem.type == .roleInHK
......@@ -181,31 +253,93 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell
}
if cellType == .addItem { // 新增item cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = item.getTitle()
return cell
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.title = item.getTitle()
cell.isMust = detailItem.isNeed
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.textChange = {
[weak self] text in
guard let self = self else { return }
if detailItem.type == .spouseName {
self.spouse?.subsetName = text
} else if detailItem.type == .everName {
self.spouse?.usedName = text
} else if detailItem.type == .befourMarryFirstName {
self.spouse?.surname = text
} else if detailItem.type == .birthCity {
self.spouse?.birthPlace?.foreign = text
} else if detailItem.type == .occupationName {
self.spouse?.occupationName = text
} else if detailItem.type == .hkIdentityCardNumber {
self.spouse?.hkIdentityCard = text
}
}
return cell
}
if cellType == .selectSheet { // 点击选择列表cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.title = item.getTitle()
cell.isMust = detailItem.isNeed
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
return cell
}
if cellType == .twoChoice { // 双项选择cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed
cell.title = item.getTitle()
let answers = [YHFormChoiceItem(title: "是".local, isSelect: true),
YHFormChoiceItem(title: "否".local, isSelect: false)]
cell.answerArr = nil
if detailItem.type == .birthNation { // 出生国家
var select = false
if let value = detailItem.value {
select = Bool(value)!
}
let answers = [YHFormChoiceItem(title: "国内".local, isSelect: !select),
YHFormChoiceItem(title: "国外".local, isSelect: select)]
cell.answerArr = answers
return cell
cell.answerBlock = {
[weak self] (answers, index) in
guard let self = self else { return }
let selectItem = answers[index]
self.spouse?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
}
} else if detailItem.type == .isHaveHkIdentityCard || detailItem.type == .isNowInHK { // 是否办理过香港身份证 是否在岗
var select = false
if let value = detailItem.value {
select = Bool(value)!
}
let answers = [YHFormChoiceItem(title: "是".local, isSelect: select),
YHFormChoiceItem(title: "否".local, isSelect: !select)]
cell.answerArr = answers
cell.answerBlock = {
[weak self] (answers, index) in
guard let self = self else { return }
let selectItem = answers[index]
if detailItem.type == .isNowInHK {
self.spouse?.setNowIsInHK(selectItem.title == "是".local)
} else if detailItem.type == .isHaveHkIdentityCard {
self.spouse?.setHaveHKIdentityCard(selectItem.title == "是".local)
}
self.loadBasicInfo()
}
}
if cellType == .addItem { // 新增item cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = item.getTitle()
return cell
}
......@@ -215,6 +349,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = item.getTitle()
return cell
}
}
return createDefaultCell(indexPath)
}
......@@ -271,8 +406,64 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHParentInfoVC()
self.navigationController?.pushViewController(vc)
if !(0..<items.count).contains(indexPath.section) { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if !(0..<arr.count).contains(indexPath.row) { return }
let item = arr[indexPath.row]
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthday || detailItem.type == .stayHKDate { // 出生日期/获准滞留至
YHDatePickView.show(type: .yyyymmdd) { [weak self] date in
guard let self = self else { return }
if detailItem.type == .birthday {
self.spouse?.birthday = date
} else if detailItem.type == .stayHKDate {
self.spouse?.childInHk?.info = date
}
self.loadBasicInfo()
}
} else if detailItem.type == .birthCity { // 出生城市
var isBirthOverSeas = false
if let spouse = spouse {
isBirthOverSeas = spouse.isOverSeasOver1Year()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
let vc = YHAddressViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.spouse?.birthPlace?.area = [string2, string3, string4]
self.loadBasicInfo()
}
self.present(vc, animated: true)
} else if detailItem.type == .roleInHK { // 在港身份
let identity = self.spouse?.hkIdentity ?? ""
YHFormPickerView.show(type: .identity, selectTitle:identity ) {
[weak self] selectType in
guard let self = self else { return }
self.spouse?.hkIdentity = selectType.title
self.loadBasicInfo()
}
} else if detailItem.type == .occupation {
let occupation = self.spouse?.occupation ?? ""
YHFormPickerView.show(type: .occupation, selectTitle:occupation ) {
[weak self] selectType in
guard let self = self else { return }
self.spouse?.occupation = selectType.title
self.loadBasicInfo()
}
}
}
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
......
......@@ -126,7 +126,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
self.view.addSubview(uploadVC.view)
self.view.addSubview(initalInfoVC.view)
stepView.dataSource = ["初始信息".local, "证件上传".local, "基本信息".local, "证件信息".local]
stepView.dataSource = ["初始信息".local, "证件上传".local, "证件信息".local, "基本信息".local]
stepView.block = {[weak self] (index) in
guard let self = self else { return }
print("follow:%d", self.orderId)
......@@ -139,7 +139,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
self.view.addSubview(basicInfoVC.view)
self.view.addSubview(initalInfoVC.view)
stepView.dataSource = ["初始信息".local, "证件信息".local]
stepView.dataSource = ["初始信息".local, "基本信息".local]
stepView.block = {[weak self] (index) in
guard let self = self else { return }
print("follow:%d", self.orderId)
......@@ -158,8 +158,6 @@ extension YHSpouseInfoVC {
guard let spouse = spouse else { return }
guard let info = spouse.toDictionary() else { return }
let follow = spouse.follow
let dict:[String: Any] = ["orderId":self.orderId,
"relation":spouse.relationType.rawValue,
"step":spouse.step,
......
......@@ -175,6 +175,7 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .isAccompanyToHK || detailItem.type == .isHandleHKPassPort || detailItem.type == .isLiveTother || detailItem.type == .isLiveOverSeasMore1Year {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
var select = false
......
......@@ -457,10 +457,13 @@ enum YHFamilyMemberType: Int {
class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var id: Int = 0
// 是否已故
var deceased: Int = 0
var custody: Int = 0
// 国籍
var nationality: String?
var orderId: Int = 0
// 关系 1父亲 2母亲 3配偶 4子女 5兄弟姐妹
var relation: String?
var hasDegree: String?
......@@ -468,58 +471,66 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
// var hasDegreeJson: [YHHasDegreeJson]?
var hasDegreeJson: SmartAny?
// 是否随行至香港
var follow: Int = 0
var statement: Int = 0
// 姓名
var subsetName: String?
// mark any
// var subsetNamePinyin: YHSubsetNamePinyin?
var subsetNamePinyin: SmartAny?
// 曾用名
var usedName: String?
// 出生日期
var birthday: String?
// 出生国家地区 (国内/国外)
var birthPlaceAboard: Int = 0
// mark any
// var birthPlace: YHAddress?
var birthPlace: SmartAny?
// 出生地址信息
var birthPlace: YHAddress?
// 职业
var occupation: String?
// 职业名称
var occupationName: String?
// mark any
var operatorAme: SmartAny?
// mark any
// var childHasHkId: YHChildStepchildClass?
var childHasHkId: SmartAny?
// 香港身份证号
var hkIdentityCard: String?
// 性别
var sex: Int = 0
// 婚姻状况
var married: String?
// 是否与主申请人同住
var nows: Int = 0
// 居住地址
var address: YHAddress?
// mark any
// var childStepchild: YHChildStepchildClass?
var childStepchild: SmartAny?
// mark any
// var childInHk: YHChildStepchildClass?
var childInHk: SmartAny?
// 香港身份证信息
var childHasHkId: YHChildStepchildClass?
var childStepchild: YHChildStepchildClass?
// 在港信息
var childInHk: YHChildStepchildClass?
// mark any
var countryIdentity: SmartAny?
// 在港身份
var hkIdentity: String?
var hkIdentityOther: String?
// 现居住国家
var liveCountry: String?
// 是否要办理港澳通行证
var isHandled: Int = 0
var finishFollow: Int = 0
var step: Int = 0
// 未填写项数
var notFillNum: Int = 0
// 是否在海外居住满1年及以上
var isLiveOverseaYear: Int = 0
// 婚前刑事
var surname: String?
// mark any
......@@ -577,8 +588,8 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
return follow == 1
}
func setFollow(_ follow:Bool) {
self.follow = (follow ? 1 : 0)
func setFollow(_ value:Bool) {
self.follow = (value ? 1 : 0)
}
// 是否要办理港澳通行证
......@@ -586,8 +597,8 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
return self.isHandled == 1
}
func setNeedHandleHKPassPort(_ need:Bool) {
self.isHandled = (need ? 1 : 0)
func setNeedHandleHKPassPort(_ value:Bool) {
self.isHandled = (value ? 1 : 0)
}
// 是否与主申请人同住
......@@ -595,8 +606,8 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
return self.nows == 1
}
func setLiveTother(_ together:Bool) {
self.nows = (together ? 1 : 0)
func setLiveTother(_ value:Bool) {
self.nows = (value ? 1 : 0)
}
// 是否在海外居住满1年及以上
......@@ -608,6 +619,46 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
self.isLiveOverseaYear = value ? 1 : 0
}
// 是否出生国外
func isBirthOverSeas() -> Bool {
return self.birthPlaceAboard == 1
}
func setBirthOverSeas(_ value:Bool) {
return self.birthPlaceAboard = value ? 1 : 0
}
// 目前是否在港
func isNowInHK() -> Bool {
if let inHK = self.childInHk {
if inHK.has == "Y" {
return true
} else if inHK.has == "N" {
return false
}
}
return false
}
func setNowIsInHK(_ value:Bool) {
self.childInHk?.has = value ? "Y" : "N"
}
// 是否办理过香港身份证
func isHaveHKIdentityCard() -> Bool {
if let hasHkId = self.childHasHkId {
if hasHkId.has == "Y" {
return true
} else if hasHkId.has == "N" {
return false
}
}
return false
}
func setHaveHKIdentityCard(_ value:Bool) {
self.childHasHkId?.has = value ? "Y" : "N"
}
var relationType:YHFamilyMemberType {
......
......@@ -21,6 +21,7 @@
print(selectType.title)
}
*/
......@@ -30,17 +31,19 @@ enum YHFormPickerViewType: Int {
// 按自然顺序递增
case none = 0
// 学位
case degree = 1
case degree
// 婚姻
case marriage = 2
case marriage
// 授课形式
case edution = 3
case edution
// 职业
case occupation = 4
case occupation
// 性别
case gender = 5
case gender
// 证件
case certificate = 6
case certificate
// 在港身份
case identity
}
enum YHFormPickerViewSubType {
......@@ -52,6 +55,7 @@ enum YHFormPickerViewSubType {
case occupation(YHPickerViewOccupationType)
case gender(YHPickerViewGenderType)
case certificate(YHPickerViewCertificateType)
case identity(YHPickerViewIdentityType)
var title:String {
switch self {
......@@ -113,72 +117,23 @@ enum YHFormPickerViewSubType {
case .certificate(.officialPassport):
return "公务护照".local
case .identity(.student):
return "学生".local
case .identity(.employment):
return "就业".local
case .identity(.residence):
return "居留".local
case .identity(.visit):
return "访问".local
case .identity(.other):
return "其他".local
}
}
static func getType(_ title: String?) -> YHFormPickerViewSubType {
guard let title = title else { return .none }
if title == "未婚".local {
return .marriage(.unmarriage)
} else if title == "已婚".local {
return .marriage(.marriaged)
} else if title == "分居".local {
return .marriage(.separated)
} else if title == "离婚".local {
return .marriage(.divorced)
} else if title == "丧偶".local {
return .marriage(.widowed)
} else if title == "学士学位".local {
return .degree(.bachelor)
} else if title == "硕士学位".local {
return .degree(.master)
} else if title == "硕士学位".local {
return .degree(.doctor)
} else if title == "全日制".local {
return .education(.fullTime)
} else if title == "兼读制".local {
return .education(.partTime)
} else if title == "遥距课程".local {
return .education(.distanceCourses)
} else if title == "在职".local {
return .occupation(.onTheJob)
} else if title == "退休".local {
return .occupation(.retire)
} else if title == "无业".local {
return .occupation(.unemployed)
} else if title == "学生".local {
return .occupation(.student)
} else if title == "男".local {
return .gender(.male)
} else if title == "女".local {
return .gender(.female)
} else if title == "护照".local {
return .certificate(.passport)
} else if title == "外交护照".local {
return .certificate(.diplomaticPassport)
} else if title == "旅游通行证".local {
return .certificate(.travelPassport)
} else if title == "公务护照".local {
return .certificate(.officialPassport)
} else if title == "中国发无国籍旅游证件".local {
return .certificate(.chineseStatelessTravelPassport)
} else if title == "其他无国籍旅行证件".local {
return .certificate(.otherStatelessTravelPassport)
} else if title == "联合国通行证".local {
return .certificate(.unitedNationsPassport)
}
return .none
}
}
......@@ -249,6 +204,19 @@ enum YHPickerViewCertificateType {
}
enum YHPickerViewIdentityType {
// 学生
case student
// 就业
case employment
// 居留
case residence
// 访问
case visit
// 其他
case other
}
class YHFormPickerViewItem {
......@@ -266,14 +234,14 @@ class YHFormPickerView: UIView {
let type: YHFormPickerViewType
var selectType:YHFormPickerViewSubType?
var selectTitle:String? {
private var selectType:YHFormPickerViewSubType?
private var selectTitle:String? {
didSet {
let type:YHFormPickerViewSubType = YHFormPickerViewSubType.getType(selectTitle)
let type:YHFormPickerViewSubType = getSubType(selectTitle)
selectType = type
}
}
var selectBlock:((YHFormPickerViewSubType)->Void)?
private var selectBlock:((YHFormPickerViewSubType)->Void)?
var title: String? {
didSet {
......@@ -397,6 +365,14 @@ class YHFormPickerView: UIView {
YHFormPickerViewItem(type: .certificate(.travelPassport)),
YHFormPickerViewItem(type: .certificate(.unitedNationsPassport)),
YHFormPickerViewItem(type: .certificate(.otherStatelessTravelPassport))],
// 在港身份
.identity:
[YHFormPickerViewItem(type: .identity(.student)),
YHFormPickerViewItem(type: .identity(.employment)),
YHFormPickerViewItem(type: .identity(.residence)),
YHFormPickerViewItem(type: .identity(.visit)),
YHFormPickerViewItem(type: .identity(.other))],
]
}()
......@@ -541,6 +517,8 @@ class YHFormPickerView: UIView {
return "选择性别"
case .certificate:
return "选择证件"
case .identity:
return "选择在港身份"
}
}
}
......@@ -597,3 +575,89 @@ extension YHFormPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
return label
}
}
extension YHFormPickerView {
func getSubType(_ title: String?) -> YHFormPickerViewSubType {
guard let title = title else { return .none }
switch type {
case .none:
return .none
case .degree:
if title == "学士学位".local {
return .degree(.bachelor)
} else if title == "硕士学位".local {
return .degree(.master)
} else if title == "硕士学位".local {
return .degree(.doctor)
}
case .marriage:
if title == "未婚".local {
return .marriage(.unmarriage)
} else if title == "已婚".local {
return .marriage(.marriaged)
} else if title == "分居".local {
return .marriage(.separated)
} else if title == "离婚".local {
return .marriage(.divorced)
} else if title == "丧偶".local {
return .marriage(.widowed)
}
case .edution:
if title == "全日制".local {
return .education(.fullTime)
} else if title == "兼读制".local {
return .education(.partTime)
} else if title == "遥距课程".local {
return .education(.distanceCourses)
}
case .occupation:
if title == "在职".local {
return .occupation(.onTheJob)
} else if title == "退休".local {
return .occupation(.retire)
} else if title == "无业".local {
return .occupation(.unemployed)
} else if title == "学生".local {
return .occupation(.student)
}
case .gender:
if title == "男".local {
return .gender(.male)
} else if title == "女".local {
return .gender(.female)
}
case .certificate:
if title == "护照".local {
return .certificate(.passport)
} else if title == "外交护照".local {
return .certificate(.diplomaticPassport)
} else if title == "旅游通行证".local {
return .certificate(.travelPassport)
} else if title == "公务护照".local {
return .certificate(.officialPassport)
} else if title == "中国发无国籍旅游证件".local {
return .certificate(.chineseStatelessTravelPassport)
} else if title == "其他无国籍旅行证件".local {
return .certificate(.otherStatelessTravelPassport)
} else if title == "联合国通行证".local {
return .certificate(.unitedNationsPassport)
}
case .identity:
if title == "学生".local {
return .identity(.student)
} else if title == "就业".local {
return .identity(.employment)
} else if title == "居留".local {
return .identity(.residence)
} else if title == "访问".local {
return .identity(.visit)
} else if title == "其他".local {
return .identity(.other)
}
}
return .none
}
}
......@@ -24,6 +24,7 @@ class YHFormChoiceItem {
class YHFormItemDoubleChoiceCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemDoubleChoiceCell"
private let btnWidth = 70.0
private let btnHeight = 32.0
private let btnTitleSelectColor = UIColor.brandMainColor
......@@ -32,21 +33,27 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
private let btnBgSelectColor = UIColor.brandMainColor.withAlphaComponent(0.08)
private let answerBaseTag = 9527
// 是否必须字段
var isMust:Bool = false
var answerBlock:(([YHFormChoiceItem], Int)->Void)?
var title:String? {
didSet {
if let question = title {
let str = "*"+question
if let title = title, !title.isEmpty {
let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
.foregroundColor: UIColor.mainTextColor]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
}
}
}
......@@ -135,8 +142,6 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
self.selectionStyle = .none
title = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
contentView.addSubview(titleLabel)
contentView.addSubview(answer2Btn)
contentView.addSubview(answer1Btn)
......
......@@ -28,7 +28,7 @@ class YHFormItemEnterDetailCell: UITableViewCell {
var title:String? {
didSet {
if let title = title {
if let title = title, !title.isEmpty {
let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: titleFont,
......@@ -40,6 +40,8 @@ class YHFormItemEnterDetailCell: UITableViewCell {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
}
}
}
......
......@@ -20,7 +20,7 @@ class YHFormItemExpireDateCell: UITableViewCell {
var title:String? {
didSet {
if let title = title {
if let title = title, !title.isEmpty {
let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
......@@ -31,6 +31,8 @@ class YHFormItemExpireDateCell: UITableViewCell {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
}
titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
}
}
}
......
......@@ -65,7 +65,7 @@ class YHFormItemInputTextCell: UITableViewCell {
private lazy var textField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.placeholder = "请如实填写"
textField.placeholder = "请输入"
textField.font = UIFont.PFSC_M(ofSize: 14)
textField.tintColor = UIColor.mainTextColor
textField.textColor = UIColor.mainTextColor
......
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