ref |> 调整精选评论详情页顶部间距问题
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
1 changed file
with
23 additions
and
16 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| 1 | import { ViewType } from 'wdConstant/Index' | 1 | import { ViewType } from 'wdConstant/Index' |
| 2 | -import { DateTimeUtils, LazyDataSource, ToastUtils, WindowModel } from 'wdKit/Index' | 2 | +import { DateTimeUtils, LazyDataSource, Logger, ToastUtils, WindowModel } from 'wdKit/Index' |
| 3 | import { commentItemModel } from '../model/CommentModel' | 3 | import { commentItemModel } from '../model/CommentModel' |
| 4 | import commentViewModel from '../viewmodel/CommentViewModel' | 4 | import commentViewModel from '../viewmodel/CommentViewModel' |
| 5 | import { router, window } from '@kit.ArkUI' | 5 | import { router, window } from '@kit.ArkUI' |
| @@ -106,8 +106,13 @@ export struct QualityCommentsComponent { | @@ -106,8 +106,13 @@ export struct QualityCommentsComponent { | ||
| 106 | // .aspectRatio(375 / 283); | 106 | // .aspectRatio(375 / 283); |
| 107 | } | 107 | } |
| 108 | .onAreaChange((oldValue: Area, newValue: Area) => { | 108 | .onAreaChange((oldValue: Area, newValue: Area) => { |
| 109 | - | ||
| 110 | - let persent = Math.abs(Number(newValue.globalPosition.y)) / 150 | 109 | + if (Number(oldValue.globalPosition.y) == 0 && Number(newValue.globalPosition.y) > 30) { |
| 110 | + this.firstPositionY = Number(newValue.globalPosition.y) | ||
| 111 | + return | ||
| 112 | + } | ||
| 113 | + Logger.debug(TAG, "oldValue.globalPosition.y : " + oldValue.globalPosition.y) | ||
| 114 | + Logger.debug(TAG, "newValue.globalPosition.y : " + newValue.globalPosition.y + `,this.topSafeHeight : ` + this.topSafeHeight) | ||
| 115 | + let persent = Math.abs(Number(newValue.globalPosition.y) - this.firstPositionY ) / 150 //- this.topSafeHeight) / 283 | ||
| 111 | if (persent > 1) { | 116 | if (persent > 1) { |
| 112 | persent = 1 | 117 | persent = 1 |
| 113 | } | 118 | } |
| @@ -130,16 +135,17 @@ export struct QualityCommentsComponent { | @@ -130,16 +135,17 @@ export struct QualityCommentsComponent { | ||
| 130 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 135 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 131 | left: { anchor: "__container__", align: HorizontalAlign.Start } | 136 | left: { anchor: "__container__", align: HorizontalAlign.Start } |
| 132 | }) | 137 | }) |
| 133 | - .offset({ | ||
| 134 | - y: (this.topSafeHeight / 2) + 'px' | ||
| 135 | - }) | 138 | + // .offset({ |
| 139 | + // y: (this.topSafeHeight / 2) + 'px' | ||
| 140 | + // }) | ||
| 136 | .margin({ left: 16 }) | 141 | .margin({ left: 16 }) |
| 137 | .onClick(() => { | 142 | .onClick(() => { |
| 138 | router.back() | 143 | router.back() |
| 139 | }) | 144 | }) |
| 140 | } | 145 | } |
| 141 | .visibility(this.tileOpacity > 0 ? 1 : 0) | 146 | .visibility(this.tileOpacity > 0 ? 1 : 0) |
| 142 | - .height(this.topSafeHeight + vp2px(44) + 'px') | 147 | + // .height(this.topSafeHeight + vp2px(44) + 'px') |
| 148 | + .height(44) | ||
| 143 | .width('100%') | 149 | .width('100%') |
| 144 | .backgroundColor($r('app.color.color_transparent')) | 150 | .backgroundColor($r('app.color.color_transparent')) |
| 145 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | 151 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) |
| @@ -159,9 +165,9 @@ export struct QualityCommentsComponent { | @@ -159,9 +165,9 @@ export struct QualityCommentsComponent { | ||
| 159 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 165 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 160 | left: { anchor: "__container__", align: HorizontalAlign.Start } | 166 | left: { anchor: "__container__", align: HorizontalAlign.Start } |
| 161 | }) | 167 | }) |
| 162 | - .offset({ | ||
| 163 | - y: (this.topSafeHeight / 2) + 'px' | ||
| 164 | - }) | 168 | + // .offset({ |
| 169 | + // y: (this.topSafeHeight / 2) + 'px' | ||
| 170 | + // }) | ||
| 165 | .margin({ left: 16 }) | 171 | .margin({ left: 16 }) |
| 166 | .onClick(() => { | 172 | .onClick(() => { |
| 167 | router.back() | 173 | router.back() |
| @@ -178,16 +184,17 @@ export struct QualityCommentsComponent { | @@ -178,16 +184,17 @@ export struct QualityCommentsComponent { | ||
| 178 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 184 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 179 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 185 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 180 | }) | 186 | }) |
| 181 | - .offset({ | ||
| 182 | - y: (this.topSafeHeight / 2) + 'px' | ||
| 183 | - }) | 187 | + // .offset({ |
| 188 | + // y: (this.topSafeHeight / 2) + 'px' | ||
| 189 | + // }) | ||
| 184 | } | 190 | } |
| 185 | .visibility(this.tileOpacity > 0 ? 0 : 1) | 191 | .visibility(this.tileOpacity > 0 ? 0 : 1) |
| 186 | .opacity(this.tileOpacity) | 192 | .opacity(this.tileOpacity) |
| 187 | - .height(this.topSafeHeight + vp2px(44) + 'px') | 193 | + // .height(this.topSafeHeight + vp2px(44) + 'px') |
| 194 | + .height(44) | ||
| 188 | .width('100%') | 195 | .width('100%') |
| 189 | .backgroundColor($r('app.color.white')) | 196 | .backgroundColor($r('app.color.white')) |
| 190 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | 197 | + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) |
| 191 | } | 198 | } |
| 192 | 199 | ||
| 193 | build() { | 200 | build() { |
| @@ -212,7 +219,7 @@ export struct QualityCommentsComponent { | @@ -212,7 +219,7 @@ export struct QualityCommentsComponent { | ||
| 212 | .friction(0.6) | 219 | .friction(0.6) |
| 213 | .scrollBar(BarState.Off) | 220 | .scrollBar(BarState.Off) |
| 214 | .edgeEffect(EdgeEffect.None) | 221 | .edgeEffect(EdgeEffect.None) |
| 215 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 222 | + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 216 | 223 | ||
| 217 | this.TabbarTransparent() | 224 | this.TabbarTransparent() |
| 218 | this.TabbarNormal() | 225 | this.TabbarNormal() |
-
Please register or login to post a comment