Commit 1dc3e06a 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 cf1fe734 255873b6
......@@ -431,7 +431,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.birthPlace.area = [string2, string3, string4]
self.child?.birthPlace.area = [string2, string3]
self.loadInfo()
save()
}
......
......@@ -86,7 +86,7 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if isLiveInChina {
var value = ""
if !child.address.area.isEmpty {
value = child.address.area.joined(separator: "/")
value = child.address.area.joined(separator: ",")
}
let item22 = YHFormDetailItem(type: .liveCity, value: value, tips: "请选择现居住城市".local)
arr2.append(item22)
......@@ -357,7 +357,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.address.area = [string2, string3, string4]
self.child?.address.area = [string2, string3]
self.loadInfo()
}
self.present(vc, animated: true)
......
......@@ -612,7 +612,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[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.spouse?.birthPlace.area = [string2, string3]
self.loadInfo()
}
self.present(vc, animated: true)
......
......@@ -94,8 +94,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
func createUI() {
guard let spouse = spouse else { return }
primaryInfoVC.delegate = self
certificateVC.delegate = self
basicInfoVC.delegate = self
......
......@@ -85,7 +85,7 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if isLiveInChina {
var value:String? = ""
if !spouse.address.area.isEmpty {
value = spouse.address.area.joined(separator: "/")
value = spouse.address.area.joined(separator: ",")
}
let item22 = YHFormDetailItem(type:.liveCity, value:value, placeHolder:"请选择城市".local, tips:"请请选择城市".local)
arr2.append(item22)
......@@ -317,7 +317,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.spouse?.address.area = [string2, string3, string4]
self.spouse?.address.area = [string2, string3]
self.loadInfo()
save()
}
......@@ -355,14 +355,20 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if isEmptyString(spouse.nationality) {
return false
}
if isEmptyString(spouse.address.country) {
return false
}
if isEmptyString(spouse.address.details) {
return false
}
if spouse.isBirthOverSeas(), isEmptyArray(spouse.address.area) {
return false
if !spouse.isLiveTother() { // 没有与主申请人同住
if isEmptyString(spouse.address.country) {
return false
}
if isEmptyString(spouse.address.details) {
return false
}
if spouse.address.isInChina() {
if isEmptyArray(spouse.address.area) {
return false
}
}
}
return true
}
......
......@@ -60,7 +60,7 @@ class YHBrotherInfoVC: YHBaseViewController {
view.addSubview(tableView);
view.addSubview(bottomView)
bottomView.saveBlock = {
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
self.saveInfo(isSubmit: true, isLoading: true) {
......@@ -95,55 +95,40 @@ class YHBrotherInfoVC: YHBaseViewController {
// 兄弟姐妹信息
let title1 = YHFormTitleItem(type: .brotherInfo)
let item10 = YHFormDetailItem(type: .brotherName)
item10.value = brotherInfo.subsetName
let item11 = YHFormDetailItem(type: .birthday)
item11.value = brotherInfo.birthday
let item12 = YHFormDetailItem(type: .birthNation)
item12.value = String(brotherInfo.isBirthOverSeas())
let item13 = YHFormDetailItem(type: .birthCity)
let item10 = YHFormDetailItem(type: .brotherName, value:brotherInfo.subsetName, tips:"请输入姓名".local)
let item11 = YHFormDetailItem(type: .birthday, value:brotherInfo.birthday, tips:"请选择出生日期".local )
let item12 = YHFormDetailItem(type: .birthNation, value:String(brotherInfo.isBirthOverSeas()))
var birthCity = ""
if brotherInfo.isBirthOverSeas() {
item13.value = brotherInfo.birthPlace.foreign
item13.placeHolder = "请输入".local
birthCity = brotherInfo.birthPlace.foreign
} else {
item13.value = brotherInfo.birthPlace.area.joined(separator: ",")
item13.placeHolder = "请选择".local
birthCity = brotherInfo.birthPlace.area.joined(separator: ",")
}
let item14 = YHFormDetailItem(type: .gender)
item14.value = brotherInfo.sexName()
let item15 = YHFormDetailItem(type: .marriageState)
item15.value = brotherInfo.married
let item13 = YHFormDetailItem(type: .birthCity, value: birthCity, tips:"请选择出生城市".local)
let item14 = YHFormDetailItem(type: .gender, value:brotherInfo.sexName(), tips:"请选择性别".local)
let item15 = YHFormDetailItem(type: .marriageState, value:brotherInfo.married, tips:"请选择婚姻状况".local)
let arr1:[YHFormItemProtocol] = [title1, item10, item11, item12, item13, item14, item15]
// 职业信息
let title2 = YHFormTitleItem(type: .occupationInfo)
let item20 = YHFormDetailItem(type: .occupation)
item20.value = brotherInfo.occupation
item20.placeHolder = "请输入".local
let item20 = YHFormDetailItem(type: .occupation, value:brotherInfo.occupation, tips:"请选择职业".local)
var arr2:[YHFormItemProtocol] = [title2, item20]
// 居住信息
let title3 = YHFormTitleItem(type: .liveInfo)
let item30 = YHFormDetailItem(type: .liveNationOrArea)
item30.value = brotherInfo.liveCountry
let item30 = YHFormDetailItem(type: .liveNationOrArea, value:brotherInfo.liveCountry, tips:"请选择国家/地区".local)
let arr3:[YHFormItemProtocol] = [title3, item30]
// 香港身份证
let title4 = YHFormTitleItem(type: .hkIdentityCardInfo)
let item40 = YHFormDetailItem(type: .isHaveHkIdentityCard)
item40.value = String(brotherInfo.isHaveHKIdentityCard())
let item40 = YHFormDetailItem(type: .isHaveHkIdentityCard, value:String(brotherInfo.isHaveHKIdentityCard()))
var arr4:[YHFormItemProtocol] = [title4, item40]
if brotherInfo.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber)
item41.value = brotherInfo.hkIdentityCard
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber, value:brotherInfo.hkIdentityCard, tips: "请输入正确的香港身份证号码")
arr4.append(item41)
}
items.append(contentsOf: [arr1, arr2, arr3, arr4])
......@@ -238,7 +223,17 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
if detailItem.type == .hkIdentityCardNumber { // 输入香港身份证号码
let isEmptyValue = isEmptyString(detailItem.value)
var isUnvalidFormat = true
if let value = detailItem.value, value.isHKIdentityCardNumber() {
isUnvalidFormat = false
}
let isNeedShowTips = isEmptyValue || isUnvalidFormat
cell.setTips(detailItem.tips, isShow: isNeedShowError && isNeedShowTips)
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
cell.textChange = {
[weak self] (text, isEditEnd) in
......@@ -269,6 +264,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
return cell
}
......@@ -405,51 +401,51 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.brotherInfo?.birthPlace.area = [string2, string3, string4]
self.brotherInfo?.birthPlace.area = [string2, string3]
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
} else if detailItem.type == .occupation { // 职业
let occupation = self.brotherInfo?.occupation ?? ""
YHFormPickerView.show(type: .profession, selectTitle:occupation ) {
[weak self] selectType in
YHSheetPickerView.show(type: .profession, selectTitle:occupation) {
[weak self] selectItem in
guard let self = self else { return }
self.brotherInfo?.occupation = selectType.title
self.brotherInfo?.occupation = selectItem.title
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .marriageState { // 婚姻
let marriage = self.brotherInfo?.married
YHFormPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectType in
YHSheetPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectItem in
guard let self = self else { return }
self.brotherInfo?.married = selectType.title
self.brotherInfo?.married = selectItem.title
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
let vc = YHAddressViewController()
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
[weak self] string in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.brotherInfo?.liveCountry = string2
self.brotherInfo?.liveCountry = string
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
} else if detailItem.type == .gender { // 性别
guard let brotherInfo = brotherInfo else { return }
let isMale = brotherInfo.isMale()
let selectType:YHFormPickerViewSubType = isMale ? .gender(.male) : .gender(.female)
YHFormPickerView.show(type: .gender, selectType:selectType) {
[weak self] selectType in
YHSheetPickerView.show(type: .gender, selectTitle:brotherInfo.sexName()) {
[weak self] selectItem in
guard let self = self else { return }
let selectMale = (selectType.index == YHFormPickerViewSubType.gender(.male).index)
self.brotherInfo?.setMale(selectMale)
self.brotherInfo?.setSexName(selectItem.title)
self.loadInfo()
saveInfoSilent()
}
......
......@@ -92,7 +92,14 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
// 护照及其他旅行证件 信息必有
let title2 = YHFormTitleItem(type: .passPortOrTravelInfo)
let item20 = YHFormDetailItem(type: .certificateType, isNeed: false, value:String(familyMember.certificates.passport.passportType), tips:"请选择证件类别".local)
// 证件类别名称
var value = ""
let passPortType = self.familyMember?.certificates.passport.passPortType ?? 0
if let item = YHSheetPickerView.getItem(type:.certificate, index:passPortType) {
value = item.title
}
let item20 = YHFormDetailItem(type: .certificateType, isNeed: false, value:value, tips:"请选择证件类别".local)
let item21 = YHFormDetailItem(type: .certificateNumber, isNeed: false, value: familyMember.certificates.passport.number, tips: "请输入证件号码".local)
let item22 = YHFormDetailItem(type: .certificateSignPlace, isNeed: false, value: familyMember.certificates.passport.issueAt, tips:"请输入签发地".local)
let item23 = YHFormDetailItem(type: .certificateSignDate, isNeed: false, value:familyMember.certificates.passport.issueDateStartAt, tips:"请选择签发日期".local)
......@@ -100,15 +107,6 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23, item24]
items.append(arr2)
// 证件类别名称
var selectType:YHFormPickerViewSubType = .certificate(.passport)
if let passPortType = self.familyMember?.certificates.passport.passportType,
let subType = YHPickerViewCertificateType(rawValue: passPortType)
{
selectType = YHFormPickerViewSubType.certificate(subType)
}
item20.value = selectType.title
tableView.reloadData()
}
}
......@@ -208,8 +206,7 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
[weak self] isLongTime in
guard let self = self else { return }
if title.type == .chinaIdCardInfo {
let issueAt = self.familyMember?.certificates.cnIdentityCard.issueAt
self.familyMember?.certificates.cnIdentityCard.issueDateEndAt = ((isLongTime ? YHCNIdentityCard.longTime : issueAt)!)
self.familyMember?.certificates.cnIdentityCard.issueDateEndAt = (isLongTime ? YHCNIdentityCard.longTime : "")
loadInfo()
save()
}
......@@ -306,17 +303,11 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
}
} else if detailItem.type == .certificateType { // 选择证件类别
var selectType:YHFormPickerViewSubType = .certificate(.passport)
if let passPortType = self.familyMember?.certificates.passport.passportType,
let subType = YHPickerViewCertificateType(rawValue: passPortType)
{
selectType = YHFormPickerViewSubType.certificate(subType)
}
YHFormPickerView.show(type: .certificate, selectType:selectType) {
[weak self] selectType in
let type = self.familyMember?.certificates.passport.passPortType ?? 0
YHSheetPickerView.show(type: .certificate, selectIndex:type) {
[weak self] selectItem in
guard let self = self else { return }
self.familyMember?.certificates.passport.passportType = selectType.index
self.familyMember?.certificates.passport.passPortType = selectItem.index
self.loadInfo()
self.save()
}
......@@ -376,7 +367,7 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
|| familyMember.certificates.hkMacaoPass.issueAt.count <= 0
|| familyMember.certificates.hkMacaoPass.issueDateStartAt.count <= 0
|| familyMember.certificates.hkMacaoPass.issueDateEndAt.count <= 0
|| familyMember.certificates.hkMacaoPass.passportType == -1
|| familyMember.certificates.hkMacaoPass.passPortType == -1
{
return false
}
......
......@@ -106,41 +106,31 @@ class YHParentInfoVC: YHBaseViewController {
var arr1 = [YHFormItemProtocol]()
if parentInfo.relationType == .father { // 父亲
let title1 = YHFormTitleItem(type: .fatherInfo)
let item10 = YHFormDetailItem(type: .fatherName)
item10.value = parentInfo.subsetName
item10.tips = "请输入姓名".local
item10.placeHolder = "请输入姓名".local
let item10 = YHFormDetailItem(type: .fatherName, value:parentInfo.subsetName, tips:"请输入姓名".local)
arr1.append(title1)
arr1.append(item10)
} else { // 母亲
let title1 = YHFormTitleItem(type: .motherInfo)
let item10 = YHFormDetailItem(type: .motherName)
item10.value = parentInfo.subsetName
item10.tips = "请输入姓名".local
item10.placeHolder = "请输入姓名".local
let item10 = YHFormDetailItem(type: .motherName, value:parentInfo.subsetName, tips:"请输入姓名".local)
arr1.append(title1)
arr1.append(item10)
}
let item11 = YHFormDetailItem(type: .birthday)
item11.value = parentInfo.birthday
item11.tips = "请选择生日日期".local
let item12 = YHFormDetailItem(type: .birthNation)
item12.value = String(parentInfo.isBirthOverSeas())
let item13 = YHFormDetailItem(type: .birthCity)
let item11 = YHFormDetailItem(type: .birthday, value:parentInfo.birthday, tips:"请选择生日日期".local)
let item12 = YHFormDetailItem(type: .birthNation, value:String(parentInfo.isBirthOverSeas()))
var cityValue = parentInfo.birthPlace.area.joined(separator: ",")
var cityPlaceHolder = "请选择".local
var cityTips = "请选择城市".local
if parentInfo.isBirthOverSeas() {
item13.value = parentInfo.birthPlace.foreign
item13.placeHolder = "请输入".local
item13.tips = "请输入城市".local
} else {
item13.value = parentInfo.birthPlace.area.joined(separator: ",")
item13.placeHolder = "请选择".local
item13.tips = "请选择城市".local
cityValue = parentInfo.birthPlace.foreign
cityPlaceHolder = "请输入".local
cityTips = "请输入城市".local
}
let item13 = YHFormDetailItem(type: .birthCity, value:cityValue,placeHolder:cityPlaceHolder, tips:cityTips)
let arr:[YHFormItemProtocol] = [item11, item12, item13]
arr1.append(contentsOf: arr)
......@@ -149,33 +139,22 @@ class YHParentInfoVC: YHBaseViewController {
}
if !parentInfo.isDead() { // 健在
let item14 = YHFormDetailItem(type: .marriageState)
item14.value = parentInfo.married
item14.placeHolder = "请选择".local
item14.tips = "请选择".local
let item14 = YHFormDetailItem(type: .marriageState, value:parentInfo.married, tips:"请选择婚姻状况".local)
arr1.append(item14)
// 职业信息
let title2 = YHFormTitleItem(type: .occupationInfo)
let item20 = YHFormDetailItem(type: .occupation)
item20.value = parentInfo.occupation
item20.placeHolder = "请选择".local
item20.tips = "请选择".local
let item20 = YHFormDetailItem(type: .occupation, value:parentInfo.occupation, tips:"请选择职业".local)
var arr2:[YHFormItemProtocol] = [title2, item20]
if parentInfo.isNowHaveJob() {
let item21 = YHFormDetailItem(type: .occupationName)
item21.value = parentInfo.occupationName
item21.placeHolder = "请输入".local
item21.tips = "请输入".local
let item21 = YHFormDetailItem(type: .occupationName, value:parentInfo.occupationName, tips:"请输入职业名称".local)
arr2.append(item21)
}
// 居住信息
let title3 = YHFormTitleItem(type: .liveInfo)
let item30 = YHFormDetailItem(type: .liveNationOrArea)
item30.value = parentInfo.liveCountry
item30.tips = "请选择国家/地区".local
let item30 = YHFormDetailItem(type: .liveNationOrArea, value:parentInfo.liveCountry, tips:"请选择国家/地区".local)
let arr3:[YHFormItemProtocol] = [title3, item30]
// 香港身份证
......@@ -185,9 +164,7 @@ class YHParentInfoVC: YHBaseViewController {
var arr4:[YHFormItemProtocol] = [title4, item40]
if parentInfo.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber)
item41.value = parentInfo.hkIdentityCard
item41.tips = "请输入正确的香港身份证号码".local
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber, value:parentInfo.hkIdentityCard, tips: "请输入正确的香港身份证号码".local)
arr4.append(item41)
}
items.append(contentsOf: [arr0, arr1, arr2, arr3, arr4])
......@@ -466,38 +443,39 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.birthPlace.area = [string2, string3, string4]
self.parentInfo?.birthPlace.area = [string2, string3]
self.loadInfo()
saveInfoSilent()
}
self.present(vc, animated: true)
} else if detailItem.type == .occupation { // 职业
let occupation = self.parentInfo?.occupation ?? ""
YHFormPickerView.show(type: .occupation, selectTitle:occupation ) {
[weak self] selectType in
YHSheetPickerView.show(type: .occupation, selectTitle:occupation) {
[weak self] selectItem in
guard let self = self else { return }
self.parentInfo?.occupation = selectType.title
self.parentInfo?.occupation = selectItem.title
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .marriageState { // 婚姻
let marriage = self.parentInfo?.married
YHFormPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectType in
let marriage = self.parentInfo?.married ?? ""
YHSheetPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectItem in
guard let self = self else { return }
self.parentInfo?.married = selectType.title
self.parentInfo?.married = selectItem.title
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
let vc = YHAddressViewController()
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
[weak self] string in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.liveCountry = string2
self.parentInfo?.liveCountry = string
self.loadInfo()
saveInfoSilent()
}
......
......@@ -1101,6 +1101,15 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
return ""
}
func setSexName(_ sexName:String?) {
guard let sexName = sexName else { return }
if sexName == "男".local {
self.sex = 1
} else if sexName == "女".local {
self.sex = 2
}
}
// 是否前一次婚姻子女
func isPreviousMarriageChild() -> Bool {
return self.childStepchild.has == "Y"
......@@ -1186,6 +1195,16 @@ class YHAddress: SmartCodable {
required init() {
}
// 是否在中国
func isInChina() ->Bool {
// 默认在中国
if isEmptyString(country) { return true }
if country.contains("中国") {
return true
}
return false
}
}
// MARK: - YHChildStepchildClass
......@@ -1247,7 +1266,7 @@ class YHCNIdentityCard: SmartCodable {
var issueDateEndAt: String = ""
var imgFront: String = ""
var imgBack: String = ""
var passportType: Int = -1
var passPortType: Int = -1
enum CodingKeys: String, CodingKey {
case id = "id"
......@@ -1257,7 +1276,7 @@ class YHCNIdentityCard: SmartCodable {
case issueDateEndAt = "issue_date_end_at"
case imgFront = "img_front"
case imgBack = "img_back"
case passportType = "passport_type"
case passPortType = "pass_port_type"
}
required init() {
......
......@@ -10,14 +10,15 @@
/*
// (1) 直接传index 此处的index是后台的数值,并非行数
YHSheetPickerView.show(type: .degree, selectIndex: 1) {
selectItem in
YHSheetPickerView.show(type: .occupation, selectIndex:0) {
[weak self] selectItem in
guard let self = self else { return }
}
// (2) 直接传字符串值
YHSheetPickerView.show(type: .degree, selectTitle:"博士学位") {
selectItem in
YHSheetPickerView.show(type: .occupation, selectTitle:"在职") {
[weak self] selectItem in
guard let self = self else { return }
}
// 如何扩展新类型
......@@ -124,7 +125,7 @@ class YHSheetPickerView: UIView {
}
func showSelectRow() {
if let arr = dataSource[type], selectRow < arr.count {
if let arr = Self.dataSource[type], selectRow < arr.count {
pickerView.selectRow(selectRow, inComponent: 0, animated: true)
} else {
......@@ -148,8 +149,8 @@ class YHSheetPickerView: UIView {
picker.show()
}
lazy var dataSource:[YHSheetPickerViewType: [YHSheetPickerViewItem]] = {
return [
static var dataSource:[YHSheetPickerViewType: [YHSheetPickerViewItem]] =
[
// 默认无
.none:[],
......@@ -202,8 +203,8 @@ class YHSheetPickerView: UIView {
// 性别
.gender:
[YHSheetPickerViewItem(title:"男".local, index:0),
YHSheetPickerViewItem(title:"女".local, index:1),
[YHSheetPickerViewItem(title:"男".local, index:1),
YHSheetPickerViewItem(title:"女".local, index:2),
],
// 证件
......@@ -272,7 +273,6 @@ class YHSheetPickerView: UIView {
YHSheetPickerViewItem(title:"其他".local, index:10),
],
]
}()
func createUI() {
......@@ -370,7 +370,7 @@ extension YHSheetPickerView {
// 返回所在行的数据
func getPickerViewItem(row:Int) -> YHSheetPickerViewItem? {
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
for (index, item) in arr.enumerated() {
if index == row {
return item
......@@ -382,7 +382,7 @@ extension YHSheetPickerView {
// 返回对应index的数据所在行
func getRowOfPickerViewItem(index:Int) -> Int {
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
for (row, item) in arr.enumerated() {
if item.index == index {
return row
......@@ -396,7 +396,7 @@ extension YHSheetPickerView {
func getRowOfPickerViewItem(title:String?) -> Int {
guard let title = title else { return 0 }
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
for (row, item) in arr.enumerated() {
if item.title == title {
return row
......@@ -406,6 +406,29 @@ extension YHSheetPickerView {
return 0
}
// 根据index获取item
static func getItem(type:YHSheetPickerViewType, index:Int)-> YHSheetPickerViewItem? {
if let arr = dataSource[type], arr.count > 0 {
for item in arr {
if item.index == index {
return item
}
}
}
return nil
}
// 根据名称获取item
static func getItem(type:YHSheetPickerViewType, title:String)-> YHSheetPickerViewItem? {
if let arr = dataSource[type], arr.count > 0 {
for item in arr {
if item.title == title {
return item
}
}
}
return nil
}
}
// MARK: - UIPickerViewDelegate
......@@ -416,14 +439,14 @@ extension YHSheetPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
if let arr = dataSource[type], !arr.isEmpty {
if let arr = Self.dataSource[type], !arr.isEmpty {
return arr.count
}
return 0
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
if 0 <= row && row < arr.count {
let item :YHSheetPickerViewItem = arr[row]
return item.title
......@@ -433,7 +456,7 @@ extension YHSheetPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
if 0 <= row && row < arr.count {
let item :YHSheetPickerViewItem = arr[row]
print(item.title)
......@@ -458,7 +481,7 @@ extension YHSheetPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
label.numberOfLines = 2
label.font = UIFont.PFSC_R(ofSize: 14)
label.text = ""
if let arr = dataSource[type] {
if let arr = Self.dataSource[type] {
if 0 <= row && row < arr.count {
let item :YHSheetPickerViewItem = arr[row]
label.text = item.title
......
......@@ -50,31 +50,24 @@ class YHAllApiName {
struct Family {
// 获取家庭成员信息 添加家庭成员也用这个
// static let familyInfoApi = "frontend/order/information/family"
static let familyInfoApi = "infoflow/information/family"
// 删除家庭成员信息
static let deleteFamilyMemberApi = "infoflow/family/delete"
// 提交家庭成员信息
static let submitAllFamilyInfoApi = "family/submit"
static let submitAllFamilyInfoApi = "/infoflow/family/submit"
}
struct Education {
// 获取教育和专业资格列表
static let getEducationAndQulificationInfoListApi = "infoflow/getEducationList"
// 获取学历详情信息
static let getEducationDetailInfoApi = "infoflow/getEducationDetail"
// 保存学历信息
static let saveEducationInfoApi = "infoflow/saveEducationData"
// 删除学历
static let deleteEducationInfoApi = "infoflow/delEducationData"
// 保存所有信息
static let saveAllEduAndQuaInfoApi = "infoflow/submitEducert"
// 搜索大学名称
static let searchCollegeNameApi = "infoflow/getSchools"
......
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