Commit 6d71746f authored by Steven杜宇's avatar Steven杜宇

// 家庭成员

parent 2f1277ef
......@@ -100,7 +100,7 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
item07.tips = "请输入出生城市".local
} else {
item07.value = child.birthPlace.area?.joined(separator: ",")
item07.value = child.birthPlace.area.joined(separator: ",")
item07.placeHolder = "请选择出生城市".local
item07.tips = "请选择出生城市".local
}
......@@ -279,7 +279,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
self.child?.surname = text ?? ""
} else if detailItem.type == .birthCity {
self.child?.birthPlace.foreign = text
self.child?.birthPlace.foreign = text ?? ""
} else if detailItem.type == .occupationName {
self.child?.occupationName = text ?? ""
......
......@@ -83,37 +83,35 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if !child.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea)
item21.value = child.address?.country
item21.value = child.address.country
item21.placeHolder = "请选择".local
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
if let address = child.address {
if let country = address.country, !country.isEmpty {
if !child.address.country.isEmpty {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = country.contains("中国".local)
if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity)
if let area = address.area {
item22.value = area.joined(separator: "/")
}
item22.placeHolder = "请选择城市".local
arr2.append(item22)
}
let item23 = YHFormDetailItem(type: .detailAddress)
item23.value = address.details
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(child.isOverSeasOver1Year())
arr2.append(item24)
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = child.address.country.contains("中国".local)
if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity)
if !child.address.area.isEmpty {
item22.value = child.address.area.joined(separator: "/")
}
item22.placeHolder = "请选择城市".local
arr2.append(item22)
}
let item23 = YHFormDetailItem(type: .detailAddress)
item23.value = child.address.details
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(child.isOverSeasOver1Year())
arr2.append(item24)
}
}
}
......@@ -254,9 +252,9 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
self.child?.setLiveTother(option)
if option {
self.child?.address?.country = nil
self.child?.address?.details = nil
self.child?.address?.area = nil
self.child?.address.country = ""
self.child?.address.details = ""
self.child?.address.area = []
}
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
self.child?.setOverSearsOver1Year(option)
......@@ -289,7 +287,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
if detailItem.type == .detailAddress {
self.child?.address?.details = text
self.child?.address.details = text ?? ""
}
if isEditEnd {
......@@ -384,7 +382,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.child?.nationality = country
} else if title.type == .liveInfo {
self.child?.address?.country = country
self.child?.address.country = country
}
self.loadChildInfo()
......@@ -398,7 +396,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, string4]
self.loadChildInfo()
}
self.present(vc, animated: true)
......@@ -450,13 +448,13 @@ extension YHChildPrimaryInfoVC {
if isEmptyString(child.nationality) {
return false
}
if isEmptyString(child.address?.country) {
if isEmptyString(child.address.country) {
return false
}
if isEmptyString(child.address?.details) {
if isEmptyString(child.address.details) {
return false
}
if child.isBirthOverSeas(), isEmptyArray(child.address?.area) {
if child.isBirthOverSeas(), isEmptyArray(child.address.area) {
return false
}
return true
......
......@@ -113,7 +113,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
item05.tips = "请输入出生城市".local
} else {
item05.value = spouse.birthPlace.area?.joined(separator: ",")
item05.value = spouse.birthPlace.area.joined(separator: ",")
item05.placeHolder = "请选择".local
item05.tips = "请选择出生城市".local
......@@ -386,7 +386,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .befourMarryFirstName {
self.spouse?.surname = text ?? ""
} else if detailItem.type == .birthCity {
self.spouse?.birthPlace.foreign = text
self.spouse?.birthPlace.foreign = text ?? ""
} else if detailItem.type == .occupationName {
self.spouse?.occupationName = text ?? ""
} else if detailItem.type == .hkIdentityCardNumber {
......
......@@ -79,40 +79,38 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if !spouse.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea)
item21.value = spouse.address?.country
item21.value = spouse.address.country
item21.placeHolder = "请选择".local
item21.tips = "请选择国家/地区".local
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
if let address = spouse.address {
if let country = address.country, !country.isEmpty {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = country.contains("中国".local)
if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity)
if let area = address.area {
item22.value = area.joined(separator: "/")
}
item22.placeHolder = "请选择城市".local
item22.tips = "请请选择城市".local
arr2.append(item22)
}
let item23 = YHFormDetailItem(type: .detailAddress)
item23.value = address.details
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
item23.tips = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(spouse.isOverSeasOver1Year())
arr2.append(item24)
if !spouse.address.country.isEmpty {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = spouse.address.country.contains("中国".local)
if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity)
if !spouse.address.area.isEmpty {
item22.value = spouse.address.area.joined(separator: "/")
}
item22.placeHolder = "请选择城市".local
item22.tips = "请请选择城市".local
arr2.append(item22)
}
let item23 = YHFormDetailItem(type: .detailAddress)
item23.value = spouse.address.details
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
item23.tips = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(spouse.isOverSeasOver1Year())
arr2.append(item24)
}
}
}
......@@ -210,9 +208,9 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
self.spouse?.setLiveTother(option)
if option {
self.spouse?.address?.country = nil
self.spouse?.address?.details = nil
self.spouse?.address?.area = nil
self.spouse?.address.country = ""
self.spouse?.address.details = ""
self.spouse?.address.area = []
}
self.loadSponseInfo()
......@@ -248,7 +246,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
self.spouse?.address?.details = text
self.spouse?.address.details = text ?? ""
if isEditEnd {
self.loadSponseInfo()
if let delegate = delegate {
......@@ -338,7 +336,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
self.spouse?.nationality = country
} else if title.type == .liveInfo {
self.spouse?.address?.country = country
self.spouse?.address.country = country
}
self.loadSponseInfo()
......@@ -352,7 +350,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, string4]
self.loadSponseInfo()
}
self.present(vc, animated: true)
......@@ -389,13 +387,13 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if isEmptyString(spouse.nationality) {
return false
}
if isEmptyString(spouse.address?.country) {
if isEmptyString(spouse.address.country) {
return false
}
if isEmptyString(spouse.address?.details) {
if isEmptyString(spouse.address.details) {
return false
}
if spouse.isBirthOverSeas(), isEmptyArray(spouse.address?.area) {
if spouse.isBirthOverSeas(), isEmptyArray(spouse.address.area) {
return false
}
return true
......
......@@ -101,7 +101,7 @@ class YHBrotherInfoVC: YHBaseViewController {
item13.value = brotherInfo.birthPlace.foreign
item13.placeHolder = "请输入".local
} else {
item13.value = brotherInfo.birthPlace.area?.joined(separator: ",")
item13.value = brotherInfo.birthPlace.area.joined(separator: ",")
item13.placeHolder = "请选择".local
}
......@@ -240,13 +240,13 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
self.brotherInfo?.subsetName = text ?? ""
} else if detailItem.type == .birthCity {
self.brotherInfo?.birthPlace.foreign = text
self.brotherInfo?.birthPlace.foreign = text ?? ""
} else if detailItem.type == .occupationName {
self.brotherInfo?.occupationName = text ?? ""
} else if detailItem.type == .hkIdentityCardNumber {
self.brotherInfo?.hkIdentityCard = text
self.brotherInfo?.hkIdentityCard = text ?? ""
}
if isEditEnd {
......
......@@ -129,7 +129,7 @@ class YHParentInfoVC: YHBaseViewController {
item13.placeHolder = "请输入".local
item13.tips = "请输入城市".local
} else {
item13.value = parentInfo.birthPlace.area?.joined(separator: ",")
item13.value = parentInfo.birthPlace.area.joined(separator: ",")
item13.placeHolder = "请选择".local
item13.tips = "请选择城市".local
......@@ -300,7 +300,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
self.parentInfo?.subsetName = text ?? ""
} else if detailItem.type == .birthCity {
self.parentInfo?.birthPlace.foreign = text
self.parentInfo?.birthPlace.foreign = text ?? ""
} else if detailItem.type == .occupationName {
self.parentInfo?.occupationName = text ?? ""
......
......@@ -902,7 +902,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var sex: Int = 0
var married: String = ""
var nows: Int = 0
var address: YHAddress?
var address: YHAddress = YHAddress()
var childStepchild: YHChildStepchildClass = YHChildStepchildClass()
var childInHk: YHChildStepchildClass = YHChildStepchildClass()
var countryIdentity: YHChildStepchildClass = YHChildStepchildClass()
......@@ -1168,10 +1168,10 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
// MARK: - 居住地址信息 YHAddress
class YHAddress: SmartCodable {
var area: [String]?
var country: String?
var details: String?
var foreign: String?
var area: [String] = []
var country: String = ""
var details: String = ""
var foreign: String = ""
enum CodingKeys: String, CodingKey {
case area = "area"
......
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