Showing
5 changed files
with
43 additions
and
10 deletions
| @@ -4,9 +4,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -4,9 +4,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 4 | import { SpConstants } from 'wdConstant/Index'; | 4 | import { SpConstants } from 'wdConstant/Index'; |
| 5 | import measure from '@ohos.measure' | 5 | import measure from '@ohos.measure' |
| 6 | import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'; | 6 | import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'; |
| 7 | -import { | ||
| 8 | - ContentDetailDTO, | ||
| 9 | -} from 'wdBean'; | 7 | +import { ContentDetailDTO, } from 'wdBean'; |
| 10 | import { LiveModel } from '../../viewmodel/LiveModel'; | 8 | import { LiveModel } from '../../viewmodel/LiveModel'; |
| 11 | import { HttpUtils } from 'wdNetwork/Index'; | 9 | import { HttpUtils } from 'wdNetwork/Index'; |
| 12 | import vibrator from '@ohos.vibrator'; | 10 | import vibrator from '@ohos.vibrator'; |
| @@ -47,6 +45,7 @@ export struct LiveLikeComponent { | @@ -47,6 +45,7 @@ export struct LiveLikeComponent { | ||
| 47 | this.onDetailUpdated() | 45 | this.onDetailUpdated() |
| 48 | this.contentTrackingDict() | 46 | this.contentTrackingDict() |
| 49 | } | 47 | } |
| 48 | + | ||
| 50 | async onDetailUpdated() { | 49 | async onDetailUpdated() { |
| 51 | // 2:竖屏直播页 4:横屏直播页 | 50 | // 2:竖屏直播页 4:横屏直播页 |
| 52 | // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 | 51 | // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 |
| @@ -61,13 +60,13 @@ export struct LiveLikeComponent { | @@ -61,13 +60,13 @@ export struct LiveLikeComponent { | ||
| 61 | this.getLikeCount() | 60 | this.getLikeCount() |
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | - contentTrackingDict(){ | 63 | + contentTrackingDict() { |
| 65 | this.pageParam = { | 64 | this.pageParam = { |
| 66 | 'contentType': `${this.contentDetailData.newsType}`, | 65 | 'contentType': `${this.contentDetailData.newsType}`, |
| 67 | 'contentId': `${this.contentDetailData.newsId}`, | 66 | 'contentId': `${this.contentDetailData.newsId}`, |
| 68 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, | 67 | 'contentName': `${this.contentDetailData.newsTitle || ''}`, |
| 69 | } | 68 | } |
| 70 | - if(this.contentDetailData.newsType == 2) { | 69 | + if (this.contentDetailData.newsType == 2) { |
| 71 | this.PageName = TrackConstants.PageName.Live_Detail // 直播 | 70 | this.PageName = TrackConstants.PageName.Live_Detail // 直播 |
| 72 | } | 71 | } |
| 73 | } | 72 | } |
| @@ -118,7 +117,9 @@ export struct LiveLikeComponent { | @@ -118,7 +117,9 @@ export struct LiveLikeComponent { | ||
| 118 | .width(36) | 117 | .width(36) |
| 119 | .height(36) | 118 | .height(36) |
| 120 | .borderRadius(18) | 119 | .borderRadius(18) |
| 121 | - .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') | 120 | + .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : |
| 121 | + this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') | ||
| 122 | + | ||
| 122 | if (this.likeCount != 0) { | 123 | if (this.likeCount != 0) { |
| 123 | RelativeContainer() { | 124 | RelativeContainer() { |
| 124 | Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg') : $r('app.media.ic_like_back_Select')) | 125 | Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg') : $r('app.media.ic_like_back_Select')) |
| @@ -211,6 +212,16 @@ export struct LiveLikeComponent { | @@ -211,6 +212,16 @@ export struct LiveLikeComponent { | ||
| 211 | console.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`); | 212 | console.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`); |
| 212 | } | 213 | } |
| 213 | this.likeCount++ | 214 | this.likeCount++ |
| 215 | + this.likeStatus = true | ||
| 216 | + | ||
| 217 | + //内容点赞、取消点赞Tracking 1点赞 0取消点赞 | ||
| 218 | + TrackingContent.like(true, TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail, | ||
| 219 | + { | ||
| 220 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 221 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 222 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 223 | + }) | ||
| 224 | + | ||
| 214 | 225 | ||
| 215 | }).catch(() => { | 226 | }).catch(() => { |
| 216 | }) | 227 | }) |
| @@ -245,6 +256,7 @@ export struct LiveLikeComponent { | @@ -245,6 +256,7 @@ export struct LiveLikeComponent { | ||
| 245 | this.likeCount = 0 | 256 | this.likeCount = 0 |
| 246 | }) | 257 | }) |
| 247 | } | 258 | } |
| 259 | + | ||
| 248 | private getMeasureText(text: string) { | 260 | private getMeasureText(text: string) { |
| 249 | let width = measure.measureText({ | 261 | let width = measure.measureText({ |
| 250 | textContent: text, | 262 | textContent: text, |
| @@ -91,7 +91,7 @@ export struct DetailPlayLiveCommon { | @@ -91,7 +91,7 @@ export struct DetailPlayLiveCommon { | ||
| 91 | let vliveId = detailData.liveInfo.vlive[0].vliveId as string | 91 | let vliveId = detailData.liveInfo.vlive[0].vliveId as string |
| 92 | console.error(TAG, 'vliveId==' + vliveId) | 92 | console.error(TAG, 'vliveId==' + vliveId) |
| 93 | let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean | 93 | let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean |
| 94 | - | 94 | + console.error(TAG, 'vliveId==' + vliveId) |
| 95 | if (pullStreamAddressData) { | 95 | if (pullStreamAddressData) { |
| 96 | console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData)) | 96 | console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData)) |
| 97 | let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url | 97 | let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url |
| @@ -9,6 +9,7 @@ import { router, window } from '@kit.ArkUI'; | @@ -9,6 +9,7 @@ import { router, window } from '@kit.ArkUI'; | ||
| 9 | import { WDAliPlayerController } from 'wdPlayer/Index'; | 9 | import { WDAliPlayerController } from 'wdPlayer/Index'; |
| 10 | import { LiveOperRowListView } from 'wdComponent'; | 10 | import { LiveOperRowListView } from 'wdComponent'; |
| 11 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; | 11 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; |
| 12 | +import { TrackConstants, TrackingContent } from 'wdTracking/Index'; | ||
| 12 | 13 | ||
| 13 | let TAG: string = 'DetailPlayLivePage'; | 14 | let TAG: string = 'DetailPlayLivePage'; |
| 14 | 15 | ||
| @@ -34,7 +35,6 @@ export struct DetailPlayLivePage { | @@ -34,7 +35,6 @@ export struct DetailPlayLivePage { | ||
| 34 | @Consume @Watch('onBackPressCus') pageBackPress: number | 35 | @Consume @Watch('onBackPressCus') pageBackPress: number |
| 35 | @Consume contentDetailData: ContentDetailDTO | 36 | @Consume contentDetailData: ContentDetailDTO |
| 36 | @Consume publishCommentModel: publishCommentModel | 37 | @Consume publishCommentModel: publishCommentModel |
| 37 | - | ||
| 38 | // 尽量不要动属性。用来作为输入了评论之后,值传递 | 38 | // 尽量不要动属性。用来作为输入了评论之后,值传递 |
| 39 | @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息 | 39 | @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息 |
| 40 | @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息 | 40 | @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息 |
| @@ -69,10 +69,12 @@ export struct DetailPlayLivePage { | @@ -69,10 +69,12 @@ export struct DetailPlayLivePage { | ||
| 69 | TopPlayComponent({ playerController: this.playerController }) | 69 | TopPlayComponent({ playerController: this.playerController }) |
| 70 | .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%') | 70 | .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%') |
| 71 | 71 | ||
| 72 | - TabComponent({ tabs: this.tabs, | 72 | + TabComponent({ |
| 73 | + tabs: this.tabs, | ||
| 73 | changeToTab: this.changeToTab, | 74 | changeToTab: this.changeToTab, |
| 74 | lastInputedLiveComment: this.lastInputedLiveComment, | 75 | lastInputedLiveComment: this.lastInputedLiveComment, |
| 75 | - lastInputedChatComment: this.lastInputedChatComment}) | 76 | + lastInputedChatComment: this.lastInputedChatComment |
| 77 | + }) | ||
| 76 | .layoutWeight(1) | 78 | .layoutWeight(1) |
| 77 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 79 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 78 | 80 | ||
| @@ -95,6 +97,13 @@ export struct DetailPlayLivePage { | @@ -95,6 +97,13 @@ export struct DetailPlayLivePage { | ||
| 95 | } else { | 97 | } else { |
| 96 | this.lastInputedChatComment = result | 98 | this.lastInputedChatComment = result |
| 97 | } | 99 | } |
| 100 | + // 发布评论埋点 | ||
| 101 | + TrackingContent.commentClick(TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail, | ||
| 102 | + { | ||
| 103 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 104 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 105 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 106 | + }); | ||
| 98 | }) | 107 | }) |
| 99 | } | 108 | } |
| 100 | } | 109 | } |
| @@ -39,6 +39,8 @@ export class LiveViewModel { | @@ -39,6 +39,8 @@ export class LiveViewModel { | ||
| 39 | console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) | 39 | console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) |
| 40 | if (resDTO.data) { | 40 | if (resDTO.data) { |
| 41 | success(resDTO.data) | 41 | success(resDTO.data) |
| 42 | + }else { | ||
| 43 | + fail("数据为空") | ||
| 42 | } | 44 | } |
| 43 | }).catch(() => { | 45 | }).catch(() => { |
| 44 | fail("数据为空") | 46 | fail("数据为空") |
| @@ -11,6 +11,7 @@ import { ChartItemCompereComponent } from './ChartItemCompereComponent' | @@ -11,6 +11,7 @@ import { ChartItemCompereComponent } from './ChartItemCompereComponent' | ||
| 11 | import { ChatItemComponent } from './ChartItemComponent' | 11 | import { ChatItemComponent } from './ChartItemComponent' |
| 12 | import { router } from '@kit.ArkUI' | 12 | import { router } from '@kit.ArkUI' |
| 13 | import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index' | 13 | import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index' |
| 14 | +import { TrackConstants, TrackingContent } from 'wdTracking/Index' | ||
| 14 | 15 | ||
| 15 | const TAG = "PlayerCommentComponent" | 16 | const TAG = "PlayerCommentComponent" |
| 16 | /** | 17 | /** |
| @@ -105,6 +106,7 @@ export struct PlayerCommentComponent { | @@ -105,6 +106,7 @@ export struct PlayerCommentComponent { | ||
| 105 | contentDetailData: this.contentDetailData, | 106 | contentDetailData: this.contentDetailData, |
| 106 | onCommentInputFocus: () => { | 107 | onCommentInputFocus: () => { |
| 107 | 108 | ||
| 109 | + | ||
| 108 | }, | 110 | }, |
| 109 | onCommentInputed: (content) => { | 111 | onCommentInputed: (content) => { |
| 110 | if (content.comment) { | 112 | if (content.comment) { |
| @@ -116,6 +118,14 @@ export struct PlayerCommentComponent { | @@ -116,6 +118,14 @@ export struct PlayerCommentComponent { | ||
| 116 | this.liveChatList.push(result) | 118 | this.liveChatList.push(result) |
| 117 | this.scroller.scrollEdge(Edge.Bottom) | 119 | this.scroller.scrollEdge(Edge.Bottom) |
| 118 | }) | 120 | }) |
| 121 | + | ||
| 122 | + // 发布评论埋点 | ||
| 123 | + TrackingContent.commentClick(TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail, | ||
| 124 | + { | ||
| 125 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 126 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 127 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 128 | + }); | ||
| 119 | } | 129 | } |
| 120 | }, | 130 | }, |
| 121 | onBack: () => { | 131 | onBack: () => { |
-
Please register or login to post a comment