wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix(埋点):发布评论
@@ -601,6 +601,8 @@ export struct DynamicDetailComponent { @@ -601,6 +601,8 @@ export struct DynamicDetailComponent {
601 this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') 601 this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
602 this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') 602 this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
603 this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') 603 this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
  604 + this.publishCommentModel.pageId = TrackConstants.PageName.DynamicDetail
  605 + this.publishCommentModel.pageName = TrackConstants.PageName.DynamicDetail
604 } 606 }
605 607
606 this.operationButtonList = ['comment', 'collect', 'share'] 608 this.operationButtonList = ['comment', 'collect', 'share']
@@ -680,7 +682,7 @@ export struct DynamicDetailComponent { @@ -680,7 +682,7 @@ export struct DynamicDetailComponent {
680 682
681 //创建跳转信息 683 //创建跳转信息
682 makeJumpInfo() { 684 makeJumpInfo() {
683 - this.mJumpInfo.pageId = 'dynamicDetailPage' 685 + this.mJumpInfo.pageId = TrackConstants.PageName.DynamicDetail
684 this.mJumpInfo.objectId = this.contentDetailData.newsId + "" 686 this.mJumpInfo.objectId = this.contentDetailData.newsId + ""
685 this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType + "" 687 this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType + ""
686 this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId + "" 688 this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId + ""
@@ -86,7 +86,7 @@ export struct ENewspaperItemComponent { @@ -86,7 +86,7 @@ export struct ENewspaperItemComponent {
86 } as ContentDTO 86 } as ContentDTO
87 ProcessUtils.processPage(content) 87 ProcessUtils.processPage(content)
88 //内容点击 88 //内容点击
89 - TrackingContent.commentClickWithEvent('current_Number_Panel_content_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage 89 + TrackingContent.clickWithEvent('current_Number_Panel_content_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
90 ,{ 90 ,{
91 'contentName':this.itemBeanClicked.title, 91 'contentName':this.itemBeanClicked.title,
92 'contentType':this.itemBeanClicked.newsType, 92 'contentType':this.itemBeanClicked.newsType,
@@ -36,7 +36,7 @@ export struct ENewspaperPageComponent { @@ -36,7 +36,7 @@ export struct ENewspaperPageComponent {
36 this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex 36 this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
37 37
38 //电子报--版面序号选择点击 38 //电子报--版面序号选择点击
39 - TrackingContent.commentClickWithEvent('panel_number_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage 39 + TrackingContent.clickWithEvent('panel_number_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
40 ,{ 40 ,{
41 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum, 41 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
42 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName, 42 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
@@ -61,7 +61,7 @@ export struct ENewspaperPageComponent { @@ -61,7 +61,7 @@ export struct ENewspaperPageComponent {
61 new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) 61 new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0)
62 } 62 }
63 //日历选择点击 63 //日历选择点击
64 - TrackingContent.commentClickWithEvent('date_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage 64 + TrackingContent.clickWithEvent('date_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
65 ,{ 65 ,{
66 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum, 66 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
67 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName, 67 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
@@ -340,7 +340,7 @@ export struct ENewspaperPageComponent { @@ -340,7 +340,7 @@ export struct ENewspaperPageComponent {
340 if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { 340 if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
341 this.isOpenListDialog = true 341 this.isOpenListDialog = true
342 //电子报--读报纸点击 342 //电子报--读报纸点击
343 - TrackingContent.commentClickWithEvent('read_newspaper_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage 343 + TrackingContent.clickWithEvent('read_newspaper_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
344 ,{ 344 ,{
345 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum, 345 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
346 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName, 346 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
@@ -41,7 +41,8 @@ export class publishCommentModel { @@ -41,7 +41,8 @@ export class publishCommentModel {
41 41
42 //最新发布的评论 42 //最新发布的评论
43 lastCommentModel: commentItemModel = new commentItemModel() 43 lastCommentModel: commentItemModel = new commentItemModel()
44 - 44 + pageId: string = ''
  45 + pageName: string = ''
45 46
46 } 47 }
47 48
@@ -16,7 +16,7 @@ const TAG = 'CommentComponent'; @@ -16,7 +16,7 @@ const TAG = 'CommentComponent';
16 16
17 17
18 const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸' 18 const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸'
19 - 19 +//评论组件
20 // @Entry 20 // @Entry
21 @Preview 21 @Preview
22 @Component 22 @Component
@@ -6,6 +6,7 @@ import { @@ -6,6 +6,7 @@ import {
6 import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; 6 import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index';
7 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 7 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
8 import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 8 import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  9 +import { TrackConstants, TrackingContent } from 'wdTracking/Index';
9 import { 10 import {
10 commentItemModel, 11 commentItemModel,
11 commentListModel, 12 commentListModel,
@@ -16,7 +17,7 @@ import { @@ -16,7 +17,7 @@ import {
16 import { publishCommentModel } from '../model/PublishCommentModel'; 17 import { publishCommentModel } from '../model/PublishCommentModel';
17 18
18 const TAG = "CommentViewModel" 19 const TAG = "CommentViewModel"
19 - 20 +//评论model
20 class CommentViewModel { 21 class CommentViewModel {
21 private static instance: CommentViewModel 22 private static instance: CommentViewModel
22 23
@@ -166,9 +167,9 @@ class CommentViewModel { @@ -166,9 +167,9 @@ class CommentViewModel {
166 return new Promise<commentItemModel>((success, fail) => { 167 return new Promise<commentItemModel>((success, fail) => {
167 const visitorMode = model.visitorComment == "1" && HttpUtils.isLogin() == false 168 const visitorMode = model.visitorComment == "1" && HttpUtils.isLogin() == false
168 let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl() 169 let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl()
169 - 170 + let pageId = model.pageId;
  171 + let pageName = model.pageName;
170 let bean: Record<string, string> = {}; 172 let bean: Record<string, string> = {};
171 -  
172 bean['targetId'] = model.targetId; 173 bean['targetId'] = model.targetId;
173 bean['targetRelId'] = model.targetRelId; 174 bean['targetRelId'] = model.targetRelId;
174 bean['commentType'] = model.commentType; 175 bean['commentType'] = model.commentType;
@@ -188,6 +189,11 @@ class CommentViewModel { @@ -188,6 +189,11 @@ class CommentViewModel {
188 } 189 }
189 190
190 HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { 191 HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => {
  192 + // fixme 埋点 评论发布点击
  193 + TrackingContent.commentClick(pageId,pageName
  194 + ,{
  195 + 'duration':0,
  196 + })
191 if (data.code != 0) { 197 if (data.code != 0) {
192 ToastUtils.showToast(data.message, 1000); 198 ToastUtils.showToast(data.message, 1000);
193 fail() 199 fail()
@@ -3,6 +3,7 @@ import { TrackConstants } from "../common/TrackConstants" @@ -3,6 +3,7 @@ import { TrackConstants } from "../common/TrackConstants"
3 import { TrackingUtils } from '../common/TrackingUtils' 3 import { TrackingUtils } from '../common/TrackingUtils'
4 import { Tracking } from './Tracking' 4 import { Tracking } from './Tracking'
5 import { PointerMatrix } from '@kit.TestKit' 5 import { PointerMatrix } from '@kit.TestKit'
  6 +import { StringUtils } from 'wdKit/Index'
6 7
7 export class TrackingContent { 8 export class TrackingContent {
8 9
@@ -86,10 +87,10 @@ export class TrackingContent { @@ -86,10 +87,10 @@ export class TrackingContent {
86 } 87 }
87 88
88 static commentClick(pageId: string, pageName: string, extParams?: ParamType) { 89 static commentClick(pageId: string, pageName: string, extParams?: ParamType) {
89 - TrackingContent.commentClickWithEvent("content_comment_click",pageId,pageName,extParams); 90 + TrackingContent.clickWithEventAction("content_comment_click",pageId,pageName,TrackConstants.ActionType.Comment,extParams);
90 } 91 }
91 92
92 - static commentClickWithEvent(event: string,pageId: string, pageName: string, extParams?: ParamType) { 93 + static clickWithEventAction(event: string,pageId: string, pageName: string,action: string, extParams?: ParamType) {
93 let params = TrackingUtils.generateParams(extParams) 94 let params = TrackingUtils.generateParams(extParams)
94 if (pageId.length) { 95 if (pageId.length) {
95 params["pageId"] = pageId 96 params["pageId"] = pageId
@@ -97,11 +98,17 @@ export class TrackingContent { @@ -97,11 +98,17 @@ export class TrackingContent {
97 if (pageName.length) { 98 if (pageName.length) {
98 params["pageName"] = pageName 99 params["pageName"] = pageName
99 } 100 }
100 - params["action"] =TrackConstants.ActionType.Comment 101 + if(!StringUtils.isEmpty(action)){
  102 + params["action"] =action
  103 + }
101 TrackingUtils.fillPositionWith(params) 104 TrackingUtils.fillPositionWith(params)
102 Tracking.event(event, params) 105 Tracking.event(event, params)
103 } 106 }
104 107
  108 + static clickWithEvent(event: string,pageId: string, pageName: string,extParams?: ParamType) {
  109 + TrackingContent.clickWithEventAction(event,pageId,pageName,'',extParams);
  110 + }
  111 +
105 static commentShare(pageId: string, pageName: string, extParams?: ParamType) { 112 static commentShare(pageId: string, pageName: string, extParams?: ParamType) {
106 113
107 } 114 }