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

// 配偶基本信息

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