王士厅

人民号主页下文章详情页,视频详情页,动态详情页与图集详情页均无法收藏

... ... @@ -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 + '',
}
... ...
... ... @@ -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['channelId'] !== 'undefined') {
if (this.data['contentType'] !== '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
... ...
... ... @@ -36,6 +36,7 @@ const TAG = 'OperRowListView';
* 注意:外层需注册 @Provide contentDetailData:contentDetailData = {} as contentDetailData
* 传值示例:
OperRowListView({
contentDetailData: this.contentDetailData[0],
operationButtonList: ['comment', 'like', 'collect', 'listen', 'share']
})
... ... @@ -119,11 +120,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))
// 评论需要数据
... ... @@ -198,7 +213,7 @@ export struct OperRowListView {
.padding({
top: 10,
// bottom: 10
bottom: px2vp(this.bottomSafeHeight)
bottom: `${this.bottomSafeHeight}px`
// bottom: 50
})
}
... ... @@ -383,6 +398,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))
... ...
... ... @@ -119,7 +119,7 @@ export interface postBatchAttentionStatusResult {
export interface postExecuteLikeParams {
status: string;
status: number;
contentId: string;
contentType: string;
relType?: string;
... ...
... ... @@ -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 || '' + '',
}
]
}
... ...
... ... @@ -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 + '',
}
... ...
... ... @@ -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: '默哀'
}
... ...