xugenyuan

ref |> 处理自己发的评论预显不可以点赞

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -546,37 +546,41 @@ struct commentFooterView { @@ -546,37 +546,41 @@ struct commentFooterView {
546 }) 546 })
547 } 547 }
548 548
549 - Row({ space: 6 }) {  
550 - Text(this.item.likeNum)  
551 - .fontColor($r('app.color.color_666666'))  
552 - .fontSize(14)  
553 -  
554 - Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal'))  
555 - .size({  
556 - width: 16,  
557 - height: 16  
558 - })  
559 -  
560 - }  
561 - .onClick(() => {  
562 - // 未登录,跳转登录  
563 - const user_id = HttpUtils.getUserId()  
564 - if (!user_id) {  
565 - WDRouterRule.jumpWithPage(WDRouterPage.loginPage)  
566 - return 549 + if (this.item.id) { // 审核通过的才显示点赞
  550 + Row({ space: 6 }) {
  551 + Text(this.item.likeNum)
  552 + .fontColor($r('app.color.color_666666'))
  553 + .fontSize(14)
  554 +
  555 + Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal'))
  556 + .size({
  557 + width: 16,
  558 + height: 16
  559 + })
567 } 560 }
568 - commentLikeChange(this.item)  
569 - commentViewModel.commentLike(this.item).then(() => {  
570 - }).catch(() => {  
571 - commentLikeChange(this.item) 561 + .onClick(() => {
  562 + this.clickLike()
572 }) 563 })
573 - })  
574 - 564 + }
575 } 565 }
576 .justifyContent(FlexAlign.SpaceBetween) 566 .justifyContent(FlexAlign.SpaceBetween)
577 .width('100%') 567 .width('100%')
578 .height(30) 568 .height(30)
579 } 569 }
  570 +
  571 + clickLike() {
  572 + // 未登录,跳转登录
  573 + const user_id = HttpUtils.getUserId()
  574 + if (!user_id) {
  575 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  576 + return
  577 + }
  578 + commentLikeChange(this.item)
  579 + commentViewModel.commentLike(this.item).then(() => {
  580 + }).catch(() => {
  581 + commentLikeChange(this.item)
  582 + })
  583 + }
580 } 584 }
581 585
582 function commentLikeChange(item: commentItemModel) { 586 function commentLikeChange(item: commentItemModel) {