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-05-24 14:08:27 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
8fc56294a4e11b289f7ab198bc008ee85b2b9305
8fc56294
2 parents
28ed81be
a12467c2
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
27 deletions
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/LikeComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/OperationListView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
View file @
8fc5629
...
...
@@ -751,7 +751,7 @@ export struct DynamicDetailComponent {
return
}
const params: postExecuteLikeParams = {
status: this.newsStatusOfUser?.likeStatus === '1' ?
'0' : '1'
,
status: this.newsStatusOfUser?.likeStatus === '1' ?
0 : 1
,
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/LikeComponent.ets
View file @
8fc5629
...
...
@@ -5,6 +5,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index';
import { ContentDetailDTO } from 'wdBean/Index';
import measure from '@ohos.measure'
import {
ContentDetailRequest,
postExecuteLikeParams,
batchLikeAndCollectParams,
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
const TAG = 'LikeComponent';
...
...
@@ -40,8 +45,9 @@ export struct LikeComponent {
}
onDataUpdated() {
console.log(TAG, '点赞点击')
if (this.data) {
if (this.data['c
hannelId
'] !== 'undefined') {
if (this.data['c
ontentType
'] !== 'undefined') {
//获取点赞状态
this.getLikeStatus()
//获取点赞数
...
...
@@ -300,13 +306,26 @@ export struct LikeComponent {
executeLike(status: string) {
console.log(TAG, '点赞接口调用', status)
this.data['status'] = status
this.data['contentId'] = this.contentDetailData?.newsId + ''
this.data['contentType'] = this.contentDetailData?.newsType + ''
this.viewModel.executeLike2(this.data).then(() => {
const params: postExecuteLikeParams = {
status: Number(status),
contentId: this.data['contentId'],
contentType: this.data['contentType']
}
if(this.data['relType']) {
params.relType = this.data['relType']
}
if(this.data['contentRelId']) {
params.contentRelId = this.data['contentRelId']
}
if(this.data['channelId']) {
params.channelId = this.data['channelId']
}
console.log(TAG, "点赞 params", JSON.stringify(params))
ContentDetailRequest.postExecuteLike(params).then((data) => {
console.log(TAG, '点赞接口调用成功')
console.log(TAG, '点赞接口调用成功'
, JSON.stringify(data)
)
// 直播点赞一直增加
if (this.contentDetailData.liveInfo) {
...
...
@@ -333,11 +352,25 @@ export struct LikeComponent {
}
getLikeStatus() {
this.viewModel.getLikeStatus(this.data).then((data) => {
if (data && data['data'].length && data['data'][0]['likeStatus']) {
this.likeStatus = data['data'][0]['likeStatus']
} else {
this.likeStatus = false
// console.log(TAG, "this.data", JSON.stringify(this.data))
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.data['contentId'],
contentType: this.data['contentType'],
contentRelId: this.data['contentRelId'] || '' + '',
}
]
}
console.log(TAG, "查询点赞状态params", JSON.stringify(params))
ContentDetailRequest.postBatchLikeAndCollectStatus(params).then(res => {
console.log(TAG, '查询点赞、收藏状态==', JSON.stringify(res.data))
if (res.data) {
if(res.data[0].likeStatus) {
this.likeStatus = res.data[0].likeStatus ? true : false
} else {
this.likeStatus = false
}
}
}).catch(() => {
this.likeStatus = false
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
8fc5629
...
...
@@ -36,6 +36,7 @@ const TAG = 'OperRowListView';
* 注意:外层需注册 @Provide contentDetailData:contentDetailData = {} as contentDetailData
* 传值示例:
OperRowListView({
contentDetailData: this.contentDetailData[0],
operationButtonList: ['comment', 'like', 'collect', 'listen', 'share']
})
...
...
@@ -123,11 +124,25 @@ export struct OperRowListView {
await this.queryContentInteractCount()
// 点赞需要数据
this.likeBean['contentId'] = this.contentDetailData.newsId + ''
this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + ''
if(this.contentDetailData.userInfo?.userName) {
this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + ''
}
this.likeBean['contentType'] = this.contentDetailData.newsType + ''
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
if(this.contentDetailData.newsTitle) {
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
}
if(this.contentDetailData.userInfo?.headPhotoUrl) {
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
}
if(this.contentDetailData.reLInfo?.channelId) {
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
}
if(this.contentDetailData?.reLInfo?.relType) {
this.likeBean['relType'] = this.contentDetailData?.reLInfo?.relType + ''
}
if(this.contentDetailData?.reLInfo?.relId) {
this.likeBean['contentRelId'] = this.contentDetailData?.reLInfo?.relId + ''
}
console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
// 评论需要数据
...
...
@@ -202,7 +217,7 @@ export struct OperRowListView {
.padding({
top: 10,
// bottom: 10
bottom:
px2vp(this.bottomSafeHeight)
bottom:
`${this.bottomSafeHeight}px`
// bottom: 50
})
}
...
...
@@ -387,6 +402,7 @@ export struct OperRowListView {
}
]
}
console.info(TAG, '查询用户对作品收藏1', JSON.stringify(params))
// console.info(TAG, '查询用户对作品收藏11', JSON.stringify(params))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.info(TAG, '查询用户对作品收藏22', JSON.stringify(data))
...
...
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
View file @
8fc5629
...
...
@@ -119,7 +119,7 @@ export interface postBatchAttentionStatusResult {
export interface postExecuteLikeParams {
status:
string
;
status:
number
;
contentId: string;
contentType: string;
relType?: string;
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
8fc5629
...
...
@@ -112,7 +112,7 @@ export struct DetailPlayShortVideoPage {
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
contentRelId: this.contentDetailData?.reLInfo?.relId + '',
contentRelId: this.contentDetailData?.reLInfo?.relId
|| ''
+ '',
}
]
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/OperationListView.ets
View file @
8fc5629
...
...
@@ -74,7 +74,7 @@ export struct OperationListView {
return
}
const params: postExecuteLikeParams = {
status: this.newsStatusOfUser?.likeStatus === '1' ?
'0' : '1'
,
status: this.newsStatusOfUser?.likeStatus === '1' ?
0 : 1
,
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
View file @
8fc5629
...
...
@@ -56,15 +56,22 @@ export struct PlayerRightView {
return
}
const params: postExecuteLikeParams = {
status: this.newsStatusOfUser?.likeStatus === '1' ?
'0' : '1'
,
status: this.newsStatusOfUser?.likeStatus === '1' ?
0 : 1
,
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
userName: this.contentDetailData?.userInfo?.userName || '' + '',
contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
title: this.contentDetailData?.newsTitle || '' + '',
channelId: this.contentDetailData?.reLInfo?.channelId + '',
relType: this.contentDetailData?.reLInfo?.relType || '' + '',
userHeaderUrl: this.contentDetailData?.userInfo?.headPhotoUrl || '' + '',
}
console.log(TAG, '点赞params', JSON.stringify(params))
ContentDetailRequest.postExecuteLike(params).then(res => {
console.log(TAG, '点赞this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
if (this.newsStatusOfUser) {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus === '1') {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus == '1') {
this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1
} else {
this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1)
...
...
@@ -237,17 +244,17 @@ export struct PlayerRightView {
transLikeStyle(): ILikeStyleResp {
if (this.likesStyle === 1) {
return {
url: this.newsStatusOfUser.likeStatus ==
=
'1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`),
url: this.newsStatusOfUser.likeStatus == '1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`),
name: '赞'
}
} else if (this.likesStyle === 2) {
return {
url: this.newsStatusOfUser.likeStatus ==
=
'1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`),
url: this.newsStatusOfUser.likeStatus == '1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`),
name: '祈祷'
}
} else if (this.likesStyle === 3) {
return {
url: this.newsStatusOfUser.likeStatus ==
=
'1' ? $r(`app.media.ic_candle_check`) :
url: this.newsStatusOfUser.likeStatus == '1' ? $r(`app.media.ic_candle_check`) :
$r(`app.media.ic_candle_uncheck`),
name: '默哀'
}
...
...
Please
register
or
login
to post a comment