Showing
3 changed files
with
31 additions
and
25 deletions
| @@ -99,8 +99,8 @@ export struct MorningEveningPaperComponent { | @@ -99,8 +99,8 @@ export struct MorningEveningPaperComponent { | ||
| 99 | 99 | ||
| 100 | async aboutToAppear() { | 100 | async aboutToAppear() { |
| 101 | let windowHight: window.Window = await window.getLastWindow(getContext(this)); | 101 | let windowHight: window.Window = await window.getLastWindow(getContext(this)); |
| 102 | - await windowHight.setWindowLayoutFullScreen(true); | ||
| 103 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | 102 | + // await windowHight.setWindowLayoutFullScreen(true); |
| 103 | + // WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 104 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) | 104 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) |
| 105 | 105 | ||
| 106 | const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String | 106 | const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String |
| @@ -178,9 +178,9 @@ export struct MorningEveningPaperComponent { | @@ -178,9 +178,9 @@ export struct MorningEveningPaperComponent { | ||
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | async aboutToDisappear() { | 180 | async aboutToDisappear() { |
| 181 | - let windowHight: window.Window = await window.getLastWindow(getContext(this)); | ||
| 182 | - await windowHight.setWindowLayoutFullScreen(false); | ||
| 183 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | 181 | + // let windowHight: window.Window = await window.getLastWindow(getContext(this)); |
| 182 | + // await windowHight.setWindowLayoutFullScreen(false); | ||
| 183 | + // WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | onPageHide() { | 186 | onPageHide() { |
| @@ -209,25 +209,18 @@ export struct MorningEveningPaperComponent { | @@ -209,25 +209,18 @@ export struct MorningEveningPaperComponent { | ||
| 209 | }) | 209 | }) |
| 210 | } | 210 | } |
| 211 | } | 211 | } |
| 212 | - // .backgroundColor('#fff7b348') | ||
| 213 | - // .backgroundColor(Color.Blue) | ||
| 214 | .height('100%') | 212 | .height('100%') |
| 215 | 213 | ||
| 216 | - // .margin({ left: 12, right: 12 }) | ||
| 217 | - | ||
| 218 | - PaperTitleComponent()// PaperTitleComponent({ | ||
| 219 | - // // title: this.morningEveningPaperDTO?.topicInfo?.title ?? "", | ||
| 220 | - // title: this.title ?? "", | ||
| 221 | - // // subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '' | ||
| 222 | - // subtitle: this.subTitle | ||
| 223 | - // }) | ||
| 224 | - // .margin({ left: 14, right: 14 }) | 214 | + PaperTitleComponent().margin({ |
| 215 | + top: this.topSafeHeight | ||
| 216 | + }) | ||
| 225 | } | 217 | } |
| 226 | .width('100%') | 218 | .width('100%') |
| 219 | + .height('100%') | ||
| 227 | // .backgroundColor(Color.Black) | 220 | // .backgroundColor(Color.Black) |
| 228 | // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) | 221 | // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) |
| 229 | .backgroundColor(this.mixedBgColor ?? Color.Black) | 222 | .backgroundColor(this.mixedBgColor ?? Color.Black) |
| 230 | - .padding({ top: this.topSafeHeight }) | 223 | + |
| 231 | } | 224 | } |
| 232 | 225 | ||
| 233 | @Builder | 226 | @Builder |
| @@ -11,15 +11,13 @@ struct ENewspaper { | @@ -11,15 +11,13 @@ struct ENewspaper { | ||
| 11 | // 获取UIAbility上下文 | 11 | // 获取UIAbility上下文 |
| 12 | context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext | 12 | context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext |
| 13 | 13 | ||
| 14 | - async setSystemBar(color: string) { | 14 | + async setSystemBar(color: string, barColor: string) { |
| 15 | // 获取当前应用窗口 | 15 | // 获取当前应用窗口 |
| 16 | let windowClass: window.Window = await window.getLastWindow(this.context) | 16 | let windowClass: window.Window = await window.getLastWindow(this.context) |
| 17 | // 将状态栏和导航栏的背景色设置为跟应用窗口相同的颜色 | 17 | // 将状态栏和导航栏的背景色设置为跟应用窗口相同的颜色 |
| 18 | await windowClass.setWindowSystemBarProperties({ | 18 | await windowClass.setWindowSystemBarProperties({ |
| 19 | navigationBarColor: color, | 19 | navigationBarColor: color, |
| 20 | - statusBarColor: color, | ||
| 21 | - // navigationBarContentColor: "#00FF00", | ||
| 22 | - // statusBarContentColor: "#00FF00" | 20 | + statusBarColor: barColor, |
| 23 | }) | 21 | }) |
| 24 | } | 22 | } |
| 25 | 23 | ||
| @@ -47,12 +45,12 @@ struct ENewspaper { | @@ -47,12 +45,12 @@ struct ENewspaper { | ||
| 47 | } | 45 | } |
| 48 | 46 | ||
| 49 | onPageShow() { | 47 | onPageShow() { |
| 50 | - this.setSystemBar('#80000000') | 48 | + this.setSystemBar('#80000000','#80000000') |
| 51 | Logger.info(TAG, 'onPageShow'); | 49 | Logger.info(TAG, 'onPageShow'); |
| 52 | } | 50 | } |
| 53 | 51 | ||
| 54 | onPageHide() { | 52 | onPageHide() { |
| 55 | - this.setSystemBar('#FFFFFFFF') | 53 | + this.setSystemBar('#FFFFFFFF','#00000000') |
| 56 | Logger.info(TAG, 'onPageHide'); | 54 | Logger.info(TAG, 'onPageHide'); |
| 57 | } | 55 | } |
| 58 | 56 |
| 1 | import { MorningEveningPaperComponent } from 'wdComponent'; | 1 | import { MorningEveningPaperComponent } from 'wdComponent'; |
| 2 | -import { Logger } from 'wdKit'; | 2 | +import { Logger, WindowModel } from 'wdKit'; |
| 3 | 3 | ||
| 4 | const TAG = 'MorningEveningPaperPage'; | 4 | const TAG = 'MorningEveningPaperPage'; |
| 5 | 5 | ||
| 6 | @Entry | 6 | @Entry |
| 7 | @Component | 7 | @Component |
| 8 | struct MorningEveningPaperPage { | 8 | struct MorningEveningPaperPage { |
| 9 | + @State isPageShow: boolean = false | ||
| 9 | build() { | 10 | build() { |
| 10 | Column() { | 11 | Column() { |
| 11 | MorningEveningPaperComponent() | 12 | MorningEveningPaperComponent() |
| 12 | } | 13 | } |
| 14 | + .width('100%') | ||
| 15 | + .height('100%') | ||
| 13 | } | 16 | } |
| 14 | 17 | ||
| 15 | pageTransition() { | 18 | pageTransition() { |
| 16 | // 定义页面进入时的效果,从底侧滑入 | 19 | // 定义页面进入时的效果,从底侧滑入 |
| 17 | PageTransitionEnter({ type: RouteType.None, duration: 300 }) | 20 | PageTransitionEnter({ type: RouteType.None, duration: 300 }) |
| 18 | - .slide(SlideEffect.Bottom) | 21 | + .slide(SlideEffect.Bottom).onEnter((type: RouteType, progress: number) => { |
| 22 | + if (progress >= 0.99) { | ||
| 23 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 24 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 25 | + } | ||
| 26 | + }) | ||
| 19 | // 定义页面退出时的效果,向底侧滑出 | 27 | // 定义页面退出时的效果,向底侧滑出 |
| 20 | PageTransitionExit({ type: RouteType.None, duration: 300 }) | 28 | PageTransitionExit({ type: RouteType.None, duration: 300 }) |
| 21 | .slide(SlideEffect.Bottom) | 29 | .slide(SlideEffect.Bottom) |
| @@ -31,9 +39,16 @@ struct MorningEveningPaperPage { | @@ -31,9 +39,16 @@ struct MorningEveningPaperPage { | ||
| 31 | 39 | ||
| 32 | onPageShow() { | 40 | onPageShow() { |
| 33 | Logger.info(TAG, 'onPageShow'); | 41 | Logger.info(TAG, 'onPageShow'); |
| 42 | + if (this.isPageShow) { | ||
| 43 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 44 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 45 | + } | ||
| 34 | } | 46 | } |
| 35 | 47 | ||
| 36 | onPageHide() { | 48 | onPageHide() { |
| 49 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 50 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 51 | + this.isPageShow = true | ||
| 37 | Logger.info(TAG, 'onPageHide'); | 52 | Logger.info(TAG, 'onPageHide'); |
| 38 | } | 53 | } |
| 39 | 54 |
-
Please register or login to post a comment