yangchenggong1_wd

desc:全屏 我的 主页 状态栏 颜色适配

@@ -47,7 +47,7 @@ struct PeopleShipHomePage { @@ -47,7 +47,7 @@ struct PeopleShipHomePage {
47 } 47 }
48 48
49 onPageHide(): void { 49 onPageHide(): void {
50 - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) 50 + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000'})
51 } 51 }
52 52
53 topOpacityChange(){ 53 topOpacityChange(){
1 import router from '@ohos.router' 1 import router from '@ohos.router'
2 -import { DateTimeUtils, NetworkUtil, StringUtils } from 'wdKit'; 2 +import { DateTimeUtils, NetworkUtil, StringUtils, WindowModel } from 'wdKit';
3 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 3 import { WDRouterPage, WDRouterRule } from 'wdRouter';
4 import { editModelParams } from '../model/EditInfoModel'; 4 import { editModelParams } from '../model/EditInfoModel';
5 import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; 5 import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent';
@@ -14,7 +14,7 @@ const TAG = "MineHomePage" @@ -14,7 +14,7 @@ const TAG = "MineHomePage"
14 @Entry 14 @Entry
15 @Component 15 @Component
16 struct MineHomePage { 16 struct MineHomePage {
17 - @State tileOpacity: number = 0; 17 + @Watch('topOpacityChange') @State tileOpacity: number = 0;
18 firstPositionY:number = 0; 18 firstPositionY:number = 0;
19 fontColor: string = '#999999' 19 fontColor: string = '#999999'
20 selectedFontColor: string = '#000000' 20 selectedFontColor: string = '#000000'
@@ -43,6 +43,7 @@ struct MineHomePage { @@ -43,6 +43,7 @@ struct MineHomePage {
43 pageHideTime:number = 0; 43 pageHideTime:number = 0;
44 44
45 onPageShow(): void { 45 onPageShow(): void {
  46 + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'})
46 this.pageShowTime = DateTimeUtils.getTimeStamp() 47 this.pageShowTime = DateTimeUtils.getTimeStamp()
47 this.getUserInfo() 48 this.getUserInfo()
48 49
@@ -55,7 +56,16 @@ struct MineHomePage { @@ -55,7 +56,16 @@ struct MineHomePage {
55 }, 200); 56 }, 200);
56 } 57 }
57 58
  59 + topOpacityChange(){
  60 + if(this.tileOpacity > 0.8){
  61 + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000'})
  62 + }else{
  63 + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'})
  64 + }
  65 + }
  66 +
58 onPageHide(): void { 67 onPageHide(): void {
  68 + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000'})
59 this.pageHideTime = DateTimeUtils.getTimeStamp() 69 this.pageHideTime = DateTimeUtils.getTimeStamp()
60 let duration = 0 70 let duration = 0
61 duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) 71 duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
@@ -16,6 +16,7 @@ import { CommentListItem } from '../viewmodel/CommentListItem'; @@ -16,6 +16,7 @@ import { CommentListItem } from '../viewmodel/CommentListItem';
16 struct VisitorCommentPage { 16 struct VisitorCommentPage {
17 @State data: LazyDataSource<CommentListItem> = new LazyDataSource(); 17 @State data: LazyDataSource<CommentListItem> = new LazyDataSource();
18 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 18 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
  19 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
19 @State count: number = 0; 20 @State count: number = 0;
20 @State isLoading: boolean = false 21 @State isLoading: boolean = false
21 @State hasMore: boolean = true 22 @State hasMore: boolean = true
@@ -35,69 +36,74 @@ struct VisitorCommentPage { @@ -35,69 +36,74 @@ struct VisitorCommentPage {
35 } 36 }
36 37
37 build() { 38 build() {
38 - Column() {  
39 - //标题栏目  
40 - CustomTitleUI({ titleName: "评论列表" })  
41 - if (this.count == 0) {  
42 - if (this.isGetRequest == true) {  
43 - if(this.isConnectNetwork){  
44 - EmptyComponent({ emptyType: 10 })  
45 - .height('100%')  
46 - .width('100%')  
47 - }else{  
48 - EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {  
49 - this.isConnectNetwork = NetworkUtil.isNetConnected()  
50 - if(this.isConnectNetwork){ 39 + Column(){
  40 + Column() {
  41 + //标题栏目
  42 + CustomTitleUI({ titleName: "评论列表" })
  43 + if (this.count == 0) {
  44 + if (this.isGetRequest == true) {
  45 + if(this.isConnectNetwork){
  46 + EmptyComponent({ emptyType: 11 })
  47 + .height('100%')
  48 + .width('100%')
  49 + }else{
  50 + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
  51 + this.isConnectNetwork = NetworkUtil.isNetConnected()
  52 + if(this.isConnectNetwork){
  53 + this.curPageNum = 1;
  54 + this.hasMore = true
  55 + this.isGetRequest = false
  56 + this.data.clear()
  57 +
  58 + if (!this.isLoading) {
  59 + this.getNewPageData(this.commentTime)
  60 + }
  61 + }
  62 + }})
  63 + .layoutWeight(1)
  64 + .width('100%')
  65 + }
  66 + }
  67 + } else {
  68 + Stack(){
  69 + Row()
  70 + .width("100%")
  71 + .height("100%")
  72 + .backgroundColor($r('app.color.white'))
  73 + CustomPullToRefresh({
  74 + alldata:this.data,
  75 + scroller:this.scroller,
  76 + customList:()=>{
  77 + this.ListLayout()
  78 + },
  79 + onRefresh:(resolve)=>{
51 this.curPageNum = 1; 80 this.curPageNum = 1;
52 this.hasMore = true 81 this.hasMore = true
53 this.isGetRequest = false 82 this.isGetRequest = false
54 this.data.clear() 83 this.data.clear()
55 84
  85 + if (!this.isLoading){
  86 + this.getNewPageData(this.commentTime)
  87 + if(resolve) resolve('刷新成功')
  88 + }
  89 + },
  90 + onLoadMore:(resolve)=> {
56 if (!this.isLoading) { 91 if (!this.isLoading) {
  92 + this.isLoading = true
57 this.getNewPageData(this.commentTime) 93 this.getNewPageData(this.commentTime)
58 } 94 }
59 } 95 }
60 - }})  
61 - .layoutWeight(1)  
62 - .width('100%') 96 + })
63 } 97 }
64 } 98 }
65 - } else {  
66 - Stack(){  
67 - Row()  
68 - .width("100%")  
69 - .height("100%")  
70 - .backgroundColor($r('app.color.white'))  
71 - CustomPullToRefresh({  
72 - alldata:this.data,  
73 - scroller:this.scroller,  
74 - customList:()=>{  
75 - this.ListLayout()  
76 - },  
77 - onRefresh:(resolve)=>{  
78 - this.curPageNum = 1;  
79 - this.hasMore = true  
80 - this.isGetRequest = false  
81 - this.data.clear()  
82 -  
83 - if (!this.isLoading){  
84 - this.getNewPageData(this.commentTime)  
85 - if(resolve) resolve('刷新成功')  
86 - }  
87 - },  
88 - onLoadMore:(resolve)=> {  
89 - if (!this.isLoading) {  
90 - this.isLoading = true  
91 - this.getNewPageData(this.commentTime)  
92 - }  
93 - }  
94 - })  
95 - }  
96 } 99 }
97 - }  
98 - .backgroundColor($r('app.color.color_transparent'))  
99 - .height('100%')  
100 - .width('100%') 100 + .backgroundColor($r('app.color.color_transparent'))
  101 + .height('100%')
  102 + .width('100%')
  103 + }.width("100%")
  104 + .height("100%")
  105 + .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
  106 +
101 } 107 }
102 108
103 @Builder ListLayout(){ 109 @Builder ListLayout(){