wangyujian_wd

Merge remote-tracking branch 'origin/main'

@@ -44,9 +44,9 @@ export struct DynamicDetailComponent { @@ -44,9 +44,9 @@ export struct DynamicDetailComponent {
44 /** 44 /**
45 * 关注状态:默认未关注 点击去关注 45 * 关注状态:默认未关注 点击去关注
46 */ 46 */
47 - @State followStatus: String = '0'; 47 + @State followStatus: String = '';
48 48
49 - @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined// 点赞、收藏状态 49 + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
50 //跳转 50 //跳转
51 private mJumpInfo: ContentDTO = {} as ContentDTO; 51 private mJumpInfo: ContentDTO = {} as ContentDTO;
52 52
@@ -121,6 +121,7 @@ export struct DynamicDetailComponent { @@ -121,6 +121,7 @@ export struct DynamicDetailComponent {
121 } 121 }
122 .width('63%') 122 .width('63%')
123 .margin({right: $r('app.float.margin_6')}) 123 .margin({right: $r('app.float.margin_6')})
  124 + if(!StringUtils.isEmpty(this.followStatus)){
124 if (this.followStatus == '0') { 125 if (this.followStatus == '0') {
125 Text('关注') 126 Text('关注')
126 .width($r('app.float.margin_54')) 127 .width($r('app.float.margin_54'))
@@ -148,6 +149,7 @@ export struct DynamicDetailComponent { @@ -148,6 +149,7 @@ export struct DynamicDetailComponent {
148 }) 149 })
149 } 150 }
150 } 151 }
  152 + }
151 .width('100%') 153 .width('100%')
152 .margin({ left: $r('app.float.margin_16')}) 154 .margin({ left: $r('app.float.margin_16')})
153 //内容 155 //内容
@@ -330,8 +332,8 @@ export struct DynamicDetailComponent { @@ -330,8 +332,8 @@ export struct DynamicDetailComponent {
330 Image(this.newsStatusOfUser?.likeStatus == '1'? 332 Image(this.newsStatusOfUser?.likeStatus == '1'?
331 $r('app.media.icon_like_selected_redheart') 333 $r('app.media.icon_like_selected_redheart')
332 :$r('app.media.icon_like_unselect_grey_redheart')) 334 :$r('app.media.icon_like_unselect_grey_redheart'))
333 - .width($r('app.float.margin_24'))  
334 - .height($r('app.float.margin_24')) 335 + .width($r('app.float.margin_36'))
  336 + .height($r('app.float.margin_36'))
335 .objectFit(ImageFit.Cover) 337 .objectFit(ImageFit.Cover)
336 if(this.interactDataDTO?.likeNum != 0){ 338 if(this.interactDataDTO?.likeNum != 0){
337 Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum)) 339 Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
@@ -430,12 +432,18 @@ export struct DynamicDetailComponent { @@ -430,12 +432,18 @@ export struct DynamicDetailComponent {
430 432
431 // 已登录->查询用户对作品点赞、收藏状态 433 // 已登录->查询用户对作品点赞、收藏状态
432 private async getInteractDataStatus() { 434 private async getInteractDataStatus() {
  435 + // 未登录,跳转登录
  436 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  437 + if (!user_id) {
  438 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  439 + return
  440 + }
433 try { 441 try {
434 const params: batchLikeAndCollectParams = { 442 const params: batchLikeAndCollectParams = {
435 contentList: [ 443 contentList: [
436 { 444 {
437 - contentId: this.contentDetailData[0]?.newsId + '',  
438 - contentType: this.contentDetailData[0]?.newsType + '', 445 + contentId: this.contentDetailData?.newsId + '',
  446 + contentType: this.contentDetailData?.newsType + '',
439 } 447 }
440 ] 448 ]
441 } 449 }
@@ -453,6 +461,13 @@ export struct DynamicDetailComponent { @@ -453,6 +461,13 @@ export struct DynamicDetailComponent {
453 * 查询当前登录用户是否关注作品号主 461 * 查询当前登录用户是否关注作品号主
454 * */ 462 * */
455 private async getBatchAttentionStatus() { 463 private async getBatchAttentionStatus() {
  464 + // 未登录,跳转登录
  465 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  466 + if (!user_id) {
  467 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  468 + this.followStatus = '0';
  469 + return
  470 + }
456 try { 471 try {
457 const params: postBatchAttentionStatusParams = { 472 const params: postBatchAttentionStatusParams = {
458 creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }] 473 creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
@@ -461,7 +476,7 @@ export struct DynamicDetailComponent { @@ -461,7 +476,7 @@ export struct DynamicDetailComponent {
461 this.followStatus = data[0]?.status; 476 this.followStatus = data[0]?.status;
462 Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`) 477 Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
463 } catch (exception) { 478 } catch (exception) {
464 - 479 + this.followStatus = '0';
465 } 480 }
466 } 481 }
467 482
@@ -558,8 +573,6 @@ export struct DynamicDetailComponent { @@ -558,8 +573,6 @@ export struct DynamicDetailComponent {
558 contentType: this.contentDetailData?.newsType + '', 573 contentType: this.contentDetailData?.newsType + '',
559 } 574 }
560 ContentDetailRequest.postExecuteLike(params).then(res => { 575 ContentDetailRequest.postExecuteLike(params).then(res => {
561 -  
562 - if (this.newsStatusOfUser) {  
563 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1' 576 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
564 if (this.newsStatusOfUser.likeStatus === '1') { 577 if (this.newsStatusOfUser.likeStatus === '1') {
565 this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1 578 this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1
@@ -567,9 +580,6 @@ export struct DynamicDetailComponent { @@ -567,9 +580,6 @@ export struct DynamicDetailComponent {
567 this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1 580 this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
568 } 581 }
569 console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) 582 console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
570 - // this.queryContentInteractCount()  
571 - }  
572 -  
573 }) 583 })
574 } 584 }
575 } 585 }
@@ -104,6 +104,9 @@ struct createImg { @@ -104,6 +104,9 @@ struct createImg {
104 } 104 }
105 .align(Alignment.BottomEnd) 105 .align(Alignment.BottomEnd)
106 } 106 }
  107 + .onClick((event: ClickEvent) => {
  108 + ProcessUtils.gotoVod(this.contentDTO)
  109 + })
107 } else { 110 } else {
108 // 竖图显示,宽度占50%,高度自适应 111 // 竖图显示,宽度占50%,高度自适应
109 GridCol({ 112 GridCol({