xugenyuan

ref |> 调整精选评论点击评论内容可进行回复

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -339,6 +339,9 @@ struct QualityCommentItem { @@ -339,6 +339,9 @@ struct QualityCommentItem {
339 .fontColor('#222222') 339 .fontColor('#222222')
340 .fontWeight(FontWeight.Medium) 340 .fontWeight(FontWeight.Medium)
341 }.margin({ top: 10 }) 341 }.margin({ top: 10 })
  342 + .onClick(() => {
  343 + this.replyComment()
  344 + })
342 345
343 /*分割线*/ 346 /*分割线*/
344 Row() { 347 Row() {
@@ -381,19 +384,9 @@ struct QualityCommentItem { @@ -381,19 +384,9 @@ struct QualityCommentItem {
381 Row({ space: 16 }) { 384 Row({ space: 16 }) {
382 Row() { 385 Row() {
383 Image($r('app.media.comment_icon_pinglun')).width(16).height(16) 386 Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
384 - }.onClick(()=>{  
385 - this.publishCommentModel.targetId = this.item.targetId  
386 - this.publishCommentModel.targetRelId = this.item.targetRelId  
387 - this.publishCommentModel.targetTitle = this.item.targetTitle  
388 - this.publishCommentModel.targetRelType = this.item.targetRelType  
389 - this.publishCommentModel.targetRelObjectId = this.item.targetRelObjectId  
390 - this.publishCommentModel.targetType = this.item.targetType  
391 - // this.publishCommentModel.keyArticle = this.item.keyArticle  
392 -  
393 - this.publishCommentModel.rootCommentId = this.item.rootCommentId  
394 - this.publishCommentModel.parentId = this.item.id  
395 -  
396 - this.dialogController?.open() 387 + }.height('100%')
  388 + .onClick(()=>{
  389 + this.replyComment()
397 }) 390 })
398 391
399 Row() { 392 Row() {
@@ -407,17 +400,7 @@ struct QualityCommentItem { @@ -407,17 +400,7 @@ struct QualityCommentItem {
407 .margin({ left: 3 }) 400 .margin({ left: 3 })
408 } 401 }
409 }.onClick(() => { 402 }.onClick(() => {
410 - // 未登录,跳转登录  
411 - const user_id = HttpUtils.getUserId()  
412 - if (!user_id) {  
413 - WDRouterRule.jumpWithPage(WDRouterPage.loginPage)  
414 - return  
415 - }  
416 - commentLikeChange(this.item)  
417 - commentViewModel.commentLike(this.item).then(() => {  
418 - }).catch(() => {  
419 - commentLikeChange(this.item)  
420 - }) 403 + this.clickLikeComment()
421 }) 404 })
422 } 405 }
423 }.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween) 406 }.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween)
@@ -473,6 +456,37 @@ struct QualityCommentItem { @@ -473,6 +456,37 @@ struct QualityCommentItem {
473 456
474 ProcessUtils.processPage(program) 457 ProcessUtils.processPage(program)
475 } 458 }
  459 +
  460 + replyComment() {
  461 + this.publishCommentModel.targetId = this.item.targetId
  462 + this.publishCommentModel.targetRelId = this.item.targetRelId
  463 + this.publishCommentModel.targetTitle = this.item.targetTitle
  464 + this.publishCommentModel.targetRelType = this.item.targetRelType
  465 + this.publishCommentModel.targetRelObjectId = this.item.targetRelObjectId
  466 + this.publishCommentModel.targetType = this.item.targetType
  467 + // this.publishCommentModel.keyArticle = this.item.keyArticle
  468 +
  469 + this.publishCommentModel.rootCommentId = this.item.rootCommentId
  470 + this.publishCommentModel.parentId = this.item.id
  471 +
  472 + this.publishCommentModel.placeHolderText = '回复 ' + this.item.fromUserName + ':'
  473 +
  474 + this.dialogController?.open()
  475 + }
  476 +
  477 + clickLikeComment() {
  478 + // 未登录,跳转登录
  479 + const user_id = HttpUtils.getUserId()
  480 + if (!user_id) {
  481 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  482 + return
  483 + }
  484 + commentLikeChange(this.item)
  485 + commentViewModel.commentLike(this.item).then(() => {
  486 + }).catch(() => {
  487 + commentLikeChange(this.item)
  488 + })
  489 + }
476 } 490 }
477 491
478 function commentLikeChange(item: commentItemModel) { 492 function commentLikeChange(item: commentItemModel) {