Commit e98bba03 authored by Steven杜宇's avatar Steven杜宇

// 配偶信息

parent c695d434
......@@ -66,7 +66,7 @@ class YHConsortFormVC: YHBaseViewController {
func loadData() {
var item1 = YHTableItemInfo(type: .accompany)
let item1 = YHTableItemInfo(type: .accompany)
let item2 = YHTableItemInfo(type: .country)
let item3 = YHTableItemInfo(type: .address)
let item4 = YHTableItemInfo(type: .hongkongMacaouPassport)
......@@ -127,88 +127,74 @@ extension YHConsortFormVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section >= items.count { return 0 }
let item:YHTableItemInfo = items[section]
switch item.type {
case .accompany:
return 2
case .country:
return 2
case .address:
if !item.isAccompany {
return 3
}
return 1
case .hongkongMacaouPassport:
return 1
}
return item.getSubItems().count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
createCorner(cell: cell, indexPath: indexPath)
cell.title = "配偶".local
cell.detailLabel.text = "(如未婚、离婚、丧偶可不填)".local
return cell
} else if indexPath.section == 1 {
if indexPath.section >= items.count { return UITableViewCell() }
let item:YHTableItemInfo = items[indexPath.section]
if indexPath.row >= item.getSubItems().count { return UITableViewCell() }
let subItem:YHTableSubItemInfo = item.getSubItems()[indexPath.row]
switch subItem.type {
if indexPath.row == 0 {
case .subTitle:
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
createCorner(cell: cell, indexPath: indexPath)
cell.titleLabel.text = "子女".local
cell.subTitleLabel.text = "(如无可不填)".local
return cell
} else if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell
createCorner(cell: cell, indexPath: indexPath)
cell.titleLabel.text = item.title
return cell
}
} else if indexPath.section == 2 {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
case .subAcompany:
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
createCorner(cell: cell, indexPath: indexPath)
cell.titleLabel.text = "父母".local
cell.subTitleLabel.text = "(包含已故)".local
cell.question = subItem.title
return cell
} else {
case .subCountry:
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
createCorner(cell: cell, indexPath: indexPath)
cell.isMust = subItem.isMust
cell.title = subItem.title
return cell
}
} else if indexPath.section == 3 {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
case .subIsLiveTogether, .subHongkongMacaouPassport:
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
createCorner(cell: cell, indexPath: indexPath)
cell.titleLabel.text = "兄弟姐妹".local
cell.subTitleLabel.text = "(如无可不填)".local
cell.question = subItem.title
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell
case .subLiveNation, .subLiveCity, .subDetailAddress:
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
createCorner(cell: cell, indexPath: indexPath)
cell.isMust = subItem.isMust
cell.title = subItem.title
return cell
}
}
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
createCorner(cell: cell, indexPath: indexPath)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 80.0
if indexPath.section >= items.count { return 0 }
let item:YHTableItemInfo = items[indexPath.section]
if indexPath.row >= item.getSubItems().count { return 0 }
let subItem = item.getSubItems()[indexPath.row]
if subItem.type == .subIsLiveTogether ||
subItem.type == .subAcompany ||
subItem.type == .subHongkongMacaouPassport
{ return UITableView.automaticDimension }
return 52.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......
......@@ -24,15 +24,90 @@ public enum YHTableItemType : Int32 {
case hongkongMacaouPassport = 3
}
//表单条目信息
class YHTableItemInfo {
var type:YHTableItemType
var title:String {
return getTitle()
}
init(type: YHTableItemType) {
self.type = type
}
var subTitleItems:[YHTableSubItemInfo]? = Array()
func getTitle()-> String {
switch self.type {
case .accompany:
return "随行".local
case .country:
return "国籍".local
case .address:
return "居住信息".local
case .hongkongMacaouPassport:
return "港澳通信证".local
}
}
func getSubItems()->[YHTableSubItemInfo] {
let item0 = YHTableSubItemInfo(type: .subTitle)
var res = [item0]
switch self.type {
case .accompany:
res.append(YHTableSubItemInfo(type: .subAcompany))
case .country:
res.append(YHTableSubItemInfo(type: .subCountry))
case .address:
let item1 = YHTableSubItemInfo(type: .subIsLiveTogether, isMust: true)
let item2 = YHTableSubItemInfo(type: .subLiveNation, isMust: true)
let item3 = YHTableSubItemInfo(type: .subDetailAddress, isMust: true)
res.append(contentsOf:[item1, item2, item3])
case .hongkongMacaouPassport:
res.append(YHTableSubItemInfo(type: .subHongkongMacaouPassport, isMust: true))
}
return res
}
}
public enum YHTableSubItemType : Int32 {
// 标题
case subTitle = 0
// 是否随行
case subAcompany = 1
// 国籍
case subCountry = 2
/* 居住信息 */
// 是否与主申请人同住
case subIsLiveTogether = 3
// 居住国家/地区
case subLiveNation = 4
// 现居住城市
case subLiveCity = 5
// 详细地址
case subDetailAddress = 6
// 港澳通信证
case subHongkongMacaouPassport = 7
}
class YHTableSubItemInfo {
var type:YHTableSubItemType
// 是否必填
var isMust:Bool
// 是否随行
var isAccompany:Bool = false
// 港澳通信证
......@@ -40,7 +115,6 @@ class YHTableItemInfo {
// 国籍
var nation:String? = ""
/** 居住信息 **/
// 是否与主申请人同住
var isLiveTogether:Bool = false
......@@ -51,19 +125,34 @@ class YHTableItemInfo {
// 现居住详细地址
var liveAddress:String? = ""
func getTitle(_ type:YHTableItemType)-> String {
switch type {
case .accompany:
return "随行".local
case .country:
return "国籍".local
case .address:
return "居住信息".local
case .hongkongMacaouPassport:
return "港澳通信证".local
default:
return ""
}
var title:String {
return getTitle()
}
init(type: YHTableSubItemType, isMust:Bool = true) {
self.type = type
self.isMust = isMust
}
func getTitle()-> String {
switch self.type {
case .subTitle:
return "".local
case .subAcompany:
return "是否随行至香港".local
case .subCountry:
return "国家/地区".local
case .subIsLiveTogether:
return "是否与主申请人同住".local
case .subLiveNation:
return "国家/地区".local
case .subLiveCity:
return "现居住城市".local
case .subDetailAddress:
return "现居住地址".local
case .subHongkongMacaouPassport:
return "是否办理".local
}
}
}
......@@ -127,6 +127,11 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
if (indexPath.row >= items.count) { return }
let vvc = YHFamilyMemberFormVC()
self.navigationController?.pushViewController(vvc)
return
let item: PersonalModuleItem = items[indexPath.row];
if item.title == "关于我们" {
......
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