Commit 9d940893 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:
  // UI走查
  //  UI走查
  // UI走查
  颁发地区修改
  // UI走查
  // 证件信息UI走查
  导航栏 修改
parents 4033a1bf 9b33d87c
......@@ -143,7 +143,6 @@
045EEEF82B9F171A0022A143 /* YHFormItemOnlyDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE3F2B9F171A0022A143 /* YHFormItemOnlyDoubleChoiceCell.swift */; };
045EEEF92B9F171A0022A143 /* YHFormItemTitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE402B9F171A0022A143 /* YHFormItemTitleCell.swift */; };
045EEEFA2B9F171A0022A143 /* YHFormPickerViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE422B9F171A0022A143 /* YHFormPickerViewType.swift */; };
045EEEFB2B9F171A0022A143 /* YHFormPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE432B9F171A0022A143 /* YHFormPickerView.swift */; };
045EEEFC2B9F171A0022A143 /* YHSheetPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE442B9F171A0022A143 /* YHSheetPickerView.swift */; };
045EEEFD2B9F171A0022A143 /* YHSheetPickerViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE452B9F171A0022A143 /* YHSheetPickerViewType.swift */; };
045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EEE462B9F171A0022A143 /* YHFormItemInputTextCell.swift */; };
......@@ -511,7 +510,6 @@
045EEE3F2B9F171A0022A143 /* YHFormItemOnlyDoubleChoiceCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFormItemOnlyDoubleChoiceCell.swift; sourceTree = "<group>"; };
045EEE402B9F171A0022A143 /* YHFormItemTitleCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFormItemTitleCell.swift; sourceTree = "<group>"; };
045EEE422B9F171A0022A143 /* YHFormPickerViewType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFormPickerViewType.swift; sourceTree = "<group>"; };
045EEE432B9F171A0022A143 /* YHFormPickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFormPickerView.swift; sourceTree = "<group>"; };
045EEE442B9F171A0022A143 /* YHSheetPickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSheetPickerView.swift; sourceTree = "<group>"; };
045EEE452B9F171A0022A143 /* YHSheetPickerViewType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSheetPickerViewType.swift; sourceTree = "<group>"; };
045EEE462B9F171A0022A143 /* YHFormItemInputTextCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFormItemInputTextCell.swift; sourceTree = "<group>"; };
......@@ -1213,7 +1211,6 @@
isa = PBXGroup;
children = (
045EEE422B9F171A0022A143 /* YHFormPickerViewType.swift */,
045EEE432B9F171A0022A143 /* YHFormPickerView.swift */,
045EEE442B9F171A0022A143 /* YHSheetPickerView.swift */,
045EEE452B9F171A0022A143 /* YHSheetPickerViewType.swift */,
);
......@@ -2289,7 +2286,6 @@
045EEF152B9F171A0022A143 /* YHHKIDCardModel.swift in Sources */,
0477E17E2BA4362A00436346 /* YHCustomNavigationBar.swift in Sources */,
045EEEC42B9F171A0022A143 /* YHOtherInfoFillCell.swift in Sources */,
045EEEFB2B9F171A0022A143 /* YHFormPickerView.swift in Sources */,
045EEE9F2B9F171A0022A143 /* YHWorkExperienceModel.swift in Sources */,
045EEF232B9F171A0022A143 /* YHItemView.swift in Sources */,
04754A952B96FF3D00F8ADCA /* UITextField+Extension.swift in Sources */,
......@@ -2623,7 +2619,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -2665,7 +2661,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......
......@@ -16,12 +16,9 @@ class YHMineSchemeViewController: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
gk_navBarAlpha = 1
gk_navBackgroundImage = UIImage(named: "my_scheme_nav")
gk_darkNavBackgroundImage = UIImage(named: "my_scheme_nav")
gk_navShadowImage = UIImage(named: "my_scheme_nav")
gk_darkNavShadowImage = UIImage(named: "my_scheme_nav")
gk_backImage = UIImage(named: "my_scheme_nav")
gk_darkBackImage = UIImage(named: "my_scheme_nav")
gk_backImage = UIImage(named: "nav_icon_back")
}
......
......@@ -107,43 +107,35 @@ class YHEducationDetailVC: YHBaseViewController {
let title0 = YHFormTitleItem(type: .mainApplicantEducation)
let item00 = YHFormDetailItem(type: .universityFullName)
item00.placeHolder = "请选择学校".local
item00.tips = "请选择学校".local
item00.value = detailInfo.college
let item01 = YHFormDetailItem(type: .educationStyle)
item01.placeHolder = "请选择授课形式".local
item01.tips = "请选择授课形式".local
item01.value = detailInfo.teachingFormat
let item02 = YHFormDetailItem(type: .educationTime)
item02.placeHolder = "请选择年月".local
item02.tips = "请选择年月".local
item02.value = detailInfo.admissionTime
let item03 = YHFormDetailItem(type: .graduateTime)
item03.placeHolder = "请选择年月".local
item03.tips = "请选择年月".local
item03.value = detailInfo.graduateTime
let item04 = YHFormDetailItem(type: .educationMajor)
item04.placeHolder = "请输入专业".local
item04.tips = "请输入专业".local
item04.value = detailInfo.major
let item05 = YHFormDetailItem(type: .educationDegree)
item05.placeHolder = "请选择学位".local
item05.tips = "请选择学位".local
item05.value = detailInfo.degree
let item06 = YHFormDetailItem(type: .degreeType)
item06.placeHolder = "请选择学位类型".local
item06.tips = "请选择学位类型".local
item06.value = detailInfo.degreeType
let item07 = YHFormDetailItem(type: .educationCountry)
item07.placeHolder = "请输入国家及地区".local
item07.tips = "请输入国家及地区".local
item07.value = detailInfo.schoolAddress.country
......@@ -152,14 +144,10 @@ class YHEducationDetailVC: YHBaseViewController {
if detailInfo.isSchoolInAboard() {
item08.value = detailInfo.schoolAddress.foreign
item08.tips = "请输入城市".local
item08.placeHolder = "请输入城市".local
item08.tips = "请输入城市".local
} else {
item08.value = detailInfo.schoolAddress.area.joined(separator: ",")
item08.tips = "请选择城市".local
item08.placeHolder = "请选择城市".local
item08.tips = "请选择城市".local
}
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02, item03, item04, item05, item06, item07, item08]
......
......@@ -315,9 +315,10 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
} else {
cell.title = "学历标题".local
}
cell.detailLabel.text = String(format: "有%d项未填", eduInfo.vacantNum)
let tips = String(format: "有%d项未填", eduInfo.vacantNum)
cell.detailLabel.text = tips
cell.isShowDeleteBtn = (isDegreeEditMode == .canCancel)
cell.detailLabel.textColor = (isNeedShowError && eduInfo.vacantNum > 0 ? .failColor : .labelTextColor2)
cell.setTips(tips, isShow:(isNeedShowError && eduInfo.vacantNum > 0))
cell.deleteBlock = {
var title = "确定要删除该学历吗?"
YHTwoOptionAlertView.showAlertView(message:title) {
......@@ -366,12 +367,15 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
if let qualification = quaInfo.qualification, !qualification.isEmpty {
cell.title = qualification
}
var tips = ""
if quaInfo.vacantNum > 0 {
cell.detailLabel.text = String(format: "有%d项未填", quaInfo.vacantNum)
tips = String(format: "有%d项未填", quaInfo.vacantNum)
cell.detailLabel.text = tips
} else {
cell.detailLabel.text = "已填完".local
}
cell.detailLabel.textColor = (isNeedShowError && quaInfo.vacantNum > 0 ? .failColor : .labelTextColor2)
cell.setTips(tips, isShow:(isNeedShowError && quaInfo.vacantNum > 0))
cell.isShowDeleteBtn = (isQualificationEditMode == .canCancel)
cell.deleteBlock = {
var title = "确定要删除该证书吗?"
......
......@@ -104,34 +104,28 @@ class YHQualificationDetailVC: YHBaseViewController {
let title0 = YHFormTitleItem(type: .mainApplicantProfessionalQualification)
let item00 = YHFormDetailItem(type: .qualificationCertificateName)
item00.placeHolder = "请选择资格证书名称".local
item00.tips = "请选择资格证书名称".local
item00.value = detailInfo.certName
let item01 = YHFormDetailItem(type: .conferAgencyFullName)
item01.placeHolder = "请输入颁授机构".local
item01.tips = "请输入颁授机构".local
item01.value = detailInfo.issuingAgent
let item02 = YHFormDetailItem(type: .conferTime)
item02.placeHolder = "请选择颁授年份".local
item02.tips = "请选择颁授年份".local
if detailInfo.issuingYear > 0 {
item02.value = String(detailInfo.issuingYear)
}
let item03 = YHFormDetailItem(type: .conferCountry)
item03.placeHolder = "请选择颁授国家/地区".local
item03.tips = "请选择颁授国家/地区".local
item03.value = detailInfo.issuingAddr.country
let item04 = YHFormDetailItem(type: .conferCity)
if detailInfo.isCollegeInAboard() {
item04.placeHolder = "请输入颁授城市".local
item04.tips = "请输入颁授城市".local
item04.value = detailInfo.issuingAddr.foreign
} else {
item04.placeHolder = "请选择颁授城市".local
item04.tips = "请选择颁授城市".local
item04.value = detailInfo.issuingAddr.area.joined(separator: ",")
}
......
......@@ -138,8 +138,35 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
let titleItem = item as! YHFormTitleItem
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.setTitleAndSubTitle(title:item.getTitle())
var isNeedText = ""
if titleItem.type == .chinaIdCardInfo {
if let familyMember = familyMember {
let isChinaCardMust = familyMember.isChinese() && familyMember.relationType != .child
isNeedText = isChinaCardMust ? "(必填)" : "(选填)"
}
} else if titleItem.type == .hkAndMacaoPassport {
if let familyMember = familyMember {
isNeedText = familyMember.isNeedHandleHKPassPort() ? "(必填)" : "(选填)"
}
} else if titleItem.type == .passPortOrTravelInfo {
if let familyMember = familyMember {
let isPassPortMust = !familyMember.isChinese()
isNeedText = isPassPortMust ? "(必填)" : "(选填)"
}
}
var title = ""
if isNeedText.isEmpty {
title = item.getTitle()
} else {
title = "\(item.getTitle())\(isNeedText)"
}
cell.setTitleAndSubTitle(title: title)
return cell
}
......
......@@ -165,12 +165,14 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
}
if detailItem.type == .isAccompanyToHK
|| detailItem.type == .isHandleHKPassPort
|| detailItem.type == .isLiveTother
|| detailItem.type == .isLiveOverSeasMore1Year
|| detailItem.type == .ownCustody
{
return .twoChoice
}
if detailItem.type == .ownCustody
|| detailItem.type == .isLiveTother
|| detailItem.type == .isLiveOverSeasMore1Year{
return .question
}
}
return .defaultType
}
......@@ -249,17 +251,6 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
self.child?.setNeedHandleHKPassPort(option)
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
self.child?.setLiveTother(option)
if option {
self.child?.address.clearAddress()
}
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
self.child?.setOverSearsOver1Year(option)
} else if detailItem.type == .ownCustody { // 抚养权
self.child?.setOwnCustody(option)
}
self.loadInfo()
save()
......@@ -308,7 +299,43 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
}
return cell
} else if cellType == .question {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemQuestionsCell.cellReuseIdentifier, for: indexPath) as! YHFormItemQuestionsCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
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] (arr, selectIndex) in
let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? true : false)
guard let self = self else { return }
if detailItem.type == .isLiveTother { // 是否与主申请人同住
self.child?.setLiveTother(option)
if option {
self.child?.address.clearAddress()
}
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
self.child?.setOverSearsOver1Year(option)
} else if detailItem.type == .ownCustody { // 抚养权
self.child?.setOwnCustody(option)
}
self.loadInfo()
save()
}
return cell
}
}
......
......@@ -19,6 +19,7 @@ enum HKFormItemCellType: Int {
case addItem = 6
case degreeDetailInfo = 7
case onlyTwoChoice = 8
case question = 9
}
......
......@@ -38,6 +38,7 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
tableView.register(YHFormItemDoubleChoiceCell.self, forCellReuseIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier)
tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier)
tableView.register(YHFormItemSelectSheetCell.self, forCellReuseIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier)
tableView.register(YHFormItemQuestionsCell.self, forCellReuseIdentifier: YHFormItemQuestionsCell.cellReuseIdentifier)
tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier)
tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier)
return tableView
......@@ -167,7 +168,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let detailItem = item as! YHFormDetailItem
// 是否随行到香港 / 是否办理港澳通行证 / // 是否与主申请人同住 均用双项按钮cell
if detailItem.type == .isAccompanyToHK || detailItem.type == .isHandleHKPassPort || detailItem.type == .isLiveTother || detailItem.type == .isLiveOverSeasMore1Year {
if detailItem.type == .isAccompanyToHK || detailItem.type == .isHandleHKPassPort || detailItem.type == .isLiveTother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed
......@@ -215,7 +216,34 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
save()
}
return cell
}
if detailItem.type == .isLiveOverSeasMore1Year {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemQuestionsCell.cellReuseIdentifier, for: indexPath) as! YHFormItemQuestionsCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
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] (arr, selectIndex) in
guard let self = self else { return }
let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? true : false)
if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
self.spouse?.setOverSearsOver1Year(option)
self.loadInfo()
}
save()
}
return cell
}
if detailItem.type == .nationOrArea || detailItem.type == .liveCity {
......
......@@ -265,7 +265,7 @@ class YHFormTitleItem : YHFormItemProtocol {
case .chinaIdCardInfo:
return "中国身份证".local
case .passPortOrTravelInfo:
return String(format: "%@(%@)", "护照及其他旅行证件".local, "选填".local)
return "护照及其他旅行证件".local
case .spouseInfo:
return "配偶信息".local
case .occupationInfo:
......
//
// YHFormPickerView.swift
// galaxy
//
// Created by edy on 2024/1/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
// 【 用法 Usage】
/*
// (1) 直接传type
YHFormPickerView.show(type: .certificate, selectType: .certificate(.otherStatelessTravelPassport)) { selectType in
// 选择类型的标题
print(selectType.title)
}
// (2) 直接传字符串值
YHFormPickerView.show(type: .certificate, selectTitle: "公务通行证") { selectType in
// 选择类型的标题
print(selectType.title)
}
// 【扩展新类型】
1)先增加一个YHFormPickerViewType类型
2)再扩展其关联类型 YHFormPickerViewSubType
3)补充新增类型后的方法 YHFormPickerView的getSubType方法 YHFormPickerViewSubType的title和index方法
4)填充数据源 详情见 属性 dataDict 懒加载方法
*/
import UIKit
class YHFormPickerViewItem {
let type: YHFormPickerViewSubType
lazy var title = {
return type.title
}()
init(type: YHFormPickerViewSubType) {
self.type = type
}
}
class YHFormPickerView: UIView {
let type: YHFormPickerViewType
private var selectType:YHFormPickerViewSubType?
private var selectTitle:String? {
didSet {
let type:YHFormPickerViewSubType = getSubType(selectTitle)
selectType = type
}
}
private var selectBlock:((YHFormPickerViewSubType)->Void)?
var title: String? {
didSet {
titleLabel.text = title
}
}
lazy var pickerView:UIPickerView = {
let view = UIPickerView()
view.dataSource = self
view.delegate = self
return view
}()
lazy var blackMaskView: UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
let tap = UITapGestureRecognizer(target: self, action: #selector(dismiss))
view.addGestureRecognizer(tap)
return view
}()
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
lazy var topView:UIView = {
let view = UIView()
view.addSubview(titleLabel)
view.addSubview(cancelBtn)
view.addSubview(confirmBtn)
titleLabel.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
cancelBtn.snp.makeConstraints { make in
make.left.top.bottom.equalToSuperview()
make.width.equalTo(60)
}
confirmBtn.snp.makeConstraints { make in
make.right.top.bottom.equalToSuperview()
make.width.equalTo(60)
}
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize: 16)
label.text = "请选择"
return label
}()
lazy var cancelBtn: UIButton = {
let btn = UIButton()
btn.setTitle("取消".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(UIColor.mainTextColor, for: .normal)
btn.addTarget(self, action: #selector(didClickCancelButton), for: .touchUpInside)
return btn
}()
lazy var confirmBtn: UIButton = {
let btn = UIButton()
btn.setTitle("确定".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(UIColor(hex: 0x4487F9), for: .normal)
btn.addTarget(self, action: #selector(didClickConfirmButton), for: .touchUpInside)
return btn
}()
lazy var dataDict:[ YHFormPickerViewType: [YHFormPickerViewItem]] = {
return [
// 此处顺序需遵循 YHFormPickerViewType 枚举顺序
// 默认无
.none:[],
// 学位
.degree:
[YHFormPickerViewItem(type: .degree(.bachelor)),
YHFormPickerViewItem(type: .degree(.master)),
YHFormPickerViewItem(type: .degree(.doctor))],
// 婚姻
.marriage:
[YHFormPickerViewItem(type: .marriage(.unmarriage)),
YHFormPickerViewItem(type: .marriage(.marriaged)),
YHFormPickerViewItem(type: .marriage(.divorced)),
YHFormPickerViewItem(type: .marriage(.separated)),
YHFormPickerViewItem(type: .marriage(.widowed))],
// 教育
.edution:
[YHFormPickerViewItem(type: .education(.fullTime)),
YHFormPickerViewItem(type: .education(.partTime)),
YHFormPickerViewItem(type: .education(.distanceCourses))],
// 职业
.occupation:
[YHFormPickerViewItem(type: .occupation(.onTheJob)),
YHFormPickerViewItem(type: .occupation(.retire)),
YHFormPickerViewItem(type: .occupation(.unemployed)),
YHFormPickerViewItem(type: .occupation(.student))],
// 职业2
.profession:
[YHFormPickerViewItem(type: .profession(.enterpriseManagerSenior)),
YHFormPickerViewItem(type: .profession(.enterpriseManagerJunior)),
YHFormPickerViewItem(type: .profession(.startOwnBusiness)),
YHFormPickerViewItem(type: .profession(.generalStaff)),
YHFormPickerViewItem(type: .profession(.professionals)),
YHFormPickerViewItem(type: .profession(.selfEmployed)),
YHFormPickerViewItem(type: .profession(.governmentEmployee)),
YHFormPickerViewItem(type: .profession(.student)),
YHFormPickerViewItem(type: .profession(.houseWife)),
YHFormPickerViewItem(type: .profession(.retirees)),
YHFormPickerViewItem(type: .profession(.graduates)),
YHFormPickerViewItem(type: .profession(.other))],
// 性别
.gender:
[YHFormPickerViewItem(type: .gender(.male)),
YHFormPickerViewItem(type: .gender(.female))],
// 证件
.certificate:
[YHFormPickerViewItem(type: .certificate(.passport)),
YHFormPickerViewItem(type: .certificate(.diplomaticPassport)),
YHFormPickerViewItem(type: .certificate(.officialPassport)),
YHFormPickerViewItem(type: .certificate(.chineseStatelessTravelPassport)),
YHFormPickerViewItem(type: .certificate(.travelPassport)),
YHFormPickerViewItem(type: .certificate(.unitedNationsPassport)),
YHFormPickerViewItem(type: .certificate(.otherStatelessTravelPassport)),
YHFormPickerViewItem(type: .certificate(.other))],
// 在港身份
.identity:
[YHFormPickerViewItem(type: .identity(.student)),
YHFormPickerViewItem(type: .identity(.employment)),
YHFormPickerViewItem(type: .identity(.residence)),
YHFormPickerViewItem(type: .identity(.visit)),
YHFormPickerViewItem(type: .identity(.other))],
// 是否拥有学位
.ownDegree:
[YHFormPickerViewItem(type: .ownDegree(.noDegree)),
YHFormPickerViewItem(type: .ownDegree(.hasDegree))],
// 学位颁发地区
.degreeLocation:
[YHFormPickerViewItem(type: .degreeLocation(.domestic)),
YHFormPickerViewItem(type: .degreeLocation(.forgin))],
// 专业证书
.professionCertificate:
[YHFormPickerViewItem(type: .professionCertificate(.CFA)),
YHFormPickerViewItem(type: .professionCertificate(.CFP)),
YHFormPickerViewItem(type: .professionCertificate(.FRM)),
YHFormPickerViewItem(type: .professionCertificate(.FIA)),
YHFormPickerViewItem(type: .professionCertificate(.CPA)),
YHFormPickerViewItem(type: .professionCertificate(.CIIA)),
YHFormPickerViewItem(type: .professionCertificate(.RFC)),
YHFormPickerViewItem(type: .professionCertificate(.ACCA)),
YHFormPickerViewItem(type: .professionCertificate(.CIA)),
YHFormPickerViewItem(type: .professionCertificate(.CMA)),
YHFormPickerViewItem(type: .professionCertificate(.CQF)),
YHFormPickerViewItem(type: .professionCertificate(.CIMA)),
YHFormPickerViewItem(type: .professionCertificate(.ACA))],
// 学位类型
.degreeCategory:
[YHFormPickerViewItem(type: .degreeCategory(.accountantOrFinance)),
YHFormPickerViewItem(type: .degreeCategory(.artOrLiterature)),
YHFormPickerViewItem(type: .degreeCategory(.businessManagement)),
YHFormPickerViewItem(type: .degreeCategory(.economics)),
YHFormPickerViewItem(type: .degreeCategory(.engineering)),
YHFormPickerViewItem(type: .degreeCategory(.electronicOrSoftwareEngineering)),
YHFormPickerViewItem(type: .degreeCategory(.laws)),
YHFormPickerViewItem(type: .degreeCategory(.lifeSciencesOrMedicine)),
YHFormPickerViewItem(type: .degreeCategory(.management)),
YHFormPickerViewItem(type: .degreeCategory(.NeoConfucianism)),
YHFormPickerViewItem(type: .degreeCategory(.socialScience)),
YHFormPickerViewItem(type: .degreeCategory(.others))],
]
}()
init(type: YHFormPickerViewType) {
self.type = type
super.init(frame: UIScreen.main.bounds)
self.createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func show() {
showSelectType(&selectType)
UIApplication.shared.yhKeyWindow()?.addSubview(self)
}
static func show(type:YHFormPickerViewType, selectType:YHFormPickerViewSubType? = nil, callBack: @escaping ((YHFormPickerViewSubType)->Void)) {
let picker = YHFormPickerView(type: type)
picker.selectType = selectType
picker.selectBlock = callBack
picker.show()
}
static func show(type:YHFormPickerViewType, selectTitle:String?, callBack: @escaping ((YHFormPickerViewSubType)->Void)) {
let picker = YHFormPickerView(type: type)
picker.selectTitle = selectTitle
picker.selectBlock = callBack
picker.show()
}
@objc func dismiss() {
self.removeFromSuperview()
}
func createUI() {
self.addSubview(blackMaskView)
self.addSubview(whiteContentView)
whiteContentView.addSubview(topView)
whiteContentView.addSubview(pickerView)
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(16.0, 16.0));
let layer = CAShapeLayer();
layer.frame = whiteContentView.bounds;
layer.path = path.cgPath;
whiteContentView.layer.mask = layer;
if let title = title {
titleLabel.text = title
} else {
titleLabel.text = getTitle(type: type)
}
blackMaskView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
whiteContentView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalToSuperview().offset(KScreenHeight*2/3.0)
}
topView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(52)
}
pickerView.snp.makeConstraints { make in
make.top.equalTo(topView.snp.bottom)
make.left.right.bottom.equalToSuperview()
}
}
@objc func didClickCancelButton() {
dismiss()
}
@objc func didClickConfirmButton() {
if let selectBlock = selectBlock {
if let selectType = selectType {
selectBlock(selectType)
} else {
// 默认选中第一行
let arr = dataDict[type]
if let arr = arr, !arr.isEmpty {
let item:YHFormPickerViewItem = arr[0]
selectType = item.type
selectBlock(item.type)
}
}
}
dismiss()
}
func showSelectType(_ selectType: inout YHFormPickerViewSubType?) {
// 处理从外部传入的选中第几行的参数
// 是否找到选中行数据
var selectIndex:Int = -1
if let selectType = selectType, let arr = dataDict[type], !arr.isEmpty {
for (index, item) in arr.enumerated() {
if selectType.index == item.type.index {
selectIndex = index
break
}
}
}
if selectIndex != -1 { // 找到了选择行
pickerView.selectRow(selectIndex, inComponent: 0, animated: true)
} else { // 未找到选中行数据则滚动至第一行
if dataDict[type]?.isEmpty == true { return }
if let arr = dataDict[type], !arr.isEmpty {
let item = arr[0]
selectType = item.type
pickerView.selectRow(0, inComponent: 0, animated: true)
}
}
}
func getTitle(type: YHFormPickerViewType)-> String {
switch type {
case .none:
return ""
case .degree:
return "选择学位"
case .marriage:
return "选择婚姻状况"
case .edution:
return "选择学位"
case .occupation:
return "选择职业"
case .gender:
return "选择性别"
case .certificate:
return "选择证件"
case .identity:
return "选择在港身份"
case .ownDegree:
return "是否拥有学位"
case .degreeLocation:
return "选择学位"
case .profession:
return "职业"
case .professionCertificate:
return "选择证书名称"
case .degreeCategory:
return "选择学位类型"
}
}
}
extension YHFormPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
if let arr = dataDict[type], !arr.isEmpty {
return arr.count
}
return 0
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if let arr = dataDict[type] {
if 0 <= row && row < arr.count {
let item :YHFormPickerViewItem = arr[row]
return item.title
}
}
return ""
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if let arr = dataDict[type] {
if 0 <= row && row < arr.count {
let item :YHFormPickerViewItem = arr[row]
print(item.title)
selectType = item.type
}
}
}
func rowSize(forComponent component: Int) -> CGSize {
return CGSize(width: KScreenWidth, height: 250)
}
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize: 14)
label.text = ""
if let arr = dataDict[type] {
if 0 <= row && row < arr.count {
let item :YHFormPickerViewItem = arr[row]
label.text = item.title
}
}
// 选中背景色
if #available(iOS 14.0, *), pickerView.subviews.count > 1 {
pickerView.subviews[1].backgroundColor = UIColor(hex: 0x4487F9, alpha: 0.06)
}
return label
}
}
extension YHFormPickerView {
func getSubType(_ title: String?) -> YHFormPickerViewSubType {
guard let title = title, !title.isEmpty else {
if let arr = dataDict[type], arr.count > 0 {
let item0:YHFormPickerViewItem = arr[0]
return item0.type
}
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)
}
case .ownDegree:
if title == "无学位".local {
return .ownDegree(.noDegree)
} else if title == "有学位".local {
return .ownDegree(.hasDegree)
}
case .degreeLocation:
if title == "国内 (颁发)".local {
return .degreeLocation(.domestic)
} else if title == "国外 (颁发)".local {
return .degreeLocation(.forgin)
}
case .profession:
if title.contains("高级管理者") {
return .profession(.enterpriseManagerSenior)
} else if title.contains("包括初、中级层管理者") {
return .profession(.enterpriseManagerJunior)
} else if title.contains("自主创业") {
return .profession(.startOwnBusiness)
} else if title.contains("普通职员") {
return .profession(.generalStaff)
} else if title.contains("专业人员") {
return .profession(.professionals)
} else if title.contains("个体经营/承包商") {
return .profession(.selfEmployed)
} else if title.contains("政府机关干部/公务人员") {
return .profession(.governmentEmployee)
} else if title.contains("在校学生") {
return .profession(.student)
} else if title.contains("家庭主妇") {
return .profession(.houseWife)
} else if title.contains("退休人员") {
return .profession(.retirees)
} else if title.contains("应届毕业生") {
return .profession(.graduates)
} else if title.contains("其他") {
return .profession(.other)
}
case .professionCertificate:
if title.contains("CFA") {
return .professionCertificate(.CFA)
} else if title.contains("CFP") {
return .professionCertificate(.CFP)
} else if title.contains("FRM") {
return .professionCertificate(.FRM)
} else if title.contains("FIA") {
return .professionCertificate(.FIA)
} else if title.contains("CPA") {
return .professionCertificate(.CPA)
} else if title.contains("CIIA") {
return .professionCertificate(.CIIA)
} else if title.contains("RFC") {
return .professionCertificate(.RFC)
} else if title.contains("ACCA") {
return .professionCertificate(.ACCA)
} else if title.contains("CIA") {
return .professionCertificate(.CIA)
} else if title.contains("CMA") {
return .professionCertificate(.CMA)
} else if title.contains("CQF") {
return .professionCertificate(.CQF)
} else if title.contains("CIMA") {
return .professionCertificate(.CIMA)
} else if title.contains("英国皇家特许会计师") {
return .professionCertificate(.ACA)
}
case .degreeCategory:
if title == "会计/金融" {
return .degreeCategory(.accountantOrFinance)
} else if title == "艺术及人文/文学" {
return .degreeCategory(.artOrLiterature)
} else if title == "工商管理" {
return .degreeCategory(.businessManagement)
} else if title == "经济学" {
return .degreeCategory(.economics)
} else if title == "工程学" {
return .degreeCategory(.engineering)
} else if title == "咨询科技/电子及软件工程/数据科学" {
return .degreeCategory(.electronicOrSoftwareEngineering)
} else if title == "法律" {
return .degreeCategory(.laws)
} else if title == "生命科学及医学" {
return .degreeCategory(.lifeSciencesOrMedicine)
} else if title == "管理学" {
return .degreeCategory(.management)
} else if title == "理学" {
return .degreeCategory(.NeoConfucianism)
} else if title == "社会科学" {
return .degreeCategory(.socialScience)
} else if title == "其他" {
return .degreeCategory(.others)
}
}
return .none
}
}
......@@ -175,8 +175,8 @@ class YHSheetPickerView: UIView {
// 婚姻
.marriage:
[YHSheetPickerViewItem(title:"未婚".local, index:0),
YHSheetPickerViewItem(title:"已婚".local, index:1),
[YHSheetPickerViewItem(title:"已婚".local, index:1),
YHSheetPickerViewItem(title:"未婚".local, index:0),
YHSheetPickerViewItem(title:"分居".local, index:2),
YHSheetPickerViewItem(title:"离婚".local, index:3),
YHSheetPickerViewItem(title:"丧偶".local, index:4),
......@@ -186,7 +186,8 @@ class YHSheetPickerView: UIView {
.educationStyle:
[YHSheetPickerViewItem(title:"全日制".local, index:0),
YHSheetPickerViewItem(title:"兼职制".local, index:1),
YHSheetPickerViewItem(title:"遥距课程".local, index:2),
YHSheetPickerViewItem(title:"全日制(遥距课程)".local, index:2),
YHSheetPickerViewItem(title:"兼职制(遥距课程)".local, index:3),
],
// 职业
......@@ -360,7 +361,7 @@ extension YHSheetPickerView {
case .marriage:
return "选择婚姻状况"
case .educationStyle:
return "选择学位"
return "选择授课形式"
case .occupation:
return "选择职业"
case .gender:
......
......@@ -138,7 +138,6 @@ class YHFormItemEnterDetailCell: UITableViewCell {
make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalTo(detailLabel.snp.left).offset(-8)
make.height.equalTo(20)
}
detailLabel.snp.makeConstraints { make in
......
......@@ -84,6 +84,7 @@ class YHFormItemSelectSheetCell: UITableViewCell {
let label = UILabel()
label.textColor = detailColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_M(ofSize: 14)
return label
}()
......@@ -105,7 +106,6 @@ class YHFormItemSelectSheetCell: UITableViewCell {
let label = UILabel()
label.textColor = .failColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 12)
label.isHidden = true
return label
......@@ -170,6 +170,8 @@ class YHFormItemSelectSheetCell: UITableViewCell {
}
setTips("", isShow: false)
tipsButton.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
}
@objc func didTipsButtonClicked() {
......@@ -183,14 +185,14 @@ class YHFormItemSelectSheetCell: UITableViewCell {
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.top.equalTo(titleLabel.snp.bottom).offset(6)
make.top.equalTo(detailLabel.snp.bottom).offset(6)
make.bottom.equalToSuperview().offset(-16)
}
} else {
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.top.equalTo(titleLabel.snp.bottom)
make.top.equalTo(detailLabel.snp.bottom)
make.height.equalTo(0)
make.bottom.equalToSuperview().offset(-16)
}
......
......@@ -114,7 +114,7 @@ class YHAddressPickView: UIView {
private let titleLabel: UILabel = {
let label = UILabel(frame: CGRect(x: (UIScreen.main.bounds.width - 150) / 2, y: 16, width: 150, height: 24))
label.textColor = UIColor.mainTextColor
label.text = "选择国家地区"
label.text = "选择省市地区"
label.textAlignment = .center
label.font = UIFont.PFSC_M(ofSize: 17)
return label
......
......@@ -364,8 +364,8 @@ class YHConstantArrayData {
//学位颁发地
static let arrDegreeAddress = [
[ "id": "0", "title": "国内(颁发)" ],
[ "id": "1", "title": "国外(颁发)" ],
[ "id": "1", "title": "国内(颁发)" ],
[ "id": "2", "title": "国外(颁发)" ],
]
//通过 id 获取 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