王士厅
Showing 25 changed files with 359 additions and 275 deletions
... ... @@ -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) => {
... ...
... ... @@ -21,7 +21,7 @@ export enum HostEnum {
* 环境host管理工具类
*/
export class HostManager {
private static _hostUrl: HostEnum = HostEnum.HOST_PRODUCT;
private static _hostUrl: HostEnum = HostEnum.HOST_UAT;
static changeHost(host: HostEnum) {
HostManager._hostUrl = host;
... ...
... ... @@ -166,6 +166,25 @@ export class ProcessUtils {
* @param content
* */
public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?: number) {
let tempP = [] as PhotoListBean[]
let relIndex = 0;
for (let index = 0; index < photoList.length; index++) {
const element = photoList[index];
if(!StringUtils.isEmpty(element.picPath)){
relIndex = relIndex+1
}
}
tempP.length = relIndex
relIndex = 0
for (let index = 0; index < photoList.length; index++) {
const element = photoList[index];
if(!StringUtils.isEmpty(element.picPath)){
tempP[relIndex] = element
relIndex = relIndex+1
}
}
photoList.length = tempP.length
photoList = tempP
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ...
... ... @@ -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
... ...
... ... @@ -107,7 +107,7 @@ export struct Card6Component {
}
.alignItems(HorizontalAlign.Start)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78: 156)
.height(78)
.justifyContent(FlexAlign.SpaceBetween)
... ... @@ -119,7 +119,7 @@ export struct Card6Component {
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.borderRadius(5)
.aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156)
.height(78)
CardMediaInfo({ contentDTO: this.contentDTO })
}
... ... @@ -138,7 +138,7 @@ export struct Card6Component {
})
.width(CommonConstants.FULL_WIDTH)
// .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217)
.height(106)
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Top)
}
... ...
... ... @@ -289,9 +289,9 @@ struct indicatorAnimations {
build() {
Flex({ alignItems: ItemAlign.End }) {
Stack() {
Image($r('app.media.swiper_indicator_gray'))
.width('100%')
.height(2)
// Image($r('app.media.swiper_indicator_gray'))
// .width('100%')
// .height(2)
Image($r('app.media.swiper_indicator_white'))
.width(this.leftW)
.height(2)
... ... @@ -312,6 +312,7 @@ struct indicatorAnimations {
.margin({
bottom: -2
})
.fontFamily('BebasNeue')
.flexShrink(0)
.animation({
duration: 300,
... ... @@ -319,9 +320,9 @@ struct indicatorAnimations {
playMode: PlayMode.Normal
})
Stack() {
Image($r('app.media.swiper_indicator_gray'))
.width('100%')
.height(2)
// Image($r('app.media.swiper_indicator_gray'))
// .width('100%')
// .height(2)
Image($r('app.media.swiper_indicator_white'))
.width(this.rightW)
.height(2)
... ...
... ... @@ -34,7 +34,7 @@ export struct ZhSingleRow02 {
edgeAnimation() {
if (this.moreWidth < this.initMoreWidth * 3) {
if (!this.moreTips) {
this.moreTips = '查看更多';
this.moreTips = '查看 ';
}
this.moreWidth = this.moreWidth + 2
}
... ... @@ -91,7 +91,7 @@ export struct ZhSingleRow02 {
.margin({ right: 8 })
})
}
if (this.compDTO.operDataList.length > 2) {
if (this.compDTO.operDataList.length >= 2) {
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
... ... @@ -112,7 +112,7 @@ export struct ZhSingleRow02 {
.width(CommonConstants.FULL_WIDTH)
.height(208)
.align(Alignment.Start)
.scrollable(this.compDTO.operDataList.length > 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollable(this.compDTO.operDataList.length >= 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.onReachEnd(() => {
... ... @@ -233,6 +233,8 @@ struct CreatorItem {
.textOverflow({overflow: TextOverflow.Ellipsis})
.width(140)
.margin({bottom: 8})
.height(42)
.lineHeight(21)
}
}
.width(156)
... ...
... ... @@ -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,
... ... @@ -155,7 +166,7 @@ export struct ZhSingleRow03 {
this.ItemCard(item)
})
}
if (this.compDTO.operDataList.length > 2) {
if (this.compDTO.operDataList.length >= 2) {
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
... ... @@ -174,7 +185,7 @@ export struct ZhSingleRow03 {
}
}
.align(Alignment.Start)
.scrollable(this.compDTO.operDataList.length > 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollable(this.compDTO.operDataList.length >= 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.onReachEnd(() => {
... ... @@ -208,6 +219,7 @@ export struct ZhSingleRow03 {
@Builder
ItemCard(item: ContentDTO) {
if (this.compDTO.operDataList.length >= 2) {
Column() {
Row() {
Image(this.loadImg ? item.coverUrl : '')
... ... @@ -215,6 +227,7 @@ export struct ZhSingleRow03 {
.height(60)
.margin({right: 12})
.backgroundColor(0xf5f5f5)
.margin({right: 12})
Text(item.newsTitle)
.width(154)
... ... @@ -273,6 +286,74 @@ export struct ZhSingleRow03 {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
} else {
Column() {
Row() {
Image(this.loadImg ? item.coverUrl : '')
.width(106)
.height(60)
.backgroundColor(0xf5f5f5)
.margin({right: 12})
Text(item.newsTitle)
.width(201)
.height(60)
.maxLines(3)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
.margin({bottom: 16})
.justifyContent(FlexAlign.Start)
Row() {
Flex({justifyContent: FlexAlign.SpaceBetween}){
Row() {
Text(this.format(new Date(item.liveInfo.liveStartTime).getTime()))
.margin({right: 6})
.fontColor(0x000000)
.fontSize(13)
.textAlign(TextAlign.Start)
Image($r('app.media.timeline_rect'))
.width(4)
.height(3)
.margin({right: 6})
Text(item.liveInfo.liveStartTime.split(' ')[1].slice(0, 5))
.margin({right: 6})
.fontColor(0x000000)
.fontSize(13)
Text('开始直播')
.fontColor(0xC8C8C8)
.fontSize(13)
}
Row() {
Text(this.isReserved(Number(item.objectId)) ? '已预约' : '预约')
.width(48)
.height(24)
.backgroundColor(this.isReserved(Number(item.objectId)) ? 0xffffff : 0xED2800)
.fontColor(this.isReserved(Number(item.objectId)) ? 0xC8C8C8 : 0xffffff)
.fontSize(12)
.textAlign(TextAlign.Center)
.borderRadius(3)
.onClick(() => {
this.bookAndCancel(item.relId, item.objectId, !this.isReserved(Number(item.objectId)))
})
}
.margin({top: -5})
}
}
}
.width('100%')
.height(116)
.padding({top: 12, bottom: 12, left: 12, right: 12})
.backgroundColor(0xf9f9f9)
.margin({right: 8})
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
}
}
... ... @@ -299,9 +380,6 @@ export struct ZhSingleRow03 {
.width(14)
.height(14)
}
.padding({
right: $r('app.float.card_comp_pagePadding_lf'),
})
.onClick(() => {
this.jumpToMore();
})
... ... @@ -331,85 +409,4 @@ export struct ZhSingleRow03 {
}
@Extend(Text)
function textOverflowStyle(maxLine: number) {
.maxLines(maxLine)
.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
}
})
}
}
... ...
... ... @@ -88,7 +88,7 @@ export struct PageComponent {
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex });
CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex, pageId: this.pageId });
}
}
},
... ...
... ... @@ -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
... ...
... ... @@ -104,7 +104,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
})
}.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 16, right: 16 })
// .padding({ left: 16, right: 16 })
.margin({ top: 8, bottom: 8 })
.width('100%')
... ... @@ -130,8 +130,10 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
.margin({ top: 8 })
.width(150)
.lineHeight(19)
.height(42)
.lineHeight(21)
}
.padding({ left: (index == 0) ? 16 : 0, right: 16 })
.padding({ right: 16 })
// .offset({x:16})
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
... ... @@ -187,12 +189,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
// .margin({left:16,right:16})
}
.width("100%")
// .width("100%")
.padding({
top: 14,
left: 0,
right: 0,
bottom: 14
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r("app.color.white"))
// .backgroundColor($r("app.color.color_FE4B05"))
... ...
... ... @@ -119,7 +119,7 @@ export struct LiveHorizontalCardComponent {
})
}
}.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 16, right: 16 })
// .padding({ left: 16, right: 16 })
.margin({ top: 8, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
... ... @@ -152,8 +152,10 @@ export struct LiveHorizontalCardComponent {
.textAlign(TextAlign.Start)
.margin({ top: 8 })
.width(this.compDTO.operDataList.length == 2 ? 210 : 150)
.height(42)
.lineHeight(21)
}
.padding({ left: (index == 0) ? 16 : 0, right: 16 })
.padding({ right: 16 })
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
if (item.objectType != '0') {
... ... @@ -163,7 +165,7 @@ export struct LiveHorizontalCardComponent {
})
})
}
if (this.compDTO.operDataList.length > 2) {
if (this.compDTO.operDataList.length >= 2) {
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
... ... @@ -182,7 +184,7 @@ export struct LiveHorizontalCardComponent {
}
}
.align(Alignment.Start)
.scrollable(this.compDTO.operDataList.length > 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollable(this.compDTO.operDataList.length >= 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.onReachEnd(() => {
... ... @@ -211,9 +213,12 @@ export struct LiveHorizontalCardComponent {
LiveHorizontalCardForOneComponent({ contentDTO: this.compDTO.operDataList[0] })
}
}
.width(CommonConstants.FULL_WIDTH)
// .width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r("app.color.white"))
}
... ...
... ... @@ -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> {
... ... @@ -51,12 +50,6 @@ export struct DetailPlayLiveCommon {
}
aboutToDisappear(): void {
console.error("XXXXZZZZ", '---aboutToDisappear------------')
}
build() {
Column() {
// 直播预约或横屏直播统一进横屏直播
... ... @@ -66,7 +59,7 @@ export struct DetailPlayLiveCommon {
} else if (this.liveLandscape === 'general') {
// 沉浸式直播
DetailPlayVLivePage()
}else {
} else {
PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible)
}
}
... ... @@ -86,20 +79,16 @@ 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
if (pullStreamAddressData) {
console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData))
// console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData))
let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url
detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl
this.playUrl = m3u8uUrl
console.log(TAG, ' GetPullAddressBean:', m3u8uUrl)
// console.log(TAG, ' GetPullAddressBean:', m3u8uUrl)
}
}
this.liveLandscape =
... ... @@ -133,7 +122,7 @@ export struct DetailPlayLiveCommon {
ToastUtils.shortToast('内容不存在')
router.back()
}
},()=>{
}, () => {
this.isLoading
ToastUtils.shortToast('内容不存在')
router.back()
... ... @@ -141,8 +130,6 @@ export struct DetailPlayLiveCommon {
})
}
onPageShow() {
this.pageShow = Math.random()
Logger.info(TAG, 'onPageShow')
... ... @@ -152,10 +139,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)
})
}
}
... ...
import { ContentDetailDTO,
import {
ContentDetailDTO,
GetPullAddressBean,
LiveDetailsBean, LiveRoomBean, LiveRoomDataBean,
LiveDetailsBean,
LiveRoomBean,
LiveRoomDataBean,
LiveRoomItemBean,
ValueType } from 'wdBean/Index'
ValueType
} from 'wdBean/Index'
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { Logger } from 'wdKit/Index'
import { ToastUtils } from 'wdKit/src/main/ets/utils/ToastUtils'
... ... @@ -32,16 +36,25 @@ export class LiveViewModel {
}
async getLiveRoomPullAddress(vliveId:string) : Promise<GetPullAddressBean>{
/**
* 获取直播间的拉流地址
* @param vliveId
* @returns
*/
async getLiveRoomPullAddress(vliveId: string): Promise<GetPullAddressBean | null> {
return new Promise<GetPullAddressBean>((success, fail) => {
ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => {
return new Promise<GetPullAddressBean | null>((success, fail) => {
ContentDetailRequest.getLiveRoomPullStream(vliveId)
.then(async (resDTO: ResponseDTO<GetPullAddressBean>) => {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
if (resDTO.data) {
success(resDTO.data)
} else {
success(null)
}
}).catch(() => {
fail("数据为空")
})
.catch(() => {
success(null)
})
})
... ... @@ -102,6 +115,7 @@ export class LiveViewModel {
})
})
}
// 直播详情-C端点赞接口
getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) {
return new Promise<number>((success, fail) => {
... ... @@ -112,6 +126,7 @@ export class LiveViewModel {
})
})
}
// 直播详情-查询是否点赞接口
getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) {
return new Promise<boolean>((success, fail) => {
... ...
... ... @@ -56,7 +56,7 @@ export struct PlayUIComponent {
/*
初始话播放器设置
*/
initPlayerSet(){
initPlayerSet() {
//播放进度监听
if (this.playerController) {
... ... @@ -280,7 +280,12 @@ 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: () => {
... ...
... ... @@ -40,7 +40,7 @@ export struct DetailPlayShortVideoPage {
@Provide isOpenDetail: boolean = false // 查看详情按钮点击
@Provide isDragging: boolean = false // 拖动时间进度条
@Provide status: number = PlayerConstants.STATUS_START;
@Consume showCommentList: boolean
@Consume @Watch("showCommentListChanged") showCommentList: boolean
@Consume displayDirection: DisplayDirection
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@Consume @Watch('pageShowChange') pageShow: number
... ... @@ -229,6 +229,15 @@ export struct DetailPlayShortVideoPage {
}
showCommentListChanged() {
if (this.showCommentList) {
this.playerWidth = px2vp(this.windowWidth)
this.playerHeight = px2vp(this.windowWidth) / (16 / 9.0)
} else {
this.calculatePlayerRect()
}
}
build() {
Stack({ alignContent: Alignment.Top }) {
Column() {
... ... @@ -305,7 +314,7 @@ export struct DetailPlayShortVideoPage {
@Builder
playerViewBuilder() {
Stack() {
Stack({alignContent: this.showCommentList && this.index === this.currentIndex ? Alignment.Top : Alignment.Center}) {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
... ... @@ -335,7 +344,6 @@ export struct DetailPlayShortVideoPage {
}
.width('100%')
.height('100%')
.align(Alignment.Center)
}
... ...
... ... @@ -103,6 +103,7 @@ export class WDPlayerController {
case AVPlayerStatus.PLAYING:
this.setBright();
this.status = PlayerConstants.STATUS_START;
this.avPlayer!.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT
this.watchStatus();
break;
case AVPlayerStatus.PAUSED:
... ...
import componentUtils from '@ohos.arkui.componentUtils';
import { WDPlayerController } from '../controller/WDPlayerController'
import { WindowModel } from 'wdKit';
import { Logger } from '../utils/Logger';
import { Logger, WindowModel } from 'wdKit';
import { enableAliPlayer } from '../utils/GlobalSetting';
import json from '@ohos.util.json';
import { JSON } from '@kit.ArkTS';
class Size {
width: Length = "100%";
... ... @@ -82,12 +83,17 @@ export struct WDPlayerRenderView {
libraryname: enableAliPlayer && this.enableAliPlayer ? "premierlibrary" : undefined,
controller: this.xComponentController
})
.id(this.insId)
.onLoad(async (event) => {
Logger.info(TAG, 'onLoad')
this.xComponentController.setXComponentSurfaceSize({
surfaceWidth: 1920,
surfaceHeight: 1080
if (this.videoHeight > 0 && this.videoWidth > 0) {
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: this.videoWidth,
surfaceHeight: this.videoHeight
});
}
if (enableAliPlayer && this.enableAliPlayer) {
this.playerController?.setSurfaceId(this.insId)
} else {
... ... @@ -98,8 +104,8 @@ export struct WDPlayerRenderView {
}
})
.zIndex(1000)
.width(this.selfSize.width)
.height(this.selfSize.height)
// .width(this.selfSize.width)
// .height(this.selfSize.height)
}
.onAreaChange(() => {
this.updateLayout()
... ... @@ -108,19 +114,55 @@ export struct WDPlayerRenderView {
.justifyContent(FlexAlign.Center)
.height('100%')
.width('100%')
.align(this.videoWidth > this.videoHeight ? Alignment.Top : Alignment.Center)
// .align(this.videoWidth > this.videoHeight ? Alignment.Top : Alignment.Center)
.align(Alignment.Center)
}
updateLayout() {
let info = componentUtils.getRectangleById(this.insId);
if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) {
if (info.size.width / info.size.height > this.videoWidth / this.videoHeight) {
let scale = info.size.height / this.videoHeight;
this.selfSize = new Size((this.videoWidth * scale / info.size.width) * 100 + "%", '100%');
} else {
let scale = info.size.width / this.videoWidth;
this.selfSize = new Size('100%', (this.videoHeight * scale / info.size.height) * 100 + "%");
Logger.debug(TAG, "播放器区域变化: " + JSON.stringify(info))
Logger.debug(TAG, "xComponent rect: " + JSON.stringify(this.xComponentController.getXComponentSurfaceRect()))
if (info.size.width > 0 && info.size.height > 0) {
// 竖屏
if (this.videoHeight > 0 && this.videoWidth > 0 && this.videoWidth < this.videoHeight) {
let ratio = this.videoWidth / this.videoHeight
const height = info.size.width / ratio
// 竖屏,缩放高度大于 视频区域高度
if (height > info.size.height) {
Logger.debug(TAG, "ratio = " + ratio + " ==> new height = " + height)
Logger.debug(TAG, "高度固定,求宽度: " + info.size.height * ratio)
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.height * ratio,
surfaceHeight: info.size.height
});
return
}
}
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.width,
surfaceHeight: info.size.height
});
}
// if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) {
// if (info.size.width / info.size.height > this.videoWidth / this.videoHeight) {
// let scale = info.size.height / this.videoHeight;
// this.selfSize = new Size((this.videoWidth * scale / info.size.width) * 100 + "%", '100%');
// } else {
// let scale = info.size.width / this.videoWidth;
// this.selfSize = new Size('100%', (this.videoHeight * scale / info.size.height) * 100 + "%");
// }
// }
}
}
\ No newline at end of file
... ...
... ... @@ -46,52 +46,6 @@ export default struct CustomDialogComponent {
}
.width('90%').lineHeight(22)
Row(){
// Button(){
// Text($r('app.string.privacy_text_title_policy'))
// .fontSize('27lpx')
// .fontColor(Color.Red)
// .margin({left:'10lpx',right:'10lpx'})
// }
// .width('90%')
// .height('56lpx')
// .margin({top:'54lpx',right:'19lpx'})
// .backgroundColor('#80000000')
// .onClick(() => {
//
// })
// Button(){
// Text($r('app.string.privacy_text_title_protocol'))
// .fontSize('27lpx')
// .fontColor(Color.Red)
// .margin({left:'10lpx',right:'10lpx'})
// }
// .width('90%')
// .height('56lpx')
// .margin({top:'54lpx',right:'19lpx'})
// .backgroundColor('#80000000')
// .onClick(() => {
//
// })
// Navigator({ target: 'pages/PrivacyPage', type: NavigationType.Push }) {
// Button($r('app.string.privacy_text_title_policy'))
// .onClick(()=>{
// GlobalContext.getContext().setObject('isJumpPrivacy', true);
// })
// {
// // Text($r('app.string.privacy_text_title_policy'))
// // .fontSize($r('app.float.dialog_common_text_size'))
// // .width('50%')
// // .fontColor(Color.Red)
// // .onClick(() => {
// // GlobalContext.getContext().setObject('isJumpPrivacy', true);
// // })
// }
// .fancy(Const.MainConstant_BUTTON_MARGIN_TOP)
// }
// .params({ path: 'https://www.baidu.com', tips: '在线' } as NavigatorModel)
Text($r('app.string.privacy_text_title_policy'))
.fontSize($r('app.float.dialog_common_text_size'))
.width('40%')
... ... @@ -100,14 +54,6 @@ export default struct CustomDialogComponent {
let bean={contentID:"2",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
//GlobalContext.getContext().setObject('isJumpPrivacy', true);
//WDRouterRule.jumpWithPage(WDRouterPage.privacyPage)
// router.pushUrl({
// url: 'pages/PrivacyPage'
// }).catch((error: Error) => {
// //Logger.error(CommonConstants.CUSTOM_DIALOG_TAG, 'CustomDialog pushUrl error ' + JSON.stringify(error));
// });
})
Text($r('app.string.privacy_text_title_protocol'))
.fontSize($r('app.float.dialog_common_text_size'))
... ... @@ -117,30 +63,25 @@ export default struct CustomDialogComponent {
let bean={contentID:"1",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
//GlobalContext.getContext().setObject('isJumpPrivacy', true);
//WDRouterRule.jumpWithPage(WDRouterPage.privacyPage)
// router.pushUrl({
// url: 'pages/PrivacyPage'
// }).catch((error: Error) => {
// //Logger.error(CommonConstants.CUSTOM_DIALOG_TAG, 'CustomDialog pushUrl error ' + JSON.stringify(error));
// });
})
}
.margin({
top:'36lpx',
bottom:'21lpx'
}).visibility(Visibility.None)
Row() {
Text($r('app.string.dialog_text_privacy_statement'))
.width('90%')
.fontColor($r('app.color.dialog_text_color'))
.fontSize(14).margin({top:20})
}.width('90%')
.justifyContent(FlexAlign.Center)
Divider()
.color('#f5f5f5')
.width('100%')
.strokeWidth(1)
.padding({left:16,right:16,top:22})
.padding({top:22})
Row() {
Row() {
Text($r('app.string.dialog_button_disagree'))
.fancy()
... ... @@ -148,24 +89,30 @@ export default struct CustomDialogComponent {
this.controller.close();
this.cancel();
})
Blank()
.backgroundColor($r('app.color.dialog_blank_background_color'))
.width($r('app.float.dialog_blank_width'))
.height($r('app.float.dialog_blank_height'))
}.width("50%")
// Blank()
// .backgroundColor($r('app.color.dialog_blank_background_color'))
// .width($r('app.float.dialog_blank_width'))
// .height($r('app.float.dialog_blank_height'))
Row() {
Text($r('app.string.dialog_button_agree'))
.fancyAgree()
.onClick(() => {
this.controller.close();
this.confirm();
})
}.width("50%")
.height("100%")
.backgroundColor($r("app.color.dialog_fancy_text_right_color"))
}
.margin({ bottom: '21lpx',top:'22lpx' })
.width("100%")
.height(44)
.margin({top: 1})
}
.width('528lpx')
.borderRadius('15')
.backgroundColor(Color.White)
.clip(true)
}
... ... @@ -182,7 +129,8 @@ export default struct CustomDialogComponent {
}
// Common text styles.
@Extend(Text) function fancyAgree () {
.fontColor($r("app.color.dialog_fancy_text_right_color"))
.backgroundColor($r("app.color.dialog_fancy_text_right_color"))
.fontColor($r("app.color.white"))
.fontSize(16)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
... ...
... ... @@ -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++
}
... ...