wangliang_wd

feat:优化人民号主页展示UI,增加点赞提示

@@ -137,7 +137,7 @@ struct PeopleShipHomePage { @@ -137,7 +137,7 @@ struct PeopleShipHomePage {
137 // .height('calc(100% - 44vp)') 137 // .height('calc(100% - 44vp)')
138 .onDidScroll(() => { 138 .onDidScroll(() => {
139 this.topOpacity = this.scroller.currentOffset().yOffset / 120 139 this.topOpacity = this.scroller.currentOffset().yOffset / 120
140 - if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) { 140 + if (this.scroller.currentOffset().yOffset >= this.topHeight) {
141 this.attentionOpacity = true 141 this.attentionOpacity = true
142 } else { 142 } else {
143 this.attentionOpacity = false 143 this.attentionOpacity = false
@@ -11,6 +11,7 @@ import { @@ -11,6 +11,7 @@ import {
11 batchLikeAndCollectParams, 11 batchLikeAndCollectParams,
12 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; 12 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
13 import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; 13 import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
  14 +import { promptAction } from '@kit.ArkUI';
14 15
15 const TAG = 'LikeComponent'; 16 const TAG = 'LikeComponent';
16 17
@@ -437,30 +438,35 @@ export struct LikeComponent { @@ -437,30 +438,35 @@ export struct LikeComponent {
437 console.log(TAG, "点赞 params", JSON.stringify(params)) 438 console.log(TAG, "点赞 params", JSON.stringify(params))
438 ContentDetailRequest.postExecuteLike(params).then((data) => { 439 ContentDetailRequest.postExecuteLike(params).then((data) => {
439 440
440 - console.log(TAG, '点赞接口调用成功', JSON.stringify(data)) 441 + if (data.code != 0) {
  442 + promptAction.showToast({ message: data.message })
  443 + }else {
  444 + console.log(TAG, '点赞接口调用成功', JSON.stringify(data))
441 445
442 - // 直播点赞一直增加  
443 - if (this.contentDetailData.liveInfo) {  
444 - this.likeStatus = true  
445 - this.likeCount++  
446 - TrackingContent.like(true,this.pageId,this.pageName,this.pageParam)  
447 - } else {  
448 - this.likeStatus = !this.likeStatus  
449 - //点赞和取消点赞成功后更新点赞数  
450 - if (this.likeStatus) { 446 + // 直播点赞一直增加
  447 + if (this.contentDetailData.liveInfo) {
  448 + this.likeStatus = true
451 this.likeCount++ 449 this.likeCount++
452 TrackingContent.like(true,this.pageId,this.pageName,this.pageParam) 450 TrackingContent.like(true,this.pageId,this.pageName,this.pageParam)
453 } else { 451 } else {
454 - this.likeCount--  
455 - TrackingContent.like(false,this.pageId,this.pageName,this.pageParam) 452 + this.likeStatus = !this.likeStatus
  453 + //点赞和取消点赞成功后更新点赞数
  454 + if (this.likeStatus) {
  455 + this.likeCount++
  456 + TrackingContent.like(true,this.pageId,this.pageName,this.pageParam)
  457 + } else {
  458 + this.likeCount--
  459 + TrackingContent.like(false,this.pageId,this.pageName,this.pageParam)
  460 + }
456 } 461 }
457 - }  
458 462
459 - if (this.likeCount <= 0) {  
460 - this.likeCount = 0  
461 - } 463 + if (this.likeCount <= 0) {
  464 + this.likeCount = 0
  465 + }
462 466
463 - this.enableBtn = true 467 + this.enableBtn = true
  468 +
  469 + }
464 }).catch(() => { 470 }).catch(() => {
465 this.enableBtn = true 471 this.enableBtn = true
466 }) 472 })