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
789d2e49
Commit
789d2e49
authored
Mar 26, 2025
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 方案
parent
3c9718bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
330 additions
and
4 deletions
+330
-4
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+12
-0
YHPlanViewController.swift
...axy/Classes/Modules/Plan(方案)/C/YHPlanViewController.swift
+20
-4
YHPlanCustomerCaseCollectionCell.swift
...Modules/Plan(方案)/V/YHPlanCustomerCaseCollectionCell.swift
+70
-0
YHPlanCustomerCaseListCell.swift
...asses/Modules/Plan(方案)/V/YHPlanCustomerCaseListCell.swift
+136
-0
YHPlanCustomerCaseListLayout.swift
...ses/Modules/Plan(方案)/V/YHPlanCustomerCaseListLayout.swift
+92
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
789d2e49
...
@@ -1224,6 +1224,9 @@
...
@@ -1224,6 +1224,9 @@
04D8FF5F2D93945100703C75
/* YHPlanAnalyzeInfoCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF5E2D93945100703C75
/* YHPlanAnalyzeInfoCell.swift */
;
};
04D8FF5F2D93945100703C75
/* YHPlanAnalyzeInfoCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF5E2D93945100703C75
/* YHPlanAnalyzeInfoCell.swift */
;
};
04D8FF612D939D2400703C75
/* YHPlanScoreCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF602D939D2400703C75
/* YHPlanScoreCell.swift */
;
};
04D8FF612D939D2400703C75
/* YHPlanScoreCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF602D939D2400703C75
/* YHPlanScoreCell.swift */
;
};
04D8FF632D93A98200703C75
/* YHPlanProductListView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF622D93A98200703C75
/* YHPlanProductListView.swift */
;
};
04D8FF632D93A98200703C75
/* YHPlanProductListView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF622D93A98200703C75
/* YHPlanProductListView.swift */
;
};
04D8FF652D93CCBA00703C75
/* YHPlanCustomerCaseListCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF642D93CCBA00703C75
/* YHPlanCustomerCaseListCell.swift */
;
};
04D8FF672D93D15800703C75
/* YHPlanCustomerCaseCollectionCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF662D93D15800703C75
/* YHPlanCustomerCaseCollectionCell.swift */
;
};
04D8FF692D93D4E500703C75
/* YHPlanCustomerCaseListLayout.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04D8FF682D93D4E500703C75
/* YHPlanCustomerCaseListLayout.swift */
;
};
04E4CF3E2D5C6D32004D4013
/* YHCountryMessageView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04E4CF3D2D5C6D32004D4013
/* YHCountryMessageView.swift */
;
};
04E4CF3E2D5C6D32004D4013
/* YHCountryMessageView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04E4CF3D2D5C6D32004D4013
/* YHCountryMessageView.swift */
;
};
04E4CF402D5C83AE004D4013
/* YHSelectPhoneCountryViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04E4CF3F2D5C83AE004D4013
/* YHSelectPhoneCountryViewController.swift */
;
};
04E4CF402D5C83AE004D4013
/* YHSelectPhoneCountryViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04E4CF3F2D5C83AE004D4013
/* YHSelectPhoneCountryViewController.swift */
;
};
04E507D62D6EE856005F758B
/* YHUserLevelAlertView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04E507D52D6EE856005F758B
/* YHUserLevelAlertView.swift */
;
};
04E507D62D6EE856005F758B
/* YHUserLevelAlertView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04E507D52D6EE856005F758B
/* YHUserLevelAlertView.swift */
;
};
...
@@ -2487,6 +2490,9 @@
...
@@ -2487,6 +2490,9 @@
04D8FF5E2D93945100703C75
/* YHPlanAnalyzeInfoCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanAnalyzeInfoCell.swift
;
sourceTree
=
"<group>"
;
};
04D8FF5E2D93945100703C75
/* YHPlanAnalyzeInfoCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanAnalyzeInfoCell.swift
;
sourceTree
=
"<group>"
;
};
04D8FF602D939D2400703C75
/* YHPlanScoreCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanScoreCell.swift
;
sourceTree
=
"<group>"
;
};
04D8FF602D939D2400703C75
/* YHPlanScoreCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanScoreCell.swift
;
sourceTree
=
"<group>"
;
};
04D8FF622D93A98200703C75
/* YHPlanProductListView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanProductListView.swift
;
sourceTree
=
"<group>"
;
};
04D8FF622D93A98200703C75
/* YHPlanProductListView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanProductListView.swift
;
sourceTree
=
"<group>"
;
};
04D8FF642D93CCBA00703C75
/* YHPlanCustomerCaseListCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanCustomerCaseListCell.swift
;
sourceTree
=
"<group>"
;
};
04D8FF662D93D15800703C75
/* YHPlanCustomerCaseCollectionCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanCustomerCaseCollectionCell.swift
;
sourceTree
=
"<group>"
;
};
04D8FF682D93D4E500703C75
/* YHPlanCustomerCaseListLayout.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPlanCustomerCaseListLayout.swift
;
sourceTree
=
"<group>"
;
};
04E4CF3D2D5C6D32004D4013
/* YHCountryMessageView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCountryMessageView.swift
;
sourceTree
=
"<group>"
;
};
04E4CF3D2D5C6D32004D4013
/* YHCountryMessageView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCountryMessageView.swift
;
sourceTree
=
"<group>"
;
};
04E4CF3F2D5C83AE004D4013
/* YHSelectPhoneCountryViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSelectPhoneCountryViewController.swift
;
sourceTree
=
"<group>"
;
};
04E4CF3F2D5C83AE004D4013
/* YHSelectPhoneCountryViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSelectPhoneCountryViewController.swift
;
sourceTree
=
"<group>"
;
};
04E507D52D6EE856005F758B
/* YHUserLevelAlertView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHUserLevelAlertView.swift
;
sourceTree
=
"<group>"
;
};
04E507D52D6EE856005F758B
/* YHUserLevelAlertView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHUserLevelAlertView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -6633,6 +6639,9 @@
...
@@ -6633,6 +6639,9 @@
04D8FF5E2D93945100703C75
/* YHPlanAnalyzeInfoCell.swift */
,
04D8FF5E2D93945100703C75
/* YHPlanAnalyzeInfoCell.swift */
,
04D8FF602D939D2400703C75
/* YHPlanScoreCell.swift */
,
04D8FF602D939D2400703C75
/* YHPlanScoreCell.swift */
,
04D8FF622D93A98200703C75
/* YHPlanProductListView.swift */
,
04D8FF622D93A98200703C75
/* YHPlanProductListView.swift */
,
04D8FF642D93CCBA00703C75
/* YHPlanCustomerCaseListCell.swift */
,
04D8FF682D93D4E500703C75
/* YHPlanCustomerCaseListLayout.swift */
,
04D8FF662D93D15800703C75
/* YHPlanCustomerCaseCollectionCell.swift */
,
);
);
path
=
V
;
path
=
V
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -7468,6 +7477,7 @@
...
@@ -7468,6 +7477,7 @@
045C11572D12CA5F00BD2DC0
/* YHCountryHotView.swift in Sources */
,
045C11572D12CA5F00BD2DC0
/* YHCountryHotView.swift in Sources */
,
048D6ADB2D5E00DE00BC6F4C
/* YHMemberCenterViewController.swift in Sources */
,
048D6ADB2D5E00DE00BC6F4C
/* YHMemberCenterViewController.swift in Sources */
,
045C11582D12CA5F00BD2DC0
/* YHPreviewBaseViewController.swift in Sources */
,
045C11582D12CA5F00BD2DC0
/* YHPreviewBaseViewController.swift in Sources */
,
04D8FF692D93D4E500703C75
/* YHPlanCustomerCaseListLayout.swift in Sources */
,
045C11592D12CA5F00BD2DC0
/* YHAITextMessageCell.swift in Sources */
,
045C11592D12CA5F00BD2DC0
/* YHAITextMessageCell.swift in Sources */
,
04307BB02D215D1C00ED8E8D
/* YHRecommendedLiveHeader.swift in Sources */
,
04307BB02D215D1C00ED8E8D
/* YHRecommendedLiveHeader.swift in Sources */
,
048D6ADF2D5F0FBE00BC6F4C
/* YHMemberCenterHeaderBannerCell.swift in Sources */
,
048D6ADF2D5F0FBE00BC6F4C
/* YHMemberCenterHeaderBannerCell.swift in Sources */
,
...
@@ -7707,6 +7717,7 @@
...
@@ -7707,6 +7717,7 @@
045C122C2D12CA5F00BD2DC0
/* YHFamilyInfoUpdateViewController.swift in Sources */
,
045C122C2D12CA5F00BD2DC0
/* YHFamilyInfoUpdateViewController.swift in Sources */
,
04307BA82D1FDF5200ED8E8D
/* YHGCPreviewIncomeTypeCell.swift in Sources */
,
04307BA82D1FDF5200ED8E8D
/* YHGCPreviewIncomeTypeCell.swift in Sources */
,
045C122D2D12CA5F00BD2DC0
/* YHVisaRenewalTipsCell.swift in Sources */
,
045C122D2D12CA5F00BD2DC0
/* YHVisaRenewalTipsCell.swift in Sources */
,
04D8FF672D93D15800703C75
/* YHPlanCustomerCaseCollectionCell.swift in Sources */
,
04307B8A2D1AB66100ED8E8D
/* YHGCPreviewBasiceInformationViewController.swift in Sources */
,
04307B8A2D1AB66100ED8E8D
/* YHGCPreviewBasiceInformationViewController.swift in Sources */
,
04307B8C2D1AB66100ED8E8D
/* YHGCPreviewControllerHoldViewController.swift in Sources */
,
04307B8C2D1AB66100ED8E8D
/* YHGCPreviewControllerHoldViewController.swift in Sources */
,
04307B8D2D1AB66100ED8E8D
/* YHGCPreviewAcademicAndProfessionalQualificationViewController.swift in Sources */
,
04307B8D2D1AB66100ED8E8D
/* YHGCPreviewAcademicAndProfessionalQualificationViewController.swift in Sources */
,
...
@@ -7893,6 +7904,7 @@
...
@@ -7893,6 +7904,7 @@
045C12D12D12CA5F00BD2DC0
/* YHOtherServiceListViewController.swift in Sources */
,
045C12D12D12CA5F00BD2DC0
/* YHOtherServiceListViewController.swift in Sources */
,
045C12D22D12CA5F00BD2DC0
/* YHResignAppointTimeSettingModel.swift in Sources */
,
045C12D22D12CA5F00BD2DC0
/* YHResignAppointTimeSettingModel.swift in Sources */
,
045C12D32D12CA5F00BD2DC0
/* YHVisaRenewalPayTipsCell.swift in Sources */
,
045C12D32D12CA5F00BD2DC0
/* YHVisaRenewalPayTipsCell.swift in Sources */
,
04D8FF652D93CCBA00703C75
/* YHPlanCustomerCaseListCell.swift in Sources */
,
045C12D42D12CA5F00BD2DC0
/* YHRefreshHeaderAnimator.swift in Sources */
,
045C12D42D12CA5F00BD2DC0
/* YHRefreshHeaderAnimator.swift in Sources */
,
045C12D52D12CA5F00BD2DC0
/* YHLifeSectionView.swift in Sources */
,
045C12D52D12CA5F00BD2DC0
/* YHLifeSectionView.swift in Sources */
,
045C12D62D12CA5F00BD2DC0
/* YHAIGreetCollectionReusableView.swift in Sources */
,
045C12D62D12CA5F00BD2DC0
/* YHAIGreetCollectionReusableView.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Plan(方案)/C/YHPlanViewController.swift
View file @
789d2e49
...
@@ -28,6 +28,7 @@ class YHPlanViewController: YHBaseViewController {
...
@@ -28,6 +28,7 @@ class YHPlanViewController: YHBaseViewController {
tableView
.
dataSource
=
self
tableView
.
dataSource
=
self
tableView
.
register
(
YHPlanAnalyzeInfoCell
.
self
,
forCellReuseIdentifier
:
YHPlanAnalyzeInfoCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHPlanAnalyzeInfoCell
.
self
,
forCellReuseIdentifier
:
YHPlanAnalyzeInfoCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHPlanScoreCell
.
self
,
forCellReuseIdentifier
:
YHPlanScoreCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHPlanScoreCell
.
self
,
forCellReuseIdentifier
:
YHPlanScoreCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHPlanCustomerCaseListCell
.
self
,
forCellReuseIdentifier
:
YHPlanCustomerCaseListCell
.
cellReuseIdentifier
)
tableView
.
register
(
UITableViewCell
.
self
,
forCellReuseIdentifier
:
"UITableViewCell"
)
tableView
.
register
(
UITableViewCell
.
self
,
forCellReuseIdentifier
:
"UITableViewCell"
)
return
tableView
return
tableView
}()
}()
...
@@ -56,26 +57,41 @@ extension YHPlanViewController: UITableViewDelegate, UITableViewDataSource {
...
@@ -56,26 +57,41 @@ extension YHPlanViewController: UITableViewDelegate, UITableViewDataSource {
}
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
defaultCell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"UITableViewCell"
,
for
:
indexPath
)
if
0
<=
indexPath
.
section
&&
indexPath
.
section
<
self
.
infoArr
.
count
{
if
0
<=
indexPath
.
section
&&
indexPath
.
section
<
self
.
infoArr
.
count
{
if
indexPath
.
section
==
0
{
if
indexPath
.
section
==
0
{
guard
let
cell1
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHPlanScoreCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHPlanScoreCell
else
{
guard
let
cell1
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHPlanScoreCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHPlanScoreCell
else
{
return
UITableViewCell
()
return
UITableViewCell
()
}
}
return
cell1
return
cell1
}
else
{
}
else
if
indexPath
.
section
==
1
||
indexPath
.
section
==
2
{
guard
let
cell2
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHPlanAnalyzeInfoCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHPlanAnalyzeInfoCell
else
{
guard
let
cell2
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHPlanAnalyzeInfoCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHPlanAnalyzeInfoCell
else
{
return
UITableViewCell
()
return
UITableViewCell
()
}
}
cell2
.
products
=
[]
cell2
.
products
=
[
""
,
""
]
return
cell2
return
cell2
}
else
if
indexPath
.
section
==
3
{
guard
let
cell3
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHPlanCustomerCaseListCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHPlanCustomerCaseListCell
else
{
return
UITableViewCell
()
}
cell3
.
cases
=
[
"水电费噶事多发结石冷风机拉萨反垃圾算法逻辑的山卡拉飞机啊索拉卡飞机啊拉卡萨"
,
"阿斯顿发发"
,
"阿斯顿发生大法师懂法守法说法大萨达法司法发沙发是打发三大发实达防擦是打发"
,
"啊所发生的发生的放假啦苏卡达飞机拉萨开发机阿萨拉法基阿萨拉开发"
,
"双法防"
,
"沙发上"
,
"啊防守打法"
]
return
cell3
}
}
}
}
let
defaultCell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"UITableViewCell"
,
for
:
indexPath
)
return
defaultCell
return
defaultCell
}
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
indexPath
.
section
==
3
{
return
2000
}
return
UITableView
.
automaticDimension
return
UITableView
.
automaticDimension
}
}
...
...
galaxy/galaxy/Classes/Modules/Plan(方案)/V/YHPlanCustomerCaseCollectionCell.swift
0 → 100644
View file @
789d2e49
//
// YHPlanCustomerCaseCollectionCell.swift
// galaxy
//
// Created by Dufet on 2025/3/26.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHPlanCustomerCaseCollectionCell
:
UICollectionViewCell
{
static
let
cellReuseIdentifier
=
"YHPlanCustomerCaseCollectionCell"
lazy
var
whiteContentView
:
UIView
=
{
let
v
=
UIView
()
v
.
backgroundColor
=
.
white
v
.
layer
.
cornerRadius
=
6.0
v
.
clipsToBounds
=
true
return
v
}()
lazy
var
iconImgV
:
UIImageView
=
{
let
v
=
UIImageView
()
v
.
backgroundColor
=
.
red
return
v
}()
lazy
var
descLabel
:
UILabel
=
{
let
lable
=
UILabel
()
lable
.
textColor
=
UIColor
.
mainTextColor
lable
.
textAlignment
=
.
left
lable
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
lable
.
numberOfLines
=
0
lable
.
text
=
"啊所发生的发生的法师打发三大发啥打法是都发啥打法是打发撒打发三大发啥打法啊所发生的发生的法师打发三大发啥打法是都发啥打法是打发撒打发三大发啥打法"
return
lable
}()
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
}
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
setupUI
()
}
private
func
setupUI
()
{
contentView
.
addSubview
(
whiteContentView
)
whiteContentView
.
addSubview
(
iconImgV
)
whiteContentView
.
addSubview
(
descLabel
)
whiteContentView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
iconImgV
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
iconImgV
.
snp
.
width
)
.
multipliedBy
(
200.0
/
166.0
)
}
descLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
iconImgV
.
snp
.
bottom
)
.
offset
(
8
)
make
.
bottom
.
equalTo
(
-
12
)
make
.
left
.
equalTo
(
12
)
make
.
right
.
equalTo
(
-
12
)
}
}
}
galaxy/galaxy/Classes/Modules/Plan(方案)/V/YHPlanCustomerCaseListCell.swift
0 → 100644
View file @
789d2e49
//
// YHPlanCustomerCaseListCell.swift
// galaxy
//
// Created by Dufet on 2025/3/26.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHPlanCustomerCaseListCell
:
UITableViewCell
{
static
let
cellReuseIdentifier
=
"YHPlanCustomerCaseListCell"
var
cases
:
[
String
]
=
[]
{
didSet
{
collectionView
.
reloadData
()
}
}
lazy
var
titleLabel
:
UILabel
=
{
let
lable
=
UILabel
()
lable
.
textColor
=
UIColor
.
init
(
hex
:
0x8993A2
)
lable
.
textAlignment
=
.
center
lable
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
lable
.
text
=
"客户案例"
return
lable
}()
lazy
var
collectionView
:
UICollectionView
=
{
let
layout
=
YHPlanCustomerCaseListLayout
()
let
collectView
=
UICollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
layout
)
collectView
.
backgroundColor
=
.
clear
collectView
.
delegate
=
self
collectView
.
dataSource
=
self
collectView
.
register
(
YHPlanCustomerCaseCollectionCell
.
self
,
forCellWithReuseIdentifier
:
YHPlanCustomerCaseCollectionCell
.
cellReuseIdentifier
)
return
collectView
}()
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
}
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
setupUI
()
}
func
setupUI
()
{
selectionStyle
=
.
none
backgroundColor
=
.
clear
contentView
.
backgroundColor
=
.
clear
let
leftLine
=
UIView
()
leftLine
.
backgroundColor
=
.
init
(
hex
:
0xD5DAE1
)
contentView
.
addSubview
(
leftLine
)
let
rightLine
=
UIView
()
rightLine
.
backgroundColor
=
.
init
(
hex
:
0xD5DAE1
)
contentView
.
addSubview
(
rightLine
)
contentView
.
addSubview
(
titleLabel
)
contentView
.
addSubview
(
collectionView
)
titleLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
0
)
make
.
centerX
.
equalToSuperview
()
make
.
width
.
equalTo
(
70
)
make
.
height
.
equalTo
(
20
)
}
leftLine
.
snp
.
makeConstraints
{
make
in
make
.
width
.
equalTo
(
50
)
make
.
height
.
equalTo
(
0.5
)
make
.
right
.
equalTo
(
titleLabel
.
snp
.
left
)
make
.
centerY
.
equalTo
(
titleLabel
)
}
rightLine
.
snp
.
makeConstraints
{
make
in
make
.
width
.
equalTo
(
50
)
make
.
height
.
equalTo
(
0.5
)
make
.
left
.
equalTo
(
titleLabel
.
snp
.
right
)
make
.
centerY
.
equalTo
(
titleLabel
)
}
collectionView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
16
)
make
.
right
.
equalTo
(
-
16
)
make
.
top
.
equalTo
(
titleLabel
.
snp
.
bottom
)
.
offset
(
12
)
make
.
bottom
.
equalToSuperview
()
}
}
}
extension
YHPlanCustomerCaseListCell
:
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
YHPlanCustomerCaseListLayoutDelegate
{
// 返回单元格数量
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
return
cases
.
count
}
// 返回每个单元格的大小
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
sizeForItemAt
indexPath
:
IndexPath
)
->
CGSize
{
let
cellWidth
=
floor
(
KScreenWidth
-
16.0
*
2.0
-
10.0
)
/
2.0
var
height
=
self
.
getHeigt
(
font
:
UIFont
.
PFSC_R
(
ofSize
:
14
),
width
:
cellWidth
,
string
:
cases
[
indexPath
.
item
])
height
+=
(
cellWidth
*
(
200.0
/
166.0
)
+
20.0
)
return
CGSize
(
width
:
cellWidth
,
height
:
height
)
}
// 返回自定义单元格
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
guard
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHPlanCustomerCaseCollectionCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHPlanCustomerCaseCollectionCell
else
{
return
UICollectionViewCell
()
}
if
0
<=
indexPath
.
item
&&
indexPath
.
item
<
cases
.
count
{
cell
.
descLabel
.
text
=
cases
[
indexPath
.
item
]
}
return
cell
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
0
<=
indexPath
.
item
&&
indexPath
.
item
<
cases
.
count
{
// let text = topicArr[indexPath.item]
}
}
// 计算文字宽度大小
func
getHeigt
(
font
:
UIFont
,
width
:
CGFloat
,
string
:
String
)
->
CGFloat
{
let
size
=
CGSize
.
init
(
width
:
width
,
height
:
CGFloat
(
MAXFLOAT
))
let
dic
=
[
NSAttributedString
.
Key
.
font
:
font
]
// swift 4.2
let
strSize
=
string
.
boundingRect
(
with
:
size
,
options
:
[
.
usesLineFragmentOrigin
],
attributes
:
dic
,
context
:
nil
)
.
size
return
ceil
(
strSize
.
height
)
}
}
galaxy/galaxy/Classes/Modules/Plan(方案)/V/YHPlanCustomerCaseListLayout.swift
0 → 100644
View file @
789d2e49
//
// YHPlanCustomerCaseListLayout.swift
// galaxy
//
// Created by Dufet on 2025/3/26.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHPlanCustomerCaseListLayout
:
UICollectionViewLayout
{
// MARK: - 配置属性
let
cellWidth
=
floor
(
KScreenWidth
-
16.0
*
2.0
-
10.0
)
/
2.0
let
cellPadding
=
10.0
let
cellGap
=
10.0
private
var
contentHeight
:
CGFloat
=
0
// MARK: - 缓存布局属性
private
var
cachedAttributes
=
[
UICollectionViewLayoutAttributes
]()
// MARK: - 布局计算
override
func
prepare
()
{
super
.
prepare
()
guard
let
collectionView
=
collectionView
else
{
return
}
// 重置缓存和内容高度
cachedAttributes
.
removeAll
()
contentHeight
=
0.0
var
yOffset1
:
CGFloat
=
0.0
var
yOffset2
:
CGFloat
=
0.0
// 计算每个item的布局属性
for
item
in
0
..<
collectionView
.
numberOfItems
(
inSection
:
0
)
{
let
indexPath
=
IndexPath
(
item
:
item
,
section
:
0
)
// 获取item高度(通过委托)
let
height
:
CGFloat
if
let
delegate
=
collectionView
.
delegate
as?
YHPlanCustomerCaseListLayoutDelegate
{
height
=
delegate
.
collectionView
(
collectionView
,
layout
:
self
,
sizeForItemAt
:
indexPath
)
.
height
}
else
{
height
=
240
// 默认高度
}
// 计算frame
let
x
=
item
%
2
==
0
?
0.0
:
cellWidth
+
cellPadding
let
y
=
item
%
2
==
0
?
yOffset1
:
yOffset2
let
frame
=
CGRect
(
x
:
x
,
y
:
y
,
width
:
cellWidth
,
height
:
height
)
// 创建布局属性
let
attributes
=
UICollectionViewLayoutAttributes
(
forCellWith
:
indexPath
)
attributes
.
frame
=
frame
cachedAttributes
.
append
(
attributes
)
// 更新内容高度和yOffset
if
item
%
2
==
0
{
yOffset1
=
y
+
height
}
else
{
yOffset2
=
y
+
height
}
}
contentHeight
=
max
(
yOffset1
,
yOffset2
)
}
// MARK: - 布局属性提供
override
var
collectionViewContentSize
:
CGSize
{
return
CGSize
(
width
:
(
KScreenWidth
-
16.0
*
2.0
-
10.0
),
height
:
contentHeight
)
}
override
func
layoutAttributesForElements
(
in
rect
:
CGRect
)
->
[
UICollectionViewLayoutAttributes
]?
{
return
cachedAttributes
.
filter
{
$0
.
frame
.
intersects
(
rect
)
}
}
override
func
layoutAttributesForItem
(
at
indexPath
:
IndexPath
)
->
UICollectionViewLayoutAttributes
?
{
return
cachedAttributes
[
indexPath
.
item
]
}
// MARK: - 支持动态高度变化
override
func
shouldInvalidateLayout
(
forBoundsChange
newBounds
:
CGRect
)
->
Bool
{
guard
let
collectionView
=
collectionView
else
{
return
false
}
return
!
newBounds
.
size
.
equalTo
(
collectionView
.
bounds
.
size
)
}
}
// MARK: - 高度计算协议
protocol
YHPlanCustomerCaseListLayoutDelegate
:
AnyObject
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
sizeForItemAt
indexPath
:
IndexPath
)
->
CGSize
}
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