Showing
2 changed files
with
31 additions
and
23 deletions
| @@ -5,7 +5,8 @@ import { | @@ -5,7 +5,8 @@ import { | ||
| 5 | EmitterUtils, | 5 | EmitterUtils, |
| 6 | EmitterEventId, | 6 | EmitterEventId, |
| 7 | NetworkUtil, | 7 | NetworkUtil, |
| 8 | - DisplayUtils | 8 | + DisplayUtils, |
| 9 | + ToastUtils | ||
| 9 | } from 'wdKit'; | 10 | } from 'wdKit'; |
| 10 | import { | 11 | import { |
| 11 | Action, | 12 | Action, |
| @@ -439,22 +440,25 @@ export struct ImageAndTextPageComponent { | @@ -439,22 +440,25 @@ export struct ImageAndTextPageComponent { | ||
| 439 | PageRepository.postExecuteLike(params).then(res => { | 440 | PageRepository.postExecuteLike(params).then(res => { |
| 440 | // console.log(TAG, '点赞、res', JSON.stringify(res)) | 441 | // console.log(TAG, '点赞、res', JSON.stringify(res)) |
| 441 | // console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) | 442 | // console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) |
| 442 | - if (this.newsStatusOfUser) { | ||
| 443 | - //内容点赞、取消点赞Tracking 1点赞 0取消点赞 | ||
| 444 | - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' | ||
| 445 | - if (this.newsStatusOfUser.likeStatus === '1') { | ||
| 446 | - this.likeNum = Number(this.likeNum) + 1 | 443 | + if (res.code != 0){ |
| 444 | + ToastUtils.showToast(res.message, 1000); | ||
| 445 | + }else { | ||
| 446 | + if (this.newsStatusOfUser) { | ||
| 447 | + //内容点赞、取消点赞Tracking 1点赞 0取消点赞 | ||
| 448 | + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' | ||
| 449 | + if (this.newsStatusOfUser.likeStatus === '1') { | ||
| 450 | + this.likeNum = Number(this.likeNum) + 1 | ||
| 451 | + } else { | ||
| 452 | + this.likeNum = Number(this.likeNum) - 1 | ||
| 453 | + } | ||
| 454 | + // console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus) | ||
| 455 | + // this.queryContentInteractCount() | ||
| 456 | + TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My) | ||
| 447 | } else { | 457 | } else { |
| 448 | - this.likeNum = Number(this.likeNum) - 1 | 458 | + // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象 |
| 459 | + this.getInteractDataStatus() | ||
| 449 | } | 460 | } |
| 450 | - // console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus) | ||
| 451 | - // this.queryContentInteractCount() | ||
| 452 | - TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My) | ||
| 453 | - } else { | ||
| 454 | - // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象 | ||
| 455 | - this.getInteractDataStatus() | ||
| 456 | } | 461 | } |
| 457 | - | ||
| 458 | }) | 462 | }) |
| 459 | } | 463 | } |
| 460 | 464 |
| 1 | -import { NumberFormatterUtils, SPHelper } from 'wdKit'; | 1 | +import { NumberFormatterUtils, SPHelper, ToastUtils } from 'wdKit'; |
| 2 | import promptAction from '@ohos.promptAction'; | 2 | import promptAction from '@ohos.promptAction'; |
| 3 | import { | 3 | import { |
| 4 | batchLikeAndCollectParams, | 4 | batchLikeAndCollectParams, |
| @@ -526,15 +526,19 @@ export struct OperRowListView { | @@ -526,15 +526,19 @@ export struct OperRowListView { | ||
| 526 | 526 | ||
| 527 | console.log(TAG, '收藏点击', JSON.stringify(params)) | 527 | console.log(TAG, '收藏点击', JSON.stringify(params)) |
| 528 | PageRepository.postExecuteCollectRecord(params).then(res => { | 528 | PageRepository.postExecuteCollectRecord(params).then(res => { |
| 529 | - if (this.newsStatusOfUser) { | ||
| 530 | - this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | ||
| 531 | - if (this.newsStatusOfUser.collectStatus === 1) { | ||
| 532 | - promptAction.showToast({ message: '收藏成功' }) | ||
| 533 | - TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam) | ||
| 534 | - } else { | ||
| 535 | - TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam) | 529 | + if (res.code != 0){ |
| 530 | + ToastUtils.showToast(res.message, 1000); | ||
| 531 | + }else { | ||
| 532 | + if (this.newsStatusOfUser) { | ||
| 533 | + this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | ||
| 534 | + if (this.newsStatusOfUser.collectStatus === 1) { | ||
| 535 | + promptAction.showToast({ message: '收藏成功' }) | ||
| 536 | + TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam) | ||
| 537 | + } else { | ||
| 538 | + TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam) | ||
| 539 | + } | ||
| 540 | + this.queryContentInteractCount() | ||
| 536 | } | 541 | } |
| 537 | - this.queryContentInteractCount() | ||
| 538 | } | 542 | } |
| 539 | console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) | 543 | console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) |
| 540 | }) | 544 | }) |
-
Please register or login to post a comment