陈剑华

feat: 兴趣卡埋点

@@ -135,7 +135,7 @@ export struct CompParser { @@ -135,7 +135,7 @@ export struct CompParser {
135 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { 135 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
136 Divider().strokeWidth(3).color('#ffffff').padding({ left: 0, right: 0 }).margin({ top: -3 }) 136 Divider().strokeWidth(3).color('#ffffff').padding({ left: 0, right: 0 }).margin({ top: -3 })
137 Divider().strokeWidth(6).color('#f5f5f5') 137 Divider().strokeWidth(6).color('#f5f5f5')
138 - ZhSingleColumn09({ compDTO: this.compDTO }) 138 + ZhSingleColumn09({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
139 Divider().strokeWidth(6).color('#f5f5f5') 139 Divider().strokeWidth(6).color('#f5f5f5')
140 } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 140 } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
141 AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO }) 141 AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO })
@@ -5,6 +5,8 @@ import { postInteractAccentionOperateParams } from 'wdBean'; @@ -5,6 +5,8 @@ import { postInteractAccentionOperateParams } from 'wdBean';
5 import { PageRepository } from '../../repository/PageRepository'; 5 import { PageRepository } from '../../repository/PageRepository';
6 import { CommonConstants } from 'wdConstant/Index'; 6 import { CommonConstants } from 'wdConstant/Index';
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
  8 +import { Tracking, TrackingContent, TrackConstants, ParamType } from 'wdTracking';
  9 +import { TrackingUtils } from 'wdTracking/src/main/ets/common/TrackingUtils'
8 /** 10 /**
9 * 兴趣卡 11 * 兴趣卡
10 * Zh_Single_Column-09 12 * Zh_Single_Column-09
@@ -14,6 +16,8 @@ const TAG = 'Zh_Single_Column-09' @@ -14,6 +16,8 @@ const TAG = 'Zh_Single_Column-09'
14 @Entry 16 @Entry
15 @Component 17 @Component
16 export struct ZhSingleColumn09 { 18 export struct ZhSingleColumn09 {
  19 + @State pageId: string = '';
  20 + @State pageName: string = '';
17 @State compDTO: CompDTO = {} as CompDTO 21 @State compDTO: CompDTO = {} as CompDTO
18 @State activeIndexs: Array<number> = [] 22 @State activeIndexs: Array<number> = []
19 @State operDataList: ContentDTO[] = this.compDTO?.operDataList || [] 23 @State operDataList: ContentDTO[] = this.compDTO?.operDataList || []
@@ -25,6 +29,45 @@ export struct ZhSingleColumn09 { @@ -25,6 +29,45 @@ export struct ZhSingleColumn09 {
25 this.operDataList = this.shuffleArray(this.compDTO?.operDataList) 29 this.operDataList = this.shuffleArray(this.compDTO?.operDataList)
26 } 30 }
27 31
  32 + trackClick(type: 'close_interest_card_click' | 'interest_card_selecting_click') {
  33 + try {
  34 + const contentDTO = this.compDTO.operDataList[0];
  35 + const extParams: ParamType = {
  36 + 'value': type === 'close_interest_card_click' ? 'closeInterestCard' : 'selectInterestCard',
  37 + 'shareChannel': '',
  38 + 'duration': 0,
  39 + 'action': 'detailPageShow',
  40 + 'shareChannel': '',
  41 + 'duration': 0,
  42 + 'contentName': '兴趣选项卡',
  43 + 'contentType': this.compDTO.objectType || '',
  44 + 'contentId': this.compDTO.objectId,
  45 + // 'channelSourceId': this.compDTO.channelId,
  46 + // 'contentShowChannelId': this.compDTO.channelId,
  47 + 'regionName': 2, // 信息流:2
  48 + 'componentType': this.compDTO.compStyle,
  49 + 'sceneId': contentDTO.sceneId,
  50 + 'subSceneId': contentDTO.subSceneId,
  51 + 'cnsTraceId': contentDTO.cnsTraceId,
  52 + 'cardItemId': this.compDTO.cardItemId,
  53 + 'itemId': this.compDTO.itemId || contentDTO.itemId,
  54 + 'expIds': this.compDTO.expIds || contentDTO.expIds,
  55 + }
  56 + if (type === 'interest_card_selecting_click') {
  57 + // extParams['interestOptions'] = this.operDataList.map(item => {
  58 + // return item.
  59 + // })
  60 + }
  61 + let params = TrackingUtils.generateParams(extParams);
  62 + params['pageId'] = this.pageId;
  63 + params['pageName'] = this.pageName;
  64 + TrackingUtils.fillPositionWith(params)
  65 + Tracking.event(type, params)
  66 + } catch (e) {
  67 + console.log('Zh_Single_Column-09', JSON.stringify(e))
  68 + }
  69 + }
  70 +
28 getItemWidth(index: number) { 71 getItemWidth(index: number) {
29 if (index % 4 === 0 || index % 4 === 3) { 72 if (index % 4 === 0 || index % 4 === 3) {
30 return 80 73 return 80
@@ -73,6 +116,7 @@ export struct ZhSingleColumn09 { @@ -73,6 +116,7 @@ export struct ZhSingleColumn09 {
73 .margin({top: -10}) 116 .margin({top: -10})
74 .padding({top: 0, bottom: 0, left: 0, right: 0}) 117 .padding({top: 0, bottom: 0, left: 0, right: 0})
75 .onClick(() => { 118 .onClick(() => {
  119 + this.trackClick('interest_card_selecting_click')
76 if (this.activeIndexs.length > 0) { 120 if (this.activeIndexs.length > 0) {
77 this.selfClosed = true; 121 this.selfClosed = true;
78 } 122 }
@@ -142,6 +186,7 @@ export struct ZhSingleColumn09 { @@ -142,6 +186,7 @@ export struct ZhSingleColumn09 {
142 .width(14) 186 .width(14)
143 .height(14) 187 .height(14)
144 .onClick(() => { 188 .onClick(() => {
  189 + this.trackClick('close_interest_card_click')
145 this.selfClosed = true; 190 this.selfClosed = true;
146 }) 191 })
147 } 192 }