Showing
1 changed file
with
95 additions
and
90 deletions
| @@ -67,109 +67,114 @@ struct PeopleShipHomePage { | @@ -67,109 +67,114 @@ struct PeopleShipHomePage { | ||
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | build() { | 69 | build() { |
| 70 | - if(this.isConnectNetwork){ | ||
| 71 | - if (this.isHasHomePage){ | ||
| 72 | - Stack({ alignContent: Alignment.Top }) { | ||
| 73 | - Stack({ alignContent: Alignment.Top }){ | ||
| 74 | - // 顶部图片 | ||
| 75 | - Image($r('app.media.home_page_bg')) | ||
| 76 | - .width('100%') | ||
| 77 | - ///1-this.topOpacity 联动上滑 | ||
| 78 | - .height(this.topOpacity>1?0:120*(1-this.topOpacity)) | ||
| 79 | - .objectFit(ImageFit.Cover) | ||
| 80 | - | ||
| 81 | - Row() | ||
| 82 | - .height(px2vp(this.topSafeHeight)) | ||
| 83 | - .width("100%") | ||
| 84 | - .backgroundColor($r('app.color.white')) | ||
| 85 | - .visibility(this.topOpacity > 0 ? Visibility.Visible : Visibility.None) | ||
| 86 | - .opacity(this.topOpacity ) | ||
| 87 | - } | ||
| 88 | - Column(){ | 70 | + Column(){ |
| 71 | + if(this.isConnectNetwork){ | ||
| 72 | + if (this.isHasHomePage){ | ||
| 73 | + Stack({ alignContent: Alignment.Top }) { | ||
| 89 | Stack({ alignContent: Alignment.Top }){ | 74 | Stack({ alignContent: Alignment.Top }){ |
| 90 | - this.peopleHomeTitleTransparent() | ||
| 91 | - // 头部返回 | ||
| 92 | - PeopleShipHomePageNavComponent({ | ||
| 93 | - attentionOpacity: this.attentionOpacity, | ||
| 94 | - topOpacity: this.topOpacity, | ||
| 95 | - detailModel: this.detailModel | ||
| 96 | - }) | ||
| 97 | - } | ||
| 98 | - if (this.detailModel && this.detailModel.userName) { | ||
| 99 | - Scroll(this.scroller) { | ||
| 100 | - Column() { | ||
| 101 | - // 顶部相关 | ||
| 102 | - PeopleShipHomePageTopComponent({ | ||
| 103 | - creatorId: this.creatorId, | ||
| 104 | - detailModel: this.detailModel, | ||
| 105 | - publishCount: this.publishCount, | ||
| 106 | - topHeight: this.topHeight | ||
| 107 | - }) | ||
| 108 | - .width("100%") | ||
| 109 | - .height(this.topHeight) | ||
| 110 | - // 列表 | ||
| 111 | - PeopleShipHomeListComponent({ | ||
| 112 | - publishCount: this.publishCount, | ||
| 113 | - creatorId: this.creatorId | ||
| 114 | - }) | ||
| 115 | - // Column(){ | ||
| 116 | - // | ||
| 117 | - // | ||
| 118 | - // }.height('100%') | ||
| 119 | - } | 75 | + // 顶部图片 |
| 76 | + Image($r('app.media.home_page_bg')) | ||
| 77 | + .width('100%') | ||
| 78 | + ///1-this.topOpacity 联动上滑 | ||
| 79 | + .height(this.topOpacity>1?0:120*(1-this.topOpacity)) | ||
| 80 | + .objectFit(ImageFit.Cover) | ||
| 81 | + | ||
| 82 | + Row() | ||
| 83 | + .height(px2vp(this.topSafeHeight)) | ||
| 120 | .width("100%") | 84 | .width("100%") |
| 121 | - .justifyContent(FlexAlign.Start) | ||
| 122 | - .alignItems(HorizontalAlign.Start) | 85 | + .backgroundColor($r('app.color.white')) |
| 86 | + .visibility(this.topOpacity > 0 ? Visibility.Visible : Visibility.None) | ||
| 87 | + .opacity(this.topOpacity ) | ||
| 88 | + } | ||
| 89 | + Column(){ | ||
| 90 | + Stack({ alignContent: Alignment.Top }){ | ||
| 91 | + this.peopleHomeTitleTransparent() | ||
| 92 | + // 头部返回 | ||
| 93 | + PeopleShipHomePageNavComponent({ | ||
| 94 | + attentionOpacity: this.attentionOpacity, | ||
| 95 | + topOpacity: this.topOpacity, | ||
| 96 | + detailModel: this.detailModel | ||
| 97 | + }) | ||
| 123 | } | 98 | } |
| 124 | - .edgeEffect(EdgeEffect.None) | ||
| 125 | - .scrollBar(BarState.Off) | ||
| 126 | - .width('100%') | ||
| 127 | - .layoutWeight(1) | ||
| 128 | - // .scrollable(ScrollDirection.Vertical) | ||
| 129 | - // .edgeEffect(EdgeEffect.None) | ||
| 130 | - // .friction(0.7) | ||
| 131 | - // .backgroundColor(Color.White) | ||
| 132 | - // .scrollBar(BarState.Off) | ||
| 133 | - // .width('100%') | ||
| 134 | - // .height('calc(100% - 44vp)') | ||
| 135 | - .onDidScroll(() => { | ||
| 136 | - this.topOpacity = this.scroller.currentOffset().yOffset / 120 | ||
| 137 | - if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) { | ||
| 138 | - this.attentionOpacity = true | ||
| 139 | - } else { | ||
| 140 | - this.attentionOpacity = false | 99 | + if (this.detailModel && this.detailModel.userName) { |
| 100 | + Scroll(this.scroller) { | ||
| 101 | + Column() { | ||
| 102 | + // 顶部相关 | ||
| 103 | + PeopleShipHomePageTopComponent({ | ||
| 104 | + creatorId: this.creatorId, | ||
| 105 | + detailModel: this.detailModel, | ||
| 106 | + publishCount: this.publishCount, | ||
| 107 | + topHeight: this.topHeight | ||
| 108 | + }) | ||
| 109 | + .width("100%") | ||
| 110 | + .height(this.topHeight) | ||
| 111 | + // 列表 | ||
| 112 | + PeopleShipHomeListComponent({ | ||
| 113 | + publishCount: this.publishCount, | ||
| 114 | + creatorId: this.creatorId | ||
| 115 | + }) | ||
| 116 | + // Column(){ | ||
| 117 | + // | ||
| 118 | + // | ||
| 119 | + // }.height('100%') | ||
| 120 | + } | ||
| 121 | + .width("100%") | ||
| 122 | + .justifyContent(FlexAlign.Start) | ||
| 123 | + .alignItems(HorizontalAlign.Start) | ||
| 141 | } | 124 | } |
| 142 | - Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`) | 125 | + .edgeEffect(EdgeEffect.None) |
| 126 | + .scrollBar(BarState.Off) | ||
| 127 | + .width('100%') | ||
| 128 | + .layoutWeight(1) | ||
| 129 | + // .scrollable(ScrollDirection.Vertical) | ||
| 130 | + // .edgeEffect(EdgeEffect.None) | ||
| 131 | + // .friction(0.7) | ||
| 132 | + // .backgroundColor(Color.White) | ||
| 133 | + // .scrollBar(BarState.Off) | ||
| 134 | + // .width('100%') | ||
| 135 | + // .height('calc(100% - 44vp)') | ||
| 136 | + .onDidScroll(() => { | ||
| 137 | + this.topOpacity = this.scroller.currentOffset().yOffset / 120 | ||
| 138 | + if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) { | ||
| 139 | + this.attentionOpacity = true | ||
| 140 | + } else { | ||
| 141 | + this.attentionOpacity = false | ||
| 142 | + } | ||
| 143 | + Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`) | ||
| 143 | 144 | ||
| 144 | - }) | 145 | + }) |
| 146 | + } | ||
| 145 | } | 147 | } |
| 148 | + .margin({top:px2vp(this.topSafeHeight)}) | ||
| 146 | } | 149 | } |
| 147 | - .margin({top:px2vp(this.topSafeHeight)}) | 150 | + .width('100%') |
| 151 | + }else { | ||
| 152 | + Column(){ | ||
| 153 | + CustomTitleUI({ titleName: "" }) | ||
| 154 | + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoUserHomepage}).height('70%') | ||
| 155 | + }.width("100%") | ||
| 156 | + .height("100%") | ||
| 157 | + .padding({top:px2vp(this.topSafeHeight)}) | ||
| 148 | } | 158 | } |
| 149 | - .width('100%') | ||
| 150 | - }else { | 159 | + }else{ |
| 151 | Column(){ | 160 | Column(){ |
| 152 | CustomTitleUI({ titleName: "" }) | 161 | CustomTitleUI({ titleName: "" }) |
| 153 | - EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoUserHomepage}).height('70%') | 162 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { |
| 163 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 164 | + if(this.isConnectNetwork){ | ||
| 165 | + this.detailModel = {} as PeopleShipUserDetailData | ||
| 166 | + this.getData() | ||
| 167 | + } | ||
| 168 | + }}) | ||
| 169 | + .height('calc(100% - 84lpx)') | ||
| 170 | + .width('100%') | ||
| 154 | }.width("100%") | 171 | }.width("100%") |
| 155 | .height("100%") | 172 | .height("100%") |
| 156 | - .padding({top:px2vp(this.topSafeHeight)}) | ||
| 157 | } | 173 | } |
| 158 | - }else{ | ||
| 159 | - Column(){ | ||
| 160 | - CustomTitleUI({ titleName: "" }) | ||
| 161 | - EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 162 | - this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 163 | - if(this.isConnectNetwork){ | ||
| 164 | - this.detailModel = {} as PeopleShipUserDetailData | ||
| 165 | - this.getData() | ||
| 166 | - } | ||
| 167 | - }}) | ||
| 168 | - .height('calc(100% - 84lpx)') | ||
| 169 | - .width('100%') | ||
| 170 | - }.width("100%") | ||
| 171 | - .height("100%") | ||
| 172 | - } | 174 | + }.width("100%") |
| 175 | + .height("100%") | ||
| 176 | + .backgroundColor(Color.White) | ||
| 177 | + | ||
| 173 | } | 178 | } |
| 174 | 179 | ||
| 175 | @Builder peopleHomeTitleTransparent() { | 180 | @Builder peopleHomeTitleTransparent() { |
-
Please register or login to post a comment