yangchenggong1_wd

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

@@ -44,6 +44,8 @@ export struct PageComponent { @@ -44,6 +44,8 @@ export struct PageComponent {
44 GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') 44 GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
45 @State netStatus: number | undefined = undefined // 存储网络状态 45 @State netStatus: number | undefined = undefined // 存储网络状态
46 bottomNavi:BottomNavi = BottomNavi.NEWS 46 bottomNavi:BottomNavi = BottomNavi.NEWS
  47 + @Prop scrollBgHeight:number = 0
  48 + onHideBgImage?: (isShow:boolean) => void;
47 49
48 build() { 50 build() {
49 Column() { 51 Column() {
@@ -156,6 +158,20 @@ export struct PageComponent { @@ -156,6 +158,20 @@ export struct PageComponent {
156 this.pageModel.endIndex = end; 158 this.pageModel.endIndex = end;
157 }) 159 })
158 .id('page_list') 160 .id('page_list')
  161 + .onDidScroll(() => {
  162 + if(this.scrollBgHeight === 0){
  163 + return
  164 + }
  165 + let y = this.listScroller.currentOffset().yOffset
  166 +
  167 + if (this.onHideBgImage !== undefined ) {
  168 + if( y - this.scrollBgHeight > 0){
  169 + this.onHideBgImage(true)
  170 + }else{
  171 + this.onHideBgImage(false)
  172 + }
  173 + }
  174 + })
159 175
160 // 挂角广告 176 // 挂角广告
161 this.pageHornAd() 177 this.pageHornAd()
1 import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean'; 1 import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean';
2 -import { Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; 2 +import { Logger, NetworkUtil, SPHelper, StringUtils, ToastUtils } from 'wdKit';
3 import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; 3 import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
4 import { PageComponent } from './PageComponent'; 4 import { PageComponent } from './PageComponent';
5 import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; 5 import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
@@ -75,9 +75,25 @@ export struct TopNavigationComponentNew { @@ -75,9 +75,25 @@ export struct TopNavigationComponentNew {
75 @State backgroundImageH: number = 0 75 @State backgroundImageH: number = 0
76 // 国殇灰度管理 76 // 国殇灰度管理
77 GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') 77 GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
  78 + @State backImageHeight:number = 0
  79 + @State isHideBackgroundImage:boolean = false
78 80
79 build() { 81 build() {
80 - Column() { 82 + Stack({ alignContent: Alignment.Top }) {
  83 + // 顶部背景图
  84 + if(StringUtils.isNotEmpty(this.navItem.backgroundUrl)){
  85 + Image(this.navItem.backgroundUrl).width('100%')
  86 + .objectFit(ImageFit.Cover)
  87 + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
  88 + .onAreaChange((oldValue: Area, newValue: Area) => {
  89 + if(typeof newValue?.height == 'number'){
  90 + let backImageHeight = newValue?.height
  91 + this.backImageHeight = backImageHeight - 40 - this.topRectHeight
  92 + console.log("ycg","height===>"+this.backImageHeight)
  93 + }
  94 + })
  95 + }
  96 +
81 // 频道分类list 97 // 频道分类list
82 RelativeContainer() { 98 RelativeContainer() {
83 this.tabBar() 99 this.tabBar()
@@ -174,7 +190,9 @@ export struct TopNavigationComponentNew { @@ -174,7 +190,9 @@ export struct TopNavigationComponentNew {
174 channelId: navItem?.channelId + '', 190 channelId: navItem?.channelId + '',
175 autoRefresh: this.autoRefresh2Page, 191 autoRefresh: this.autoRefresh2Page,
176 isMourning: mourningCheckFn(`${navItem.channelId}`), 192 isMourning: mourningCheckFn(`${navItem.channelId}`),
177 - bottomNavi:bottomNavi 193 + bottomNavi:bottomNavi,
  194 + onHideBgImage: (isShow:boolean): void => this.onHideBgImage(isShow),
  195 + scrollBgHeight: this.backImageHeight
178 }) 196 })
179 // .margin({ 197 // .margin({
180 // left: 6, 198 // left: 6,
@@ -184,7 +202,7 @@ export struct TopNavigationComponentNew { @@ -184,7 +202,7 @@ export struct TopNavigationComponentNew {
184 // topLeft: 6, 202 // topLeft: 6,
185 // topRight: 6 203 // topRight: 6
186 // }) 204 // })
187 - .backgroundColor(CompUtils.isRMH(this.navItem) || CompUtils.isNews(this.navItem) ? Color.White : Color.Transparent) 205 + .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))
188 } 206 }
189 207
190 /** 208 /**
@@ -272,8 +290,8 @@ export struct TopNavigationComponentNew { @@ -272,8 +290,8 @@ export struct TopNavigationComponentNew {
272 tabBar() { 290 tabBar() {
273 291
274 // 顶部背景图 292 // 顶部背景图
275 - Image(this.navItem.backgroundUrl).width('100%').height('100%')  
276 - .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) 293 + // Image(this.navItem.backgroundUrl).width('100%').height('100%')
  294 + // .grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
277 295
278 if (CompUtils.isNews(this.navItem)) { 296 if (CompUtils.isNews(this.navItem)) {
279 // 顶部搜索、日报logo、早晚报 297 // 顶部搜索、日报logo、早晚报
@@ -858,4 +876,8 @@ export struct TopNavigationComponentNew { @@ -858,4 +876,8 @@ export struct TopNavigationComponentNew {
858 } 876 }
859 877
860 } 878 }
  879 +
  880 + onHideBgImage(isShow:boolean){
  881 + this.isHideBackgroundImage = isShow
  882 + }
861 } 883 }