Commit 94c4f7c9 authored by Steven杜宇's avatar Steven杜宇

// 港澳台地址选择器适配

parent fcb711c2
......@@ -367,11 +367,13 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] country in
guard let self = self else { return }
let title = arr[0] as! YHFormTitleItem
if title.type == .nationality {
if title.type == .nationality { // 选国籍
self.child?.nationality = country
} else if title.type == .liveInfo {
} else if title.type == .liveInfo { // // 居住信息选国家地区
self.child?.address.country = country
// 选择国家地区后需清空城市
self.child?.address.area = []
}
self.loadInfo()
......@@ -381,23 +383,36 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .liveCity {
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)")
var provice = ""
if let country = self.child?.address.country {
if country.contains("台湾") {
provice = "台湾省"
}
if country.contains("香港") {
provice = "香港特别行政区"
}
if country.contains("澳门") {
provice = "澳门特别行政区"
}
}
let addressPicker = YHAddressViewController(selectProvince: provice)
addressPicker.backLocationStringController = {
[weak self] (address,province,city,area) in
guard let self = self else { return }
print("\(address)\n\(province)\n\(city)\n\(area)")
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
if !isEmptyString(province) {
citys.append(province)
}
if !isEmptyString(string3) {
citys.append(string3)
if !isEmptyString(city) {
citys.append(city)
}
self.child?.address.area = citys
self.loadInfo()
save()
}
self.present(vc, animated: true)
self.child?.address.area = citys
self.loadInfo()
save()
}
UIViewController.current?.present(addressPicker, animated: true, completion: nil)
} else if detailItem.type == .birthday { // 出生日期
......
......@@ -326,11 +326,13 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] country in
guard let self = self else { return }
let title = arr[0] as! YHFormTitleItem
if title.type == .nationality {
if title.type == .nationality { // 选国籍
self.spouse?.nationality = country
} else if title.type == .liveInfo {
} else if title.type == .liveInfo {// 居住信息选国家地区
self.spouse?.address.country = country
// 选择国家地区后需清空城市
self.spouse?.address.area = []
}
self.loadInfo()
......@@ -340,23 +342,36 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .liveCity {
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)")
var citys:[String] = []
if !isEmptyString(string2) {
citys.append(string2)
}
if !isEmptyString(string3) {
citys.append(string3)
}
self.spouse?.address.area = citys
self.loadInfo()
save()
}
self.present(vc, animated: true)
var provice = ""
if let country = self.spouse?.address.country {
if country.contains("台湾") {
provice = "台湾省"
}
if country.contains("香港") {
provice = "香港特别行政区"
}
if country.contains("澳门") {
provice = "澳门特别行政区"
}
}
let addressPicker = YHAddressViewController(selectProvince: provice)
addressPicker.backLocationStringController = {
[weak self] (address,province,city,area) in
guard let self = self else { return }
print("\(address)\n\(province)\n\(city)\n\(area)")
var citys:[String] = []
if !isEmptyString(province) {
citys.append(province)
}
if !isEmptyString(city) {
citys.append(city)
}
self.spouse?.address.area = citys
self.loadInfo()
save()
}
UIViewController.current?.present(addressPicker, animated: true, completion: nil)
}
}
......
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