张善主

Merge remote-tracking branch 'origin/main'

@@ -751,7 +751,7 @@ export struct DynamicDetailComponent { @@ -751,7 +751,7 @@ export struct DynamicDetailComponent {
751 return 751 return
752 } 752 }
753 const params: postExecuteLikeParams = { 753 const params: postExecuteLikeParams = {
754 - status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', 754 + status: this.newsStatusOfUser?.likeStatus === '1' ? 0 : 1,
755 contentId: this.contentDetailData?.newsId + '', 755 contentId: this.contentDetailData?.newsId + '',
756 contentType: this.contentDetailData?.newsType + '', 756 contentType: this.contentDetailData?.newsType + '',
757 } 757 }
@@ -5,6 +5,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; @@ -5,6 +5,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
5 import { SpConstants } from 'wdConstant/Index'; 5 import { SpConstants } from 'wdConstant/Index';
6 import { ContentDetailDTO } from 'wdBean/Index'; 6 import { ContentDetailDTO } from 'wdBean/Index';
7 import measure from '@ohos.measure' 7 import measure from '@ohos.measure'
  8 +import {
  9 + ContentDetailRequest,
  10 + postExecuteLikeParams,
  11 + batchLikeAndCollectParams,
  12 +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
8 13
9 const TAG = 'LikeComponent'; 14 const TAG = 'LikeComponent';
10 15
@@ -40,8 +45,9 @@ export struct LikeComponent { @@ -40,8 +45,9 @@ export struct LikeComponent {
40 } 45 }
41 46
42 onDataUpdated() { 47 onDataUpdated() {
  48 + console.log(TAG, '点赞点击')
43 if (this.data) { 49 if (this.data) {
44 - if (this.data['channelId'] !== 'undefined') { 50 + if (this.data['contentType'] !== 'undefined') {
45 //获取点赞状态 51 //获取点赞状态
46 this.getLikeStatus() 52 this.getLikeStatus()
47 //获取点赞数 53 //获取点赞数
@@ -300,13 +306,26 @@ export struct LikeComponent { @@ -300,13 +306,26 @@ export struct LikeComponent {
300 306
301 executeLike(status: string) { 307 executeLike(status: string) {
302 console.log(TAG, '点赞接口调用', status) 308 console.log(TAG, '点赞接口调用', status)
303 - this.data['status'] = status  
304 - this.data['contentId'] = this.contentDetailData?.newsId + ''  
305 - this.data['contentType'] = this.contentDetailData?.newsType + ''  
306 309
307 - this.viewModel.executeLike2(this.data).then(() => { 310 + const params: postExecuteLikeParams = {
  311 + status: Number(status),
  312 + contentId: this.data['contentId'],
  313 + contentType: this.data['contentType']
  314 + }
  315 + if(this.data['relType']) {
  316 + params.relType = this.data['relType']
  317 + }
  318 + if(this.data['contentRelId']) {
  319 + params.contentRelId = this.data['contentRelId']
  320 + }
  321 + if(this.data['channelId']) {
  322 + params.channelId = this.data['channelId']
  323 + }
  324 +
  325 + console.log(TAG, "点赞 params", JSON.stringify(params))
  326 + ContentDetailRequest.postExecuteLike(params).then((data) => {
308 327
309 - console.log(TAG, '点赞接口调用成功') 328 + console.log(TAG, '点赞接口调用成功', JSON.stringify(data))
310 329
311 // 直播点赞一直增加 330 // 直播点赞一直增加
312 if (this.contentDetailData.liveInfo) { 331 if (this.contentDetailData.liveInfo) {
@@ -333,12 +352,26 @@ export struct LikeComponent { @@ -333,12 +352,26 @@ export struct LikeComponent {
333 } 352 }
334 353
335 getLikeStatus() { 354 getLikeStatus() {
336 - this.viewModel.getLikeStatus(this.data).then((data) => {  
337 - if (data && data['data'].length && data['data'][0]['likeStatus']) {  
338 - this.likeStatus = data['data'][0]['likeStatus'] 355 + // console.log(TAG, "this.data", JSON.stringify(this.data))
  356 + const params: batchLikeAndCollectParams = {
  357 + contentList: [
  358 + {
  359 + contentId: this.data['contentId'],
  360 + contentType: this.data['contentType'],
  361 + contentRelId: this.data['contentRelId'] || '' + '',
  362 + }
  363 + ]
  364 + }
  365 + console.log(TAG, "查询点赞状态params", JSON.stringify(params))
  366 + ContentDetailRequest.postBatchLikeAndCollectStatus(params).then(res => {
  367 + console.log(TAG, '查询点赞、收藏状态==', JSON.stringify(res.data))
  368 + if (res.data) {
  369 + if(res.data[0].likeStatus) {
  370 + this.likeStatus = res.data[0].likeStatus ? true : false
339 } else { 371 } else {
340 this.likeStatus = false 372 this.likeStatus = false
341 } 373 }
  374 + }
342 }).catch(() => { 375 }).catch(() => {
343 this.likeStatus = false 376 this.likeStatus = false
344 }) 377 })
@@ -36,6 +36,7 @@ const TAG = 'OperRowListView'; @@ -36,6 +36,7 @@ const TAG = 'OperRowListView';
36 * 注意:外层需注册 @Provide contentDetailData:contentDetailData = {} as contentDetailData 36 * 注意:外层需注册 @Provide contentDetailData:contentDetailData = {} as contentDetailData
37 * 传值示例: 37 * 传值示例:
38 OperRowListView({ 38 OperRowListView({
  39 +
39 contentDetailData: this.contentDetailData[0], 40 contentDetailData: this.contentDetailData[0],
40 operationButtonList: ['comment', 'like', 'collect', 'listen', 'share'] 41 operationButtonList: ['comment', 'like', 'collect', 'listen', 'share']
41 }) 42 })
@@ -123,11 +124,25 @@ export struct OperRowListView { @@ -123,11 +124,25 @@ export struct OperRowListView {
123 await this.queryContentInteractCount() 124 await this.queryContentInteractCount()
124 // 点赞需要数据 125 // 点赞需要数据
125 this.likeBean['contentId'] = this.contentDetailData.newsId + '' 126 this.likeBean['contentId'] = this.contentDetailData.newsId + ''
  127 + if(this.contentDetailData.userInfo?.userName) {
126 this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + '' 128 this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + ''
  129 + }
127 this.likeBean['contentType'] = this.contentDetailData.newsType + '' 130 this.likeBean['contentType'] = this.contentDetailData.newsType + ''
  131 + if(this.contentDetailData.newsTitle) {
128 this.likeBean['title'] = this.contentDetailData.newsTitle + '' 132 this.likeBean['title'] = this.contentDetailData.newsTitle + ''
  133 + }
  134 + if(this.contentDetailData.userInfo?.headPhotoUrl) {
129 this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' 135 this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
  136 + }
  137 + if(this.contentDetailData.reLInfo?.channelId) {
130 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' 138 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
  139 + }
  140 + if(this.contentDetailData?.reLInfo?.relType) {
  141 + this.likeBean['relType'] = this.contentDetailData?.reLInfo?.relType + ''
  142 + }
  143 + if(this.contentDetailData?.reLInfo?.relId) {
  144 + this.likeBean['contentRelId'] = this.contentDetailData?.reLInfo?.relId + ''
  145 + }
131 console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData)) 146 console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
132 console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean)) 147 console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
133 // 评论需要数据 148 // 评论需要数据
@@ -202,7 +217,7 @@ export struct OperRowListView { @@ -202,7 +217,7 @@ export struct OperRowListView {
202 .padding({ 217 .padding({
203 top: 10, 218 top: 10,
204 // bottom: 10 219 // bottom: 10
205 - bottom: px2vp(this.bottomSafeHeight) 220 + bottom: `${this.bottomSafeHeight}px`
206 // bottom: 50 221 // bottom: 50
207 }) 222 })
208 } 223 }
@@ -387,6 +402,7 @@ export struct OperRowListView { @@ -387,6 +402,7 @@ export struct OperRowListView {
387 } 402 }
388 ] 403 ]
389 } 404 }
  405 + console.info(TAG, '查询用户对作品收藏1', JSON.stringify(params))
390 // console.info(TAG, '查询用户对作品收藏11', JSON.stringify(params)) 406 // console.info(TAG, '查询用户对作品收藏11', JSON.stringify(params))
391 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) 407 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
392 console.info(TAG, '查询用户对作品收藏22', JSON.stringify(data)) 408 console.info(TAG, '查询用户对作品收藏22', JSON.stringify(data))
@@ -119,7 +119,7 @@ export interface postBatchAttentionStatusResult { @@ -119,7 +119,7 @@ export interface postBatchAttentionStatusResult {
119 119
120 120
121 export interface postExecuteLikeParams { 121 export interface postExecuteLikeParams {
122 - status: string; 122 + status: number;
123 contentId: string; 123 contentId: string;
124 contentType: string; 124 contentType: string;
125 relType?: string; 125 relType?: string;
@@ -112,7 +112,7 @@ export struct DetailPlayShortVideoPage { @@ -112,7 +112,7 @@ export struct DetailPlayShortVideoPage {
112 { 112 {
113 contentId: this.contentDetailData?.newsId + '', 113 contentId: this.contentDetailData?.newsId + '',
114 contentType: this.contentDetailData?.newsType + '', 114 contentType: this.contentDetailData?.newsType + '',
115 - contentRelId: this.contentDetailData?.reLInfo?.relId + '', 115 + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
116 } 116 }
117 ] 117 ]
118 } 118 }
@@ -74,7 +74,7 @@ export struct OperationListView { @@ -74,7 +74,7 @@ export struct OperationListView {
74 return 74 return
75 } 75 }
76 const params: postExecuteLikeParams = { 76 const params: postExecuteLikeParams = {
77 - status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', 77 + status: this.newsStatusOfUser?.likeStatus === '1' ? 0 : 1,
78 contentId: this.contentDetailData?.newsId + '', 78 contentId: this.contentDetailData?.newsId + '',
79 contentType: this.contentDetailData?.newsType + '', 79 contentType: this.contentDetailData?.newsType + '',
80 } 80 }
@@ -56,15 +56,22 @@ export struct PlayerRightView { @@ -56,15 +56,22 @@ export struct PlayerRightView {
56 return 56 return
57 } 57 }
58 const params: postExecuteLikeParams = { 58 const params: postExecuteLikeParams = {
59 - status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', 59 + status: this.newsStatusOfUser?.likeStatus === '1' ? 0 : 1,
60 contentId: this.contentDetailData?.newsId + '', 60 contentId: this.contentDetailData?.newsId + '',
61 contentType: this.contentDetailData?.newsType + '', 61 contentType: this.contentDetailData?.newsType + '',
  62 + userName: this.contentDetailData?.userInfo?.userName || '' + '',
  63 + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
  64 + title: this.contentDetailData?.newsTitle || '' + '',
  65 + channelId: this.contentDetailData?.reLInfo?.channelId + '',
  66 + relType: this.contentDetailData?.reLInfo?.relType || '' + '',
  67 + userHeaderUrl: this.contentDetailData?.userInfo?.headPhotoUrl || '' + '',
62 } 68 }
  69 + console.log(TAG, '点赞params', JSON.stringify(params))
63 ContentDetailRequest.postExecuteLike(params).then(res => { 70 ContentDetailRequest.postExecuteLike(params).then(res => {
64 - 71 + console.log(TAG, '点赞this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
65 if (this.newsStatusOfUser) { 72 if (this.newsStatusOfUser) {
66 - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'  
67 - if (this.newsStatusOfUser.likeStatus === '1') { 73 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
  74 + if (this.newsStatusOfUser.likeStatus == '1') {
68 this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1 75 this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1
69 } else { 76 } else {
70 this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1) 77 this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1)
@@ -237,17 +244,17 @@ export struct PlayerRightView { @@ -237,17 +244,17 @@ export struct PlayerRightView {
237 transLikeStyle(): ILikeStyleResp { 244 transLikeStyle(): ILikeStyleResp {
238 if (this.likesStyle === 1) { 245 if (this.likesStyle === 1) {
239 return { 246 return {
240 - url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`), 247 + url: this.newsStatusOfUser.likeStatus == '1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`),
241 name: '赞' 248 name: '赞'
242 } 249 }
243 } else if (this.likesStyle === 2) { 250 } else if (this.likesStyle === 2) {
244 return { 251 return {
245 - url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`), 252 + url: this.newsStatusOfUser.likeStatus == '1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`),
246 name: '祈祷' 253 name: '祈祷'
247 } 254 }
248 } else if (this.likesStyle === 3) { 255 } else if (this.likesStyle === 3) {
249 return { 256 return {
250 - url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) : 257 + url: this.newsStatusOfUser.likeStatus == '1' ? $r(`app.media.ic_candle_check`) :
251 $r(`app.media.ic_candle_uncheck`), 258 $r(`app.media.ic_candle_uncheck`),
252 name: '默哀' 259 name: '默哀'
253 } 260 }