yangchenggong1_wd

fix |> 20302 uat>导航换肤,新闻频道列表页,内容区背景未展示换肤图片。

... ... @@ -44,6 +44,8 @@ export struct PageComponent {
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
@State netStatus: number | undefined = undefined // 存储网络状态
bottomNavi:BottomNavi = BottomNavi.NEWS
@Prop scrollBgHeight:number = 0
onHideBgImage?: (isShow:boolean) => void;
build() {
Column() {
... ... @@ -156,6 +158,20 @@ export struct PageComponent {
this.pageModel.endIndex = end;
})
.id('page_list')
.onDidScroll(() => {
if(this.scrollBgHeight === 0){
return
}
let y = this.listScroller.currentOffset().yOffset
if (this.onHideBgImage !== undefined ) {
if( y - this.scrollBgHeight > 0){
this.onHideBgImage(true)
}else{
this.onHideBgImage(false)
}
}
})
// 挂角广告
this.pageHornAd()
... ...
import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean';
import { Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
import { Logger, NetworkUtil, SPHelper, StringUtils, ToastUtils } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { PageComponent } from './PageComponent';
import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
... ... @@ -75,9 +75,25 @@ export struct TopNavigationComponentNew {
@State backgroundImageH: number = 0
// 国殇灰度管理
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
@State backImageHeight:number = 0
@State isHideBackgroundImage:boolean = false
build() {
Column() {
Stack({ alignContent: Alignment.Top }) {
// 顶部背景图
if(StringUtils.isNotEmpty(this.navItem.backgroundUrl)){
Image(this.navItem.backgroundUrl).width('100%')
.objectFit(ImageFit.Cover)
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
.onAreaChange((oldValue: Area, newValue: Area) => {
if(typeof newValue?.height == 'number'){
let backImageHeight = newValue?.height
this.backImageHeight = backImageHeight - 40 - this.topRectHeight
console.log("ycg","height===>"+this.backImageHeight)
}
})
}
// 频道分类list
RelativeContainer() {
this.tabBar()
... ... @@ -174,7 +190,9 @@ export struct TopNavigationComponentNew {
channelId: navItem?.channelId + '',
autoRefresh: this.autoRefresh2Page,
isMourning: mourningCheckFn(`${navItem.channelId}`),
bottomNavi:bottomNavi
bottomNavi:bottomNavi,
onHideBgImage: (isShow:boolean): void => this.onHideBgImage(isShow),
scrollBgHeight: this.backImageHeight
})
// .margin({
// left: 6,
... ... @@ -184,7 +202,7 @@ export struct TopNavigationComponentNew {
// topLeft: 6,
// topRight: 6
// })
.backgroundColor(CompUtils.isRMH(this.navItem) || CompUtils.isNews(this.navItem) ? Color.White : Color.Transparent)
.backgroundColor((CompUtils.isRMH(this.navItem) || (CompUtils.isNews(this.navItem) && StringUtils.isEmpty(this.navItem.backgroundUrl) )) ? Color.White : ((this.isHideBackgroundImage && (CompUtils.isRMH(this.navItem) || CompUtils.isNews(this.navItem))) ? Color.White : Color.Transparent))
}
/**
... ... @@ -272,8 +290,8 @@ export struct TopNavigationComponentNew {
tabBar() {
// 顶部背景图
Image(this.navItem.backgroundUrl).width('100%').height('100%')
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
// Image(this.navItem.backgroundUrl).width('100%').height('100%')
// .grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
if (CompUtils.isNews(this.navItem)) {
// 顶部搜索、日报logo、早晚报
... ... @@ -858,4 +876,8 @@ export struct TopNavigationComponentNew {
}
}
onHideBgImage(isShow:boolean){
this.isHideBackgroundImage = isShow
}
}
\ No newline at end of file
... ...