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
1d12f186
Commit
1d12f186
authored
Apr 12, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
29e12ba0
' into xiezhaolin
parents
a8e93ab9
29e12ba0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
YHSearchInfomationVC.swift
...axy/Classes/Modules/Home(首页)/C/YHSearchInfomationVC.swift
+38
-2
YHSearchInfoHistoryView.swift
.../Classes/Modules/Home(首页)/V/YHSearchInfoHistoryView.swift
+1
-0
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHSearchInfomationVC.swift
View file @
1d12f186
...
...
@@ -14,18 +14,33 @@ class YHSearchInfomationVC: YHBaseViewController {
static
let
searchHistoryMaxCount
=
10
var
items
:[
YHHomeListModel
]
=
[]
lazy
var
viewModel
:
YHHomePageViewModel
=
{
lazy
var
viewModel
:
YHHomePageViewModel
=
{
let
viewModel
=
YHHomePageViewModel
()
return
viewModel
}()
lazy
var
navBar
:
UIView
=
{
let
bar
=
UIView
()
let
backBtn
=
UIButton
()
backBtn
.
setImage
(
UIImage
(
named
:
"back_icon"
),
for
:
.
normal
)
backBtn
.
addTarget
(
self
,
action
:
#selector(
didBackBtnClicked
)
,
for
:
.
touchUpInside
)
backBtn
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
20
,
left
:
20
,
bottom
:
20
,
right
:
20
)
bar
.
addSubview
(
backBtn
)
backBtn
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
21
)
make
.
centerY
.
equalToSuperview
()
make
.
left
.
equalToSuperview
()
.
offset
(
16
)
}
return
bar
}()
lazy
var
searchBar
:
YHSearchInfoBar
=
{
let
bar
=
YHSearchInfoBar
(
frame
:
CGRect
(
x
:
20
,
y
:
k_Height_NavigationtBarAndStatuBar
+
8.0
,
width
:
KScreenWidth
-
40
,
height
:
36.0
))
bar
.
searchBlock
=
{
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
searchText
(
self
.
searchBar
.
textField
.
text
??
""
)
if
let
searchText
=
self
.
searchBar
.
textField
.
text
{
if
let
searchText
=
self
.
searchBar
.
textField
.
text
,
searchText
.
count
>
0
{
self
.
saveSearchHistory
(
searchText
)
}
}
...
...
@@ -70,6 +85,7 @@ class YHSearchInfomationVC: YHBaseViewController {
self
.
searchHistoryView
.
isHidden
=
true
self
.
searchBar
.
textField
.
text
=
text
searchText
(
text
)
self
.
saveSearchHistory
(
text
)
}
return
view
}()
...
...
@@ -104,12 +120,25 @@ class YHSearchInfomationVC: YHBaseViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
self
.
setupUI
()
}
func
setupUI
()
{
gk_navigationBar
.
isHidden
=
true
view
.
backgroundColor
=
.
white
view
.
addSubview
(
navBar
)
view
.
addSubview
(
searchBar
)
view
.
addSubview
(
tableView
)
view
.
addSubview
(
searchHistoryView
)
searchBar
.
textField
.
becomeFirstResponder
()
navBar
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalToSuperview
()
make
.
top
.
equalToSuperview
()
.
offset
(
k_Height_statusBar
())
make
.
height
.
equalTo
(
k_Height_NavContentBar
)
}
searchBar
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
.
offset
(
20
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
20
)
...
...
@@ -154,6 +183,9 @@ class YHSearchInfomationVC: YHBaseViewController {
}
func
saveSearchHistory
(
_
text
:
String
)
{
if
isEmptyString
(
text
)
{
return
}
var
arr
=
getSearchHistoryList
()
// 查找历史记录中是否有相同记录
var
targetIndex
=
-
1
...
...
@@ -178,6 +210,10 @@ class YHSearchInfomationVC: YHBaseViewController {
UserDefaults
.
standard
.
set
(
arr
,
forKey
:
Self
.
searchInfoHistoryKey
)
UserDefaults
.
standard
.
synchronize
()
}
@objc
func
didBackBtnClicked
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
extension
YHSearchInfomationVC
:
UITableViewDelegate
,
UITableViewDataSource
{
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHSearchInfoHistoryView.swift
View file @
1d12f186
...
...
@@ -74,6 +74,7 @@ class YHSearchInfoHistoryView: UIView {
historyItems
.
removeAll
()
historyItems
.
append
(
contentsOf
:
arr
)
self
.
collectionView
.
reloadData
()
titleLabel
.
isHidden
=
arr
.
count
<=
0
}
// 计算文字宽度大小
...
...
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