liyubing

feat:直播详情页面,消息发布按钮埋点,点赞按钮埋点

... ... @@ -4,9 +4,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index';
import measure from '@ohos.measure'
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
import {
ContentDetailDTO,
} from 'wdBean';
import { ContentDetailDTO, } from 'wdBean';
import { LiveModel } from '../../viewmodel/LiveModel';
import { HttpUtils } from 'wdNetwork/Index';
import vibrator from '@ohos.vibrator';
... ... @@ -47,6 +45,7 @@ export struct LiveLikeComponent {
this.onDetailUpdated()
this.contentTrackingDict()
}
async onDetailUpdated() {
// 2:竖屏直播页 4:横屏直播页
// 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
... ... @@ -61,13 +60,13 @@ export struct LiveLikeComponent {
this.getLikeCount()
}
contentTrackingDict(){
contentTrackingDict() {
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 2) {
if (this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
}
}
... ... @@ -118,7 +117,9 @@ export struct LiveLikeComponent {
.width(36)
.height(36)
.borderRadius(18)
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' :
this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
if (this.likeCount != 0) {
RelativeContainer() {
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 {
console.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
}
this.likeCount++
this.likeStatus = true
//内容点赞、取消点赞Tracking 1点赞 0取消点赞
TrackingContent.like(true, TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
})
}).catch(() => {
})
... ... @@ -245,6 +256,7 @@ export struct LiveLikeComponent {
this.likeCount = 0
})
}
private getMeasureText(text: string) {
let width = measure.measureText({
textContent: text,
... ...
... ... @@ -91,7 +91,7 @@ export struct DetailPlayLiveCommon {
let vliveId = detailData.liveInfo.vlive[0].vliveId as string
console.error(TAG, 'vliveId==' + vliveId)
let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean
console.error(TAG, 'vliveId==' + vliveId)
if (pullStreamAddressData) {
console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData))
let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url
... ...
... ... @@ -9,6 +9,7 @@ import { router, window } from '@kit.ArkUI';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { LiveOperRowListView } from 'wdComponent';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
import { TrackConstants, TrackingContent } from 'wdTracking/Index';
let TAG: string = 'DetailPlayLivePage';
... ... @@ -34,7 +35,6 @@ export struct DetailPlayLivePage {
@Consume @Watch('onBackPressCus') pageBackPress: number
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
// 尽量不要动属性。用来作为输入了评论之后,值传递
@State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息
@State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息
... ... @@ -69,10 +69,12 @@ export struct DetailPlayLivePage {
TopPlayComponent({ playerController: this.playerController })
.height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
TabComponent({ tabs: this.tabs,
TabComponent({
tabs: this.tabs,
changeToTab: this.changeToTab,
lastInputedLiveComment: this.lastInputedLiveComment,
lastInputedChatComment: this.lastInputedChatComment})
lastInputedChatComment: this.lastInputedChatComment
})
.layoutWeight(1)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
... ... @@ -95,6 +97,13 @@ export struct DetailPlayLivePage {
} else {
this.lastInputedChatComment = result
}
// 发布评论埋点
TrackingContent.commentClick(TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
});
})
}
}
... ...
... ... @@ -39,6 +39,8 @@ export class LiveViewModel {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
if (resDTO.data) {
success(resDTO.data)
}else {
fail("数据为空")
}
}).catch(() => {
fail("数据为空")
... ...
... ... @@ -11,6 +11,7 @@ import { ChartItemCompereComponent } from './ChartItemCompereComponent'
import { ChatItemComponent } from './ChartItemComponent'
import { router } from '@kit.ArkUI'
import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'
import { TrackConstants, TrackingContent } from 'wdTracking/Index'
const TAG = "PlayerCommentComponent"
/**
... ... @@ -105,6 +106,7 @@ export struct PlayerCommentComponent {
contentDetailData: this.contentDetailData,
onCommentInputFocus: () => {
},
onCommentInputed: (content) => {
if (content.comment) {
... ... @@ -116,6 +118,14 @@ export struct PlayerCommentComponent {
this.liveChatList.push(result)
this.scroller.scrollEdge(Edge.Bottom)
})
// 发布评论埋点
TrackingContent.commentClick(TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
});
}
},
onBack: () => {
... ...