liyubing

fix:

1)适配 直播列表和预告列表页面全屏
... ... @@ -14,15 +14,16 @@ export struct LottieView {
private politeChickyController: CanvasRenderingContext2D =
new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
private animateItem: AnimationItem | null = null; // 初始化loadAnimation接口的返回对象
@Prop title: string
// 页面隐藏销毁动画
onPageHide(): void {
this.animateItem?.destroy()
if (this.onComplete) {
this.animateItem?.removeEventListener('complete', this.onComplete)
}
}
// onPageHide(): void {
// this.animateItem?.destroy()
//
// if (this.onComplete) {
// this.animateItem?.removeEventListener('complete', this.onComplete)
// }
// }
/**
* 加载动画
... ... @@ -31,7 +32,7 @@ export struct LottieView {
loadAnimation() {
// 销毁动画,减少缓存
if (this.animateItem !== null) {
this.animateItem.destroy();
this.animateItem.destroy(this.name);
this.animateItem = null;
}
... ... @@ -54,6 +55,32 @@ export struct LottieView {
}
aboutToAppear(): void {
// console.error('XXXXZZZZ', '-------aboutToAppear-------' + this.title)
//lottie?.play()
// if(this.init){
// if(this.animateItem = null){
// this.loadAnimation();
// }
// }
}
aboutToDisappear(): void {
// console.error('XXXXZZZZ', '-------aboutToDisappear-------' + this.title)
// if(this.init){
// lottie?.destroy(this.name)
//
// if (this.onComplete) {
// this.animateItem?.removeEventListener('complete', this.onComplete)
// }
// this.animateItem = null;
// // }
}
build() {
Stack({ alignContent: Alignment.TopStart }) {
Canvas(this.politeChickyController)
... ... @@ -65,9 +92,13 @@ export struct LottieView {
this.onReady(this.animateItem)
}
})
.onClick(() => {
this.animateItem?.play()
.onDisAppear(() => {
lottie.destroy(this.name)
this.animateItem = null;
}).onAppear(()=>{
this.loadAnimation();
})
}
}
}
... ...
... ... @@ -31,7 +31,7 @@ let preferenceTheme: dataPreferences.Preferences | null = null
@Component
struct LiveMorePage {
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
type: number = 1;
pageSize: number = 20;
... ... @@ -46,11 +46,9 @@ struct LiveMorePage {
@State liveRoomList: LiveRoomDataBean[] = []
// 点击过的数据
@State clickDatas: Array<string> = []
@State loadImg: boolean = false;
async aboutToAppear() : Promise<void>{
async aboutToAppear(): Promise<void> {
await this.getPreferencesFromStorage()
this.loadImg = await onlyWifiLoadImg();
this.getLivMoreClickPreference()
... ... @@ -60,16 +58,9 @@ struct LiveMorePage {
}
build() {
// Navigation() {
// //滑动区域
// this.ListLayout()
// }
// .titleMode(NavigationTitleMode.Mini)
// .title('直播列表')
Column() {
this.TabbarNormal()
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.viewType == ViewType.ERROR) {
... ... @@ -96,15 +87,13 @@ struct LiveMorePage {
})
}
}
.height('100%')
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.margin({bottom:px2vp(this.bottomSafeHeight)})
.onClick(() => {
ProcessUtils.processPage(this.contentDTO)
top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)
})
}
@Builder
... ... @@ -133,7 +122,7 @@ struct LiveMorePage {
}
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.cachedCount(8)
.cachedCount(3)
.height('calc(100% - 44vp)')
.onReachEnd(() => {
Logger.debug(TAG, "触底了");
... ... @@ -160,9 +149,10 @@ struct LiveMorePage {
.margin({ top: 16, bottom: 8 })
.alignSelf(ItemAlign.Start)
.fontColor(this.isClicked(item.objectId) ? $r('app.color.color_848484') : $r('app.color.color_222222'))
Stack() {
if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) {
Image(this.loadImg?item.fullColumnImgUrls[0].url:'')
Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width('100%')
.aspectRatio(16 / 9)
... ... @@ -246,7 +236,6 @@ struct LiveMorePage {
})
}
.height(44)
.margin({top:this.topSafeHeight+'px'})
.width('100%')
}
... ... @@ -260,24 +249,25 @@ struct LiveMorePage {
lottieHeight: 14,
autoplay: true,
loop: true,
title: item.newsTitle
})
.margin({
right: '2vp'
})
Text('直播中')
.fontSize('12vp')
.fontWeight(400)
.fontColor(Color.White)
.textShadow({ radius: 2, color: 'rgba(0,0,0,0.3)', offsetX: 0, offsetY: 2 })
.textShadow({
radius: 2,
color: 'rgba(0,0,0,0.3)',
offsetX: 0,
offsetY: 2
})
.margin({
right: '5vp'
})
// Divider()
// .vertical(true)
// .strokeWidth(1)
// .height('12vp')
// .margin({ top: 2, bottom: 2 })
// .color(Color.White)
Image($r('app.media.icon_comp_line_live')).height('11vp').width('1.5vp')
... ... @@ -285,7 +275,12 @@ struct LiveMorePage {
Text(this.getLiveRoomNumber(item))
.fontSize('12vp')
.fontWeight(400)
.textShadow({ radius: 2, color: 'rgba(0,0,0,0.3)', offsetX: 0, offsetY: 2 })
.textShadow({
radius: 2,
color: 'rgba(0,0,0,0.3)',
offsetX: 0,
offsetY: 2
})
.fontColor(Color.White)
.margin({
left: '5vp'
... ... @@ -422,7 +417,7 @@ struct LiveMorePage {
const arr: Array<string> = []
arr.push(...this.clickDatas)
preferenceTheme.put('liveMorePage', arr).then(() => {
Logger.debug(TAG,"Succeeded in putting value of 'startup'.");
Logger.debug(TAG, "Succeeded in putting value of 'startup'.");
}).catch((err: BusinessError) => {
Logger.debug(TAG, "Failed to put value of 'startup'. code =" + err.code + ", message =" + err.message);
})
... ...
... ... @@ -31,7 +31,8 @@ const TAG: string = 'ReserveMorePage';
struct ReserveMorePage {
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
private reserveList: ReserveItemBean[] = []
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
type: number = 2;
pageSize: number = 20;
title: string = '直播预告'
... ... @@ -78,10 +79,13 @@ struct ReserveMorePage {
this.currentPage = 1
this.getData(resolve)
},
})
}).backgroundColor($r('app.color.color_F5F5F5'))
}
}.backgroundColor($r('app.color.color_F5F5F5'))
}.height('100%').backgroundColor('#FFFFFF').padding({
top: px2vp(this.topSafeHeight),
bottom: px2vp(this.bottomSafeHeight)
})
}
... ... @@ -306,8 +310,7 @@ struct ReserveMorePage {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
.height(vp2px(44) + this.topSafeHeight + 'px')
.padding({ top: this.topSafeHeight + 'px' })
.height(44)
.width('100%').backgroundColor('#FFFFFF')
}
... ...