wangliang_wd

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

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  二级视频详情页-埋点
  ref |> 发布评论输入框增加发布按钮点击事件回调拦截组件上的接口调用
  ref |> 统一视频详情页评论入口开关配置
... ... @@ -4,14 +4,25 @@ import { commentItemModel } from '../model/CommentModel'
import { publishCommentModel } from '../model/PublishCommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
export interface CommentDialogInputContent {
comment?: string
imageUrl?: string
}
/// 评论输入框
@Preview
@CustomDialog
export struct CommentCustomDialog {
@ObjectLink publishCommentModel: publishCommentModel
controller?: CustomDialogController
confirm: (value: Record<string, string>) => void = () => {
}
// 发布按钮点击事件。如果上层传了该值,切返回了true,表示上层已处理,则 confirm 回调不生效
// 可以用这里在上层做埋点
onPublishBtnClick?: (content: CommentDialogInputContent) => boolean
// confirm 表示内部处理调用 内容评论接口 发布了评论并成功,上层只需要 通过 publishCommentModel.lastCommentModel 即可获取最新已提交的评论
confirm?: (value: Record<string, string>) => void
@State private emojiSwitch: boolean = false
textInputController: TextAreaController = new TextAreaController()
@State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 }
... ... @@ -21,6 +32,13 @@ export struct CommentCustomDialog {
}
publishCommentRequest() {
if (this.onPublishBtnClick) {
let content: CommentDialogInputContent = { comment: this.publishCommentModel.commentContent }
if (this.onPublishBtnClick(content)) {
return
}
}
let bean: Record<string, string> = {};
// this.publishCommentModel.commentContent = this.commentText
//TODO 判断类型
... ... @@ -34,7 +52,9 @@ export struct CommentCustomDialog {
if (this.controller != null) {
this.controller.close()
}
if (this.confirm) {
this.confirm(bean)
}
}).catch(() => {
if (this.controller != null) {
this.controller.close()
... ...
... ... @@ -8,6 +8,8 @@ import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentD
import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
import { EmptyComponent } from 'wdComponent/Index';
import { DateTimeUtils } from 'wdKit/Index';
import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
const storage = LocalStorage.getShared();
const TAG = 'DetailVideoListPage'
... ... @@ -33,6 +35,8 @@ export struct DetailVideoListPage {
@State currentIndex: number = 0
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
@State interactDataList: InteractDataDTO[] = []
pageShowTime:number = 0;
pageHideTime:number = 0;
async aboutToAppear(): Promise<void> {
// 注册监听网络连接
... ... @@ -70,12 +74,18 @@ export struct DetailVideoListPage {
this.switchVideoStatus = true
this.openFullScreen()
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
onPageHide(): void {
console.log(TAG, 'onPageHide')
this.switchVideoStatus = false
this.closeFullScreen()
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration)
}
/**
... ...
... ... @@ -14,6 +14,8 @@ import { PictureLoading } from './PictureLoading';
import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index';
import { DateTimeUtils } from 'wdKit/Index';
import {TrackConstants,TrackingPageBrowse } from 'wdTracking/Index';
interface loadMoreData {
pageNum: number;
... ... @@ -59,6 +61,8 @@ export struct VideoChannelDetail {
@State totalCount: number = 0
@State isMouted: boolean = false
@State isRequestError: boolean = false
pageShowTime:number = 0;
pageHideTime:number = 0;
autoRefreshChange() {
if (this.topNavIndex === 0) {
... ... @@ -78,12 +82,21 @@ export struct VideoChannelDetail {
this.switchVideoStatus = true
this.openFullScreen()
}
this.pageShowTime = DateTimeUtils.getTimeStamp()
console.log(TAG, '一级视频显示')
}
pageHideChange() {
this.barBackgroundColor = Color.Transparent
this.switchVideoStatus = false
this.closeFullScreen()
console.log(TAG, '一级视频隐藏')
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration)
}
/**
... ... @@ -255,7 +268,6 @@ export struct VideoChannelDetail {
})
}
}
build() {
Column() {
if (this.isRequestError) {
... ...
... ... @@ -18,7 +18,7 @@ export struct PlayerCommentView {
router.back();
})
if (this.contentDetailData.openComment === 1) {
if (this.contentDetailData.openComment == 1) {
TextInput({ placeholder: '说两句...', text: this.comment })
.placeholderColor('#999999')
.placeholderFont({ size: 14 })
... ...
... ... @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { DisplayDirection, SpConstants } from 'wdConstant/Index'
import { WDShare } from "wdShare"
import { publishCommentModel } from 'wdComponent/Index';
import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
interface ILikeStyleResp {
url: Resource;
... ... @@ -37,16 +38,44 @@ export struct PlayerRightView {
@Consume showCommentList: boolean
@Consume displayDirection: DisplayDirection
@Consume publishCommentModel: publishCommentModel
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
// @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
@State likesStyle: number | string = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
pageParam: ParamType = {}
PageName: string = ''
followUserId: string = ''
followUserName: string = ''
aboutToAppear() {
// 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
this.likesStyle = this.contentDetailData.likesStyle
this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
// console.log(TAG, 'this.likesStyle', this.likesStyle)
// console.log(TAG, 'this.openLikes', this.openLikes)
this.contentTrackingDict()
}
contentTrackingDict(){
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 1) {
this.PageName = TrackConstants.PageName.VideoDetail // 点播
} else if(this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
} else if(this.contentDetailData.newsType == 5) {
this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页
} else if(this.contentDetailData.newsType == 8) {
this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页
} else if(this.contentDetailData.newsType == 9) {
this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页
} else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
}
this.followUserId = this.contentDetailData?.rmhInfo?.rmhId || ''
this.followUserName = this.contentDetailData?.rmhInfo?.rmhName || ''
}
/**
* 点赞、取消点赞
*/
... ... @@ -76,8 +105,12 @@ export struct PlayerRightView {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus == '1') {
this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1
TrackingContent.like(true,this.PageName,this.PageName,this.pageParam)
console.log(TAG, '点赞')
} else {
this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1)
TrackingContent.like(false,this.PageName,this.PageName,this.pageParam)
console.log(TAG, '取消点赞')
}
console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
// this.queryContentInteractCount()
... ... @@ -112,8 +145,12 @@ export struct PlayerRightView {
// this.queryContentInteractCount()
if (this.newsStatusOfUser.collectStatus === 1) {
this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1
TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam)
console.log(TAG, '收藏')
} else {
this.interactData.collectNum = Math.max(0, Number(this.interactData.collectNum || 0) - 1)
TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam)
console.log(TAG, '取消收藏')
}
console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
}
... ... @@ -175,6 +212,8 @@ export struct PlayerRightView {
ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
}
})
console.log(TAG, '关注号主')
TrackingContent.follow(true,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam)
}
})
}
... ... @@ -184,7 +223,7 @@ export struct PlayerRightView {
this.userBuilderView()
this.likeBuilderView()
this.collectBuilderView()
if (this.contentDetailData.openComment === 1) {
if (this.contentDetailData.openComment == 1) {
this.commentBuilderView()
}
this.shareBuilderView()
... ...