Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: 二级视频详情页-埋点 ref |> 发布评论输入框增加发布按钮点击事件回调拦截组件上的接口调用 ref |> 统一视频详情页评论入口开关配置
Showing
5 changed files
with
89 additions
and
8 deletions
| @@ -4,14 +4,25 @@ import { commentItemModel } from '../model/CommentModel' | @@ -4,14 +4,25 @@ import { commentItemModel } from '../model/CommentModel' | ||
| 4 | import { publishCommentModel } from '../model/PublishCommentModel' | 4 | import { publishCommentModel } from '../model/PublishCommentModel' |
| 5 | import commentViewModel from '../viewmodel/CommentViewModel' | 5 | import commentViewModel from '../viewmodel/CommentViewModel' |
| 6 | 6 | ||
| 7 | +export interface CommentDialogInputContent { | ||
| 8 | + comment?: string | ||
| 9 | + imageUrl?: string | ||
| 10 | +} | ||
| 11 | + | ||
| 7 | /// 评论输入框 | 12 | /// 评论输入框 |
| 8 | @Preview | 13 | @Preview |
| 9 | @CustomDialog | 14 | @CustomDialog |
| 10 | export struct CommentCustomDialog { | 15 | export struct CommentCustomDialog { |
| 11 | @ObjectLink publishCommentModel: publishCommentModel | 16 | @ObjectLink publishCommentModel: publishCommentModel |
| 12 | controller?: CustomDialogController | 17 | controller?: CustomDialogController |
| 13 | - confirm: (value: Record<string, string>) => void = () => { | ||
| 14 | - } | 18 | + |
| 19 | + // 发布按钮点击事件。如果上层传了该值,切返回了true,表示上层已处理,则 confirm 回调不生效 | ||
| 20 | + // 可以用这里在上层做埋点 | ||
| 21 | + onPublishBtnClick?: (content: CommentDialogInputContent) => boolean | ||
| 22 | + | ||
| 23 | + // confirm 表示内部处理调用 内容评论接口 发布了评论并成功,上层只需要 通过 publishCommentModel.lastCommentModel 即可获取最新已提交的评论 | ||
| 24 | + confirm?: (value: Record<string, string>) => void | ||
| 25 | + | ||
| 15 | @State private emojiSwitch: boolean = false | 26 | @State private emojiSwitch: boolean = false |
| 16 | textInputController: TextAreaController = new TextAreaController() | 27 | textInputController: TextAreaController = new TextAreaController() |
| 17 | @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } | 28 | @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } |
| @@ -21,6 +32,13 @@ export struct CommentCustomDialog { | @@ -21,6 +32,13 @@ export struct CommentCustomDialog { | ||
| 21 | } | 32 | } |
| 22 | 33 | ||
| 23 | publishCommentRequest() { | 34 | publishCommentRequest() { |
| 35 | + if (this.onPublishBtnClick) { | ||
| 36 | + let content: CommentDialogInputContent = { comment: this.publishCommentModel.commentContent } | ||
| 37 | + if (this.onPublishBtnClick(content)) { | ||
| 38 | + return | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 24 | let bean: Record<string, string> = {}; | 42 | let bean: Record<string, string> = {}; |
| 25 | // this.publishCommentModel.commentContent = this.commentText | 43 | // this.publishCommentModel.commentContent = this.commentText |
| 26 | //TODO 判断类型 | 44 | //TODO 判断类型 |
| @@ -34,7 +52,9 @@ export struct CommentCustomDialog { | @@ -34,7 +52,9 @@ export struct CommentCustomDialog { | ||
| 34 | if (this.controller != null) { | 52 | if (this.controller != null) { |
| 35 | this.controller.close() | 53 | this.controller.close() |
| 36 | } | 54 | } |
| 37 | - this.confirm(bean) | 55 | + if (this.confirm) { |
| 56 | + this.confirm(bean) | ||
| 57 | + } | ||
| 38 | }).catch(() => { | 58 | }).catch(() => { |
| 39 | if (this.controller != null) { | 59 | if (this.controller != null) { |
| 40 | this.controller.close() | 60 | this.controller.close() |
| @@ -8,6 +8,8 @@ import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentD | @@ -8,6 +8,8 @@ import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentD | ||
| 8 | import { DisplayDirection } from 'wdConstant/Index'; | 8 | import { DisplayDirection } from 'wdConstant/Index'; |
| 9 | import { window } from '@kit.ArkUI'; | 9 | import { window } from '@kit.ArkUI'; |
| 10 | import { EmptyComponent } from 'wdComponent/Index'; | 10 | import { EmptyComponent } from 'wdComponent/Index'; |
| 11 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 12 | +import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; | ||
| 11 | 13 | ||
| 12 | const storage = LocalStorage.getShared(); | 14 | const storage = LocalStorage.getShared(); |
| 13 | const TAG = 'DetailVideoListPage' | 15 | const TAG = 'DetailVideoListPage' |
| @@ -33,6 +35,8 @@ export struct DetailVideoListPage { | @@ -33,6 +35,8 @@ export struct DetailVideoListPage { | ||
| 33 | @State currentIndex: number = 0 | 35 | @State currentIndex: number = 0 |
| 34 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | 36 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 |
| 35 | @State interactDataList: InteractDataDTO[] = [] | 37 | @State interactDataList: InteractDataDTO[] = [] |
| 38 | + pageShowTime:number = 0; | ||
| 39 | + pageHideTime:number = 0; | ||
| 36 | 40 | ||
| 37 | async aboutToAppear(): Promise<void> { | 41 | async aboutToAppear(): Promise<void> { |
| 38 | // 注册监听网络连接 | 42 | // 注册监听网络连接 |
| @@ -70,12 +74,18 @@ export struct DetailVideoListPage { | @@ -70,12 +74,18 @@ export struct DetailVideoListPage { | ||
| 70 | this.switchVideoStatus = true | 74 | this.switchVideoStatus = true |
| 71 | this.openFullScreen() | 75 | this.openFullScreen() |
| 72 | 76 | ||
| 77 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 73 | } | 78 | } |
| 74 | 79 | ||
| 75 | onPageHide(): void { | 80 | onPageHide(): void { |
| 76 | console.log(TAG, 'onPageHide') | 81 | console.log(TAG, 'onPageHide') |
| 77 | this.switchVideoStatus = false | 82 | this.switchVideoStatus = false |
| 78 | this.closeFullScreen() | 83 | this.closeFullScreen() |
| 84 | + | ||
| 85 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 86 | + let duration = 0 | ||
| 87 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 88 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration) | ||
| 79 | } | 89 | } |
| 80 | 90 | ||
| 81 | /** | 91 | /** |
| @@ -14,6 +14,8 @@ import { PictureLoading } from './PictureLoading'; | @@ -14,6 +14,8 @@ import { PictureLoading } from './PictureLoading'; | ||
| 14 | import { DisplayDirection } from 'wdConstant/Index'; | 14 | import { DisplayDirection } from 'wdConstant/Index'; |
| 15 | import { window } from '@kit.ArkUI'; | 15 | import { window } from '@kit.ArkUI'; |
| 16 | import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index'; | 16 | import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index'; |
| 17 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 18 | +import {TrackConstants,TrackingPageBrowse } from 'wdTracking/Index'; | ||
| 17 | 19 | ||
| 18 | interface loadMoreData { | 20 | interface loadMoreData { |
| 19 | pageNum: number; | 21 | pageNum: number; |
| @@ -59,6 +61,8 @@ export struct VideoChannelDetail { | @@ -59,6 +61,8 @@ export struct VideoChannelDetail { | ||
| 59 | @State totalCount: number = 0 | 61 | @State totalCount: number = 0 |
| 60 | @State isMouted: boolean = false | 62 | @State isMouted: boolean = false |
| 61 | @State isRequestError: boolean = false | 63 | @State isRequestError: boolean = false |
| 64 | + pageShowTime:number = 0; | ||
| 65 | + pageHideTime:number = 0; | ||
| 62 | 66 | ||
| 63 | autoRefreshChange() { | 67 | autoRefreshChange() { |
| 64 | if (this.topNavIndex === 0) { | 68 | if (this.topNavIndex === 0) { |
| @@ -78,12 +82,21 @@ export struct VideoChannelDetail { | @@ -78,12 +82,21 @@ export struct VideoChannelDetail { | ||
| 78 | this.switchVideoStatus = true | 82 | this.switchVideoStatus = true |
| 79 | this.openFullScreen() | 83 | this.openFullScreen() |
| 80 | } | 84 | } |
| 85 | + | ||
| 86 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 87 | + console.log(TAG, '一级视频显示') | ||
| 81 | } | 88 | } |
| 82 | 89 | ||
| 83 | pageHideChange() { | 90 | pageHideChange() { |
| 84 | this.barBackgroundColor = Color.Transparent | 91 | this.barBackgroundColor = Color.Transparent |
| 85 | this.switchVideoStatus = false | 92 | this.switchVideoStatus = false |
| 86 | this.closeFullScreen() | 93 | this.closeFullScreen() |
| 94 | + | ||
| 95 | + console.log(TAG, '一级视频隐藏') | ||
| 96 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 97 | + let duration = 0 | ||
| 98 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 99 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration) | ||
| 87 | } | 100 | } |
| 88 | 101 | ||
| 89 | /** | 102 | /** |
| @@ -255,7 +268,6 @@ export struct VideoChannelDetail { | @@ -255,7 +268,6 @@ export struct VideoChannelDetail { | ||
| 255 | }) | 268 | }) |
| 256 | } | 269 | } |
| 257 | } | 270 | } |
| 258 | - | ||
| 259 | build() { | 271 | build() { |
| 260 | Column() { | 272 | Column() { |
| 261 | if (this.isRequestError) { | 273 | if (this.isRequestError) { |
| @@ -18,7 +18,7 @@ export struct PlayerCommentView { | @@ -18,7 +18,7 @@ export struct PlayerCommentView { | ||
| 18 | router.back(); | 18 | router.back(); |
| 19 | }) | 19 | }) |
| 20 | 20 | ||
| 21 | - if (this.contentDetailData.openComment === 1) { | 21 | + if (this.contentDetailData.openComment == 1) { |
| 22 | TextInput({ placeholder: '说两句...', text: this.comment }) | 22 | TextInput({ placeholder: '说两句...', text: this.comment }) |
| 23 | .placeholderColor('#999999') | 23 | .placeholderColor('#999999') |
| 24 | .placeholderFont({ size: 14 }) | 24 | .placeholderFont({ size: 14 }) |
| @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 14 | import { DisplayDirection, SpConstants } from 'wdConstant/Index' | 14 | import { DisplayDirection, SpConstants } from 'wdConstant/Index' |
| 15 | import { WDShare } from "wdShare" | 15 | import { WDShare } from "wdShare" |
| 16 | import { publishCommentModel } from 'wdComponent/Index'; | 16 | import { publishCommentModel } from 'wdComponent/Index'; |
| 17 | +import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; | ||
| 17 | 18 | ||
| 18 | interface ILikeStyleResp { | 19 | interface ILikeStyleResp { |
| 19 | url: Resource; | 20 | url: Resource; |
| @@ -37,16 +38,44 @@ export struct PlayerRightView { | @@ -37,16 +38,44 @@ export struct PlayerRightView { | ||
| 37 | @Consume showCommentList: boolean | 38 | @Consume showCommentList: boolean |
| 38 | @Consume displayDirection: DisplayDirection | 39 | @Consume displayDirection: DisplayDirection |
| 39 | @Consume publishCommentModel: publishCommentModel | 40 | @Consume publishCommentModel: publishCommentModel |
| 40 | - @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 41 | + // @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 41 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 42 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 43 | + @State likesStyle: number | string = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | ||
| 44 | + pageParam: ParamType = {} | ||
| 45 | + PageName: string = '' | ||
| 46 | + followUserId: string = '' | ||
| 47 | + followUserName: string = '' | ||
| 48 | + | ||
| 42 | aboutToAppear() { | 49 | aboutToAppear() { |
| 43 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 50 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 44 | this.likesStyle = this.contentDetailData.likesStyle | 51 | this.likesStyle = this.contentDetailData.likesStyle |
| 45 | this.openLikes = this.contentDetailData.openLikes == 1 ? true : false | 52 | this.openLikes = this.contentDetailData.openLikes == 1 ? true : false |
| 46 | // console.log(TAG, 'this.likesStyle', this.likesStyle) | 53 | // console.log(TAG, 'this.likesStyle', this.likesStyle) |
| 47 | // console.log(TAG, 'this.openLikes', this.openLikes) | 54 | // console.log(TAG, 'this.openLikes', this.openLikes) |
| 55 | + this.contentTrackingDict() | ||
| 56 | + } | ||
| 57 | + contentTrackingDict(){ | ||
| 58 | + this.pageParam = { | ||
| 59 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 60 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 61 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 62 | + } | ||
| 63 | + if(this.contentDetailData.newsType == 1) { | ||
| 64 | + this.PageName = TrackConstants.PageName.VideoDetail // 点播 | ||
| 65 | + } else if(this.contentDetailData.newsType == 2) { | ||
| 66 | + this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 67 | + } else if(this.contentDetailData.newsType == 5) { | ||
| 68 | + this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页 | ||
| 69 | + } else if(this.contentDetailData.newsType == 8) { | ||
| 70 | + this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页 | ||
| 71 | + } else if(this.contentDetailData.newsType == 9) { | ||
| 72 | + this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页 | ||
| 73 | + } else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) { | ||
| 74 | + this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频 | ||
| 75 | + } | ||
| 76 | + this.followUserId = this.contentDetailData?.rmhInfo?.rmhId || '' | ||
| 77 | + this.followUserName = this.contentDetailData?.rmhInfo?.rmhName || '' | ||
| 48 | } | 78 | } |
| 49 | - | ||
| 50 | /** | 79 | /** |
| 51 | * 点赞、取消点赞 | 80 | * 点赞、取消点赞 |
| 52 | */ | 81 | */ |
| @@ -76,8 +105,12 @@ export struct PlayerRightView { | @@ -76,8 +105,12 @@ export struct PlayerRightView { | ||
| 76 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' | 105 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' |
| 77 | if (this.newsStatusOfUser.likeStatus == '1') { | 106 | if (this.newsStatusOfUser.likeStatus == '1') { |
| 78 | this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1 | 107 | this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1 |
| 108 | + TrackingContent.like(true,this.PageName,this.PageName,this.pageParam) | ||
| 109 | + console.log(TAG, '点赞') | ||
| 79 | } else { | 110 | } else { |
| 80 | this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1) | 111 | this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1) |
| 112 | + TrackingContent.like(false,this.PageName,this.PageName,this.pageParam) | ||
| 113 | + console.log(TAG, '取消点赞') | ||
| 81 | } | 114 | } |
| 82 | console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) | 115 | console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) |
| 83 | // this.queryContentInteractCount() | 116 | // this.queryContentInteractCount() |
| @@ -112,8 +145,12 @@ export struct PlayerRightView { | @@ -112,8 +145,12 @@ export struct PlayerRightView { | ||
| 112 | // this.queryContentInteractCount() | 145 | // this.queryContentInteractCount() |
| 113 | if (this.newsStatusOfUser.collectStatus === 1) { | 146 | if (this.newsStatusOfUser.collectStatus === 1) { |
| 114 | this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1 | 147 | this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1 |
| 148 | + TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam) | ||
| 149 | + console.log(TAG, '收藏') | ||
| 115 | } else { | 150 | } else { |
| 116 | this.interactData.collectNum = Math.max(0, Number(this.interactData.collectNum || 0) - 1) | 151 | this.interactData.collectNum = Math.max(0, Number(this.interactData.collectNum || 0) - 1) |
| 152 | + TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam) | ||
| 153 | + console.log(TAG, '取消收藏') | ||
| 117 | } | 154 | } |
| 118 | console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum) | 155 | console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum) |
| 119 | } | 156 | } |
| @@ -175,6 +212,8 @@ export struct PlayerRightView { | @@ -175,6 +212,8 @@ export struct PlayerRightView { | ||
| 175 | ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000); | 212 | ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000); |
| 176 | } | 213 | } |
| 177 | }) | 214 | }) |
| 215 | + console.log(TAG, '关注号主') | ||
| 216 | + TrackingContent.follow(true,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam) | ||
| 178 | } | 217 | } |
| 179 | }) | 218 | }) |
| 180 | } | 219 | } |
| @@ -184,7 +223,7 @@ export struct PlayerRightView { | @@ -184,7 +223,7 @@ export struct PlayerRightView { | ||
| 184 | this.userBuilderView() | 223 | this.userBuilderView() |
| 185 | this.likeBuilderView() | 224 | this.likeBuilderView() |
| 186 | this.collectBuilderView() | 225 | this.collectBuilderView() |
| 187 | - if (this.contentDetailData.openComment === 1) { | 226 | + if (this.contentDetailData.openComment == 1) { |
| 188 | this.commentBuilderView() | 227 | this.commentBuilderView() |
| 189 | } | 228 | } |
| 190 | this.shareBuilderView() | 229 | this.shareBuilderView() |
-
Please register or login to post a comment