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
f05205a4
Commit
f05205a4
authored
Apr 14, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、处理 首页的数据刷新
2、处理 数据一致性
parent
7c051f73
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
7 deletions
+40
-7
YHHomePageViewController.swift
...Classes/Modules/Home(首页)/C/YHHomePageViewController.swift
+13
-2
YHHomeWebViewController.swift
.../Classes/Modules/Home(首页)/C/YHHomeWebViewController.swift
+23
-1
YHHomeListModel.swift
...y/galaxy/Classes/Modules/Home(首页)/M/YHHomeListModel.swift
+2
-2
YHHomeCollectionViewCell.swift
...IntelligentService(服务中心)/V/YHHomeCollectionViewCell.swift
+2
-2
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomePageViewController.swift
View file @
f05205a4
...
...
@@ -41,7 +41,6 @@ class YHHomePageViewController: YHBaseViewController {
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
loadFirstData
()
}
lazy
var
searchView
:
YHHomeSearchView
=
{
...
...
@@ -104,7 +103,7 @@ private extension YHHomePageViewController {
gk_navigationBar
.
isHidden
=
true
view
.
backgroundColor
=
.
white
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
homepageRefresh
)
,
name
:
YhConstant
.
YhNotification
.
refreshHomePageNotifiction
,
object
:
nil
)
//
NotificationCenter.default.addObserver(self, selector: #selector(homepageRefresh), name:YhConstant.YhNotification.refreshHomePageNotifiction, object: nil)
view
.
addSubview
(
searchView
)
searchView
.
snp
.
makeConstraints
{
make
in
...
...
@@ -160,6 +159,18 @@ extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDa
let
vc
=
YHHomeWebViewController
()
vc
.
url
=
YHConfigManager
.
shared
.
h5Url
+
"?id=
\(
model
.
id
)
"
vc
.
id
=
model
.
id
vc
.
block
=
{
item
in
if
let
arr
=
self
.
viewModel
.
arrHomeNewsData
{
for
(
index
,
targetItem
)
in
arr
.
enumerated
()
{
if
targetItem
.
id
==
item
.
id
{
targetItem
.
is_like
=
item
.
is_like
targetItem
.
like_count
=
item
.
like_count
self
.
homeCollectView
.
reloadItems
(
at
:
[
IndexPath
(
index
:
index
)])
}
}
}
}
self
.
navigationController
?
.
pushViewController
(
vc
)
}
else
if
model
.
type
==
1
{
printLog
(
"直接播放视频"
)
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeWebViewController.swift
View file @
f05205a4
...
...
@@ -10,8 +10,14 @@ import UIKit
import
WebKit
class
YHHomeWebViewController
:
YHBaseViewController
,
WKUIDelegate
,
WKNavigationDelegate
{
var
viewModel
:
YHHomeWebViewModel
!
var
operationFlag
:
Bool
=
false
typealias
Block
=
(
YHWebModel
)
->
()
var
block
:
Block
?
var
viewModel
:
YHHomeWebViewModel
!
var
webview
=
WKWebView
()
var
progBar
=
UIProgressView
()
var
bottomView
:
YHHomeWebBottomView
!
...
...
@@ -60,16 +66,22 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
self
.
viewModel
.
getLike
(
self
.
id
,
1
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
operationFlag
=
true
YHHUD
.
flash
(
message
:
"已点赞"
)
self
.
getData
()
}
else
{
operationFlag
=
false
}
}
}
else
{
self
.
viewModel
.
getLike
(
self
.
id
,
0
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
operationFlag
=
true
YHHUD
.
flash
(
message
:
"已取消点赞"
)
self
.
getData
()
}
else
{
operationFlag
=
false
}
}
}
...
...
@@ -87,16 +99,22 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
self
.
viewModel
.
getStar
(
self
.
id
,
1
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
operationFlag
=
true
YHHUD
.
flash
(
message
:
"已收藏"
)
self
.
getData
()
}
else
{
operationFlag
=
false
}
}
}
else
{
self
.
viewModel
.
getStar
(
self
.
id
,
0
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
operationFlag
=
true
YHHUD
.
flash
(
message
:
"已取消收藏"
)
self
.
getData
()
}
else
{
operationFlag
=
false
}
}
}
...
...
@@ -132,11 +150,15 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
func
getData
()
{
viewModel
.
getWebDetail
(
self
.
id
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
guard
let
model
=
self
.
viewModel
.
mainModel
else
{
return
}
bottomView
.
likeCount
=
model
.
like_count
bottomView
.
starCount
=
model
.
collect_count
bottomView
.
isStar
=
model
.
is_collect
bottomView
.
isLike
=
model
.
is_like
self
.
block
?(
model
)
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/M/YHHomeListModel.swift
View file @
f05205a4
...
...
@@ -18,12 +18,12 @@ class YHHomeListModel: YHBaseModel {
var
id
:
Int
=
0
var
title
:
String
=
""
var
content
:
String
=
""
var
view_count
:
Int
=
0
var
view_count
:
Int
=
0
//浏览数量
var
img_url
:
String
=
""
var
type
:
Int
=
0
//文章类型 '文章类型 1视频 2图文 3图片',
var
is_like
:
Bool
=
false
var
media_url
:
String
=
""
var
like_count
:
Int
=
0
var
like_count
:
Int
=
0
//点赞梳理
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/V/YHHomeCollectionViewCell.swift
View file @
f05205a4
...
...
@@ -200,6 +200,7 @@ extension YHHomeCollectionViewCell {
if
success
{
YHHUD
.
flash
(
message
:
"已点赞"
)
listModel
.
is_like
=
true
listModel
.
like_count
=
listModel
.
like_count
+
1
updataSubViews
()
}
}
...
...
@@ -209,12 +210,11 @@ extension YHHomeCollectionViewCell {
if
success
{
YHHUD
.
flash
(
message
:
"已取消点赞"
)
listModel
.
is_like
=
false
listModel
.
like_count
=
listModel
.
like_count
-
1
updataSubViews
()
}
}
}
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
refreshHomePageNotifiction
,
object
:
nil
)
}
else
{
let
vc
=
UINavigationController
(
rootVC
:
YHPhoneLoginViewController
())
vc
.
modalPresentationStyle
=
.
custom
...
...
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