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
2f7814f2
Commit
2f7814f2
authored
Oct 11, 2025
by
Alex朱枝文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
社区列表增加点赞按钮、分享bug修复
parent
3fef7ab7
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
160 additions
and
11 deletions
+160
-11
YHCircleViewController.swift
...Community(社区)/Circle(下属社区)/C/YHCircleViewController.swift
+23
-2
YHCircleCollectionViewCell.swift
...unity(社区)/Circle(下属社区)/V/YHCircleCollectionViewCell.swift
+86
-2
YHH5WebViewVC.swift
.../Classes/Modules/InteractionH5(与H5交互)/YHH5WebViewVC.swift
+1
-3
YHJsApi.swift
...galaxy/Classes/Modules/InteractionH5(与H5交互)/YHJsApi.swift
+1
-1
YHDynamicItem.swift
...asses/Modules/Mine(我的)/NameCard(名片)/M/YHDynamicItem.swift
+1
-0
YHDynamicViewModel.swift
...Modules/Mine(我的)/NameCard(名片)/VM/YHDynamicViewModel.swift
+3
-2
YHAllApiName.swift
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
+1
-1
Contents.json
...Community/Circle/circle_grey_heart.imageset/Contents.json
+22
-0
circle_grey_heart@2x.png
...ircle/circle_grey_heart.imageset/circle_grey_heart@2x.png
+0
-0
circle_grey_heart@3x.png
...ircle/circle_grey_heart.imageset/circle_grey_heart@3x.png
+0
-0
Contents.json
.../Community/Circle/circle_red_heart.imageset/Contents.json
+22
-0
circle_red_heart@2x.png
.../Circle/circle_red_heart.imageset/circle_red_heart@2x.png
+0
-0
circle_red_heart@3x.png
.../Circle/circle_red_heart.imageset/circle_red_heart@3x.png
+0
-0
No files found.
galaxy/galaxy/Classes/Modules/Community(社区)/Circle(下属社区)/C/YHCircleViewController.swift
View file @
2f7814f2
...
@@ -219,8 +219,8 @@ extension YHCircleViewController: UICollectionViewDelegate, UICollectionViewData
...
@@ -219,8 +219,8 @@ extension YHCircleViewController: UICollectionViewDelegate, UICollectionViewData
guard
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHCircleCollectionViewCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHCircleCollectionViewCell
else
{
guard
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHCircleCollectionViewCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHCircleCollectionViewCell
else
{
return
UICollectionViewCell
()
return
UICollectionViewCell
()
}
}
let
model
=
arr
[
indexPath
.
row
]
cell
.
listModel
=
arr
[
indexPath
.
row
]
cell
.
listModel
=
model
cell
.
onImageHeightChanged
=
{
[
weak
self
]
in
cell
.
onImageHeightChanged
=
{
[
weak
self
]
in
guard
let
self
=
self
else
{
guard
let
self
=
self
else
{
return
return
...
@@ -229,6 +229,27 @@ extension YHCircleViewController: UICollectionViewDelegate, UICollectionViewData
...
@@ -229,6 +229,27 @@ extension YHCircleViewController: UICollectionViewDelegate, UICollectionViewData
self
.
circleCollectView
.
reloadData
()
self
.
circleCollectView
.
reloadData
()
}
}
}
}
cell
.
clickHeartEvent
=
{
[
weak
self
,
weak
cell
]
in
guard
let
self
=
self
else
{
return
}
if
!
YHLoginManager
.
shared
.
isLogin
()
{
YHOneKeyLoginManager
.
shared
.
oneKeyLogin
()
return
}
let
operation
=
model
.
like_self
?
2
:
1
self
.
viewModel
.
getLike
(
model
.
id
,
operation
)
{
success
,
_
in
if
success
{
model
.
like_self
=
!
model
.
like_self
if
model
.
like_self
{
model
.
like_count
+=
1
}
else
{
model
.
like_count
-=
1
}
cell
?
.
updateLikeState
(
isLike
:
model
.
like_self
,
currentModel
:
model
)
}
}
}
return
cell
return
cell
}
}
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/Circle(下属社区)/V/YHCircleCollectionViewCell.swift
View file @
2f7814f2
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
import
UIKit
import
UIKit
import
Kingfisher
import
Kingfisher
import
Lottie
class
YHCircleCollectionViewCell
:
UICollectionViewCell
{
class
YHCircleCollectionViewCell
:
UICollectionViewCell
{
...
@@ -20,6 +21,7 @@ class YHCircleCollectionViewCell: UICollectionViewCell {
...
@@ -20,6 +21,7 @@ class YHCircleCollectionViewCell: UICollectionViewCell {
}
}
var
onImageHeightChanged
:
(()
->
Void
)?
var
onImageHeightChanged
:
(()
->
Void
)?
var
clickHeartEvent
:
(()
->
Void
)?
// MARK: - UI Components
// MARK: - UI Components
...
@@ -64,6 +66,27 @@ class YHCircleCollectionViewCell: UICollectionViewCell {
...
@@ -64,6 +66,27 @@ class YHCircleCollectionViewCell: UICollectionViewCell {
return
view
return
view
}()
}()
lazy
var
heartImageViewBtn
:
UIButton
=
{
let
btn
:
UIButton
=
UIButton
(
type
:
.
custom
)
btn
.
setImage
(
UIImage
(
named
:
"circle_grey_heart"
),
for
:
.
normal
)
btn
.
setImage
(
UIImage
(
named
:
"circle_red_heart"
),
for
:
.
selected
)
return
btn
}()
lazy
var
numLable
:
UILabel
=
{
let
label
=
UILabel
()
label
.
text
=
""
label
.
textColor
=
UIColor
.
brandGrayColor6
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
12
)
return
label
}()
lazy
var
animationView
:
LottieAnimationView
=
{
let
view
=
LottieAnimationView
(
name
:
"shouye"
)
view
.
isHidden
=
true
return
view
}()
// MARK: - Initialization
// MARK: - Initialization
required
init
?(
coder
:
NSCoder
)
{
required
init
?(
coder
:
NSCoder
)
{
...
@@ -101,24 +124,79 @@ class YHCircleCollectionViewCell: UICollectionViewCell {
...
@@ -101,24 +124,79 @@ class YHCircleCollectionViewCell: UICollectionViewCell {
// 头像
// 头像
subHoldView
.
addSubview
(
avatarImageView
)
subHoldView
.
addSubview
(
avatarImageView
)
// 昵称
subHoldView
.
addSubview
(
nameLabel
)
subHoldView
.
addSubview
(
numLable
)
subHoldView
.
addSubview
(
animationView
)
subHoldView
.
addSubview
(
heartImageViewBtn
)
avatarImageView
.
setContentCompressionResistancePriority
(
.
required
,
for
:
.
horizontal
)
heartImageViewBtn
.
setContentCompressionResistancePriority
(
.
required
,
for
:
.
horizontal
)
numLable
.
setContentCompressionResistancePriority
(
.
required
,
for
:
.
horizontal
)
animationView
.
setContentCompressionResistancePriority
(
.
required
,
for
:
.
horizontal
)
nameLabel
.
setContentCompressionResistancePriority
(
.
defaultLow
,
for
:
.
horizontal
)
avatarImageView
.
snp
.
makeConstraints
{
make
in
avatarImageView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
.
offset
(
8
)
make
.
left
.
equalToSuperview
()
.
offset
(
8
)
make
.
top
.
equalTo
(
contentLabel
.
snp
.
bottom
)
.
offset
(
12
)
make
.
top
.
equalTo
(
contentLabel
.
snp
.
bottom
)
.
offset
(
12
)
make
.
width
.
height
.
equalTo
(
16
)
make
.
width
.
height
.
equalTo
(
16
)
}
}
// 昵称
subHoldView
.
addSubview
(
nameLabel
)
nameLabel
.
snp
.
makeConstraints
{
make
in
nameLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
avatarImageView
.
snp
.
right
)
.
offset
(
4
)
make
.
left
.
equalTo
(
avatarImageView
.
snp
.
right
)
.
offset
(
4
)
make
.
centerY
.
equalTo
(
avatarImageView
)
make
.
centerY
.
equalTo
(
avatarImageView
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
8
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
8
)
}
}
numLable
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalToSuperview
()
.
offset
(
-
8
)
make
.
top
.
equalTo
(
avatarImageView
)
make
.
height
.
equalTo
(
16
)
}
animationView
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalTo
(
numLable
.
snp
.
left
)
.
offset
(
2.5
)
make
.
height
.
width
.
equalTo
(
24
)
make
.
centerY
.
equalTo
(
numLable
)
.
offset
(
-
0.5
)
}
heartImageViewBtn
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalTo
(
numLable
.
snp
.
left
)
.
offset
(
-
2
)
make
.
height
.
width
.
equalTo
(
16
)
make
.
centerY
.
equalTo
(
numLable
)
}
heartImageViewBtn
.
addTarget
(
self
,
action
:
#selector(
clickHeart
)
,
for
:
.
touchUpInside
)
heartImageViewBtn
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
15
,
left
:
15
,
bottom
:
15
,
right
:
15
)
}
// MARK: - Actions
@objc
func
clickHeart
()
{
clickHeartEvent
?()
}
}
// MARK: - Update UI
// MARK: - Update UI
func
updateLikeState
(
isLike
:
Bool
,
currentModel
:
YHDynamicItem
)
{
guard
let
model
=
listModel
,
currentModel
.
id
==
model
.
id
else
{
return
}
self
.
numLable
.
text
=
model
.
like_count
>
9999
?
"9999+"
:
model
.
like_count
.
string
if
isLike
{
// self.heartImageViewBtn.setImage(UIImage(named: ""), for: .selected)
// self.heartImageViewBtn.setImage(UIImage(named: ""), for: .normal)
// self.animationView.isHidden = false
// self.animationView.loopMode = .playOnce
// self.animationView.play { [weak self] _ in
// guard let self = self else { return }
// self.animationView.isHidden = true
// self.heartImageViewBtn.setImage(UIImage(named: "circle_red_heart"), for: .normal)
// }
self
.
heartImageViewBtn
.
setImage
(
UIImage
(
named
:
"circle_red_heart"
),
for
:
.
normal
)
}
else
{
animationView
.
isHidden
=
true
self
.
heartImageViewBtn
.
setImage
(
UIImage
(
named
:
"circle_grey_heart"
),
for
:
.
normal
)
}
}
private
func
updateUI
()
{
private
func
updateUI
()
{
guard
let
model
=
listModel
else
{
return
}
guard
let
model
=
listModel
else
{
return
}
...
@@ -189,5 +267,11 @@ class YHCircleCollectionViewCell: UICollectionViewCell {
...
@@ -189,5 +267,11 @@ class YHCircleCollectionViewCell: UICollectionViewCell {
make
.
right
.
equalToSuperview
()
.
offset
(
-
8
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
8
)
make
.
height
.
equalTo
(
model
.
textH
)
make
.
height
.
equalTo
(
model
.
textH
)
}
}
numLable
.
text
=
model
.
like_count
>
9999
?
"9999+"
:
model
.
like_count
.
string
if
model
.
like_self
{
heartImageViewBtn
.
setImage
(
UIImage
(
named
:
"circle_red_heart"
),
for
:
.
normal
)
}
else
{
heartImageViewBtn
.
setImage
(
UIImage
(
named
:
"circle_grey_heart"
),
for
:
.
normal
)
}
}
}
}
}
galaxy/galaxy/Classes/Modules/InteractionH5(与H5交互)/YHH5WebViewVC.swift
View file @
2f7814f2
...
@@ -433,9 +433,7 @@ private extension YHH5WebViewVC {
...
@@ -433,9 +433,7 @@ private extension YHH5WebViewVC {
shareUrl
=
YHBaseUrlManager
.
shared
.
curH5URL
()
+
"superAppBridge.html#/evaluation?channel=APP-share&customer_id=
\(
YHLoginManager
.
shared
.
userModel
?
.
id
??
""
)
"
shareUrl
=
YHBaseUrlManager
.
shared
.
curH5URL
()
+
"superAppBridge.html#/evaluation?channel=APP-share&customer_id=
\(
YHLoginManager
.
shared
.
userModel
?
.
id
??
""
)
"
}
}
if
!
shareUrl
.
isEmpty
&&
if
!
shareUrl
.
isEmpty
{
!
self
.
shareH5Title
.
isEmpty
&&
!
self
.
shareH5Describe
.
isEmpty
{
if
let
shareImageUrl
=
shareImageUrl
,
!
shareImageUrl
.
isEmpty
{
if
let
shareImageUrl
=
shareImageUrl
,
!
shareImageUrl
.
isEmpty
{
YHHUD
.
show
(
.
progress
(
message
:
""
))
YHHUD
.
show
(
.
progress
(
message
:
""
))
YHKingfisherUtils
.
fetchImage
(
with
:
shareImageUrl
)
{
image
in
YHKingfisherUtils
.
fetchImage
(
with
:
shareImageUrl
)
{
image
in
...
...
galaxy/galaxy/Classes/Modules/InteractionH5(与H5交互)/YHJsApi.swift
View file @
2f7814f2
...
@@ -239,7 +239,7 @@ extension YHJsApi {
...
@@ -239,7 +239,7 @@ extension YHJsApi {
let
shareH5Url
:
String
=
jsonObject
[
"ShareH5Url"
]
as?
String
??
""
let
shareH5Url
:
String
=
jsonObject
[
"ShareH5Url"
]
as?
String
??
""
let
shareImageUrl
:
String
?
=
jsonObject
[
"ShareImgUrl"
]
as?
String
let
shareImageUrl
:
String
?
=
jsonObject
[
"ShareImgUrl"
]
as?
String
if
!
shareH5
Title
.
isEmpty
,
!
shareH5Describe
.
isEmpty
,
!
shareH5
Url
.
isEmpty
{
if
!
shareH5Url
.
isEmpty
{
if
let
delegate
=
self
.
delegate
as?
YHH5WebViewVC
{
if
let
delegate
=
self
.
delegate
as?
YHH5WebViewVC
{
delegate
.
shareH5Syn
(
title
:
shareH5Title
,
desc
:
shareH5Describe
,
url
:
shareH5Url
,
shareImageUrl
:
shareImageUrl
)
delegate
.
shareH5Syn
(
title
:
shareH5Title
,
desc
:
shareH5Describe
,
url
:
shareH5Url
,
shareImageUrl
:
shareImageUrl
)
}
}
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/NameCard(名片)/M/YHDynamicItem.swift
View file @
2f7814f2
...
@@ -55,6 +55,7 @@ class YHDynamicItem: SmartCodable {
...
@@ -55,6 +55,7 @@ class YHDynamicItem: SmartCodable {
var
format_release_time
:
String
=
""
var
format_release_time
:
String
=
""
var
created_at
:
String
=
""
var
created_at
:
String
=
""
var
is_self_posts
:
Bool
=
false
// 是否是自己的动态
var
is_self_posts
:
Bool
=
false
// 是否是自己的动态
var
like_self
:
Bool
=
false
// MARK: - 高度计算相关属性
// MARK: - 高度计算相关属性
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/NameCard(名片)/VM/YHDynamicViewModel.swift
View file @
2f7814f2
...
@@ -81,10 +81,11 @@ extension YHDynamicViewModel {
...
@@ -81,10 +81,11 @@ extension YHDynamicViewModel {
/// 点赞/取消点赞动态
/// 点赞/取消点赞动态
/// - Parameters:
/// - Parameters:
/// - id: 动态ID
/// - id: 动态ID
/// - operation: 操作类型 1-点赞 2-取消点赞
/// - type: 操作类型 1收藏2点赞
/// - operation: 操作类型 1增加 2取消
/// - callBackBlock: 回调
/// - callBackBlock: 回调
func
getLike
(
_
id
:
String
,
_
operation
:
Int
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
Void
)
{
func
getLike
(
_
id
:
String
,
_
operation
:
Int
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
Void
)
{
let
params
:
[
String
:
Any
]
=
[
"id"
:
id
,
"operation"
:
operation
]
let
params
:
[
String
:
Any
]
=
[
"id"
:
id
,
"operation"
:
operation
,
"type"
:
2
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Dynamic
.
like
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Dynamic
.
like
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
json
,
_
in
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
json
,
_
in
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
View file @
2f7814f2
...
@@ -787,7 +787,7 @@ class YHAllApiName {
...
@@ -787,7 +787,7 @@ class YHAllApiName {
// 动态
// 动态
struct
Dynamic
{
struct
Dynamic
{
static
let
list
=
"super-app/content/posts/list"
static
let
list
=
"super-app/content/posts/list"
static
let
like
=
"super-app/content/posts/
message-
like"
static
let
like
=
"super-app/content/posts/like"
static
let
publishCircle
=
"super-app/content/posts/add"
static
let
publishCircle
=
"super-app/content/posts/add"
}
}
...
...
galaxy/galaxy/Res/Assets.xcassets/Community/Circle/circle_grey_heart.imageset/Contents.json
0 → 100644
View file @
2f7814f2
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"filename"
:
"circle_grey_heart@2x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"circle_grey_heart@3x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
galaxy/galaxy/Res/Assets.xcassets/Community/Circle/circle_grey_heart.imageset/circle_grey_heart@2x.png
0 → 100644
View file @
2f7814f2
674 Bytes
galaxy/galaxy/Res/Assets.xcassets/Community/Circle/circle_grey_heart.imageset/circle_grey_heart@3x.png
0 → 100644
View file @
2f7814f2
884 Bytes
galaxy/galaxy/Res/Assets.xcassets/Community/Circle/circle_red_heart.imageset/Contents.json
0 → 100644
View file @
2f7814f2
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"filename"
:
"circle_red_heart@2x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"circle_red_heart@3x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
galaxy/galaxy/Res/Assets.xcassets/Community/Circle/circle_red_heart.imageset/circle_red_heart@2x.png
0 → 100644
View file @
2f7814f2
470 Bytes
galaxy/galaxy/Res/Assets.xcassets/Community/Circle/circle_red_heart.imageset/circle_red_heart@3x.png
0 → 100644
View file @
2f7814f2
629 Bytes
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