Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
5 changed files
with
46 additions
and
10 deletions
| @@ -43,7 +43,7 @@ import { EmptyComponent } from './view/EmptyComponent'; | @@ -43,7 +43,7 @@ import { EmptyComponent } from './view/EmptyComponent'; | ||
| 43 | import { detailedSkeleton } from './skeleton/detailSkeleton'; | 43 | import { detailedSkeleton } from './skeleton/detailSkeleton'; |
| 44 | import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | 44 | import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' |
| 45 | import { common } from '@kit.AbilityKit'; | 45 | import { common } from '@kit.AbilityKit'; |
| 46 | - | 46 | +import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; |
| 47 | const TAG = 'DynamicDetailComponent' | 47 | const TAG = 'DynamicDetailComponent' |
| 48 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 48 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 49 | 49 | ||
| @@ -81,6 +81,7 @@ export struct DynamicDetailComponent { | @@ -81,6 +81,7 @@ export struct DynamicDetailComponent { | ||
| 81 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 81 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 82 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 82 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 83 | 83 | ||
| 84 | + pageParam: ParamType = {} | ||
| 84 | async aboutToAppear() { | 85 | async aboutToAppear() { |
| 85 | await this.getContentDetailData() | 86 | await this.getContentDetailData() |
| 86 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 87 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| @@ -540,7 +541,6 @@ export struct DynamicDetailComponent { | @@ -540,7 +541,6 @@ export struct DynamicDetailComponent { | ||
| 540 | //点赞操作 | 541 | //点赞操作 |
| 541 | this.toggleLikeStatus() | 542 | this.toggleLikeStatus() |
| 542 | //内容点赞/取消点赞埋点 | 543 | //内容点赞/取消点赞埋点 |
| 543 | - | ||
| 544 | }) | 544 | }) |
| 545 | .visibility(this.likesStyle == 4 || !this.openLikes ? Visibility.None : Visibility.Visible) | 545 | .visibility(this.likesStyle == 4 || !this.openLikes ? Visibility.None : Visibility.Visible) |
| 546 | 546 | ||
| @@ -614,6 +614,12 @@ export struct DynamicDetailComponent { | @@ -614,6 +614,12 @@ export struct DynamicDetailComponent { | ||
| 614 | this.makeJumpInfo() | 614 | this.makeJumpInfo() |
| 615 | this.interactDataV2() | 615 | this.interactDataV2() |
| 616 | this.viewBlogInsightIntentShare() | 616 | this.viewBlogInsightIntentShare() |
| 617 | + | ||
| 618 | + this.pageParam = { | ||
| 619 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 620 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 621 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 622 | + } | ||
| 617 | } | 623 | } |
| 618 | 624 | ||
| 619 | private async interactDataV2() { | 625 | private async interactDataV2() { |
| @@ -743,8 +749,10 @@ export struct DynamicDetailComponent { | @@ -743,8 +749,10 @@ export struct DynamicDetailComponent { | ||
| 743 | console.log('关注号主==', JSON.stringify(res.data)) | 749 | console.log('关注号主==', JSON.stringify(res.data)) |
| 744 | if (this.followStatus == '1') { | 750 | if (this.followStatus == '1') { |
| 745 | this.followStatus = '0' | 751 | this.followStatus = '0' |
| 752 | + TrackingContent.follow(true,this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId,this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhName,TrackConstants.PageName.DynamicDetail,TrackConstants.PageName.DynamicDetail,this.pageParam) | ||
| 746 | } else { | 753 | } else { |
| 747 | this.followStatus = '1' | 754 | this.followStatus = '1' |
| 755 | + TrackingContent.follow(false,this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId,this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhName,TrackConstants.PageName.DynamicDetail,TrackConstants.PageName.DynamicDetail,this.pageParam) | ||
| 748 | } | 756 | } |
| 749 | }) | 757 | }) |
| 750 | } | 758 | } |
| @@ -772,6 +780,14 @@ export struct DynamicDetailComponent { | @@ -772,6 +780,14 @@ export struct DynamicDetailComponent { | ||
| 772 | this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1 | 780 | this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1 |
| 773 | } | 781 | } |
| 774 | console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) | 782 | console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) |
| 783 | + | ||
| 784 | + //内容点赞、取消点赞Tracking 1点赞 0取消点赞 | ||
| 785 | + TrackingContent.like(this.newsStatusOfUser?.likeStatus === '1', TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail, | ||
| 786 | + { | ||
| 787 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 788 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 789 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 790 | + }) | ||
| 775 | }) | 791 | }) |
| 776 | } | 792 | } |
| 777 | 793 |
| @@ -36,6 +36,30 @@ export struct CardSourceInfo { | @@ -36,6 +36,30 @@ export struct CardSourceInfo { | ||
| 36 | return flag; | 36 | return flag; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | + /** | ||
| 40 | + * 全域数字显示规则 | ||
| 41 | + * 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585 | ||
| 42 | + * 2、当数量为万位~1亿时,显示xx 万,保留小数点后一位,比如1517.9w、2.9w | ||
| 43 | + * 3、当数量为1亿~千亿时,显示XX 亿,保留小数点后一位,比如1517.9亿、2.9亿 | ||
| 44 | + * 4、不进行四舍五入 | ||
| 45 | + * 5、0 和空 不显示 | ||
| 46 | + */ | ||
| 47 | + handlerNum(number: string) { | ||
| 48 | + const num = number??'0'; | ||
| 49 | + if (Number.parseInt(num) <= 9999) { | ||
| 50 | + return Number.parseInt(num).toString() | ||
| 51 | + } else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) { | ||
| 52 | + const num1: string = num.slice(0, -4); // 万 | ||
| 53 | + const num2: string = num.slice(-4, -3); // 千 | ||
| 54 | + return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万' | ||
| 55 | + } else if (Number.parseInt(num) > 99999999) { | ||
| 56 | + const num1: string = num.slice(0, -8); // 亿 | ||
| 57 | + const num2: string = num.slice(-8, -7); | ||
| 58 | + return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿' | ||
| 59 | + } | ||
| 60 | + return num | ||
| 61 | + } | ||
| 62 | + | ||
| 39 | isTwoDaysAgo(date: string) { | 63 | isTwoDaysAgo(date: string) { |
| 40 | const twoDaysAgo = new Date(); | 64 | const twoDaysAgo = new Date(); |
| 41 | twoDaysAgo.setDate(twoDaysAgo.getDate() - 2); | 65 | twoDaysAgo.setDate(twoDaysAgo.getDate() - 2); |
| @@ -109,7 +133,7 @@ export struct CardSourceInfo { | @@ -109,7 +133,7 @@ export struct CardSourceInfo { | ||
| 109 | .margin({right: 4}) | 133 | .margin({right: 4}) |
| 110 | } | 134 | } |
| 111 | if (this.getContentDtoBean()?.interactData?.commentNum) { | 135 | if (this.getContentDtoBean()?.interactData?.commentNum) { |
| 112 | - Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) | 136 | + Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`) |
| 113 | .fontSize($r("app.float.font_size_11")) | 137 | .fontSize($r("app.float.font_size_11")) |
| 114 | .fontColor($r("app.color.color_B0B0B0")) | 138 | .fontColor($r("app.color.color_B0B0B0")) |
| 115 | .flexShrink(0) | 139 | .flexShrink(0) |
| @@ -30,9 +30,8 @@ export struct MoreComponent { | @@ -30,9 +30,8 @@ export struct MoreComponent { | ||
| 30 | 30 | ||
| 31 | Divider() | 31 | Divider() |
| 32 | .width('100%') | 32 | .width('100%') |
| 33 | - .height(10) | ||
| 34 | .color($r('app.color.color_F5F5F5')) | 33 | .color($r('app.color.color_F5F5F5')) |
| 35 | - .strokeWidth('1lpx') | 34 | + .strokeWidth(5) |
| 36 | 35 | ||
| 37 | Row() { | 36 | Row() { |
| 38 | Text('点击展开更多相似') | 37 | Text('点击展开更多相似') |
| @@ -53,9 +52,8 @@ export struct MoreComponent { | @@ -53,9 +52,8 @@ export struct MoreComponent { | ||
| 53 | 52 | ||
| 54 | Divider() | 53 | Divider() |
| 55 | .width('100%') | 54 | .width('100%') |
| 56 | - .height(10) | ||
| 57 | .color($r('app.color.color_F5F5F5')) | 55 | .color($r('app.color.color_F5F5F5')) |
| 58 | - .strokeWidth('1lpx') | 56 | + .strokeWidth(5) |
| 59 | 57 | ||
| 60 | } | 58 | } |
| 61 | } | 59 | } |
| @@ -212,8 +212,6 @@ export namespace TrackConstants { | @@ -212,8 +212,6 @@ export namespace TrackConstants { | ||
| 212 | Interest = "preferenceSelectionPage", | 212 | Interest = "preferenceSelectionPage", |
| 213 | //意见反馈 | 213 | //意见反馈 |
| 214 | FeedbackPage = 'feedbackPage', | 214 | FeedbackPage = 'feedbackPage', |
| 215 | - //动态详情 | ||
| 216 | - DynamicDetailPage = 'dynamicDetailPage', | ||
| 217 | //早晚报 | 215 | //早晚报 |
| 218 | NewsPaperPage = 'newsPaperPage', | 216 | NewsPaperPage = 'newsPaperPage', |
| 219 | } | 217 | } |
| @@ -37,7 +37,7 @@ struct DynamicDetailPage { | @@ -37,7 +37,7 @@ struct DynamicDetailPage { | ||
| 37 | } | 37 | } |
| 38 | onPageHide() { | 38 | onPageHide() { |
| 39 | //页面浏览 | 39 | //页面浏览 |
| 40 | - TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.DynamicDetailPage,TrackConstants.PageName.DynamicDetailPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) | 40 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.DynamicDetail,TrackConstants.PageName.DynamicDetail,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) |
| 41 | 41 | ||
| 42 | } | 42 | } |
| 43 | } | 43 | } |
-
Please register or login to post a comment