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
c364b41c
Commit
c364b41c
authored
Mar 13, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 过滤证件组件
parent
420cfea6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
21 deletions
+91
-21
YHCertificateFilterItemCell.swift
.../MyCertificates(我的证书)/V/YHCertificateFilterItemCell.swift
+24
-10
YHCertificateFilterView.swift
...务中心)/MyCertificates(我的证书)/V/YHCertificateFilterView.swift
+67
-11
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/V/YHCertificateFilterItemCell.swift
View file @
c364b41c
...
@@ -11,15 +11,34 @@ import UIKit
...
@@ -11,15 +11,34 @@ import UIKit
class
YHCertificateFilterItemCell
:
UICollectionViewCell
{
class
YHCertificateFilterItemCell
:
UICollectionViewCell
{
static
let
cellReuseIdentifier
=
"YHCertificateFilterItemCell"
static
let
cellReuseIdentifier
=
"YHCertificateFilterItemCell"
private
let
titleSelectColor
=
UIColor
.
brandMainColor
private
let
titleDefaultColor
=
UIColor
.
mainTextColor
private
let
btnSelectFont
=
UIFont
.
PFSC_M
(
ofSize
:
13
)
private
let
btnDefaultFont
=
UIFont
.
PFSC_R
(
ofSize
:
13
)
var
title
:
String
?
{
didSet
{
contentBtn
.
setTitle
(
title
,
for
:
.
normal
)
}
}
var
isSelect
:
Bool
=
false
{
didSet
{
contentBtn
.
layer
.
borderColor
=
(
isSelect
?
titleSelectColor
:
.
clear
)
.
cgColor
contentBtn
.
setTitleColor
((
isSelect
?
titleSelectColor
:
titleDefaultColor
),
for
:
.
normal
)
contentBtn
.
titleLabel
?
.
font
=
(
isSelect
?
btnSelectFont
:
btnDefaultFont
)
}
}
lazy
var
contentBtn
:
UIButton
=
{
lazy
var
contentBtn
:
UIButton
=
{
let
btn
=
UIButton
()
let
btn
=
UIButton
()
btn
.
setTitle
(
"
证件
"
,
for
:
.
normal
)
btn
.
setTitle
(
""
,
for
:
.
normal
)
btn
.
titleLabel
?
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
btn
.
titleLabel
?
.
font
=
btnDefaultFont
btn
.
setTitleColor
(
UIColor
.
mainTex
tColor
,
for
:
.
normal
)
btn
.
setTitleColor
(
titleDefaul
tColor
,
for
:
.
normal
)
btn
.
backgroundColor
=
UIColor
(
hexString
:
"#F8F9FB"
)
btn
.
backgroundColor
=
UIColor
(
hexString
:
"#F8F9FB"
)
btn
.
layer
.
cornerRadius
=
8.0
btn
.
layer
.
cornerRadius
=
YHCertificateFilterView
.
itemHeight
/
2.0
btn
.
addTarget
(
self
,
action
:
#selector(
didClickBtn
)
,
for
:
.
touchUpInside
)
btn
.
layer
.
borderWidth
=
1.0
btn
.
isEnabled
=
false
return
btn
return
btn
}()
}()
...
@@ -38,9 +57,4 @@ class YHCertificateFilterItemCell: UICollectionViewCell {
...
@@ -38,9 +57,4 @@ class YHCertificateFilterItemCell: UICollectionViewCell {
make
.
edges
.
equalToSuperview
()
make
.
edges
.
equalToSuperview
()
}
}
}
}
@objc
func
didClickBtn
()
{
}
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/V/YHCertificateFilterView.swift
View file @
c364b41c
...
@@ -33,6 +33,7 @@ class YHCertificateFilterSectionInfo {
...
@@ -33,6 +33,7 @@ class YHCertificateFilterSectionInfo {
class
YHCertificateFilterItem
{
class
YHCertificateFilterItem
{
var
type
:
YHCertificateFilterType
var
type
:
YHCertificateFilterType
var
title
:
String
var
title
:
String
var
isSelected
:
Bool
=
false
init
(
type
:
YHCertificateFilterType
,
title
:
String
)
{
init
(
type
:
YHCertificateFilterType
,
title
:
String
)
{
self
.
type
=
type
self
.
type
=
type
...
@@ -43,22 +44,33 @@ class YHCertificateFilterItem {
...
@@ -43,22 +44,33 @@ class YHCertificateFilterItem {
class
YHCertificateFilterView
:
UIView
{
class
YHCertificateFilterView
:
UIView
{
static
let
margin
=
21.0
static
let
gap
=
12.0
static
let
itemHeight
=
36.0
static
let
sheetView
=
YHCertificateFilterView
(
frame
:
UIScreen
.
main
.
bounds
)
static
let
sheetView
=
YHCertificateFilterView
(
frame
:
UIScreen
.
main
.
bounds
)
var
items
:[
YHCertificateFilterSectionInfo
]
=
[
var
items
:[
YHCertificateFilterSectionInfo
]
=
[
YHCertificateFilterSectionInfo
(
title
:
"类型"
.
local
,
items
:
[
YHCertificateFilterItem
(
type
:
.
certificate
,
title
:
"证件"
)])
]
YHCertificateFilterSectionInfo
(
title
:
"类型"
.
local
,
items
:
[
YHCertificateFilterItem
(
type
:
.
certificate
,
title
:
"证件"
),
YHCertificateFilterItem
(
type
:
.
degree
,
title
:
"学历"
),
YHCertificateFilterItem
(
type
:
.
employmentProof
,
title
:
"工作证明"
),
YHCertificateFilterItem
(
type
:
.
other
,
title
:
"其他"
),
]),
YHCertificateFilterSectionInfo
(
title
:
"状态"
.
local
,
items
:
[
YHCertificateFilterItem
(
type
:
.
preUpload
,
title
:
"待上传"
),
YHCertificateFilterItem
(
type
:
.
rejected
,
title
:
"已驳回"
),
YHCertificateFilterItem
(
type
:
.
review
,
title
:
"审核中"
),
YHCertificateFilterItem
(
type
:
.
pass
,
title
:
"已通过"
),
])]
lazy
var
collectionView
:
UICollectionView
=
{
lazy
var
collectionView
:
UICollectionView
=
{
// 设置布局方向
// 设置布局方向
let
flowLayout
=
UICollectionViewFlowLayout
()
let
flowLayout
=
UICollectionViewFlowLayout
()
let
margin
=
21.0
flowLayout
.
minimumInteritemSpacing
=
Self
.
gap
let
gap
=
12.0
flowLayout
.
minimumLineSpacing
=
Self
.
gap
flowLayout
.
minimumInteritemSpacing
=
12.0
flowLayout
.
minimumLineSpacing
=
12.0
flowLayout
.
scrollDirection
=
.
vertical
flowLayout
.
scrollDirection
=
.
vertical
collectionView
=
UICollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
flowLayout
)
collectionView
=
UICollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
flowLayout
)
collectionView
.
contentInset
=
UIEdgeInsets
(
top
:
0
,
left
:
margin
,
bottom
:
0
,
right
:
margin
)
collectionView
.
contentInset
=
UIEdgeInsets
(
top
:
0
,
left
:
Self
.
margin
,
bottom
:
0
,
right
:
Self
.
margin
)
collectionView
.
backgroundColor
=
UIColor
.
white
collectionView
.
backgroundColor
=
UIColor
.
white
collectionView
.
register
(
YHCertificateFilterItemCell
.
self
,
forCellWithReuseIdentifier
:
YHCertificateFilterItemCell
.
cellReuseIdentifier
)
collectionView
.
register
(
YHCertificateFilterItemCell
.
self
,
forCellWithReuseIdentifier
:
YHCertificateFilterItemCell
.
cellReuseIdentifier
)
collectionView
.
register
(
YHCertificateFilterTypeView
.
self
,
forSupplementaryViewOfKind
:
UICollectionView
.
elementKindSectionHeader
,
withReuseIdentifier
:
YHCertificateFilterTypeView
.
reuseIdentifier
)
collectionView
.
register
(
YHCertificateFilterTypeView
.
self
,
forSupplementaryViewOfKind
:
UICollectionView
.
elementKindSectionHeader
,
withReuseIdentifier
:
YHCertificateFilterTypeView
.
reuseIdentifier
)
...
@@ -244,18 +256,32 @@ extension YHCertificateFilterView {
...
@@ -244,18 +256,32 @@ extension YHCertificateFilterView {
}
}
@objc
func
didClickResetBtn
()
{
@objc
func
didClickResetBtn
()
{
for
sectionInfo
in
items
{
for
item
in
sectionInfo
.
items
{
item
.
isSelected
=
false
}
}
collectionView
.
reloadData
()
}
}
}
}
extension
YHCertificateFilterView
:
UICollectionViewDataSource
,
UICollectionViewDelegate
,
UICollectionViewDelegateFlowLayout
{
extension
YHCertificateFilterView
:
UICollectionViewDataSource
,
UICollectionViewDelegate
,
UICollectionViewDelegateFlowLayout
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
func
numberOfSections
(
in
collectionView
:
UICollectionView
)
->
Int
{
return
items
.
count
return
items
.
count
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
if
0
<=
section
&&
section
<
items
.
count
{
let
sectionInfo
=
items
[
section
]
return
sectionInfo
.
items
.
count
}
return
0
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
sizeForItemAt
indexPath
:
IndexPath
)
->
CGSize
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
sizeForItemAt
indexPath
:
IndexPath
)
->
CGSize
{
return
CGSize
(
width
:
74
,
height
:
36
)
return
CGSize
(
width
:
floorl
((
KScreenWidth
-
Self
.
margin
*
2
-
Self
.
gap
*
3
)
/
4.0
),
height
:
Self
.
itemHeight
)
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
referenceSizeForHeaderInSection
:
Int
)
->
CGSize
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
referenceSizeForHeaderInSection
:
Int
)
->
CGSize
{
...
@@ -267,22 +293,52 @@ extension YHCertificateFilterView:UICollectionViewDataSource, UICollectionViewDe
...
@@ -267,22 +293,52 @@ extension YHCertificateFilterView:UICollectionViewDataSource, UICollectionViewDe
if
kind
==
UICollectionView
.
elementKindSectionHeader
{
if
kind
==
UICollectionView
.
elementKindSectionHeader
{
let
headerView
:
YHCertificateFilterTypeView
=
collectionView
.
dequeueReusableSupplementaryView
(
ofKind
:
UICollectionView
.
elementKindSectionHeader
,
withReuseIdentifier
:
YHCertificateFilterTypeView
.
reuseIdentifier
,
for
:
indexPath
)
as!
YHCertificateFilterTypeView
let
headerView
:
YHCertificateFilterTypeView
=
collectionView
.
dequeueReusableSupplementaryView
(
ofKind
:
UICollectionView
.
elementKindSectionHeader
,
withReuseIdentifier
:
YHCertificateFilterTypeView
.
reuseIdentifier
,
for
:
indexPath
)
as!
YHCertificateFilterTypeView
return
headerView
if
0
<=
indexPath
.
section
&&
indexPath
.
section
<
items
.
count
{
let
sectionInfo
=
items
[
indexPath
.
section
]
headerView
.
title
=
sectionInfo
.
title
}
return
headerView
}
}
return
UICollectionReusableView
()
return
UICollectionReusableView
()
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHCertificateFilterItemCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHCertificateFilterItemCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHCertificateFilterItemCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHCertificateFilterItemCell
if
0
<=
indexPath
.
section
&&
indexPath
.
section
<
items
.
count
{
let
sectionInfo
=
items
[
indexPath
.
section
]
if
0
<=
indexPath
.
row
&&
indexPath
.
row
<
sectionInfo
.
items
.
count
{
let
item
=
sectionInfo
.
items
[
indexPath
.
row
]
cell
.
title
=
item
.
title
cell
.
isSelect
=
item
.
isSelected
}
}
return
cell
return
cell
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
0
<=
indexPath
.
section
&&
indexPath
.
section
<
items
.
count
{
let
sectionInfo
=
items
[
indexPath
.
section
]
if
0
<=
indexPath
.
row
&&
indexPath
.
row
<
sectionInfo
.
items
.
count
{
let
item
=
sectionInfo
.
items
[
indexPath
.
row
]
item
.
isSelected
=
!
item
.
isSelected
}
collectionView
.
reloadData
()
}
}
}
}
class
YHCertificateFilterTypeView
:
UICollectionReusableView
{
class
YHCertificateFilterTypeView
:
UICollectionReusableView
{
static
let
reuseIdentifier
=
"YHCertificateFilterTypeView"
static
let
reuseIdentifier
=
"YHCertificateFilterTypeView"
var
title
:
String
?
{
didSet
{
titleLabel
.
text
=
title
}
}
lazy
var
titleLabel
:
UILabel
=
{
lazy
var
titleLabel
:
UILabel
=
{
let
label
=
UILabel
()
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
mainTextColor
label
.
textColor
=
UIColor
.
mainTextColor
...
...
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