Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
王士厅
2024-07-16 15:11:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3324b944a0bdd88d5075ae0bbb97022ce2e0b8df
3324b944
1 parent
d2923ad4
fix:点赞样式设置-祈福或默哀,未登录用户详情页点赞后,触发登录,登录成功后,点击点赞按钮无响应
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
3324b94
...
...
@@ -48,6 +48,7 @@ export struct ImageAndTextPageComponent {
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State recommendList: ContentDTO[] = []
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State getNewsStatusOfUser: boolean = false // 接口获取点赞、收藏状态,为true时获取失败
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State isPageEnd: boolean = false
@State publishTime: string = ''
...
...
@@ -73,6 +74,10 @@ export struct ImageAndTextPageComponent {
pageShowForUpdateData() {
this.pageShowTime = DateTimeUtils.getTimeStamp()
// 未登录查不到稿件收藏状态,导致newsStatusOfUser为undefined,影响后续点赞效果
if(this.getNewsStatusOfUser) {
this.getInteractDataStatus()
}
}
//内容浏览Tracking
...
...
@@ -291,7 +296,7 @@ export struct ImageAndTextPageComponent {
if (this.detailContentEmpty) {
this.emptyType = 18
}
console.log(TAG, JSON.stringify(detailBeans))
console.log(TAG,
"dl",
JSON.stringify(detailBeans))
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans[0];
let dateTime =
...
...
@@ -302,6 +307,7 @@ export struct ImageAndTextPageComponent {
this.getRecommend()
}
if (this.contentDetailData?.openLikes === 1) {
console.log(TAG, '点赞this.getInteractDataStatus()')
this.getInteractDataStatus()
this.queryContentInteractCount()
}
...
...
@@ -364,13 +370,15 @@ export struct ImageAndTextPageComponent {
}
]
}
console.error(TAG, JSON.stringify(this.contentDetailData
))
// console.log(TAG,'contentDetailData', JSON.stringify(params.contentList
))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.getNewsStatusOfUser = false // 获取成功
this.newsStatusOfUser = data[0];
Logger.info
(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
// console.log
(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
this.getNewsStatusOfUser = true // 获取失败
console.error(TAG,'exception', JSON.stringify(exception))
}
}
...
...
@@ -391,13 +399,14 @@ export struct ImageAndTextPageComponent {
}
console.log(TAG, '点赞、取消点赞params', JSON.stringify(params))
PageRepository.postExecuteLike(params).then(res => {
console.log(TAG, '点赞、res', JSON.stringify(res))
console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',)
// console.log(TAG, '点赞、res', JSON.stringify(res))
console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
if (this.newsStatusOfUser) {
//内容点赞、取消点赞Tracking 1点赞 0取消点赞
TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus)
this.queryContentInteractCount()
TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)
}
})
...
...
@@ -415,7 +424,7 @@ export struct ImageAndTextPageComponent {
}]
}
PageRepository.getContentInteract(params).then(res => {
console.error(TAG, '
res
', JSON.stringify(res))
console.error(TAG, '
queryContentInteractCount
', JSON.stringify(res))
if (res.data) {
this.interactData = res.data[0]
this.likeNum = Number(res.data[0]?.likeNum) || 0
...
...
Please
register
or
login
to post a comment