Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
7dfae27b
Commit
7dfae27b
authored
Dec 19, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
高才主申请人
parent
e669ea20
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1465 additions
and
7 deletions
+1465
-7
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+44
-0
YHOrderDetailViewController.swift
...服务中心)/OrderList(服务订单)/C/YHOrderDetailViewController.swift
+8
-3
YHServiceOrderListViewController.swift
.../OrderList(服务订单)/C/YHServiceOrderListViewController.swift
+4
-4
YHGCMainApplicantInformationViewController.swift
...申请人信息)/C/YHGCMainApplicantInformationViewController.swift
+243
-0
YHGCMainInformationCardTableViewCell.swift
...tion(主申请人信息)/V/YHGCMainInformationCardTableViewCell.swift
+476
-0
YHGCMainApplicantInformationViewModel.swift
...on(主申请人信息)/VM/YHGCMainApplicantInformationViewModel.swift
+690
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
7dfae27b
...
...
@@ -7,6 +7,9 @@
objects
=
{
/* Begin PBXBuildFile section */
0411CEDE2D14006C00644D35
/* YHGCMainApplicantInformationViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0411CEDD2D14006C00644D35
/* YHGCMainApplicantInformationViewController.swift */
;
};
0411CEE02D1400C200644D35
/* YHGCMainApplicantInformationViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0411CEDF2D1400C200644D35
/* YHGCMainApplicantInformationViewModel.swift */
;
};
0411CEE22D14014000644D35
/* YHGCMainInformationCardTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0411CEE12D14014000644D35
/* YHGCMainInformationCardTableViewCell.swift */
;
};
045C0F7F2D12CA5F00BD2DC0
/* submit_page_scroll.gif in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045C0F4F2D12CA5E00BD2DC0
/* submit_page_scroll.gif */
;
};
045C0F802D12CA5F00BD2DC0
/* Localizable.xcstrings in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045C0F762D12CA5E00BD2DC0
/* Localizable.xcstrings */
;
};
045C0F812D12CA5F00BD2DC0
/* img_0.png in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045C0F5E2D12CA5E00BD2DC0
/* img_0.png */
;
};
...
...
@@ -1142,6 +1145,9 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0411CEDD2D14006C00644D35
/* YHGCMainApplicantInformationViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCMainApplicantInformationViewController.swift
;
sourceTree
=
"<group>"
;
};
0411CEDF2D1400C200644D35
/* YHGCMainApplicantInformationViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCMainApplicantInformationViewModel.swift
;
sourceTree
=
"<group>"
;
};
0411CEE12D14014000644D35
/* YHGCMainInformationCardTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCMainInformationCardTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
045C09A12D12C2A800BD2DC0
/* YHGCMineSchemeViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCMineSchemeViewController.swift
;
sourceTree
=
"<group>"
;
};
045C0A142D12CA5E00BD2DC0
/* YHBaseViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHBaseViewController.swift
;
sourceTree
=
"<group>"
;
};
045C0A152D12CA5E00BD2DC0
/* YHBaseViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHBaseViewModel.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -2290,6 +2296,40 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0411CED92D14000D00644D35
/* MainApplicantInformation(主申请人信息) */
=
{
isa
=
PBXGroup
;
children
=
(
0411CEDC2D14005C00644D35
/* C */
,
0411CEDB2D14004600644D35
/* V */
,
0411CEDA2D14003F00644D35
/* VM */
,
);
path
=
"MainApplicantInformation(主申请人信息)"
;
sourceTree
=
"<group>"
;
};
0411CEDA2D14003F00644D35
/* VM */
=
{
isa
=
PBXGroup
;
children
=
(
0411CEDF2D1400C200644D35
/* YHGCMainApplicantInformationViewModel.swift */
,
);
path
=
VM
;
sourceTree
=
"<group>"
;
};
0411CEDB2D14004600644D35
/* V */
=
{
isa
=
PBXGroup
;
children
=
(
0411CEE12D14014000644D35
/* YHGCMainInformationCardTableViewCell.swift */
,
);
path
=
V
;
sourceTree
=
"<group>"
;
};
0411CEDC2D14005C00644D35
/* C */
=
{
isa
=
PBXGroup
;
children
=
(
0411CEDD2D14006C00644D35
/* YHGCMainApplicantInformationViewController.swift */
,
);
path
=
C
;
sourceTree
=
"<group>"
;
};
045C0A182D12CA5E00BD2DC0
/* C */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -5882,6 +5922,7 @@
04AE200D2D12CFAF00891D24
/* ServiceProcess(我的信息流程) */
=
{
isa
=
PBXGroup
;
children
=
(
0411CED92D14000D00644D35
/* MainApplicantInformation(主申请人信息) */
,
04AE20092D12CFAF00891D24
/* ApplicationType(申请类别) */
,
04AE200C2D12CFAF00891D24
/* BaseInformation(基本资料) */
,
);
...
...
@@ -6321,6 +6362,7 @@
045C10192D12CA5F00BD2DC0
/* YHVisaRenewalPresenceStatus.swift in Sources */
,
045C101A2D12CA5F00BD2DC0
/* YHActivityDetailCell1.swift in Sources */
,
045C101B2D12CA5F00BD2DC0
/* YHLoginOneLeadView.swift in Sources */
,
0411CEE22D14014000644D35
/* YHGCMainInformationCardTableViewCell.swift in Sources */
,
045C101C2D12CA5F00BD2DC0
/* YHCollectionViewLeftAlignedFlowLayout.swift in Sources */
,
045C101D2D12CA5F00BD2DC0
/* YHHUDProgressView.swift in Sources */
,
045C101E2D12CA5F00BD2DC0
/* YHFailPromptView.swift in Sources */
,
...
...
@@ -6900,6 +6942,7 @@
045C12522D12CA5F00BD2DC0
/* YHVisaRenewalPaymentStatus.swift in Sources */
,
045C12532D12CA5F00BD2DC0
/* YHConfigManager.swift in Sources */
,
045C12542D12CA5F00BD2DC0
/* YHCertificateEntryCell.swift in Sources */
,
0411CEE02D1400C200644D35
/* YHGCMainApplicantInformationViewModel.swift in Sources */
,
045C12552D12CA5F00BD2DC0
/* YHSetExplainView.swift in Sources */
,
045C12562D12CA5F00BD2DC0
/* YHAddressPickView.swift in Sources */
,
045C12572D12CA5F00BD2DC0
/* YHPreviewBasiceInformationViewController.swift in Sources */
,
...
...
@@ -7185,6 +7228,7 @@
045C136F2D12CA5F00BD2DC0
/* YHCommonAlertView.swift in Sources */
,
045C13702D12CA5F00BD2DC0
/* YHUserInfoSettingViewModel.swift in Sources */
,
045C13712D12CA5F00BD2DC0
/* YHBaseCornerRadiusBorderView.swift in Sources */
,
0411CEDE2D14006C00644D35
/* YHGCMainApplicantInformationViewController.swift in Sources */
,
045C13722D12CA5F00BD2DC0
/* YHResignDocumentDetailViewController.swift in Sources */
,
045C13732D12CA5F00BD2DC0
/* YHPlayerManager.swift in Sources */
,
045C13742D12CA5F00BD2DC0
/* YHInterestModel.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/OrderList(服务订单)/C/YHOrderDetailViewController.swift
View file @
7dfae27b
...
...
@@ -462,7 +462,7 @@ class YHOrderDetailTableViewCell: UITableViewCell {
}()
centerView
.
addSubview
(
bottomLineView
)
bottomLineView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
206
)
make
.
bottom
.
equalTo
(
-
52
)
make
.
left
.
right
.
equalToSuperview
()
make
.
height
.
equalTo
(
0.5
)
}
...
...
@@ -476,7 +476,7 @@ class YHOrderDetailTableViewCell: UITableViewCell {
}()
centerView
.
addSubview
(
serviceLabel
)
serviceLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
188.5
)
make
.
top
.
equalTo
(
200
)
make
.
left
.
equalTo
(
16
)
make
.
height
.
equalTo
(
20
)
}
...
...
@@ -491,7 +491,7 @@ class YHOrderDetailTableViewCell: UITableViewCell {
}()
centerView
.
addSubview
(
serviceValueLabel
)
serviceValueLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
188.5
)
make
.
top
.
equalTo
(
200
)
make
.
right
.
equalTo
(
-
16
)
make
.
left
.
equalTo
(
serviceLabel
.
snp
.
right
)
.
offset
(
20
)
}
...
...
@@ -563,6 +563,11 @@ class YHOrderDetailTableViewCell: UITableViewCell {
}
titleLabel
.
text
=
model
.
productName
orderNumLabel
.
text
=
model
.
orderSn
var
title
=
"主申订单"
if
model
.
isOther
{
title
=
"协作订单"
}
orderTitleNumLabel
.
text
=
title
phoneNumLabel
.
text
=
model
.
mobile
nameValueLabel
.
text
=
model
.
username
serviceValueLabel
.
text
=
model
.
service_name
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/OrderList(服务订单)/C/YHServiceOrderListViewController.swift
View file @
7dfae27b
...
...
@@ -255,6 +255,9 @@ class YHServiceOrderListView: YHBaseViewController {
gotoResignCertificateListVC
(
orderID
:
orderId
)
}
else
if
type
==
201
{
//高才我的信息
let
vc
=
YHGCMainApplicantInformationViewController
()
vc
.
orderId
=
orderId
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
else
if
type
==
202
{
//高才我的方案
}
else
if
type
==
203
{
...
...
@@ -498,10 +501,7 @@ extension YHServiceOrderListView : UITableViewDelegate,UITableViewDataSource {
if
model
.
status
==
1
||
model
.
status
==
4
{
return
}
else
{
// let vc = YHGCMainApplicantInformationViewController()
// vc.orderId = orderID
// UIViewController.current?.navigationController?.pushViewController(vc)
// YHServiceOrderListView.jumpToMessageController(type: model.type, orderId: orderID, stepID)
YHServiceOrderListView
.
jumpToMessageController
(
type
:
model
.
type
,
orderId
:
orderID
,
stepID
)
if
model
.
type
==
3
{
//我的评分
handleRedPointFor
(
key
:
kMyScoreRedPointInfoKey
,
model
:
model
)
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/TTPS(高才)/ServiceProcess(我的信息流程)/MainApplicantInformation(主申请人信息)/C/YHGCMainApplicantInformationViewController.swift
0 → 100644
View file @
7dfae27b
//
// YHGCMainApplicantInformationViewController.swift
// galaxy
//
// Created by EDY on 2024/12/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHGCMainApplicantInformationViewController
:
YHBaseViewController
{
var
stepView
:
YHStepView
!
var
bottomView
:
YHBottomNextView
!
var
tableView
:
UITableView
!
var
viewModel
:
YHGCMainApplicantInformationViewModel
!
var
dataSource
:
[
YHSectionItemModel
]?
var
isShowPrompt
:
Bool
=
false
var
orderId
:
Int
=
0
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
viewModel
=
YHGCMainApplicantInformationViewModel
()
gk_navTitle
=
"主申请人信息填写"
gk_navBackgroundColor
=
.
white
gk_navBarAlpha
=
1
setView
()
getData
()
// Do any additional setup after loading the view.
}
func
getData
()
{
viewModel
.
requestMainInformation
(
"
\(
orderId
)
"
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
stepView
.
maxIndex
=
self
.
viewModel
.
mainModel
.
step
self
.
stepView
.
currentIndex
=
self
.
viewModel
.
mainModel
.
step
self
.
updateDataSource
()
if
self
.
stepView
.
currentIndex
==
3
{
self
.
bottomView
.
nextButton
.
setTitle
(
"提交"
,
for
:
.
normal
)
}
else
{
self
.
bottomView
.
nextButton
.
setTitle
(
"下一步"
,
for
:
.
normal
)
}
}
}
func
updateDataSource
()
{
if
self
.
stepView
.
currentIndex
==
0
{
self
.
dataSource
=
self
.
viewModel
.
getBaseDataSource
(
isShowPrompt
)
self
.
bottomView
.
nextButton
.
setTitle
(
"下一步"
,
for
:
.
normal
)
}
else
if
self
.
stepView
.
currentIndex
==
1
{
self
.
dataSource
=
self
.
viewModel
.
getIDCardDataSource
(
isShowPrompt
)
self
.
bottomView
.
nextButton
.
setTitle
(
"下一步"
,
for
:
.
normal
)
}
else
if
self
.
stepView
.
currentIndex
==
2
{
self
.
dataSource
=
self
.
viewModel
.
getDocumentInformation
(
isShowPrompt
)
self
.
bottomView
.
nextButton
.
setTitle
(
"下一步"
,
for
:
.
normal
)
}
else
if
self
.
stepView
.
currentIndex
==
3
{
self
.
dataSource
=
self
.
viewModel
.
getDetailDataSource
(
isShowPrompt
)
self
.
bottomView
.
nextButton
.
setTitle
(
"提交"
,
for
:
.
normal
)
}
self
.
tableView
.
reloadData
()
}
func
setView
()
{
view
.
backgroundColor
=
.
contentBkgColor
stepView
=
{
let
step
=
YHStepView
()
step
.
dataSource
=
[
"初始信息"
,
"证件上传"
,
"证件信息"
,
"基本信息"
]
step
.
block
=
{
[
weak
self
]
(
index
)
in
guard
let
self
=
self
else
{
return
}
self
.
updateDataSource
()
}
return
step
}()
view
.
addSubview
(
stepView
)
stepView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
k_Height_NavigationtBarAndStatuBar
)
make
.
left
.
right
.
equalTo
(
view
)
make
.
height
.
equalTo
(
104
)
}
tableView
=
{
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
if
#available(iOS 11.0, *)
{
tableView
.
contentInsetAdjustmentBehavior
=
.
never
}
tableView
.
backgroundColor
=
.
clear
tableView
.
separatorStyle
=
.
none
tableView
.
delegate
=
self
tableView
.
dataSource
=
self
tableView
.
register
(
cellWithClass
:
YHMainInformationTableViewCell
.
self
)
tableView
.
register
(
cellWithClass
:
YHGCMainInformationCardTableViewCell
.
self
)
return
tableView
}()
view
.
addSubview
(
tableView
)
tableView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
k_Height_NavigationtBarAndStatuBar
+
YHStepView
.
height
)
make
.
bottom
.
equalTo
(
-
k_Height_safeAreaInsetsBottom
()
-
64
)
make
.
left
.
right
.
bottom
.
equalTo
(
view
)
}
bottomView
=
{
let
bottom
=
YHBottomNextView
()
bottom
.
nextblock
=
{
[
weak
self
]
in
bottom
.
nextButton
.
isEnabled
=
false
guard
let
self
=
self
else
{
return
}
if
self
.
viewModel
.
isCanNext
(
self
.
stepView
.
currentIndex
)
{
self
.
viewModel
.
mainModel
.
step
=
self
.
stepView
.
currentIndex
self
.
viewModel
.
updateMainInformation
(
.
submit
,
self
.
orderId
,
self
.
stepView
.
currentIndex
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
bottom
.
nextButton
.
isEnabled
=
true
if
let
error
=
error
{
YHHUD
.
flash
(
message
:
error
.
errorMsg
)
}
else
{
YHHUD
.
hideFlashMessage
()
self
.
stepView
.
currentIndex
=
self
.
stepView
.
currentIndex
+
1
self
.
isShowPrompt
=
false
self
.
stepView
.
currentIndex
=
self
.
stepView
.
currentIndex
if
self
.
stepView
.
currentIndex
==
3
{
self
.
bottomView
.
nextButton
.
setTitle
(
"提交"
,
for
:
.
normal
)
}
else
{
self
.
bottomView
.
nextButton
.
setTitle
(
"下一步"
,
for
:
.
normal
)
}
if
self
.
stepView
.
currentIndex
==
self
.
stepView
.
dataSource
?
.
count
{
YHHUD
.
flash
(
message
:
"提交成功"
)
self
.
navigationController
?
.
popViewController
()
}
else
{
self
.
updateDataSource
()
}
}
}
}
else
{
bottom
.
nextButton
.
isEnabled
=
true
self
.
isShowPrompt
=
true
self
.
updateDataSource
()
YHHUD
.
flash
(
message
:
"您还有信息未填写"
)
}
}
bottom
.
saveBlock
=
{
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
self
.
viewModel
.
updateMainInformation
(
.
save
,
self
.
orderId
,
self
.
stepView
.
currentIndex
)
{[
weak
self
]
success
,
error
in
guard
let
_
=
self
else
{
return
}
if
let
error
=
error
{
YHHUD
.
flash
(
message
:
error
.
errorMsg
)
}
else
{
YHHUD
.
flash
(
message
:
"保存成功"
)
}
}
}
return
bottom
}()
view
.
addSubview
(
bottomView
)
bottomView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
height
.
equalTo
(
k_Height_safeAreaInsetsBottom
()
+
64
)
}
bottomView
.
layoutIfNeeded
()
bottomView
.
nextButton
.
addYinHeGradualLayer
()
}
}
extension
YHGCMainApplicantInformationViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
dataSource
?
.
count
??
0
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
stepView
.
currentIndex
==
1
{
let
cell
=
tableView
.
dequeueReusableCell
(
withClass
:
YHGCMainInformationCardTableViewCell
.
self
)
if
dataSource
?[
indexPath
.
row
]
.
models
?
.
first
?
.
id
==
.
id5
{
cell
.
type
=
.
identity
}
if
dataSource
?[
indexPath
.
row
]
.
models
?
.
first
?
.
id
==
.
id6
{
cell
.
type
=
.
passport
}
if
dataSource
?[
indexPath
.
row
]
.
models
?
.
first
?
.
id
==
.
id7
{
cell
.
type
=
.
other
}
cell
.
viewModel
=
viewModel
cell
.
backSurfaceDeleteButton
.
isHidden
=
true
cell
.
frontDeleteButton
.
isHidden
=
true
return
cell
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withClass
:
YHMainInformationTableViewCell
.
self
)
cell
.
country
=
self
.
viewModel
.
mainModel
.
address
.
country
cell
.
dataSource
=
dataSource
?[
indexPath
.
row
]
cell
.
informationBlock
=
{[
weak
self
]
model
in
guard
let
self
=
self
else
{
return
}
self
.
viewModel
.
updateModel
(
model
)
let
id
=
model
.
id
if
id
!=
.
id32
&&
id
!=
.
id4
&&
id
!=
.
id8
&&
id
!=
.
id9
&&
id
!=
.
id12
&&
id
!=
.
id13
&&
id
!=
.
id17
&&
id
!=
.
id18
&&
id
!=
.
id21
&&
id
!=
.
id22
&&
id
!=
.
id23
&&
id
!=
.
id26
&&
id
!=
.
id34
&&
id
!=
.
id29
&&
id
!=
.
id30
&&
id
!=
.
id35
{
self
.
updateDataSource
()
}
}
return
cell
}
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
stepView
.
currentIndex
==
1
{
return
227.0
}
else
{
let
array
=
dataSource
?[
indexPath
.
row
]
.
models
??
[]
var
h
=
0
for
i
in
0
..<
array
.
count
{
let
data
=
array
[
i
]
let
isShow
=
data
.
isShowPrompts
??
false
let
message
=
data
.
message
??
""
let
isNeed
=
data
.
isNeed
??
false
if
data
.
id
==
.
id3
||
data
.
id
==
.
id4
||
data
.
id
==
.
id32
||
data
.
id
==
.
id33
{
if
isShow
&&
message
.
count
==
0
&&
isNeed
{
h
=
h
+
72
+
20
}
else
{
h
=
h
+
72
}
}
else
{
if
isShow
&&
message
.
count
==
0
&&
isNeed
{
h
=
h
+
52
+
20
}
else
{
h
=
h
+
52
}
}
}
return
CGFloat
(
h
+
52
+
14
)
}
}
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
KScreenWidth
,
height
:
7
))
return
view
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
return
7
}
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
return
UIView
()
}
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
return
0.01
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/TTPS(高才)/ServiceProcess(我的信息流程)/MainApplicantInformation(主申请人信息)/V/YHGCMainInformationCardTableViewCell.swift
0 → 100644
View file @
7dfae27b
//
// YHGCMainInformationCardTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/12/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHGCMainInformationCardTableViewCell
:
UITableViewCell
{
typealias
InformationBlock
=
(
_
type
:
YHCardType
,
_
image
:
UIImage
,
_
isleft
:
Bool
)
->
()
var
informationBlock
:
InformationBlock
?
var
centerView
:
UIView
!
var
titleLabel
:
UILabel
!
var
exampleButton
:
UIButton
!
var
frontLabel
:
UILabel
!
var
backSurfaceLabel
:
UILabel
!
var
frontImageButton
:
YHCardButton
!
var
backSurfaceImageButton
:
YHCardButton
!
var
frontDeleteButton
:
UIButton
!
var
backSurfaceDeleteButton
:
UIButton
!
var
activityIndicator
:
UIActivityIndicatorView
!
var
viewModel
:
YHGCMainApplicantInformationViewModel
!
{
didSet
{
if
type
==
.
identity
{
if
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_front
.
count
!=
0
{
self
.
viewModel
.
getPublicImageUrl
(
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_front
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
self
.
frontImageButton
.
kf
.
setBackgroundImage
(
with
:
URL
(
string
:
url
),
for
:
.
normal
,
completionHandler
:
{
_
in
self
.
frontDeleteButton
.
isHidden
=
false
})
self
.
frontImageButton
.
setContent
(
""
,
""
)
}
}
if
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_back
.
count
!=
0
{
self
.
viewModel
.
getPublicImageUrl
(
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_back
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
self
.
backSurfaceImageButton
.
kf
.
setBackgroundImage
(
with
:
URL
(
string
:
url
),
for
:
.
normal
,
completionHandler
:
{
_
in
self
.
backSurfaceDeleteButton
.
isHidden
=
false
})
self
.
backSurfaceImageButton
.
setContent
(
""
,
""
)
}
}
}
else
if
type
==
.
passport
{
if
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_front
.
count
!=
0
{
self
.
viewModel
.
getPublicImageUrl
(
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_front
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
self
.
frontImageButton
.
kf
.
setBackgroundImage
(
with
:
URL
(
string
:
url
),
for
:
.
normal
,
completionHandler
:
{
_
in
self
.
frontDeleteButton
.
isHidden
=
false
})
self
.
frontImageButton
.
setContent
(
""
,
""
)
}
}
if
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_back
.
count
!=
0
{
self
.
viewModel
.
getPublicImageUrl
(
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_back
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
self
.
backSurfaceImageButton
.
kf
.
setBackgroundImage
(
with
:
URL
(
string
:
url
),
for
:
.
normal
,
completionHandler
:
{
_
in
self
.
backSurfaceDeleteButton
.
isHidden
=
false
})
self
.
backSurfaceImageButton
.
setContent
(
""
,
""
)
}
}
}
else
{
if
viewModel
.
mainModel
.
certificates
.
passport
.
img_front
.
count
!=
0
{
self
.
viewModel
.
getPublicImageUrl
(
viewModel
.
mainModel
.
certificates
.
passport
.
img_front
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
self
.
frontImageButton
.
kf
.
setBackgroundImage
(
with
:
URL
(
string
:
url
),
for
:
.
normal
,
completionHandler
:
{
_
in
self
.
frontDeleteButton
.
isHidden
=
false
})
self
.
frontImageButton
.
setContent
(
""
,
""
)
}
}
}
}
}
var
type
:
YHCardType
=
.
identity
{
didSet
{
switch
type
{
case
.
identity
:
titleLabel
.
text
=
"中国身份证(选填)"
frontLabel
.
text
=
"身份证人像面"
backSurfaceLabel
.
text
=
"身份证国徽面"
frontImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_cn_card_front"
),
for
:
.
normal
)
backSurfaceImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_cn_card_back"
),
for
:
.
normal
)
backSurfaceLabel
.
isHidden
=
false
backSurfaceImageButton
.
isHidden
=
false
case
.
passport
:
titleLabel
.
text
=
"港澳通行证(选填)"
frontLabel
.
text
=
"港澳通行证正面"
backSurfaceLabel
.
text
=
"港澳通行证反面"
frontImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_hk_card_front"
),
for
:
.
normal
)
backSurfaceImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_hk_card_back"
),
for
:
.
normal
)
backSurfaceLabel
.
isHidden
=
false
backSurfaceImageButton
.
isHidden
=
false
case
.
other
:
titleLabel
.
text
=
"护照(选填)"
frontLabel
.
text
=
"护照资料页"
backSurfaceLabel
.
isHidden
=
true
frontImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_hk_card_front"
),
for
:
.
normal
)
backSurfaceImageButton
.
isHidden
=
true
}
}
}
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
}
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
super
.
setSelected
(
selected
,
animated
:
animated
)
// Configure the view for the selected state
}
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
}
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
selectionStyle
=
.
none
setupUI
()
}
func
setupUI
()
{
contentView
.
backgroundColor
=
.
clear
backgroundColor
=
.
clear
centerView
=
{
let
view
=
UIView
()
view
.
backgroundColor
=
.
white
view
.
layer
.
cornerRadius
=
kCornerRadius6
return
view
}()
contentView
.
addSubview
(
centerView
)
centerView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
16
)
make
.
right
.
equalTo
(
-
16
)
make
.
top
.
equalTo
(
7
)
make
.
bottom
.
equalTo
(
-
16
)
}
titleLabel
=
{
let
label
=
UILabel
()
label
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
17
)
label
.
textColor
=
UIColor
.
mainTextColor
return
label
}()
centerView
.
addSubview
(
titleLabel
)
titleLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
18
)
make
.
top
.
equalTo
(
16
)
make
.
height
.
equalTo
(
20
)
}
exampleButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
backgroundColor
=
UIColor
.
brandMainColor
.
withAlphaComponent
(
0.08
)
button
.
titleLabel
?
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
10
)
button
.
contentHorizontalAlignment
=
.
center
button
.
setTitle
(
"示例模板"
,
for
:
.
normal
)
button
.
setTitleColor
(
UIColor
.
brandMainColor
,
for
:
.
normal
)
button
.
layer
.
cornerRadius
=
kCornerRadius3
button
.
addTarget
(
self
,
action
:
#selector(
exampleClick
)
,
for
:
.
touchUpInside
)
return
button
}()
centerView
.
addSubview
(
exampleButton
)
exampleButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
titleLabel
.
snp
.
right
)
.
offset
(
8
)
make
.
centerY
.
equalTo
(
titleLabel
.
snp
.
centerY
)
make
.
height
.
equalTo
(
14
)
make
.
width
.
equalTo
(
48
)
}
let
lineView
=
{
let
view
=
UIView
()
view
.
backgroundColor
=
UIColor
.
separatorColor
return
view
}()
centerView
.
addSubview
(
lineView
)
lineView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
18
)
make
.
top
.
equalTo
(
52
)
make
.
height
.
equalTo
(
1
)
make
.
right
.
equalTo
(
-
18
)
}
frontLabel
=
{
let
label
=
UILabel
()
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
12
)
label
.
textColor
=
UIColor
.
subTextColor
label
.
textAlignment
=
.
center
return
label
}()
centerView
.
addSubview
(
frontLabel
)
frontLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
18
)
make
.
right
.
equalTo
(
centerView
.
snp
.
centerX
)
make
.
top
.
equalTo
(
64
)
make
.
height
.
equalTo
(
20
)
}
backSurfaceLabel
=
{
let
label
=
UILabel
()
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
12
)
label
.
textColor
=
UIColor
.
subTextColor
label
.
textAlignment
=
.
center
return
label
}()
centerView
.
addSubview
(
backSurfaceLabel
)
backSurfaceLabel
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalTo
(
-
18
)
make
.
left
.
equalTo
(
centerView
.
snp
.
centerX
)
make
.
top
.
equalTo
(
64
)
make
.
height
.
equalTo
(
20
)
}
frontImageButton
=
{
let
button
=
YHCardButton
()
button
.
setContent
(
"card_upload"
,
"点击上传"
)
button
.
setBackgroundImage
(
UIImage
(
named
:
"service_cn_card_front"
),
for
:
.
normal
)
button
.
addTarget
(
self
,
action
:
#selector(
frontImageClick
)
,
for
:
.
touchUpInside
)
button
.
layer
.
cornerRadius
=
4
button
.
clipsToBounds
=
true
return
button
}()
centerView
.
addSubview
(
frontImageButton
)
frontImageButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
18
)
make
.
top
.
equalTo
(
96
)
make
.
height
.
equalTo
(
91
)
make
.
width
.
equalTo
(
147
)
}
frontDeleteButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
setBackgroundImage
(
UIImage
(
named
:
"service_card_delete"
),
for
:
.
normal
)
button
.
addTarget
(
self
,
action
:
#selector(
frontDeleteClick
)
,
for
:
.
touchUpInside
)
button
.
isHidden
=
true
return
button
}()
centerView
.
addSubview
(
frontDeleteButton
)
frontDeleteButton
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
equalTo
(
frontImageButton
.
snp
.
right
)
make
.
centerY
.
equalTo
(
frontImageButton
.
snp
.
top
)
make
.
height
.
equalTo
(
21
)
make
.
width
.
equalTo
(
21
)
}
backSurfaceImageButton
=
{
let
button
=
YHCardButton
()
button
.
setContent
(
"card_upload"
,
"点击上传"
)
button
.
setBackgroundImage
(
UIImage
(
named
:
"service_cn_card_back"
),
for
:
.
normal
)
button
.
addTarget
(
self
,
action
:
#selector(
backSurfaceImageClick
)
,
for
:
.
touchUpInside
)
button
.
layer
.
cornerRadius
=
4
button
.
clipsToBounds
=
true
return
button
}()
centerView
.
addSubview
(
backSurfaceImageButton
)
backSurfaceImageButton
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalTo
(
-
18
)
make
.
top
.
equalTo
(
96
)
make
.
height
.
equalTo
(
91
)
make
.
width
.
equalTo
(
147
)
}
backSurfaceDeleteButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
setBackgroundImage
(
UIImage
(
named
:
"service_card_delete"
),
for
:
.
normal
)
button
.
addTarget
(
self
,
action
:
#selector(
backSurfaceDeleteClick
)
,
for
:
.
touchUpInside
)
button
.
isHidden
=
true
return
button
}()
centerView
.
addSubview
(
backSurfaceDeleteButton
)
backSurfaceDeleteButton
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
equalTo
(
backSurfaceImageButton
.
snp
.
right
)
make
.
centerY
.
equalTo
(
backSurfaceImageButton
.
snp
.
top
)
make
.
height
.
equalTo
(
21
)
make
.
width
.
equalTo
(
21
)
}
activityIndicator
=
{
let
view
=
UIActivityIndicatorView
()
view
.
style
=
.
medium
return
view
}()
centerView
.
addSubview
(
activityIndicator
)
activityIndicator
.
snp
.
makeConstraints
{
make
in
make
.
center
.
equalTo
(
backSurfaceImageButton
.
snp
.
center
)
make
.
height
.
equalTo
(
25
)
make
.
width
.
equalTo
(
25
)
}
exampleButton
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
50
,
left
:
50
,
bottom
:
50
,
right
:
50
)
}
@objc
func
exampleClick
()
{
if
type
==
.
other
{
YHAdopterCardExampleView
.
exampleView
(
type
:
.
chinaTravel
)
.
show
()
}
else
{
let
view
=
YHCardExampleView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
KScreenWidth
,
height
:
KScreenHeight
))
view
.
type
=
type
let
window
=
UIApplication
.
shared
.
yhKeyWindow
()
window
?
.
addSubview
(
view
)
}
}
@objc
func
frontImageClick
()
{
if
type
==
.
identity
{
if
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_front
.
count
!=
0
{
// let vc = YHImageViewController()
// vc.imgString = viewModel.mainModel.certificates.cn_identity_card.img_front
// UIViewController.current?.navigationController?.pushViewController(vc)
if
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_front
.
isEmpty
==
false
{
let
vc
=
YHImageViewController
()
vc
.
imgString
=
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_front
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
return
}
}
else
if
type
==
.
passport
{
if
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_front
.
count
!=
0
{
// let vc = YHImageViewController()
// vc.imgString = viewModel.mainModel.certificates.hk_macao_pass.img_front
// UIViewController.current?.navigationController?.pushViewController(vc)
if
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_front
.
isEmpty
==
false
{
let
vc
=
YHImageViewController
()
vc
.
imgString
=
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_front
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
return
}
}
else
{
if
viewModel
.
mainModel
.
certificates
.
passport
.
img_front
.
count
!=
0
{
if
viewModel
.
mainModel
.
certificates
.
passport
.
img_front
.
isEmpty
==
false
{
let
vc
=
YHImageViewController
()
vc
.
imgString
=
viewModel
.
mainModel
.
certificates
.
passport
.
img_front
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
return
}
}
YHImagePickerView
.
show
()
{[
weak
self
]
image
in
guard
let
self
=
self
else
{
return
}
self
.
frontImageButton
.
setContent
(
"card_loading"
,
"上传中"
)
self
.
frontImageButton
.
startRotationAnimation
()
self
.
viewModel
.
uploadImage
(
image
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
frontImageButton
.
stopRotationAnimation
()
self
.
frontImageButton
.
setContent
(
""
,
""
)
guard
let
url
=
success
else
{
return
}
self
.
viewModel
.
updateModel
(
self
.
type
,
isFront
:
true
,
url
:
url
)
self
.
frontImageButton
.
setBackgroundImage
(
image
,
for
:
.
normal
)
self
.
frontDeleteButton
.
isHidden
=
false
self
.
viewModel
.
getPublicImageUrl
(
url
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
if
self
.
type
==
.
identity
{
self
.
viewModel
.
requestCnIDCardMessage
(
url
,
isBack
:
0
)
{[
weak
self
]
success
,
error
in
}
}
else
if
self
.
type
==
.
passport
{
self
.
viewModel
.
requestHkIDCardMessage
(
url
,
isBack
:
0
)
{[
weak
self
]
success
,
error
in
}
}
}
}
}
}
@objc
func
backSurfaceImageClick
()
{
if
type
==
.
identity
{
if
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_back
.
count
!=
0
{
// let vc = YHImageViewController()
// vc.imgString = viewModel.mainModel.certificates.cn_identity_card.img_back
// UIViewController.current?.navigationController?.pushViewController(vc)
if
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_back
.
isEmpty
==
false
{
let
vc
=
YHImageViewController
()
vc
.
imgString
=
viewModel
.
mainModel
.
certificates
.
cn_identity_card
.
img_back
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
return
}
}
else
{
if
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_back
.
count
!=
0
{
// let vc = YHImageViewController()
// vc.imgString = viewModel.mainModel.certificates.hk_macao_pass.img_back
// UIViewController.current?.navigationController?.pushViewController(vc)
if
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_back
.
isEmpty
==
false
{
let
vc
=
YHImageViewController
()
vc
.
imgString
=
viewModel
.
mainModel
.
certificates
.
hk_macao_pass
.
img_back
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
return
}
}
YHImagePickerView
.
show
()
{[
weak
self
]
image
in
guard
let
self
=
self
else
{
return
}
self
.
backSurfaceImageButton
.
setContent
(
"card_loading"
,
"上传中"
)
self
.
backSurfaceImageButton
.
startRotationAnimation
()
self
.
viewModel
.
uploadImage
(
image
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
backSurfaceImageButton
.
stopRotationAnimation
()
self
.
backSurfaceImageButton
.
setContent
(
""
,
""
)
guard
let
url
=
success
else
{
return
}
self
.
backSurfaceImageButton
.
setBackgroundImage
(
image
,
for
:
.
normal
)
self
.
viewModel
.
updateModel
(
self
.
type
,
isFront
:
false
,
url
:
url
)
self
.
backSurfaceDeleteButton
.
isHidden
=
false
self
.
viewModel
.
getPublicImageUrl
(
url
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
if
self
.
type
==
.
identity
{
self
.
viewModel
.
requestCnIDCardMessage
(
url
,
isBack
:
1
)
{[
weak
self
]
success
,
error
in
}
}
else
{
self
.
viewModel
.
requestHkIDCardMessage
(
url
,
isBack
:
1
)
{[
weak
self
]
success
,
error
in
}
}
}
}
}
}
func
updataData
()
{
titleLabel
.
text
=
"中国身份证(选填)"
frontLabel
.
text
=
"身份证人像面"
backSurfaceLabel
.
text
=
"身份证国徽面"
}
@objc
func
frontDeleteClick
()
{
viewModel
.
updateModel
(
self
.
type
,
isFront
:
true
,
url
:
""
)
frontDeleteButton
.
isHidden
=
true
switch
type
{
case
.
identity
:
frontImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_cn_card_front"
),
for
:
.
normal
)
case
.
passport
:
frontImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_hk_card_front"
),
for
:
.
normal
)
case
.
other
:
frontImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_hk_card_front"
),
for
:
.
normal
)
}
frontImageButton
.
setContent
(
"card_upload"
,
"点击上传"
)
}
@objc
func
backSurfaceDeleteClick
()
{
viewModel
.
updateModel
(
self
.
type
,
isFront
:
false
,
url
:
""
)
backSurfaceDeleteButton
.
isHidden
=
true
switch
type
{
case
.
identity
:
backSurfaceImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_cn_card_back"
),
for
:
.
normal
)
case
.
passport
:
backSurfaceImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_hk_card_back"
),
for
:
.
normal
)
case
.
other
:
backSurfaceImageButton
.
setBackgroundImage
(
UIImage
(
named
:
"service_hk_card_back"
),
for
:
.
normal
)
}
backSurfaceImageButton
.
setContent
(
"card_upload"
,
"点击上传"
)
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/TTPS(高才)/ServiceProcess(我的信息流程)/MainApplicantInformation(主申请人信息)/VM/YHGCMainApplicantInformationViewModel.swift
0 → 100644
View file @
7dfae27b
//
// YHGCMainApplicantInformationViewModel.swift
// galaxy
//
// Created by EDY on 2024/12/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHGCMainApplicantInformationViewModel
:
YHBaseViewModel
{
var
mainModel
:
YHMainInformationModel
=
YHMainInformationModel
()
override
init
()
{
super
.
init
()
}
func
getBaseDataSource
(
_
isShowPrompt
:
Bool
)
->
[
YHSectionItemModel
]
{
let
item
=
YHItemModel
(
id
:
.
id1
,
isNeed
:
true
,
title
:
"国家/地区"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
nationality
,
type
:
.
country
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择国家/地区"
)
let
section
=
YHSectionItemModel
(
title
:
"国籍"
,
models
:
[
item
])
let
item4
=
YHItemModel
(
id
:
.
id2
,
isNeed
:
true
,
title
:
"国家/地区"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
address
.
country
,
type
:
.
country
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择国家/地区"
)
var
string
=
""
let
array
=
mainModel
.
address
.
area
for
item
in
array
{
if
string
.
count
!=
0
{
string
=
string
+
"/"
+
item
}
else
{
string
=
string
+
item
}
}
let
item1
=
YHItemModel
(
id
:
.
id3
,
isNeed
:
true
,
title
:
"省市地区"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
string
,
type
:
.
address
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择省市地区"
)
let
item2
=
YHItemModel
(
id
:
.
id4
,
isNeed
:
true
,
title
:
"详细地址"
,
isUserKeyBoard
:
true
,
prompts
:
"请填写小区、楼栋、单元室等"
,
message
:
mainModel
.
address
.
details
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请填写小区、楼栋、单元室等"
)
let
item11
=
YHItemModel
(
id
:
.
id32
,
isNeed
:
true
,
title
:
"详细地址"
,
isUserKeyBoard
:
true
,
prompts
:
"请填写国外居住地"
,
message
:
mainModel
.
address
.
foreign
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请填写国外居住地"
)
let
item22
=
YHItemModel
(
id
:
.
id33
,
isNeed
:
true
,
title
:
"是否在海外居住一年及以上"
,
isUserKeyBoard
:
false
,
prompts
:
""
,
message
:
"
\(
mainModel
.
is_live_oversea_year
)
"
,
leftButtonString
:
"是"
,
rightButtonString
:
"否"
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择是否在海外居住满1年及以上"
)
let
section1
=
YHSectionItemModel
(
title
:
"现居住地址"
,
models
:
[
item4
,
item1
,
item2
])
let
section11
=
YHSectionItemModel
(
title
:
"现居住地址"
,
models
:
[
item4
,
item11
,
item22
])
let
item3
=
YHItemModel
(
id
:
.
id5
,
isNeed
:
true
,
title
:
"是否办理过"
,
isUserKeyBoard
:
false
,
prompts
:
""
,
message
:
"
\(
mainModel
.
is_handled
)
"
,
leftButtonString
:
"是"
,
rightButtonString
:
"否"
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择是否办理过港澳通行证"
)
let
section2
=
YHSectionItemModel
(
title
:
"港澳通行证"
,
models
:
[
item3
])
let
addressCountry
=
mainModel
.
address
.
country
let
nationality
=
mainModel
.
nationality
let
is_live_oversea_year
=
mainModel
.
is_live_oversea_year
if
(
nationality
.
contains
(
"中国"
)
&&
addressCountry
.
contains
(
"中国"
))
||
(
nationality
.
contains
(
"中国"
)
&&
is_live_oversea_year
==
0
)
{
if
addressCountry
.
contains
(
"中国"
)
||
addressCountry
==
""
{
return
[
section
,
section1
,
section2
]
}
else
{
return
[
section
,
section11
,
section2
]
}
}
else
{
if
addressCountry
.
contains
(
"中国"
)
||
addressCountry
==
""
{
return
[
section
,
section1
]
}
else
{
return
[
section
,
section11
]
}
}
}
func
getDocumentInformation
(
_
isShowPrompt
:
Bool
)
->
[
YHSectionItemModel
]
{
var
flag
=
false
let
nationality
=
mainModel
.
nationality
let
is_live_oversea_year
=
mainModel
.
is_live_oversea_year
if
nationality
.
contains
(
"中国-China"
)
{
flag
=
true
}
let
item
=
YHItemModel
(
id
:
.
id8
,
isNeed
:
flag
,
title
:
"身份证号码"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
certificates
.
cn_identity_card
.
number
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入正确的身份证号码"
)
let
item1
=
YHItemModel
(
id
:
.
id9
,
isNeed
:
flag
,
title
:
"签发地"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
certificates
.
cn_identity_card
.
issue_at
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入签发地"
)
let
item2
=
YHItemModel
(
id
:
.
id10
,
isNeed
:
flag
,
title
:
"签发日期"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
certificates
.
cn_identity_card
.
issue_date_start_at
,
type
:
.
time
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择签发日期"
)
let
item3
=
YHItemModel
(
id
:
.
id11
,
isNeed
:
flag
,
title
:
"届满日期"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
certificates
.
cn_identity_card
.
issue_date_end_at
,
type
:
.
time
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择届满日期"
)
var
section1String
=
""
if
flag
{
section1String
=
"中国身份证"
}
else
{
section1String
=
"中国身份证(选填)"
}
let
section
=
YHSectionItemModel
(
title
:
section1String
,
models
:
[
item
,
item1
,
item2
,
item3
])
var
section2String
=
""
if
mainModel
.
is_handled
==
1
{
section2String
=
"港澳通行证"
flag
=
true
}
else
{
section2String
=
"港澳通行证(选填)"
flag
=
false
}
let
item10
=
YHItemModel
(
id
:
.
id12
,
isNeed
:
flag
,
title
:
"证件号码"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
certificates
.
hk_macao_pass
.
number
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入旅行证件号码"
)
let
item11
=
YHItemModel
(
id
:
.
id13
,
isNeed
:
flag
,
title
:
"签发地"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_at
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入签发地"
)
let
item12
=
YHItemModel
(
id
:
.
id14
,
isNeed
:
flag
,
title
:
"签发日期"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_start_at
,
type
:
.
time
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择签发日期"
)
let
item13
=
YHItemModel
(
id
:
.
id15
,
isNeed
:
flag
,
title
:
"届满日期"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_end_at
,
type
:
.
time
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择届满日期"
)
let
section1
=
YHSectionItemModel
(
title
:
section2String
,
models
:
[
item10
,
item11
,
item12
,
item13
])
var
section3String
=
""
if
is_live_oversea_year
==
1
||
!
nationality
.
contains
(
"中国"
)
{
section3String
=
"护照"
flag
=
true
}
else
{
section3String
=
"护照(选填)"
flag
=
false
}
let
item5
=
YHItemModel
(
id
:
.
id17
,
isNeed
:
flag
,
title
:
"证件号码"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
certificates
.
passport
.
number
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入证件号码"
)
let
item6
=
YHItemModel
(
id
:
.
id18
,
isNeed
:
flag
,
title
:
"签发地"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
certificates
.
passport
.
issue_at
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入签发地"
)
let
item7
=
YHItemModel
(
id
:
.
id19
,
isNeed
:
flag
,
title
:
"签发日期"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
certificates
.
passport
.
issue_date_start_at
,
type
:
.
time
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择签发日期"
)
let
item8
=
YHItemModel
(
id
:
.
id20
,
isNeed
:
flag
,
title
:
"届满日期"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
certificates
.
passport
.
issue_date_end_at
,
type
:
.
time
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择届满日期"
)
let
section2
=
YHSectionItemModel
(
title
:
section3String
,
models
:
[
item5
,
item6
,
item7
,
item8
])
let
addressCountry
=
mainModel
.
address
.
country
if
(
nationality
.
contains
(
"中国-China"
)
&&
addressCountry
.
contains
(
"中国-China"
))
||
(
nationality
.
contains
(
"中国-China"
)
&&
is_live_oversea_year
==
0
)
{
return
[
section
,
section1
]
}
else
if
nationality
.
contains
(
"中国-China"
)
&&
is_live_oversea_year
==
1
{
return
[
section
,
section2
]
}
else
if
nationality
.
contains
(
"中国"
)
{
if
is_live_oversea_year
==
1
{
if
mainModel
.
is_handled
==
1
{
return
[
section1
,
section2
]
}
return
[
section2
]
}
else
{
return
[
section1
]
}
}
else
{
return
[
section2
]
}
}
func
getDetailDataSource
(
_
isShowPrompt
:
Bool
)
->
[
YHSectionItemModel
]
{
let
item
=
YHItemModel
(
id
:
.
id21
,
isNeed
:
true
,
title
:
"主申请人姓名"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
username
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入主申请人姓名"
)
let
item1
=
YHItemModel
(
id
:
.
id22
,
isNeed
:
false
,
title
:
"曾用名"
,
isUserKeyBoard
:
true
,
prompts
:
"请与户口本一致,若无则不填"
,
message
:
mainModel
.
used_name
,
isShowPrompts
:
isShowPrompt
)
let
item2
=
YHItemModel
(
id
:
.
id23
,
isNeed
:
false
,
title
:
"婚前姓氏"
,
isUserKeyBoard
:
true
,
prompts
:
"如有则填写,仅支持输入字母"
,
message
:
mainModel
.
surname
,
isShowPrompts
:
isShowPrompt
)
let
item3
=
YHItemModel
(
id
:
.
id24
,
isNeed
:
true
,
title
:
"出生日期"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
mainModel
.
birthday
,
type
:
.
time
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择出生日期"
)
let
item4
=
YHItemModel
(
id
:
.
id25
,
isNeed
:
true
,
title
:
"出生国家/地区"
,
isUserKeyBoard
:
false
,
prompts
:
nil
,
message
:
"
\(
mainModel
.
birth_place_aboard
)
"
,
leftButtonString
:
"国内"
,
rightButtonString
:
"国外"
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择出生国家/地区"
)
let
item5
=
YHItemModel
(
id
:
.
id26
,
isNeed
:
true
,
title
:
"出生城市"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
birth_place
.
details
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入出生城市;"
)
let
item55
=
YHItemModel
(
id
:
.
id34
,
isNeed
:
true
,
title
:
"出生城市"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
birth_place
.
foreign
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入出生城市"
)
let
item6
=
YHItemModel
(
id
:
.
id27
,
isNeed
:
true
,
title
:
"性别"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
"
\(
mainModel
.
sex
)
"
,
type
:
.
sex
,
alertMessage
:
"请选择性别"
)
let
item7
=
YHItemModel
(
id
:
.
id28
,
isNeed
:
true
,
title
:
"婚姻状况"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择"
,
message
:
"
\(
mainModel
.
married
)
"
,
type
:
.
marry
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择婚姻状况"
)
var
item555
=
item5
if
mainModel
.
birth_place_aboard
==
1
{
item555
=
item55
}
let
section
=
YHSectionItemModel
(
title
:
"主申请人信息"
,
models
:
[
item
,
item1
,
item2
,
item3
,
item4
,
item555
,
item6
,
item7
])
let
item10
=
YHItemModel
(
id
:
.
id31
,
isNeed
:
true
,
title
:
"是否办理过"
,
isUserKeyBoard
:
false
,
prompts
:
nil
,
message
:
"
\(
mainModel
.
has_hk_id
)
"
,
leftButtonString
:
"是"
,
rightButtonString
:
"否"
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请选择"
)
let
item11
=
YHItemModel
(
id
:
.
id35
,
isNeed
:
true
,
title
:
"香港身份证号码"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入"
,
message
:
mainModel
.
hk_id_number
,
isShowPrompts
:
isShowPrompt
,
alertMessage
:
"请输入香港身份证号码"
)
let
section2
=
YHSectionItemModel
(
title
:
"香港身份证"
,
models
:
[
item10
])
let
section22
=
YHSectionItemModel
(
title
:
"香港身份证"
,
models
:
[
item10
,
item11
])
var
section222
=
section2
if
mainModel
.
has_hk_id
==
1
{
section222
=
section22
}
return
[
section
,
section222
]
}
func
getIDCardDataSource
(
_
isShowPrompt
:
Bool
)
->
[
YHSectionItemModel
]
{
let
item
=
YHItemModel
(
id
:
.
id5
,
isNeed
:
true
,
title
:
"身份证"
,
isUserKeyBoard
:
false
,
prompts
:
"请输入"
,
message
:
nil
,
isShowPrompts
:
isShowPrompt
)
let
section
=
YHSectionItemModel
(
title
:
"中国身份证(选填)"
,
models
:
[
item
])
let
item1
=
YHItemModel
(
id
:
.
id6
,
isNeed
:
true
,
title
:
"港澳通行证(选填)"
,
isUserKeyBoard
:
false
,
prompts
:
"请输入"
,
message
:
nil
,
isShowPrompts
:
isShowPrompt
)
let
section1
=
YHSectionItemModel
(
title
:
"中国身份证(选填)"
,
models
:
[
item1
])
let
item2
=
YHItemModel
(
id
:
.
id7
,
isNeed
:
true
,
title
:
"护照(选填)"
,
isUserKeyBoard
:
false
,
prompts
:
"请输入"
,
message
:
nil
,
isShowPrompts
:
isShowPrompt
)
let
section2
=
YHSectionItemModel
(
title
:
"护照(选填)"
,
models
:
[
item2
])
let
addressCountry
=
mainModel
.
address
.
country
let
nationality
=
mainModel
.
nationality
let
is_live_oversea_year
=
mainModel
.
is_live_oversea_year
if
(
nationality
.
contains
(
"中国"
)
&&
addressCountry
.
contains
(
"中国"
))
||
(
nationality
.
contains
(
"中国"
)
&&
is_live_oversea_year
==
0
)
{
if
mainModel
.
is_handled
==
1
{
return
[
section
,
section1
]
}
else
{
return
[
section
]
}
}
else
if
nationality
.
contains
(
"中国"
)
&&
is_live_oversea_year
==
1
{
return
[
section
,
section2
]
}
else
{
return
[
section2
]
}
}
func
updateModel
(
_
item
:
YHItemModel
)
{
guard
let
type
=
item
.
id
else
{
return
}
switch
type
{
case
.
id1
:
mainModel
.
nationality
=
item
.
message
??
""
case
.
id2
:
mainModel
.
address
.
country
=
item
.
message
??
""
case
.
id3
:
mainModel
.
address
.
area
=
item
.
value
??
[]
case
.
id4
:
mainModel
.
address
.
details
=
item
.
message
??
""
case
.
id5
:
mainModel
.
is_handled
=
item
.
value
?
.
first
?
.
int
??
0
case
.
id6
:
printLog
(
"1"
)
case
.
id7
:
printLog
(
"1"
)
case
.
id8
:
mainModel
.
certificates
.
cn_identity_card
.
number
=
item
.
message
??
""
case
.
id9
:
mainModel
.
certificates
.
cn_identity_card
.
issue_at
=
item
.
message
??
""
case
.
id10
:
let
format
=
DateFormatter
()
format
.
dateFormat
=
"yyyy-MM-dd"
if
let
selectDate
=
format
.
date
(
from
:
item
.
message
??
""
)
{
let
selectTimeInterval
=
selectDate
.
timeIntervalSince1970
let
currentTimeInterval
=
Date
()
.
timeIntervalSince1970
if
selectTimeInterval
>
currentTimeInterval
{
YHHUD
.
flash
(
message
:
"签发日期不能晚于当前日期"
)
}
else
{
guard
let
endDate
=
format
.
date
(
from
:
mainModel
.
certificates
.
cn_identity_card
.
issue_date_end_at
)
else
{
mainModel
.
certificates
.
cn_identity_card
.
issue_date_start_at
=
item
.
message
??
""
return
}
let
endTimeInterval
=
endDate
.
timeIntervalSince1970
if
selectTimeInterval
>
endTimeInterval
{
YHHUD
.
flash
(
message
:
"签发日期不能晚于届满日期"
)
}
else
{
mainModel
.
certificates
.
cn_identity_card
.
issue_date_start_at
=
item
.
message
??
""
}
}
}
case
.
id11
:
let
format
=
DateFormatter
()
format
.
dateFormat
=
"yyyy-MM-dd"
if
let
selectDate
=
format
.
date
(
from
:
item
.
message
??
""
),
let
startDate
=
format
.
date
(
from
:
mainModel
.
certificates
.
cn_identity_card
.
issue_date_start_at
)
{
let
selectTimeInterval
=
selectDate
.
timeIntervalSince1970
let
startTimeInterval
=
startDate
.
timeIntervalSince1970
if
selectTimeInterval
<
startTimeInterval
{
YHHUD
.
flash
(
message
:
"届满日期不能早于签发日期"
)
}
else
{
mainModel
.
certificates
.
cn_identity_card
.
issue_date_end_at
=
item
.
message
??
""
}
}
else
{
mainModel
.
certificates
.
cn_identity_card
.
issue_date_end_at
=
item
.
message
??
""
}
case
.
id12
:
mainModel
.
certificates
.
hk_macao_pass
.
number
=
item
.
message
??
""
case
.
id13
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_at
=
item
.
message
??
""
case
.
id14
:
let
format
=
DateFormatter
()
format
.
dateFormat
=
"yyyy-MM-dd"
if
let
selectDate
=
format
.
date
(
from
:
item
.
message
??
""
)
{
let
selectTimeInterval
=
selectDate
.
timeIntervalSince1970
let
currentTimeInterval
=
Date
()
.
timeIntervalSince1970
if
selectTimeInterval
>
currentTimeInterval
{
YHHUD
.
flash
(
message
:
"签发日期不能晚于当前日期"
)
}
else
{
guard
let
endDate
=
format
.
date
(
from
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_end_at
)
else
{
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_start_at
=
item
.
message
??
""
return
}
let
endTimeInterval
=
endDate
.
timeIntervalSince1970
if
selectTimeInterval
>
endTimeInterval
{
YHHUD
.
flash
(
message
:
"签发日期不能晚于届满日期"
)
}
else
{
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_start_at
=
item
.
message
??
""
}
}
}
case
.
id15
:
let
format
=
DateFormatter
()
format
.
dateFormat
=
"yyyy-MM-dd"
if
let
selectDate
=
format
.
date
(
from
:
item
.
message
??
""
),
let
startDate
=
format
.
date
(
from
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_start_at
)
{
let
selectTimeInterval
=
selectDate
.
timeIntervalSince1970
let
startTimeInterval
=
startDate
.
timeIntervalSince1970
if
selectTimeInterval
<
startTimeInterval
{
YHHUD
.
flash
(
message
:
"届满日期不能早于签发日期"
)
}
else
{
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_end_at
=
item
.
message
??
""
}
}
case
.
id16
:
mainModel
.
certificates
.
passport
.
passport_type
=
item
.
value
?
.
first
?
.
int
??
0
case
.
id17
:
mainModel
.
certificates
.
passport
.
number
=
item
.
message
??
""
case
.
id18
:
mainModel
.
certificates
.
passport
.
issue_at
=
item
.
message
??
""
case
.
id19
:
let
format
=
DateFormatter
()
format
.
dateFormat
=
"yyyy-MM-dd"
if
let
selectDate
=
format
.
date
(
from
:
item
.
message
??
""
)
{
let
selectTimeInterval
=
selectDate
.
timeIntervalSince1970
let
currentTimeInterval
=
Date
()
.
timeIntervalSince1970
if
selectTimeInterval
>
currentTimeInterval
{
YHHUD
.
flash
(
message
:
"签发日期不能晚于当前日期"
)
}
else
{
guard
let
endDate
=
format
.
date
(
from
:
mainModel
.
certificates
.
passport
.
issue_date_end_at
)
else
{
mainModel
.
certificates
.
passport
.
issue_date_start_at
=
item
.
message
??
""
return
}
let
endTimeInterval
=
endDate
.
timeIntervalSince1970
if
selectTimeInterval
>
endTimeInterval
{
YHHUD
.
flash
(
message
:
"签发日期不能晚于届满日期"
)
}
else
{
mainModel
.
certificates
.
passport
.
issue_date_start_at
=
item
.
message
??
""
}
}
}
case
.
id20
:
let
format
=
DateFormatter
()
format
.
dateFormat
=
"yyyy-MM-dd"
if
let
selectDate
=
format
.
date
(
from
:
item
.
message
??
""
),
let
startDate
=
format
.
date
(
from
:
mainModel
.
certificates
.
passport
.
issue_date_start_at
)
{
let
selectTimeInterval
=
selectDate
.
timeIntervalSince1970
let
startTimeInterval
=
startDate
.
timeIntervalSince1970
if
selectTimeInterval
<
startTimeInterval
{
YHHUD
.
flash
(
message
:
"届满日期不能早于签发日期"
)
}
else
{
mainModel
.
certificates
.
passport
.
issue_date_end_at
=
item
.
message
??
""
}
}
case
.
id21
:
mainModel
.
username
=
item
.
message
??
""
case
.
id22
:
mainModel
.
used_name
=
item
.
message
??
""
case
.
id23
:
mainModel
.
surname
=
item
.
message
??
""
case
.
id24
:
let
format
=
DateFormatter
()
format
.
dateFormat
=
"yyyy-MM-dd"
if
let
selectDate
=
format
.
date
(
from
:
item
.
message
??
""
)
{
let
selectTimeInterval
=
selectDate
.
timeIntervalSince1970
let
currentTimeInterval
=
Date
()
.
timeIntervalSince1970
if
selectTimeInterval
>
currentTimeInterval
{
YHHUD
.
flash
(
message
:
"入学日期不能晚于当前日期"
)
}
else
{
mainModel
.
birthday
=
item
.
message
??
""
}
}
case
.
id25
:
mainModel
.
birth_place_aboard
=
item
.
value
?
.
first
?
.
int
??
0
case
.
id26
:
mainModel
.
birth_place
.
details
=
item
.
message
??
""
case
.
id27
:
mainModel
.
sex
=
item
.
value
?
.
first
?
.
int
??
0
case
.
id28
:
mainModel
.
married
=
item
.
value
?
.
first
?
.
int
??
0
case
.
id29
:
mainModel
.
mobile
=
item
.
message
??
""
case
.
id30
:
mainModel
.
email
=
item
.
message
??
""
case
.
id31
:
mainModel
.
has_hk_id
=
item
.
value
?
.
first
?
.
int
??
0
case
.
id32
:
mainModel
.
address
.
foreign
=
item
.
message
??
""
case
.
id33
:
mainModel
.
is_live_oversea_year
=
item
.
value
?
.
first
?
.
int
??
0
mainModel
.
is_handled
=
0
case
.
id34
:
mainModel
.
birth_place
.
foreign
=
item
.
message
??
""
case
.
id35
:
mainModel
.
hk_id_number
=
item
.
message
??
""
case
.
id36
:
printLog
(
"不需要"
)
case
.
id37
:
printLog
(
"不需要"
)
case
.
id38
:
printLog
(
"不需要"
)
case
.
id39
:
printLog
(
"不需要"
)
}
}
func
updateModel
(
_
type
:
YHCardType
,
isFront
:
Bool
,
url
:
String
)
{
switch
type
{
case
.
identity
:
if
isFront
{
mainModel
.
certificates
.
cn_identity_card
.
img_front
=
url
}
else
{
mainModel
.
certificates
.
cn_identity_card
.
img_back
=
url
}
case
.
passport
:
if
isFront
{
mainModel
.
certificates
.
hk_macao_pass
.
img_front
=
url
}
else
{
mainModel
.
certificates
.
hk_macao_pass
.
img_back
=
url
}
case
.
other
:
mainModel
.
certificates
.
passport
.
img_front
=
url
}
}
func
updateModel
(
_
model
:
YHHKIDCardModel
)
{
if
model
.
name
.
count
!=
0
{
mainModel
.
username
=
model
.
name
}
if
model
.
birth
.
count
!=
0
{
mainModel
.
birthday
=
model
.
birth
}
if
model
.
gender
.
count
!=
0
{
if
model
.
gender
==
"女"
{
mainModel
.
sex
=
2
}
else
{
mainModel
.
sex
=
1
}
}
if
model
.
term_begins
.
count
!=
0
{
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_start_at
=
model
.
term_begins
}
if
model
.
end_of_term
.
count
!=
0
{
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_end_at
=
model
.
end_of_term
}
if
model
.
IssueAddress
.
count
!=
0
{
mainModel
.
certificates
.
hk_macao_pass
.
issue_at
=
model
.
IssueAddress
}
if
model
.
card_num
.
count
!=
0
{
mainModel
.
certificates
.
hk_macao_pass
.
number
=
model
.
card_num
}
}
func
updateModel
(
_
model
:
YHCNIDCardModel
)
{
if
model
.
name
.
count
!=
0
{
mainModel
.
username
=
model
.
name
}
if
model
.
birth
.
count
!=
0
{
mainModel
.
birthday
=
model
.
birth
}
if
model
.
gender
.
count
!=
0
{
if
model
.
gender
==
"女"
{
mainModel
.
sex
=
2
}
else
{
mainModel
.
sex
=
1
}
}
if
model
.
term_begins
.
count
!=
0
{
mainModel
.
certificates
.
cn_identity_card
.
issue_date_start_at
=
model
.
term_begins
}
if
model
.
end_of_term
.
count
!=
0
{
mainModel
.
certificates
.
cn_identity_card
.
issue_date_end_at
=
model
.
end_of_term
}
if
model
.
issuing_authority
.
count
!=
0
{
mainModel
.
certificates
.
cn_identity_card
.
issue_at
=
model
.
issuing_authority
}
if
model
.
card_num
.
count
!=
0
{
mainModel
.
certificates
.
cn_identity_card
.
number
=
model
.
card_num
}
}
func
requestMainInformation
(
_
orderID
:
String
,
callBackBlock
:
@escaping
(
_
success
:
YHMainInformationModel
?,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
OrderInformation
.
getInformation
let
param
:
[
String
:
Any
]
=
[
"order_id"
:
orderID
]
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
,
params
:
param
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
String
:
Any
],
let
result
=
YHMainInformationModel
.
deserialize
(
from
:
dic
)
else
{
callBackBlock
(
nil
,
nil
)
return
}
self
.
mainModel
=
result
callBackBlock
(
result
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
nil
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
nil
,
err
)
}
}
func
updateMainInformation
(
_
saveType
:
YHSaveType
,
_
orderID
:
Int
,
_
step
:
Int
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
var
type
=
""
if
saveType
==
.
save
{
type
=
"save"
}
else
{
type
=
"submit"
}
let
area
:
[
String
]
=
mainModel
.
address
.
area
let
birthArea
:
[
String
]
=
mainModel
.
birth_place
.
area
let
address
=
[
"area"
:
area
,
"country"
:
mainModel
.
address
.
country
,
"details"
:
mainModel
.
address
.
details
,
"foreign"
:
mainModel
.
address
.
foreign
]
as
[
String
:
Any
]
let
birthPlace
=
[
"area"
:
birthArea
,
"country"
:
mainModel
.
birth_place
.
country
,
"details"
:
mainModel
.
birth_place
.
details
,
"foreign"
:
mainModel
.
birth_place
.
foreign
]
as
[
String
:
Any
]
let
cnID
=
[
"img_back"
:
mainModel
.
certificates
.
cn_identity_card
.
img_back
,
"img_front"
:
mainModel
.
certificates
.
cn_identity_card
.
img_front
,
"issue_at"
:
mainModel
.
certificates
.
cn_identity_card
.
issue_at
,
"issue_date_end_at"
:
mainModel
.
certificates
.
cn_identity_card
.
issue_date_end_at
,
"issue_date_start_at"
:
mainModel
.
certificates
.
cn_identity_card
.
issue_date_start_at
,
"number"
:
mainModel
.
certificates
.
cn_identity_card
.
number
]
as
[
String
:
Any
]
let
hkID
=
[
"img_back"
:
mainModel
.
certificates
.
hk_macao_pass
.
img_back
,
"img_front"
:
mainModel
.
certificates
.
hk_macao_pass
.
img_front
,
"issue_at"
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_at
,
"issue_date_end_at"
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_end_at
,
"issue_date_start_at"
:
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_start_at
,
"number"
:
mainModel
.
certificates
.
hk_macao_pass
.
number
]
as
[
String
:
Any
]
let
passport
=
[
"img_back"
:
mainModel
.
certificates
.
passport
.
img_back
,
"img_front"
:
mainModel
.
certificates
.
passport
.
img_front
,
"issue_at"
:
mainModel
.
certificates
.
passport
.
issue_at
,
"issue_date_end_at"
:
mainModel
.
certificates
.
passport
.
issue_date_end_at
,
"issue_date_start_at"
:
mainModel
.
certificates
.
passport
.
issue_date_start_at
,
"number"
:
mainModel
.
certificates
.
passport
.
number
,
"passport_type"
:
mainModel
.
certificates
.
passport
.
passport_type
]
as
[
String
:
Any
]
let
country
=
mainModel
.
address
.
country
if
country
.
contains
(
"中国"
)
{
mainModel
.
address_aboard
=
0
}
else
{
mainModel
.
address_aboard
=
1
}
let
params
:
[
String
:
Any
]
=
[
"address"
:
address
,
"address_aboard"
:
mainModel
.
address_aboard
,
"age"
:
mainModel
.
age
,
"birth_place"
:
birthPlace
,
"birth_place_aboard"
:
mainModel
.
birth_place_aboard
,
"birthday"
:
mainModel
.
birthday
,
"email"
:
mainModel
.
email
,
"has_hk_id"
:
mainModel
.
has_hk_id
,
"hk_id_number"
:
mainModel
.
hk_id_number
,
"id"
:
mainModel
.
id
,
"is_handled"
:
mainModel
.
is_handled
,
"is_live_oversea_year"
:
mainModel
.
is_live_oversea_year
,
"married"
:
mainModel
.
married
,
"mobile"
:
mainModel
.
mobile
,
"nationality"
:
mainModel
.
nationality
,
"order_id"
:
orderID
,
"sex"
:
mainModel
.
sex
,
"step"
:
step
,
"surname"
:
mainModel
.
surname
,
"used_name"
:
mainModel
.
used_name
,
"username"
:
mainModel
.
username
,
"save_type"
:
type
,
"username_pinyin"
:
[
"family_name"
:
mainModel
.
username_pinyin
.
family_name
,
"given_name"
:
mainModel
.
username_pinyin
.
given_name
],
"certificates"
:[
"cn_identity_card"
:
cnID
,
"hk_macao_pass"
:
hkID
,
"passport"
:
passport
]
]
// let strUrl = "http://192.168.25.48:18088/" + YHAllApiName.OrderInformation.updateInformation
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
OrderInformation
.
updateInformation
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestCnIDCardMessage
(
_
url
:
String
,
isBack
:
Int
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curOssURL
()
+
YHAllApiName
.
OCR
.
cn
let
params
:
[
String
:
Any
]
=
[
"url"
:
url
,
"is_back"
:
isBack
]
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
String
:
Any
],
let
result
=
YHCNIDCardModel
.
deserialize
(
from
:
dic
)
else
{
callBackBlock
(
false
,
nil
)
return
}
self
.
updateModel
(
result
)
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestHkIDCardMessage
(
_
url
:
String
,
isBack
:
Int
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curOssURL
()
+
YHAllApiName
.
OCR
.
hk
let
params
:
[
String
:
Any
]
=
[
"url"
:
url
,
"is_back"
:
isBack
]
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
String
:
Any
],
let
result
=
YHHKIDCardModel
.
deserialize
(
from
:
dic
)
else
{
callBackBlock
(
false
,
nil
)
return
}
self
.
updateModel
(
result
)
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
isCanNext
(
_
step
:
Int
)
->
Bool
{
if
step
==
0
{
let
nationality
=
mainModel
.
nationality
let
country
=
mainModel
.
address
.
country
let
area
=
mainModel
.
address
.
area
let
details
=
mainModel
.
address
.
details
let
foreign
=
mainModel
.
address
.
foreign
guard
nationality
.
count
>
0
else
{
return
false
}
guard
country
.
count
>
0
else
{
return
false
}
if
country
.
contains
(
"中国"
)
{
guard
area
.
count
>
0
else
{
return
false
}
guard
details
.
count
>
0
else
{
return
false
}
return
true
}
else
{
guard
foreign
.
count
>
0
else
{
return
false
}
return
true
}
}
else
if
step
==
1
{
return
true
}
else
if
step
==
2
{
let
cn_identity_card_number
=
mainModel
.
certificates
.
cn_identity_card
.
number
let
cn_identity_card_issue_at
=
mainModel
.
certificates
.
cn_identity_card
.
issue_at
let
cn_identity_card_issue_date_start_at
=
mainModel
.
certificates
.
cn_identity_card
.
issue_date_start_at
let
cn_identity_card_issue_date_end_at
=
mainModel
.
certificates
.
cn_identity_card
.
issue_date_end_at
let
hk_macao_pass_number
=
mainModel
.
certificates
.
hk_macao_pass
.
number
let
hk_macao_pass_issue_at
=
mainModel
.
certificates
.
hk_macao_pass
.
issue_at
let
hk_macao_pass_issue_date_start_at
=
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_start_at
let
hk_macao_pass_issue_date_end_at
=
mainModel
.
certificates
.
hk_macao_pass
.
issue_date_end_at
let
passport_number
=
mainModel
.
certificates
.
passport
.
number
let
passport_issue_at
=
mainModel
.
certificates
.
passport
.
issue_at
let
passport_issue_date_start_at
=
mainModel
.
certificates
.
passport
.
issue_date_start_at
let
passport_issue_date_end_at
=
mainModel
.
certificates
.
passport
.
issue_date_end_at
let
nationality
=
mainModel
.
nationality
let
is_live_oversea_year
=
mainModel
.
is_live_oversea_year
let
addressCountry
=
mainModel
.
address
.
country
if
(
nationality
.
contains
(
"中国-China"
)
&&
addressCountry
.
contains
(
"中国-China"
))
||
(
nationality
.
contains
(
"中国-China"
)
&&
is_live_oversea_year
==
0
)
{
guard
cn_identity_card_number
.
count
==
18
else
{
return
false
}
guard
cn_identity_card_issue_at
.
count
>
0
else
{
return
false
}
guard
cn_identity_card_issue_date_start_at
.
count
>
0
else
{
return
false
}
guard
cn_identity_card_issue_date_end_at
.
count
>
0
else
{
return
false
}
if
mainModel
.
is_handled
==
1
{
guard
hk_macao_pass_number
.
count
>
0
else
{
return
false
}
guard
hk_macao_pass_issue_at
.
count
>
0
else
{
return
false
}
guard
hk_macao_pass_issue_date_start_at
.
count
>
0
else
{
return
false
}
guard
hk_macao_pass_issue_date_end_at
.
count
>
0
else
{
return
false
}
}
}
else
if
nationality
.
contains
(
"中国-China"
)
&&
is_live_oversea_year
==
1
{
guard
cn_identity_card_number
.
count
==
18
else
{
return
false
}
guard
cn_identity_card_issue_at
.
count
>
0
else
{
return
false
}
guard
cn_identity_card_issue_date_start_at
.
count
>
0
else
{
return
false
}
guard
cn_identity_card_issue_date_end_at
.
count
>
0
else
{
return
false
}
guard
passport_number
.
count
>
0
else
{
return
false
}
guard
passport_issue_at
.
count
>
0
else
{
return
false
}
guard
passport_issue_date_start_at
.
count
>
0
else
{
return
false
}
guard
passport_issue_date_end_at
.
count
>
0
else
{
return
false
}
}
else
if
nationality
.
contains
(
"中国"
)
{
if
is_live_oversea_year
==
1
{
guard
passport_number
.
count
>
0
else
{
return
false
}
guard
passport_issue_at
.
count
>
0
else
{
return
false
}
guard
passport_issue_date_start_at
.
count
>
0
else
{
return
false
}
guard
passport_issue_date_end_at
.
count
>
0
else
{
return
false
}
}
if
mainModel
.
is_handled
==
1
{
guard
hk_macao_pass_number
.
count
>
0
else
{
return
false
}
guard
hk_macao_pass_issue_at
.
count
>
0
else
{
return
false
}
guard
hk_macao_pass_issue_date_start_at
.
count
>
0
else
{
return
false
}
guard
hk_macao_pass_issue_date_end_at
.
count
>
0
else
{
return
false
}
}
}
else
{
guard
passport_number
.
count
>
0
else
{
return
false
}
guard
passport_issue_at
.
count
>
0
else
{
return
false
}
guard
passport_issue_date_start_at
.
count
>
0
else
{
return
false
}
guard
passport_issue_date_end_at
.
count
>
0
else
{
return
false
}
}
return
true
}
else
{
let
username
=
mainModel
.
username
let
birthday
=
mainModel
.
birthday
let
birth_place_aboard
=
mainModel
.
birth_place_aboard
let
birth_place_area
=
mainModel
.
birth_place
.
details
let
birth_place_foreign
=
mainModel
.
birth_place
.
foreign
let
sex
=
mainModel
.
sex
_
=
mainModel
.
married
let
has_hk_id
=
mainModel
.
has_hk_id
let
hk_id_numbe
=
mainModel
.
hk_id_number
guard
username
.
count
>
0
else
{
return
false
}
guard
birthday
.
count
>
0
else
{
return
false
}
guard
sex
>
0
else
{
return
false
}
if
birth_place_aboard
==
1
{
guard
birth_place_foreign
.
count
>
0
else
{
return
false
}
}
else
{
guard
birth_place_area
.
count
>
0
else
{
return
false
}
}
if
has_hk_id
==
1
{
guard
hk_id_numbe
.
count
>
0
else
{
return
false
}
}
return
true
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment