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
1dd63d78
Commit
1dd63d78
authored
Jul 23, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 首页身份
parent
242cc3ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
38 deletions
+51
-38
YHHomeIdentityViewController.swift
...ses/Modules/Home(首页)/C/YHHomeIdentityViewController.swift
+32
-7
YHIdentityTabBar.swift
.../galaxy/Classes/Modules/Home(首页)/V/YHIdentityTabBar.swift
+17
-29
YHHomePageViewModel.swift
...axy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
+2
-2
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeIdentityViewController.swift
View file @
1dd63d78
...
@@ -29,6 +29,8 @@ class YHHomeIdentityViewController: YHBaseViewController {
...
@@ -29,6 +29,8 @@ class YHHomeIdentityViewController: YHBaseViewController {
var
scrollContentY
:
CGFloat
=
0.0
var
scrollContentY
:
CGFloat
=
0.0
var
isShowBottomView
:
Bool
=
false
var
isShowBottomView
:
Bool
=
false
var
subTabArr
:[
YHHomeLifeCategoryModel
]
=
[]
var
selectSubTab
:
YHHomeLifeCategoryModel
?
=
nil
lazy
var
viewModel
:
YHHomePageViewModel
=
{
lazy
var
viewModel
:
YHHomePageViewModel
=
{
let
vm
=
YHHomePageViewModel
()
let
vm
=
YHHomePageViewModel
()
...
@@ -41,13 +43,9 @@ class YHHomeIdentityViewController: YHBaseViewController {
...
@@ -41,13 +43,9 @@ class YHHomeIdentityViewController: YHBaseViewController {
YHHomeIdentityItem
(
img
:
UIImage
(
named
:
"identity_talent_4"
))]
YHHomeIdentityItem
(
img
:
UIImage
(
named
:
"identity_talent_4"
))]
lazy
var
subTabBar
:
YHIdentityTabBar
=
{
lazy
var
subTabBar
:
YHIdentityTabBar
=
{
let
items
=
[
YHIdentityTabBarItem
(
title
:
"优才"
,
type
:
.
talent
),
let
bar
=
YHIdentityTabBar
.
tabBarForItems
([])
YHIdentityTabBarItem
(
title
:
"高才"
,
type
:
.
high
),
YHIdentityTabBarItem
(
title
:
"专才"
,
type
:
.
expert
),
YHIdentityTabBarItem
(
title
:
"留学"
,
type
:
.
study
)]
let
bar
=
YHIdentityTabBar
.
tabBarForItems
(
items
)
bar
.
selectBlock
=
{
bar
.
selectBlock
=
{
[
weak
self
]
type
in
[
weak
self
]
index
,
item
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
tableView
.
setContentOffset
(
.
zero
,
animated
:
true
)
self
.
tableView
.
setContentOffset
(
.
zero
,
animated
:
true
)
self
.
tableView
.
reloadData
()
self
.
tableView
.
reloadData
()
...
@@ -260,8 +258,35 @@ extension YHHomeIdentityViewController {
...
@@ -260,8 +258,35 @@ extension YHHomeIdentityViewController {
self
.
viewModel
.
getGoodsCategory
(
params
:
params
)
{
self
.
viewModel
.
getGoodsCategory
(
params
:
params
)
{
[
weak
self
]
success
,
error
in
[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
viewModel
.
categoryArr
if
true
{
let
a
=
YHHomeLifeCategoryModel
()
a
.
name
=
"高才"
a
.
id
=
"90"
let
b
=
YHHomeLifeCategoryModel
()
b
.
name
=
"优才"
b
.
id
=
"91"
self
.
viewModel
.
categoryArr
=
[
a
,
b
]
}
subTabArr
.
removeAll
()
for
item
in
self
.
viewModel
.
categoryArr
{
if
let
item
=
item
{
subTabArr
.
append
(
item
)
}
}
self
.
subTabBar
.
updateItems
(
subTabArr
)
for
item
in
self
.
subTabArr
{
let
params
:[
String
:
Any
]
=
[
"categoryId"
:
"2"
,
"levelId"
:
item
.
id
]
self
.
viewModel
.
getGoodsCategoryDetail
(
params
:
params
)
{
[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
}
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHIdentityTabBar.swift
View file @
1dd63d78
...
@@ -8,22 +8,6 @@
...
@@ -8,22 +8,6 @@
import
UIKit
import
UIKit
enum
YHIdentityTabBarType
:
Int
{
case
none
=
0
case
talent
=
1
// 优才
case
high
=
2
// 高才
case
expert
=
3
// 专才
case
study
=
4
// 留学
}
class
YHIdentityTabBarItem
{
var
title
:
String
=
""
var
type
:
YHIdentityTabBarType
=
.
none
init
(
title
:
String
,
type
:
YHIdentityTabBarType
)
{
self
.
title
=
title
self
.
type
=
type
}
}
class
YHIdentityTabBar
:
UIView
{
class
YHIdentityTabBar
:
UIView
{
...
@@ -31,28 +15,27 @@ class YHIdentityTabBar: UIView {
...
@@ -31,28 +15,27 @@ class YHIdentityTabBar: UIView {
static
let
itemWidth
=
50.0
static
let
itemWidth
=
50.0
static
let
itemHeight
=
26.0
static
let
itemHeight
=
26.0
static
let
gap
=
10.0
static
let
gap
=
10.0
var
selectBlock
:((
Int
,
YHHomeLifeCategoryModel
)
->
Void
)?
var
items
:[
YHHomeLifeCategoryModel
]
=
[]
var
selectType
:
YHIdentityTabBarType
=
.
talent
static
func
tabBarForItems
(
_
items
:
[
YHHomeLifeCategoryModel
])
->
YHIdentityTabBar
{
let
bar
=
YHIdentityTabBar
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
KScreenWidth
,
height
:
44.0
))
var
selectBlock
:((
YHIdentityTabBarType
)
->
Void
)?
static
func
tabBarForItems
(
_
items
:
[
YHIdentityTabBarItem
])
->
YHIdentityTabBar
{
let
width
=
Self
.
itemWidth
*
Double
(
items
.
count
)
+
Self
.
gap
*
Double
(
items
.
count
-
1
)
let
bar
=
YHIdentityTabBar
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
width
,
height
:
44.0
))
bar
.
updateItems
(
items
)
bar
.
updateItems
(
items
)
return
bar
return
bar
}
}
func
updateItems
(
_
items
:
[
YHIdentityTabBarItem
])
{
func
updateItems
(
_
items
:
[
YHHomeLifeCategoryModel
])
{
self
.
items
=
items
self
.
removeSubviews
()
self
.
removeSubviews
()
for
(
index
,
item
)
in
items
.
enumerated
()
{
for
(
index
,
item
)
in
items
.
enumerated
()
{
let
x
=
(
Self
.
itemWidth
+
Self
.
gap
)
*
Double
(
index
)
let
x
=
(
Self
.
itemWidth
+
Self
.
gap
)
*
Double
(
index
)
let
btn
=
UIButton
(
type
:
.
custom
)
let
btn
=
UIButton
(
type
:
.
custom
)
btn
.
titleLabel
?
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
13
)
btn
.
titleLabel
?
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
13
)
btn
.
setTitle
(
item
.
titl
e
,
for
:
.
normal
)
btn
.
setTitle
(
item
.
nam
e
,
for
:
.
normal
)
btn
.
layer
.
borderWidth
=
0.5
btn
.
layer
.
borderWidth
=
1.0
self
.
setButton
(
btn
,
isSelected
:
index
==
0
)
self
.
setButton
(
btn
,
isSelected
:
index
==
0
)
btn
.
tag
=
Self
.
baseTag
+
index
+
1
btn
.
tag
=
Self
.
baseTag
+
index
btn
.
addTarget
(
self
,
action
:
#selector(
didTabButtonClicked(_:)
)
,
for
:
.
touchUpInside
)
btn
.
addTarget
(
self
,
action
:
#selector(
didTabButtonClicked(_:)
)
,
for
:
.
touchUpInside
)
self
.
addSubview
(
btn
)
self
.
addSubview
(
btn
)
btn
.
snp
.
makeConstraints
{
make
in
btn
.
snp
.
makeConstraints
{
make
in
...
@@ -62,6 +45,8 @@ class YHIdentityTabBar: UIView {
...
@@ -62,6 +45,8 @@ class YHIdentityTabBar: UIView {
make
.
height
.
equalTo
(
Self
.
itemHeight
)
make
.
height
.
equalTo
(
Self
.
itemHeight
)
}
}
}
}
self
.
setNeedsLayout
()
self
.
layoutIfNeeded
()
}
}
func
setButton
(
_
btn
:
UIButton
,
isSelected
:
Bool
)
{
func
setButton
(
_
btn
:
UIButton
,
isSelected
:
Bool
)
{
...
@@ -72,13 +57,16 @@ class YHIdentityTabBar: UIView {
...
@@ -72,13 +57,16 @@ class YHIdentityTabBar: UIView {
}
}
@objc
func
didTabButtonClicked
(
_
selectBtn
:
UIButton
)
{
@objc
func
didTabButtonClicked
(
_
selectBtn
:
UIButton
)
{
self
.
selectType
=
YHIdentityTabBarType
(
rawValue
:
selectBtn
.
tag
-
Self
.
baseTag
)
??
.
talent
let
selectIndex
=
selectBtn
.
tag
-
Self
.
baseTag
for
(
index
,
item
)
in
self
.
subviews
.
enumerated
()
{
for
(
index
,
item
)
in
self
.
subviews
.
enumerated
()
{
if
item
.
isKind
(
of
:
UIButton
.
self
)
{
if
item
.
isKind
(
of
:
UIButton
.
self
)
{
let
itemBtn
=
item
as!
UIButton
let
itemBtn
=
item
as!
UIButton
self
.
setButton
(
itemBtn
,
isSelected
:
itemBtn
.
tag
==
selectBtn
.
tag
)
self
.
setButton
(
itemBtn
,
isSelected
:
itemBtn
.
tag
==
selectBtn
.
tag
)
}
}
}
}
self
.
selectBlock
?(
self
.
selectType
)
if
0
<=
selectIndex
,
selectIndex
<
self
.
items
.
count
{
let
selectItem
=
self
.
items
[
selectIndex
]
self
.
selectBlock
?(
selectIndex
,
selectItem
)
}
}
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
View file @
1dd63d78
...
@@ -517,8 +517,9 @@ extension YHHomePageViewModel {
...
@@ -517,8 +517,9 @@ extension YHHomePageViewModel {
self
.
categoryArr
=
[]
self
.
categoryArr
=
[]
callBackBlock
(
false
,
err
)
callBackBlock
(
false
,
err
)
}
}
}
func
getGoodsCategoryDetail
(
params
:[
String
:
Any
]
=
[:],
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
func
getGoodsCategoryDetail
(
params
:[
String
:
Any
]
=
[:],
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Common
.
homeLifeDetail
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Common
.
homeLifeDetail
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
...
@@ -543,6 +544,5 @@ extension YHHomePageViewModel {
...
@@ -543,6 +544,5 @@ extension YHHomePageViewModel {
self
.
detailModel
=
YHHomeLifeCategoryDetailModel
()
self
.
detailModel
=
YHHomeLifeCategoryDetailModel
()
callBackBlock
(
false
,
err
)
callBackBlock
(
false
,
err
)
}
}
}
}
}
}
}
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