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
1e74b607
Commit
1e74b607
authored
Apr 11, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页 model
parent
93c7ec4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
7 deletions
+60
-7
YHHomePageViewController.swift
...Classes/Modules/Home(首页)/C/YHHomePageViewController.swift
+4
-2
YHHomeCollectionViewCell.swift
...IntelligentService(服务中心)/V/YHHomeCollectionViewCell.swift
+56
-5
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomePageViewController.swift
View file @
1e74b607
...
@@ -11,7 +11,10 @@ import ESPullToRefresh
...
@@ -11,7 +11,10 @@ import ESPullToRefresh
import
GKNavigationBarSwift
import
GKNavigationBarSwift
class
YHHomePageViewController
:
YHBaseViewController
{
class
YHHomePageViewController
:
YHBaseViewController
{
var
viewModel
:
YHHomePageViewModel
!
lazy
var
viewModel
:
YHHomePageViewModel
=
{
let
viewModel
=
YHHomePageViewModel
()
return
viewModel
}()
lazy
var
items
=
{
lazy
var
items
=
{
return
[
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
,
url
:
""
)]
return
[
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
,
url
:
""
)]
...
@@ -37,7 +40,6 @@ class YHHomePageViewController: YHBaseViewController {
...
@@ -37,7 +40,6 @@ class YHHomePageViewController: YHBaseViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
viewModel
=
YHHomePageViewModel
()
setupUI
()
setupUI
()
getData
()
getData
()
}
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/V/YHHomeCollectionViewCell.swift
View file @
1e74b607
...
@@ -12,6 +12,13 @@ import Kingfisher
...
@@ -12,6 +12,13 @@ import Kingfisher
class
YHHomeCollectionViewCell
:
UICollectionViewCell
{
class
YHHomeCollectionViewCell
:
UICollectionViewCell
{
static
let
cellReuseIdentifier
=
"YHHomeCollectionViewCell"
static
let
cellReuseIdentifier
=
"YHHomeCollectionViewCell"
lazy
var
viewModel
:
YHHomeWebViewModel
=
{
let
viewModel
=
YHHomeWebViewModel
()
return
viewModel
}()
var
listModel
:
YHHomeListModel
?
{
var
listModel
:
YHHomeListModel
?
{
didSet
{
didSet
{
updataSubViews
()
updataSubViews
()
...
@@ -48,6 +55,14 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
...
@@ -48,6 +55,14 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
return
imageV
return
imageV
}()
}()
lazy
var
heartImageViewBtn
:
UIButton
=
{
let
btn
:
UIButton
=
UIButton
(
type
:
.
custom
)
btn
.
setImage
(
UIImage
(
named
:
"home_grey_heart"
),
for
:
.
normal
)
btn
.
setImage
(
UIImage
(
named
:
"home_red_heart"
),
for
:
.
selected
)
return
btn
}()
lazy
var
numLable
:
UILabel
=
{
lazy
var
numLable
:
UILabel
=
{
let
label
=
UILabel
()
let
label
=
UILabel
()
label
.
text
=
""
label
.
text
=
""
...
@@ -98,12 +113,15 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
...
@@ -98,12 +113,15 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
make
.
height
.
equalTo
(
16
)
make
.
height
.
equalTo
(
16
)
}
}
subHoldView
.
addSubview
(
heartImageView
)
subHoldView
.
addSubview
(
heartImageView
Btn
)
heartImageView
.
snp
.
makeConstraints
{
make
in
heartImageView
Btn
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalTo
(
numLable
.
snp
.
left
)
.
offset
(
-
2
)
make
.
right
.
equalTo
(
numLable
.
snp
.
left
)
.
offset
(
-
2
)
make
.
height
.
width
.
equalTo
(
16
)
make
.
height
.
width
.
equalTo
(
16
)
make
.
centerY
.
equalTo
(
numLable
)
make
.
centerY
.
equalTo
(
numLable
)
}
}
heartImageViewBtn
.
addTarget
(
self
,
action
:
#selector(
clickHeart
)
,
for
:
.
touchUpInside
)
heartImageViewBtn
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
15
,
left
:
15
,
bottom
:
15
,
right
:
15
)
}
}
func
updataSubViews
()
{
func
updataSubViews
()
{
...
@@ -126,10 +144,43 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
...
@@ -126,10 +144,43 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
}
}
numLable
.
text
=
listModel
.
collect_count
.
string
numLable
.
text
=
listModel
.
collect_count
.
string
if
listModel
.
is_like
{
// if listModel.is_like {
headImageView
.
image
=
UIImage
(
named
:
"home_red_heart"
)
// headImageView.image = UIImage(named: "home_red_heart")
// } else {
// headImageView.image = UIImage(named: "home_grey_heart")
// }
heartImageViewBtn
.
isSelected
=
listModel
.
is_like
}
@objc
func
clickHeart
()
{
guard
let
listModel
=
listModel
else
{
return
}
if
YHLoginManager
.
shared
.
isLogin
()
{
if
listModel
.
is_like
==
false
{
viewModel
.
getLike
(
listModel
.
id
,
1
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
YHHUD
.
flash
(
message
:
"已点赞"
)
listModel
.
is_like
=
true
updataSubViews
()
}
}
}
else
{
viewModel
.
getLike
(
listModel
.
id
,
0
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
YHHUD
.
flash
(
message
:
"已取消点赞"
)
listModel
.
is_like
=
false
updataSubViews
()
}
}
}
}
else
{
}
else
{
headImageView
.
image
=
UIImage
(
named
:
"home_grey_heart"
)
let
vc
=
UINavigationController
(
rootVC
:
YHPhoneLoginViewController
())
vc
.
modalPresentationStyle
=
.
custom
self
.
parentViewController
?
.
navigationController
?
.
present
(
vc
,
animated
:
true
)
}
}
}
}
}
}
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