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
f3f52283
Commit
f3f52283
authored
Dec 13, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
c4557570
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
164 additions
and
13 deletions
+164
-13
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHPageControl.swift
galaxy/galaxy/Classes/Base/V/YHPageControl.swift
+142
-0
YHAIChatBannerView.swift
...s/Modules/AI/AI-Dialogue(AI对话)/V/YHAIChatBannerView.swift
+18
-13
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
f3f52283
...
...
@@ -566,6 +566,7 @@
048058352C7DC7AC00502CAA
/* YHMyTestViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
048058342C7DC7AC00502CAA
/* YHMyTestViewController.swift */
;
};
048058372C7F03B500502CAA
/* YHTravelCertificateUploadCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
048058362C7F03B500502CAA
/* YHTravelCertificateUploadCell.swift */
;
};
048058392C7F289700502CAA
/* YHTravelCertificateItemView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
048058382C7F289700502CAA
/* YHTravelCertificateItemView.swift */
;
};
048063612D0BE9CF0021A44F
/* YHPageControl.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
048063602D0BE9CF0021A44F
/* YHPageControl.swift */
;
};
0480976B2BA15269000B9DCA
/* YHCertificateInfoCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0480976A2BA15269000B9DCA
/* YHCertificateInfoCell.swift */
;
};
0480976D2BA158A1000B9DCA
/* YHCertificateListVC.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0480976C2BA158A1000B9DCA
/* YHCertificateListVC.swift */
;
};
048097712BA18D66000B9DCA
/* YHCertificateSearchBar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
048097702BA18D66000B9DCA
/* YHCertificateSearchBar.swift */
;
};
...
...
@@ -1687,6 +1688,7 @@
048058342C7DC7AC00502CAA
/* YHMyTestViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMyTestViewController.swift
;
sourceTree
=
"<group>"
;
};
048058362C7F03B500502CAA
/* YHTravelCertificateUploadCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHTravelCertificateUploadCell.swift
;
sourceTree
=
"<group>"
;
};
048058382C7F289700502CAA
/* YHTravelCertificateItemView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHTravelCertificateItemView.swift
;
sourceTree
=
"<group>"
;
};
048063602D0BE9CF0021A44F
/* YHPageControl.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPageControl.swift
;
sourceTree
=
"<group>"
;
};
0480976A2BA15269000B9DCA
/* YHCertificateInfoCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateInfoCell.swift
;
sourceTree
=
"<group>"
;
};
0480976C2BA158A1000B9DCA
/* YHCertificateListVC.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateListVC.swift
;
sourceTree
=
"<group>"
;
};
048097702BA18D66000B9DCA
/* YHCertificateSearchBar.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateSearchBar.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -5639,6 +5641,7 @@
04F2432E2C94704200DF2C74
/* YHPaddedLabel.swift */
,
04395F892CEDB26500D3005C
/* YHAutoTextView.swift */
,
045F283F2CF5ED3400520F19
/* YHAITabBarItemContentView.swift */
,
048063602D0BE9CF0021A44F
/* YHPageControl.swift */
,
);
path
=
V
;
sourceTree
=
"<group>"
;
...
...
@@ -6204,6 +6207,7 @@
045EEEC72B9F171A0022A143
/* YHOtherYesOrNoItemView.swift in Sources */
,
A5FF0F3E2C32F2590069852B
/* YHActivityDetailCell2.swift in Sources */
,
04256DD42C70538400A37BA4
/* YHFamilyInfoUpdateViewController.swift in Sources */
,
048063612D0BE9CF0021A44F
/* YHPageControl.swift in Sources */
,
04F243682C9D670E00DF2C74
/* YHResignDocumentListModel.swift in Sources */
,
04FD85702C21646200BEF9C5
/* YHMyInterestTopicCell.swift in Sources */
,
04F243742CA07C6C00DF2C74
/* YHCollectionViewLeftAlignedFlowLayout.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Base/V/YHPageControl.swift
0 → 100644
View file @
f3f52283
//
// YHPageControl.swift
// galaxy
//
// Created by Dufet on 2024/12/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHPageControl
:
UIView
{
// MARK: - Properties
private
var
dots
:
[
UIView
]
=
[]
var
dotSize
:
CGSize
=
CGSize
(
width
:
40
,
height
:
8
)
// 普通点的大小
var
selectedDotSize
:
CGSize
=
CGSize
(
width
:
60
,
height
:
8
)
// 选中点的大小
var
spacing
:
CGFloat
=
8
// 点之间的间距
// 当前页码
var
currentPage
:
Int
=
0
{
didSet
{
guard
oldValue
!=
currentPage
else
{
return
}
updateDots
(
animated
:
true
)
}
}
// 总页数
var
numberOfPages
:
Int
=
0
{
didSet
{
guard
oldValue
!=
numberOfPages
else
{
return
}
setupDots
()
}
}
// 自定义颜色
var
dotColor
:
UIColor
=
UIColor
.
lightGray
{
didSet
{
dots
.
forEach
{
$0
.
backgroundColor
=
dotColor
}
dots
[
safe
:
currentPage
]?
.
backgroundColor
=
selectedDotColor
}
}
var
selectedDotColor
:
UIColor
=
UIColor
.
systemBlue
{
didSet
{
dots
[
safe
:
currentPage
]?
.
backgroundColor
=
selectedDotColor
}
}
// MARK: - Initialization
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
setupView
()
}
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
setupView
()
}
// MARK: - Setup
private
func
setupView
()
{
backgroundColor
=
.
clear
}
private
func
setupDots
()
{
// 移除现有的点
dots
.
forEach
{
$0
.
removeFromSuperview
()
}
dots
.
removeAll
()
// 创建新的点
for
_
in
0
..<
numberOfPages
{
let
dot
=
UIView
()
dot
.
backgroundColor
=
dotColor
dot
.
layer
.
shadowOffset
=
.
zero
addSubview
(
dot
)
dots
.
append
(
dot
)
}
// 更新布局
setNeedsLayout
()
updateDots
(
animated
:
false
)
}
// MARK: - Layout
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
let
totalWidth
=
CGFloat
(
numberOfPages
-
1
)
*
(
dotSize
.
width
+
spacing
)
+
selectedDotSize
.
width
var
xOffset
=
(
bounds
.
width
-
totalWidth
)
/
2
for
(
index
,
dot
)
in
dots
.
enumerated
()
{
let
isSelected
=
index
==
currentPage
let
width
=
isSelected
?
selectedDotSize
.
width
:
dotSize
.
width
dot
.
frame
=
CGRect
(
x
:
xOffset
,
y
:
(
bounds
.
height
-
dotSize
.
height
)
/
2
,
width
:
width
,
height
:
dotSize
.
height
)
dot
.
layer
.
cornerRadius
=
self
.
dotSize
.
height
/
2
dot
.
clipsToBounds
=
true
xOffset
+=
width
+
spacing
}
}
// MARK: - Updates
private
func
updateDots
(
animated
:
Bool
)
{
guard
!
dots
.
isEmpty
else
{
return
}
let
update
=
{
self
.
dots
.
enumerated
()
.
forEach
{
index
,
dot
in
let
isSelected
=
index
==
self
.
currentPage
dot
.
backgroundColor
=
isSelected
?
self
.
selectedDotColor
:
self
.
dotColor
let
width
=
isSelected
?
self
.
selectedDotSize
.
width
:
self
.
dotSize
.
width
var
frame
=
dot
.
frame
frame
.
size
.
width
=
width
dot
.
layer
.
cornerRadius
=
self
.
dotSize
.
height
/
2
dot
.
clipsToBounds
=
true
dot
.
frame
=
frame
}
self
.
layoutSubviews
()
}
if
animated
{
UIView
.
animate
(
withDuration
:
0.3
,
delay
:
0
,
usingSpringWithDamping
:
0.7
,
initialSpringVelocity
:
0.5
,
options
:
[
.
curveEaseInOut
],
animations
:
update
)
}
else
{
update
()
}
}
}
// MARK: - Safe Array Access
private
extension
Array
{
subscript
(
safe
index
:
Index
)
->
Element
?
{
return
indices
.
contains
(
index
)
?
self
[
index
]
:
nil
}
}
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAIChatBannerView.swift
View file @
f3f52283
...
...
@@ -8,6 +8,7 @@
import
UIKit
import
FSPagerView
import
JXPageControl
class
YHAIChatBannerItem
{
var
id
:
Int
=
0
...
...
@@ -47,7 +48,7 @@ class YHAIChatBannerView: UIView {
descLabel
.
text
=
config
.
desc
bgCardView
.
backgroundColor
=
config
.
bgColor
bgImgV
.
image
=
UIImage
(
named
:
config
.
bgImageName
)
indicatorView
.
selectedColor
=
config
.
indicatorColor
indicatorView
.
selected
Dot
Color
=
config
.
indicatorColor
bannerArr
=
config
.
bannerItems
messages
=
config
.
flowMessages
}
...
...
@@ -96,10 +97,10 @@ class YHAIChatBannerView: UIView {
didSet
{
// 设置为0是先停掉自动滑动定时器
bannerView
.
automaticSlidingInterval
=
0
self
.
indicatorView
.
indicatorItem
s
=
self
.
bannerArr
.
count
self
.
indicatorView
.
numberOfPage
s
=
self
.
bannerArr
.
count
bannerView
.
reloadData
()
// 指定指示器为第一个
self
.
indicatorView
.
cur
IndicatorIndex
=
0
self
.
indicatorView
.
cur
rentPage
=
0
// 指定显示图片为第一个
bannerView
.
selectItem
(
at
:
0
,
animated
:
false
)
// 开启定时器开始滚动
...
...
@@ -121,13 +122,17 @@ class YHAIChatBannerView: UIView {
return
view
}()
lazy
var
indicatorView
:
YHHomeBannerIndicatorView
=
{
let
view
=
YHHomeBannerIndicatorView
()
view
.
normalColor
=
.
init
(
hex
:
0xD5DAE1
)
view
.
selectedColor
=
.
brandMainColor
view
.
layer
.
cornerRadius
=
1.0
view
.
clipsToBounds
=
true
return
view
lazy
var
indicatorView
:
YHPageControl
=
{
let
pageControl
=
YHPageControl
(
frame
:
.
zero
)
let
dotHeight
=
3.0
pageControl
.
spacing
=
2.0
pageControl
.
dotSize
=
CGSizeMake
(
5
,
dotHeight
)
pageControl
.
selectedDotSize
=
CGSizeMake
(
12
,
dotHeight
)
pageControl
.
numberOfPages
=
0
pageControl
.
currentPage
=
0
pageControl
.
dotColor
=
.
init
(
hex
:
0xD5DAE1
)
pageControl
.
selectedDotColor
=
.
brandMainColor
return
pageControl
}()
lazy
var
layout
:
YHAIChatCustomFlowLayout
=
{
...
...
@@ -212,7 +217,7 @@ class YHAIChatBannerView: UIView {
indicatorView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalToSuperview
()
make
.
height
.
equalTo
(
2
)
make
.
height
.
equalTo
(
3
)
make
.
bottom
.
equalTo
(
-
16
)
}
bannerView
.
reloadData
()
...
...
@@ -263,11 +268,11 @@ extension YHAIChatBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
}
func
pagerViewWillEndDragging
(
_
pagerView
:
FSPagerView
,
targetIndex
:
Int
)
{
self
.
indicatorView
.
cur
IndicatorIndex
=
targetIndex
self
.
indicatorView
.
cur
rentPage
=
targetIndex
}
func
pagerViewDidEndScrollAnimation
(
_
pagerView
:
FSPagerView
)
{
self
.
indicatorView
.
cur
IndicatorIndex
=
pagerView
.
currentIndex
self
.
indicatorView
.
cur
rentPage
=
pagerView
.
currentIndex
}
}
...
...
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