陈剑华

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow03.ets
... ... @@ -32,8 +32,8 @@ export class HttpBizUtil {
if (!headers) {
headers = new HashMap()
}
headers?.replace('RMRB-X-TOKEN', token)
headers?.replace('cookie', 'RMRB-X-TOKEN=' + token)
headers?.set('RMRB-X-TOKEN', token)
headers?.set('cookie', 'RMRB-X-TOKEN=' + token)
Logger.debug(TAG, 'get again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.get<T>(url, headers).then((againResDTO: T) => {
... ... @@ -71,8 +71,8 @@ export class HttpBizUtil {
if (!headers) {
headers = new HashMap()
}
headers?.replace('RMRB-X-TOKEN', token)
headers?.replace('cookie', 'RMRB-X-TOKEN=' + token)
headers?.set('RMRB-X-TOKEN', token)
headers?.set('cookie', 'RMRB-X-TOKEN=' + token)
Logger.debug(TAG, 'post again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.post<T>(url, data, headers).then((againResDTO: T) => {
... ...
... ... @@ -152,11 +152,9 @@ export struct SingleColumn999Component {
scrollBackward: NestedScrollMode.SELF_FIRST
})
} else {
if (this.compListItem && this.compListItem?.operDataList) {
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoListContent})
}
}
}
// public buildLanes(): number {
// return new BreakPointType({ xs: 1, sm: 1, md: 2, lg: 3 }).getValue(this.currentBreakpoint)
... ... @@ -176,6 +174,5 @@ export struct SingleColumn999Component {
index: index,
})
}
}
}
\ No newline at end of file
... ...
... ... @@ -10,6 +10,7 @@ import { Logger, ToastUtils } from 'wdKit';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { SpConstants } from 'wdConstant/Index'
import { InfomationCardClick } from '../../utils/infomationCardClick';
import { ParamType, Tracking } from 'wdTracking/Index';
/**
* 直播预约卡
... ... @@ -17,7 +18,17 @@ import { InfomationCardClick } from '../../utils/infomationCardClick';
*/
const TAG = 'Zh_Single_Row-03'
function getLiveState(contentDTO: ContentDTO) {
if (contentDTO?.liveInfo?.liveState === 'wait') {
return 'liveSubscribe'
} else if (contentDTO?.liveInfo?.liveState === 'running') {
return 'livePlaying'
} else if (contentDTO?.liveInfo?.liveState === 'end') {
return 'liveEnd'
} else {
return ''
}
}
interface reserveReqItem {
liveId: string,
relationId: string,
... ... @@ -404,3 +415,79 @@ function textOverflowStyle(maxLine: number) {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
@Component
struct CreatorItem {
@Prop item: ContentDTO
@State rmhIsAttention: number = 0
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
ListItem() {
Column() {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.loadImg ? this.item.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(156)
.height(208)
.border({width: 1})
.borderRadius(3)
Row()
.width(156)
.height(80)
.linearGradient({
direction: GradientDirection.Bottom,
colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]]
})
Text(this.item.newsTitle)
.fontColor(0xffffff)
.fontSize(14)
.maxLines(2)
.textOverflow({overflow: TextOverflow.Ellipsis})
.width(140)
.margin({bottom: 8})
}
}
.width(156)
.height(208)
.margin({ right: 11 })
.borderColor($r('app.color.color_EDEDED'))
.borderRadius($r('app.float.image_border_radius'))
}
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.item)
})
}
/**
* 关注号主 TODO 这里后面需要抽离
*/
handleAccention(item: ContentDTO, status: number) {
this.rmhIsAttention = this.rmhIsAttention ? 0 : 1
return
// 未登录,跳转登录
if (!HttpUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postInteractAccentionOperateParams = {
attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id
// userType: 1,
// userId: '1', // TODO 用户id需要从本地获取
status: status,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (status === 1) {
this.rmhIsAttention = 0
} else {
this.rmhIsAttention = 1
}
})
}
}
... ...
... ... @@ -45,7 +45,7 @@ export struct TopNavigationComponentNew {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@Link _currentNavIndex?: number;
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
@State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0;
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
... ... @@ -114,20 +114,6 @@ export struct TopNavigationComponentNew {
.onChange((index) => {
Logger.info(TAG, `onChange index : ${index}`);
// 顶部tab埋点
if(this.currentBottomNavName === '新闻') {
const tab = this.myChannelList[index]
Logger.info(TAG, `顶部tab : ${JSON.stringify(tab)}`);
const params: ParamType = {
"pageName": tab.name,
"tabName": tab.name,
"pageId": tab.pageId,
}
Tracking.event("home_page_tab_click ", params)
}
if (this.isBroadcastByIndex(index)) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
... ... @@ -217,6 +203,7 @@ export struct TopNavigationComponentNew {
moreChannelList: $moreChannelList,
localChannelList: $localChannelList,
changeTab: (index) => {
this.changePage(index)
}
})
... ... @@ -496,6 +483,32 @@ export struct TopNavigationComponentNew {
`onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
}
updateCurrentTopNavSelectedIndex() {
Logger.info(TAG, `currentTopNavSelectedIndex : ${this.currentTopNavSelectedIndex}、${this.currentBottomNavName}`);
// 顶部tab埋点
if(this.currentBottomNavName === '新闻') {
const tab = this.myChannelList[this.currentTopNavSelectedIndex]
Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`);
const params: ParamType = {
"pageName": tab.name,
"tabName": tab.name,
"pageId": tab.pageId,
}
Tracking.event("home_page_tab_click ", params)
} else if(this.currentBottomNavName === '人民号') {
const tab = this.topNavList[this.currentTopNavSelectedIndex]
Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`);
const params: ParamType = {
"pageName": tab.name,
"tabName": tab.name,
"pageId": tab.pageId,
}
Tracking.event("People_account_page_tab_click", params)
}
}
onAutoRefresh() {
if (this.bottomNavIndex != this._currentNavIndex) {
return
... ...
... ... @@ -4,9 +4,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index';
import measure from '@ohos.measure'
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
import {
ContentDetailDTO,
} from 'wdBean';
import { ContentDetailDTO, } from 'wdBean';
import { LiveModel } from '../../viewmodel/LiveModel';
import { HttpUtils } from 'wdNetwork/Index';
import vibrator from '@ohos.vibrator';
... ... @@ -47,6 +45,7 @@ export struct LiveLikeComponent {
this.onDetailUpdated()
this.contentTrackingDict()
}
async onDetailUpdated() {
// 2:竖屏直播页 4:横屏直播页
// 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
... ... @@ -61,13 +60,13 @@ export struct LiveLikeComponent {
this.getLikeCount()
}
contentTrackingDict(){
contentTrackingDict() {
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 2) {
if (this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
}
}
... ... @@ -118,7 +117,9 @@ export struct LiveLikeComponent {
.width(36)
.height(36)
.borderRadius(18)
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' :
this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
if (this.likeCount != 0) {
RelativeContainer() {
Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg') : $r('app.media.ic_like_back_Select'))
... ... @@ -211,6 +212,16 @@ export struct LiveLikeComponent {
console.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
}
this.likeCount++
this.likeStatus = true
//内容点赞、取消点赞Tracking 1点赞 0取消点赞
TrackingContent.like(true, TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
})
}).catch(() => {
})
... ... @@ -245,6 +256,7 @@ export struct LiveLikeComponent {
this.likeCount = 0
})
}
private getMeasureText(text: string) {
let width = measure.measureText({
textContent: text,
... ...
... ... @@ -23,7 +23,7 @@ const TAG = 'DetailPlayLiveCommon'
@Component
export struct DetailPlayLiveCommon {
private liveViewModel: LiveViewModel = new LiveViewModel()
pageShowTime:number = 0;
pageShowTime: number = 0;
@Provide relId: string = ''
@Provide contentId: string = ''
@Provide relType: string = ''
... ... @@ -38,7 +38,6 @@ export struct DetailPlayLiveCommon {
@Provide publishCommentModel: publishCommentModel = new publishCommentModel()
// 横屏或竖屏 general-竖屏,news-横屏
@State liveLandscape: string = ''
@State isLoading: boolean = false
async aboutToAppear(): Promise<void> {
... ... @@ -56,7 +55,6 @@ export struct DetailPlayLiveCommon {
}
build() {
Column() {
// 直播预约或横屏直播统一进横屏直播
... ... @@ -66,7 +64,7 @@ export struct DetailPlayLiveCommon {
} else if (this.liveLandscape === 'general') {
// 沉浸式直播
DetailPlayVLivePage()
}else {
} else {
PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible)
}
}
... ... @@ -86,12 +84,12 @@ export struct DetailPlayLiveCommon {
if (data) {
let detailData = data[0]
//人民号类型单独获取直播地址
if (detailData.rmhPlatform === 1) {
if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running') {
let vliveId = detailData.liveInfo.vlive[0].vliveId as string
console.error(TAG, 'vliveId==' + vliveId)
let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean
console.error(TAG, 'vliveId==' + vliveId)
if (pullStreamAddressData) {
console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData))
let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url
... ... @@ -133,7 +131,7 @@ export struct DetailPlayLiveCommon {
ToastUtils.shortToast('内容不存在')
router.back()
}
},()=>{
}, () => {
this.isLoading
ToastUtils.shortToast('内容不存在')
router.back()
... ... @@ -141,8 +139,6 @@ export struct DetailPlayLiveCommon {
})
}
onPageShow() {
this.pageShow = Math.random()
Logger.info(TAG, 'onPageShow')
... ... @@ -152,10 +148,10 @@ export struct DetailPlayLiveCommon {
onPageHide() {
this.pageHide = Math.random()
Logger.info(TAG, 'onPageHide')
console.error("XXXXZZZZ", '---onPageHide------------')
//页面浏览
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Live_Detail,TrackConstants.PageName.Live_Detail
,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail
, Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime) / 1000))
}
... ...
... ... @@ -9,6 +9,7 @@ import { router, window } from '@kit.ArkUI';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { LiveOperRowListView } from 'wdComponent';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
import { TrackConstants, TrackingContent } from 'wdTracking/Index';
let TAG: string = 'DetailPlayLivePage';
... ... @@ -34,7 +35,6 @@ export struct DetailPlayLivePage {
@Consume @Watch('onBackPressCus') pageBackPress: number
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
// 尽量不要动属性。用来作为输入了评论之后,值传递
@State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息
@State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息
... ... @@ -69,10 +69,12 @@ export struct DetailPlayLivePage {
TopPlayComponent({ playerController: this.playerController })
.height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
TabComponent({ tabs: this.tabs,
TabComponent({
tabs: this.tabs,
changeToTab: this.changeToTab,
lastInputedLiveComment: this.lastInputedLiveComment,
lastInputedChatComment: this.lastInputedChatComment})
lastInputedChatComment: this.lastInputedChatComment
})
.layoutWeight(1)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
... ... @@ -95,6 +97,13 @@ export struct DetailPlayLivePage {
} else {
this.lastInputedChatComment = result
}
// 发布评论埋点
TrackingContent.commentClick(TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
});
})
}
}
... ...
... ... @@ -7,6 +7,7 @@ import { WDAliPlayerController } from 'wdPlayer/Index';
import { DisplayDirection } from 'wdConstant/Index';
import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
import { PlayerEndView } from '../widgets/vertical/PlayerEndView';
import { TrackConstants, TrackingButton } from 'wdTracking/Index';
const storage = LocalStorage.getShared();
const TAG = 'DetailPlayVLivePage'
... ... @@ -96,6 +97,9 @@ export struct DetailPlayVLivePage {
.markAnchor({ x: 56, y: this.bottomSafeHeight })
.onClick(() => {
this.swiperController.showNext()
// 埋点
TrackingButton.click('clearScreen', TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail)
})
}
... ... @@ -116,7 +120,5 @@ export struct DetailPlayVLivePage {
console.error(TAG, 'getLiveDetails catch', message)
})
}
}
... ...
... ... @@ -39,6 +39,8 @@ export class LiveViewModel {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
if (resDTO.data) {
success(resDTO.data)
}else {
fail("数据为空")
}
}).catch(() => {
fail("数据为空")
... ...
... ... @@ -56,7 +56,7 @@ export struct PlayUIComponent {
/*
初始话播放器设置
*/
initPlayerSet(){
initPlayerSet() {
//播放进度监听
if (this.playerController) {
... ... @@ -279,8 +279,13 @@ export struct PlayUIComponent {
})
}
if (this.contentDetailData.liveInfo?.liveState == 'running') {
Blank()
} else {
// 进度条
this.playProgressView()
}
// 总的播放时间
if (this.contentDetailData?.liveInfo?.liveState != 'running' || this.contentDetailData.showTime) {
Text(this.totalTime)
... ...
... ... @@ -32,7 +32,6 @@ export struct TopPlayComponent {
@Provide playSourceState: number = 0
private playUrl: string = ""
private xComponentIsLoaded: boolean = false
pageParam: ParamType = {}
aboutToAppear(): void {
if (this.playerController) {
... ... @@ -148,16 +147,12 @@ export struct TopPlayComponent {
Logger.debug(TAG, "播放地址为空")
return
}
this.contentTrackingDict()
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, this.pageParam);
}
contentTrackingDict() {
this.pageParam = {
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
});
}
build() {
... ...
... ... @@ -11,6 +11,7 @@ import { ChartItemCompereComponent } from './ChartItemCompereComponent'
import { ChatItemComponent } from './ChartItemComponent'
import { router } from '@kit.ArkUI'
import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'
import { TrackConstants, TrackingContent } from 'wdTracking/Index'
const TAG = "PlayerCommentComponent"
/**
... ... @@ -105,6 +106,7 @@ export struct PlayerCommentComponent {
contentDetailData: this.contentDetailData,
onCommentInputFocus: () => {
},
onCommentInputed: (content) => {
if (content.comment) {
... ... @@ -116,6 +118,14 @@ export struct PlayerCommentComponent {
this.liveChatList.push(result)
this.scroller.scrollEdge(Edge.Bottom)
})
// 发布评论埋点
TrackingContent.commentClick(TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
});
}
},
onBack: () => {
... ...
... ... @@ -8,6 +8,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { DisplayDirection } from 'wdConstant/Index';
import { PageComponent } from 'wdComponent/Index';
import { TrackingButton, TrackConstants } from 'wdTracking/Index';
import { Logger } from 'wdKit';
import { ParamType, Tracking } from 'wdTracking/Index';
const TAG = 'VideoChannelPage'
... ... @@ -100,6 +102,18 @@ export struct VideoChannelPage {
right: $r('app.float.top_tab_item_padding_horizontal'),
})
.onClick(() => {
// 视频tab埋点
const tab = this.topNavList[index]
Logger.info(TAG, `视频tab埋点: ${JSON.stringify(tab)}`);
const params: ParamType = {
"pageName": tab.name,
"tabName": tab.name,
"pageId": tab.pageId,
}
Tracking.event("video_page_tab_click", params)
if (this.currentTopNavSelectedIndex === index) {
this.autoRefresh++
}
... ...