张善主

fix(埋点):动态详情页/版面页/意见反馈页页面浏览埋点

1 import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; 1 import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index';
2 import { AppUtils, 2 import { AppUtils,
  3 + DateTimeUtils,
3 DeviceUtil, 4 DeviceUtil,
4 FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; 5 FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index';
5 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 6 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
@@ -9,7 +10,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; @@ -9,7 +10,7 @@ import { BusinessError } from '@kit.BasicServicesKit';
9 import { router } from '@kit.ArkUI'; 10 import { router } from '@kit.ArkUI';
10 import { CommonConstants } from 'wdConstant/Index'; 11 import { CommonConstants } from 'wdConstant/Index';
11 import { ProcessUtils } from 'wdRouter/Index'; 12 import { ProcessUtils } from 'wdRouter/Index';
12 -import { HashMap } from '@kit.ArkTS'; 13 +import { TrackingPageBrowse } from 'wdTracking/Index';
13 14
14 const TAG = 'FeedBackActivity' 15 const TAG = 'FeedBackActivity'
15 16
@@ -20,6 +21,9 @@ const TAG = 'FeedBackActivity' @@ -20,6 +21,9 @@ const TAG = 'FeedBackActivity'
20 @Entry 21 @Entry
21 @Component 22 @Component
22 export struct FeedBackActivity { 23 export struct FeedBackActivity {
  24 + pageShowTime:number = 0;
  25 + pageId:string = 'feedbackPage';
  26 + pageName:string=this.pageId;
23 @State canSubmit: boolean = false; 27 @State canSubmit: boolean = false;
24 @State textNumLabel: string = '0/500'; 28 @State textNumLabel: string = '0/500';
25 contact: string = ""; 29 contact: string = "";
@@ -380,4 +384,12 @@ export struct FeedBackActivity { @@ -380,4 +384,12 @@ export struct FeedBackActivity {
380 } 384 }
381 } 385 }
382 386
  387 + onPageShow() {
  388 + this.pageShowTime = DateTimeUtils.getTimeStamp()
  389 + }
  390 + onPageHide() {
  391 + //页面浏览
  392 + TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
  393 +
  394 + }
383 } 395 }
1 import { ENewspaperPageComponent } from 'wdComponent'; 1 import { ENewspaperPageComponent } from 'wdComponent';
2 -import { Logger } from 'wdKit'; 2 +import { DateTimeUtils, Logger } from 'wdKit';
3 import common from '@ohos.app.ability.common'; 3 import common from '@ohos.app.ability.common';
4 import window from '@ohos.window'; 4 import window from '@ohos.window';
  5 +import { TrackingPageBrowse } from 'wdTracking/Index';
5 6
6 const TAG = 'ENewspaper'; 7 const TAG = 'ENewspaper';
7 8
8 @Entry 9 @Entry
9 @Component 10 @Component
10 struct ENewspaper { 11 struct ENewspaper {
  12 + pageShowTime:number = 0;
  13 + pageId:string = 'newsPaperPage';
  14 + pageName:string=this.pageId;
11 // 获取UIAbility上下文 15 // 获取UIAbility上下文
12 context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext 16 context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
13 17
@@ -46,6 +50,7 @@ struct ENewspaper { @@ -46,6 +50,7 @@ struct ENewspaper {
46 } 50 }
47 51
48 onPageShow() { 52 onPageShow() {
  53 + this.pageShowTime = DateTimeUtils.getTimeStamp()
49 this.setSystemBar('#80000000','#80000000', '#FFFFFFFF') 54 this.setSystemBar('#80000000','#80000000', '#FFFFFFFF')
50 Logger.info(TAG, 'onPageShow'); 55 Logger.info(TAG, 'onPageShow');
51 } 56 }
@@ -53,6 +58,8 @@ struct ENewspaper { @@ -53,6 +58,8 @@ struct ENewspaper {
53 onPageHide() { 58 onPageHide() {
54 this.setSystemBar('#FFFFFFFF','#00000000', '#000000') 59 this.setSystemBar('#FFFFFFFF','#00000000', '#000000')
55 Logger.info(TAG, 'onPageHide'); 60 Logger.info(TAG, 'onPageHide');
  61 + //页面浏览
  62 + TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
56 } 63 }
57 64
58 onBackPress() { 65 onBackPress() {
1 -import { Logger } from 'wdKit'; 1 +import { DateTimeUtils, Logger } from 'wdKit';
2 import { DynamicDetailComponent } from 'wdComponent'; 2 import { DynamicDetailComponent } from 'wdComponent';
3 import router from '@ohos.router'; 3 import router from '@ohos.router';
4 import { Params, Action } from 'wdBean'; 4 import { Params, Action } from 'wdBean';
  5 +import { TrackingPageBrowse } from 'wdTracking/Index';
  6 +
5 const TAG = 'DynamicDetailPage'; 7 const TAG = 'DynamicDetailPage';
6 @Entry 8 @Entry
7 @Component 9 @Component
8 struct DynamicDetailPage { 10 struct DynamicDetailPage {
9 - 11 + pageShowTime:number = 0;
  12 + pageId:string = 'dynamicDetailPage';
  13 + pageName:string=this.pageId;
10 @State relId: string = '' 14 @State relId: string = ''
11 @State contentId: string = '' 15 @State contentId: string = ''
12 @State relType: string = '' 16 @State relType: string = ''
@@ -30,4 +34,12 @@ struct DynamicDetailPage { @@ -30,4 +34,12 @@ struct DynamicDetailPage {
30 this.relType = params?.extra?.relType || ''; 34 this.relType = params?.extra?.relType || '';
31 this.contentId = params?.contentID || ''; 35 this.contentId = params?.contentID || '';
32 } 36 }
  37 + onPageShow() {
  38 + this.pageShowTime = DateTimeUtils.getTimeStamp()
  39 + }
  40 + onPageHide() {
  41 + //页面浏览
  42 + TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
  43 +
  44 + }
33 } 45 }