fanmingyou3_wd

短视频详情页面布局增加功能

... ... @@ -30,6 +30,7 @@ export struct DetailPlayShortVideoPage {
@Provide canStart?: boolean = false;
@Provide status: number = PlayerConstants.STATUS_START;
@Provide userId: string = '';
@Provide newsSourceName?: string = undefined
@Provide title?: string = undefined
@Provide message?: string = undefined
@Provide newsSummary?: string = undefined
... ... @@ -37,6 +38,7 @@ export struct DetailPlayShortVideoPage {
playVMChanged(name: string) {
this.url = this.playVM.url
this.newsSourceName = this.playVM.newsSourceName
this.title = this.playVM.title
this.curContId = this.playVM.contentId
this.nextContId = this.playVM.nextContId
... ...
... ... @@ -42,28 +42,32 @@ export struct OperationListView {
}
build() {
// List({ space: 0, initialIndex: 0 }) {
// ForEach(this.operationList, (item: OperationItem, index: number) => {
// ListItem() {
// this.buildOperationItem(item, index)
// }
// }, (item: OperationItem, index: number) => JSON.stringify(item))
// }
// .width(48)
// .height(250)
// // .margin({ bottom: 100 })
// .backgroundColor(Color.Red)
// // .listDirection(Axis.Vertical) // 默认值:Axis.Vertical
// // .lanes(this.buildLanes()) // 行/列数,一列 // 默认值:1
// .cachedCount(2)
// .scrollBar(BarState.Off)
// .nestedScroll({
// scrollForward: NestedScrollMode.PARENT_FIRST,
// scrollBackward: NestedScrollMode.SELF_FIRST
// })
List({ space: 0, initialIndex: 0 }) {
Column() {
ForEach(this.operationList, (item: OperationItem, index: number) => {
ListItem() {
this.buildOperationItem(item, index)
}
}, (item: OperationItem, index: number) => JSON.stringify(item))
}
.width(48)
// .margin({ bottom: 100 })
//.backgroundColor(Color.Red)
// .listDirection(Axis.Vertical) // 默认值:Axis.Vertical
// .lanes(this.buildLanes()) // 行/列数,一列 // 默认值:1
.cachedCount(2)
.scrollBar(BarState.Off)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
// Stack({alignContent:Alignment.End}) {
// }
// .width('100%')
}
/**
... ... @@ -80,8 +84,7 @@ export struct OperationListView {
// .borderRadius(6)
Text(item.text)
.width('100%')
// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
.width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
.fontWeight(FontWeight.Normal)
.textAlign(TextAlign.Center)
.fontSize(13)
... ... @@ -89,13 +92,13 @@ export struct OperationListView {
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.margin(10)
.margin(5)
// .backgroundColor(Color.Black)
.alignItems(HorizontalAlign.Center)
.hoverEffect(HoverEffect.Scale)
.onClick((event: ClickEvent) => {
console.info(TAG, `buildOperationItem onClick event index: ${index}`);
ToastUtils.showToast('体验版本功能暂未开放', 1000);
ToastUtils.showToast('体验版,本功能暂未开发', 1000);
})
}
}
\ No newline at end of file
... ...
/**
* 详情view&播放器view的容器布局组件
*/
@Entry
@Component
export struct PlayerDetailContainer {
@BuilderParam playerView: () => void
... ... @@ -26,12 +27,14 @@ export struct PlayerDetailContainer {
.zIndex(1)
}
.width('100%')
.aspectRatio(this.isFullScreen ? 0 : 16 / 9.0)
// .aspectRatio(this.isFullScreen ? 0.1 : 16 / 9.0) // 若width值确定,当aspectRatio值越小,则height值越大
.height(this.isFullScreen ? '100%' : 200)
.margin({ top: this.isFullScreen ? 0 : 174 })
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }
top: { anchor: '__container__', align: VerticalAlign.Top },
// middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.id('txt_title')
.id('stk_player_container')
if (!this.isFullScreen) {
Row() {
... ... @@ -39,7 +42,8 @@ export struct PlayerDetailContainer {
}
.width('100%')
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom }
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
// middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.id('row_bottomView')
}
... ...
... ... @@ -9,6 +9,7 @@ import { OperationListView } from './OperationListView';
@Component
export struct PlayerTitleComment {
private playerController?: WDPlayerController;
@Consume newsSourceName?: string
@Consume title?: string
@Consume newsSummary?: string;
@State @Watch('watchSpeed') playSpeed: number = 1;
... ... @@ -49,30 +50,40 @@ export struct PlayerTitleComment {
})
}
.width('100%')
.margin({ bottom: 120 })
// .margin({ bottom: 120 })
.alignItems(HorizontalAlign.Center)
Row() {
Column() {
Text(this.title)
if (this.newsSourceName) {
Text("@" + this.newsSourceName)
.fontColor(Color.White)
.fontSize(14)
.fontSize(15)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
if (this.newsSummary) {
Text(this.newsSummary)
.fontColor(Color.White)
.fontSize(15)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
Text('查看详情 > ')
.margin({ top: 5 })
.fontColor(Color.White)
.fontSize('14fp')
.fontSize(12)
.maxLines(2)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
// OperationListView()
// .width(48)
// .height(150)
// .zIndex(3)
OperationListView()
.width(48)
}
.width('100%')
.alignItems(VerticalAlign.Bottom)
Slider({
value: this.progressVal,
... ...
... ... @@ -11,6 +11,7 @@ export class PlayViewModel {
contentId: string
relId: string
relType: string
newsSourceName?:string
title?: string
url?: string
nextContId?: string
... ... @@ -54,6 +55,7 @@ export class PlayViewModel {
Logger.error(TAG, `getContentDetailData then body is empty`);
return
}
this.newsSourceName = resDTO.data[0].newsSourceName
this.title = resDTO.data[0].newsTitle
this.url = resDTO.data[0].videoInfo[0].videoUrl
this.canStart = true;
... ...