liyubing

feat:直播详情页面,预约和取消预约埋点

@@ -4,6 +4,7 @@ import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index' @@ -4,6 +4,7 @@ import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index'
4 import { LiveViewModel } from '../../viewModel/LiveViewModel' 4 import { LiveViewModel } from '../../viewModel/LiveViewModel'
5 import { HttpUtils } from 'wdNetwork/Index' 5 import { HttpUtils } from 'wdNetwork/Index'
6 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 6 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
  7 +import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'
7 8
8 @Component 9 @Component
9 export struct LiveCountdownComponent { 10 export struct LiveCountdownComponent {
@@ -19,6 +20,7 @@ export struct LiveCountdownComponent { @@ -19,6 +20,7 @@ export struct LiveCountdownComponent {
19 //是否预约过直播 20 //是否预约过直播
20 @State isAppointmentLive: boolean = false 21 @State isAppointmentLive: boolean = false
21 liveViewModel: LiveViewModel = new LiveViewModel() 22 liveViewModel: LiveViewModel = new LiveViewModel()
  23 + pageParam: ParamType = {}
22 24
23 aboutToAppear(): void { 25 aboutToAppear(): void {
24 //注册字体 26 //注册字体
@@ -30,6 +32,15 @@ export struct LiveCountdownComponent { @@ -30,6 +32,15 @@ export struct LiveCountdownComponent {
30 this.textTimerController.start() 32 this.textTimerController.start()
31 }, 0) 33 }, 0)
32 this.updateData() 34 this.updateData()
  35 + this.contentTrackingDict()
  36 + }
  37 +
  38 + contentTrackingDict() {
  39 + this.pageParam = {
  40 + 'contentType': `${this.liveDetailsBean.newsType}`,
  41 + 'contentId': `${this.liveDetailsBean.newsId}`,
  42 + 'contentName': `${this.liveDetailsBean.newsTitle || ''}`,
  43 + }
33 } 44 }
34 45
35 build() { 46 build() {
@@ -141,7 +152,7 @@ export struct LiveCountdownComponent { @@ -141,7 +152,7 @@ export struct LiveCountdownComponent {
141 } 152 }
142 //2024-04-01 19:44:00-trim->2024-04-0119:44:00 153 //2024-04-01 19:44:00-trim->2024-04-0119:44:00
143 if (StringUtils.isNotEmpty(this.liveDetailsBean.liveInfo?.planStartTime)) { 154 if (StringUtils.isNotEmpty(this.liveDetailsBean.liveInfo?.planStartTime)) {
144 - let playStartTimeTmp = this.liveDetailsBean.liveInfo?.planStartTime+'' 155 + let playStartTimeTmp = this.liveDetailsBean.liveInfo?.planStartTime + ''
145 this.month = Number(playStartTimeTmp.substring(5, 7)).toString() 156 this.month = Number(playStartTimeTmp.substring(5, 7)).toString()
146 this.day = playStartTimeTmp.substring(8, 10) 157 this.day = playStartTimeTmp.substring(8, 10)
147 this.hour = playStartTimeTmp.substring(11, 13) 158 this.hour = playStartTimeTmp.substring(11, 13)
@@ -152,7 +163,7 @@ export struct LiveCountdownComponent { @@ -152,7 +163,7 @@ export struct LiveCountdownComponent {
152 getLiveAppointmentStatus() { 163 getLiveAppointmentStatus() {
153 this.liveViewModel.getLiveAppointmentStatus( 164 this.liveViewModel.getLiveAppointmentStatus(
154 this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '', 165 this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '',
155 - this.liveDetailsBean.newsId+'' 166 + this.liveDetailsBean.newsId + ''
156 ).then( 167 ).then(
157 (data) => { 168 (data) => {
158 this.isAppointmentLive = data 169 this.isAppointmentLive = data
@@ -165,15 +176,19 @@ export struct LiveCountdownComponent { @@ -165,15 +176,19 @@ export struct LiveCountdownComponent {
165 liveAppointment() { 176 liveAppointment() {
166 this.liveViewModel.liveAppointment( 177 this.liveViewModel.liveAppointment(
167 this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '', 178 this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '',
168 - this.liveDetailsBean.newsId+'', 179 + this.liveDetailsBean.newsId + '',
169 !this.isAppointmentLive).then( 180 !this.isAppointmentLive).then(
170 (data) => { 181 (data) => {
171 if (data.success) { 182 if (data.success) {
172 this.isAppointmentLive = !this.isAppointmentLive 183 this.isAppointmentLive = !this.isAppointmentLive
173 if (this.isAppointmentLive) { 184 if (this.isAppointmentLive) {
174 ToastUtils.showToast('预约成功', 1000) 185 ToastUtils.showToast('预约成功', 1000)
  186 + TrackingContent.subscribeClick(true, TrackConstants.PageName.Live_Detail,
  187 + TrackConstants.PageName.Live_Detail, this.pageParam)
175 } else { 188 } else {
176 ToastUtils.showToast('取消预约成功', 1000) 189 ToastUtils.showToast('取消预约成功', 1000)
  190 + TrackingContent.subscribeClick(false, TrackConstants.PageName.Live_Detail,
  191 + TrackConstants.PageName.Live_Detail, this.pageParam)
177 } 192 }
178 } 193 }
179 }, 194 },
@@ -34,7 +34,6 @@ export struct TabComponent { @@ -34,7 +34,6 @@ export struct TabComponent {
34 34
35 build() { 35 build() {
36 Column() { 36 Column() {
37 -  
38 // 页签 37 // 页签
39 Row() { 38 Row() {
40 Scroll() { 39 Scroll() {
@@ -36,11 +36,11 @@ export struct TopPlayComponent { @@ -36,11 +36,11 @@ export struct TopPlayComponent {
36 36
37 aboutToAppear(): void { 37 aboutToAppear(): void {
38 if (this.playerController) { 38 if (this.playerController) {
  39 +
39 this.playerController.onCanplay = () => { 40 this.playerController.onCanplay = () => {
40 this.isCanPlay = true 41 this.isCanPlay = true
41 this.isLoading = true 42 this.isLoading = true
42 this.playerController?.play() 43 this.playerController?.play()
43 -  
44 } 44 }
45 45
46 this.playerController.onStatusChange = (status: number) => { 46 this.playerController.onStatusChange = (status: number) => {
@@ -113,6 +113,29 @@ export class TrackingContent { @@ -113,6 +113,29 @@ export class TrackingContent {
113 113
114 } 114 }
115 115
  116 +
  117 + /**
  118 + * 直播预约埋点
  119 + * @param isSubscribeFlag
  120 + * @param pageId
  121 + * @param pageName
  122 + * @param extParams
  123 + */
  124 + static subscribeClick(isSubscribeFlag:boolean ,pageId: string, pageName: string,extParams?: ParamType){
  125 + let params = TrackingUtils.generateParams(extParams)
  126 + if (pageId.length) {
  127 + params["pageId"] = pageId
  128 + }
  129 + if (pageName.length) {
  130 + params["pageName"] = pageName
  131 + }
  132 +
  133 + let event = isSubscribeFlag?'live_subscribe_click':'cancel_live_subscribe_click'
  134 + TrackingUtils.fillPositionWith(params)
  135 + Tracking.event(event, params)
  136 + }
  137 +
  138 +
116 // 内容下载点击事件 1.图片 2.音频 3.视频 139 // 内容下载点击事件 1.图片 2.音频 3.视频
117 static download(donwloadContentType: number, pageId: string, pageName: string, extParams?: ParamType) { 140 static download(donwloadContentType: number, pageId: string, pageName: string, extParams?: ParamType) {
118 let params = TrackingUtils.generateParams(extParams) 141 let params = TrackingUtils.generateParams(extParams)