Showing
1 changed file
with
53 additions
and
29 deletions
| @@ -28,7 +28,7 @@ export struct MultiPictureDetailPageComponent { | @@ -28,7 +28,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 28 | private picWidth: number = 0 | 28 | private picWidth: number = 0 |
| 29 | @State picHeight: number = 0 | 29 | @State picHeight: number = 0 |
| 30 | @State titleHeight: number = 0 | 30 | @State titleHeight: number = 0 |
| 31 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 31 | + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 32 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | 32 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' |
| 33 | private swiperController: SwiperController = new SwiperController() | 33 | private swiperController: SwiperController = new SwiperController() |
| 34 | @State swiperIndex: number = 0; | 34 | @State swiperIndex: number = 0; |
| @@ -37,13 +37,12 @@ export struct MultiPictureDetailPageComponent { | @@ -37,13 +37,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 37 | 37 | ||
| 38 | //watch监听页码回调 | 38 | //watch监听页码回调 |
| 39 | onCurrentPageNumUpdated(): void { | 39 | onCurrentPageNumUpdated(): void { |
| 40 | - Logger.info(TAG, `currentPageNum:${this.currentPageNum}`, ) | 40 | + Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,) |
| 41 | let _swiperIndex = Number.parseInt(this.currentPageNum) | 41 | let _swiperIndex = Number.parseInt(this.currentPageNum) |
| 42 | Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) | 42 | Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) |
| 43 | this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | 43 | this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | - | ||
| 47 | async aboutToAppear() { | 46 | async aboutToAppear() { |
| 48 | //获取宽高尺寸 | 47 | //获取宽高尺寸 |
| 49 | this.screenWidth = this.displayTool.width | 48 | this.screenWidth = this.displayTool.width |
| @@ -72,7 +71,7 @@ export struct MultiPictureDetailPageComponent { | @@ -72,7 +71,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 72 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { | 71 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { |
| 73 | Swiper(this.swiperController) { | 72 | Swiper(this.swiperController) { |
| 74 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { | 73 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { |
| 75 | - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 74 | + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) |
| 76 | }) | 75 | }) |
| 77 | } | 76 | } |
| 78 | .index(this.swiperIndex) | 77 | .index(this.swiperIndex) |
| @@ -91,10 +90,11 @@ export struct MultiPictureDetailPageComponent { | @@ -91,10 +90,11 @@ export struct MultiPictureDetailPageComponent { | ||
| 91 | .onChange((index: number) => { | 90 | .onChange((index: number) => { |
| 92 | this.swiperIndex = index | 91 | this.swiperIndex = index |
| 93 | }) | 92 | }) |
| 94 | - if(this.contentDetailData.rmhPlatform == 1) { | 93 | + |
| 94 | + if (this.contentDetailData.rmhPlatform == 1) { | ||
| 95 | Row() { | 95 | Row() { |
| 96 | - Row(){ | ||
| 97 | - Row({space: 8}) { | 96 | + Row() { |
| 97 | + Row({ space: 8 }) { | ||
| 98 | Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl) | 98 | Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl) |
| 99 | .borderRadius('50%') | 99 | .borderRadius('50%') |
| 100 | .alt($r('app.media.picture_loading')) | 100 | .alt($r('app.media.picture_loading')) |
| @@ -105,6 +105,7 @@ export struct MultiPictureDetailPageComponent { | @@ -105,6 +105,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 105 | } | 105 | } |
| 106 | .width('13%') | 106 | .width('13%') |
| 107 | .height('100%') | 107 | .height('100%') |
| 108 | + | ||
| 108 | Row() { | 109 | Row() { |
| 109 | Flex({ | 110 | Flex({ |
| 110 | direction: FlexDirection.Column, | 111 | direction: FlexDirection.Column, |
| @@ -124,7 +125,7 @@ export struct MultiPictureDetailPageComponent { | @@ -124,7 +125,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 124 | .fontWeight(400) | 125 | .fontWeight(400) |
| 125 | .lineHeight(14) | 126 | .lineHeight(14) |
| 126 | .textOverflow({ overflow: TextOverflow.Clip }) | 127 | .textOverflow({ overflow: TextOverflow.Clip }) |
| 127 | - .margin (0) | 128 | + .margin(0) |
| 128 | } | 129 | } |
| 129 | } | 130 | } |
| 130 | .width('81%') | 131 | .width('81%') |
| @@ -136,10 +137,11 @@ export struct MultiPictureDetailPageComponent { | @@ -136,10 +137,11 @@ export struct MultiPictureDetailPageComponent { | ||
| 136 | top: 0, | 137 | top: 0, |
| 137 | bottom: 0, | 138 | bottom: 0, |
| 138 | left: 16, | 139 | left: 16, |
| 139 | - right:0 | 140 | + right: 0 |
| 140 | }) | 141 | }) |
| 141 | - if(this.followStatus == '0') { | ||
| 142 | - Row(){ | 142 | + |
| 143 | + if (this.followStatus == '0') { | ||
| 144 | + Row() { | ||
| 143 | Button('+关注', { type: ButtonType.Normal, stateEffect: true }) | 145 | Button('+关注', { type: ButtonType.Normal, stateEffect: true }) |
| 144 | .borderRadius(4) | 146 | .borderRadius(4) |
| 145 | .backgroundColor('#ED2800') | 147 | .backgroundColor('#ED2800') |
| @@ -152,7 +154,7 @@ export struct MultiPictureDetailPageComponent { | @@ -152,7 +154,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 152 | top: 10, | 154 | top: 10, |
| 153 | bottom: 10, | 155 | bottom: 10, |
| 154 | left: 16, | 156 | left: 16, |
| 155 | - right:16 | 157 | + right: 16 |
| 156 | }) | 158 | }) |
| 157 | .fontSize(12) | 159 | .fontSize(12) |
| 158 | .fontColor(Color.White) | 160 | .fontColor(Color.White) |
| @@ -169,7 +171,7 @@ export struct MultiPictureDetailPageComponent { | @@ -169,7 +171,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 169 | }) | 171 | }) |
| 170 | .id('e_attention') | 172 | .id('e_attention') |
| 171 | } | 173 | } |
| 172 | - Row(){ | 174 | + Row() { |
| 173 | Scroll(this.scroller) { | 175 | Scroll(this.scroller) { |
| 174 | Row() { | 176 | Row() { |
| 175 | Flex({ | 177 | Flex({ |
| @@ -177,22 +179,38 @@ export struct MultiPictureDetailPageComponent { | @@ -177,22 +179,38 @@ export struct MultiPictureDetailPageComponent { | ||
| 177 | justifyContent: FlexAlign.Start | 179 | justifyContent: FlexAlign.Start |
| 178 | }) { | 180 | }) { |
| 179 | Text() { | 181 | Text() { |
| 180 | - Span(`${this.swiperIndex + 1}`).fontSize(24).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(28) | ||
| 181 | - Span(`/${this.contentDetailData.photoList.length}`).fontSize(14).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(19) | 182 | + Span(`${this.swiperIndex + 1}`) |
| 183 | + .fontSize(24) | ||
| 184 | + .fontFamily('PingFang SC-Medium') | ||
| 185 | + .fontWeight(500) | ||
| 186 | + .lineHeight(28) | ||
| 187 | + Span(`/${this.contentDetailData.photoList.length}`) | ||
| 188 | + .fontSize(14) | ||
| 189 | + .fontFamily('PingFang SC-Medium') | ||
| 190 | + .fontWeight(500) | ||
| 191 | + .lineHeight(19) | ||
| 182 | }.fontColor(Color.White).margin(4) | 192 | }.fontColor(Color.White).margin(4) |
| 183 | 193 | ||
| 184 | - Text(`${this.contentDetailData.newsTitle}`).fontColor(Color.White).fontSize(16).fontFamily('PingFang SC-Semibold') | ||
| 185 | - .fontWeight(600).lineHeight(24) | ||
| 186 | - .margin ({ | 194 | + Text(`${this.contentDetailData.newsTitle}`) |
| 195 | + .fontColor(Color.White) | ||
| 196 | + .fontSize(16) | ||
| 197 | + .fontFamily('PingFang SC-Semibold') | ||
| 198 | + .fontWeight(600) | ||
| 199 | + .lineHeight(24) | ||
| 200 | + .margin({ | ||
| 187 | top: 4, | 201 | top: 4, |
| 188 | left: 0, | 202 | left: 0, |
| 189 | bottom: 4, | 203 | bottom: 4, |
| 190 | right: 0 | 204 | right: 0 |
| 191 | }) | 205 | }) |
| 192 | - Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`).fontColor(Color.White) | ||
| 193 | - .fontSize(14).fontFamily('PingFang SC-Regular').fontWeight(400).lineHeight(22) | 206 | + Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`) |
| 207 | + .fontColor(Color.White) | ||
| 208 | + .fontSize(14) | ||
| 209 | + .fontFamily('PingFang SC-Regular') | ||
| 210 | + .fontWeight(400) | ||
| 211 | + .lineHeight(22) | ||
| 194 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 212 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 195 | - .margin ({ | 213 | + .margin({ |
| 196 | top: 4, | 214 | top: 4, |
| 197 | left: 0, | 215 | left: 0, |
| 198 | bottom: 4, | 216 | bottom: 4, |
| @@ -202,7 +220,7 @@ export struct MultiPictureDetailPageComponent { | @@ -202,7 +220,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 202 | } | 220 | } |
| 203 | } | 221 | } |
| 204 | .width('100%') | 222 | .width('100%') |
| 205 | - .margin ({ | 223 | + .margin({ |
| 206 | top: 8, | 224 | top: 8, |
| 207 | left: 18, | 225 | left: 18, |
| 208 | bottom: 24, | 226 | bottom: 24, |
| @@ -227,13 +245,15 @@ export struct MultiPictureDetailPageComponent { | @@ -227,13 +245,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 227 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 245 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 228 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 246 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 229 | }) | 247 | }) |
| 230 | - .width('100%').height(56).margin({ | ||
| 231 | - top: 16, | ||
| 232 | - left: 16, | ||
| 233 | - right:16, | ||
| 234 | - bottom: 0 | ||
| 235 | - }) | ||
| 236 | - .border({ width: {top: 0.5}, color: '#FFFFFF' }) | 248 | + .width('100%') |
| 249 | + .height(56) | ||
| 250 | + .margin({ | ||
| 251 | + top: 16, | ||
| 252 | + left: 16, | ||
| 253 | + right: 16, | ||
| 254 | + bottom: 0 | ||
| 255 | + }) | ||
| 256 | + .border({ width: { top: 0.5 }, color: '#FFFFFF' }) | ||
| 237 | .id('e_oper_row') | 257 | .id('e_oper_row') |
| 238 | } | 258 | } |
| 239 | } | 259 | } |
| @@ -241,6 +261,9 @@ export struct MultiPictureDetailPageComponent { | @@ -241,6 +261,9 @@ export struct MultiPictureDetailPageComponent { | ||
| 241 | .height('100%') | 261 | .height('100%') |
| 242 | .backgroundColor(Color.Black) | 262 | .backgroundColor(Color.Black) |
| 243 | .id('e_picture_container') | 263 | .id('e_picture_container') |
| 264 | + // 设置顶部绘制延伸到状态栏 | ||
| 265 | + // 设置底部绘制延伸到导航条 | ||
| 266 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 244 | } | 267 | } |
| 245 | 268 | ||
| 246 | private async getContentDetailData() { | 269 | private async getContentDetailData() { |
| @@ -285,6 +308,7 @@ export struct MultiPictureDetailPageComponent { | @@ -285,6 +308,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 285 | 308 | ||
| 286 | } | 309 | } |
| 287 | } | 310 | } |
| 311 | + | ||
| 288 | /** | 312 | /** |
| 289 | * 关注号主 | 313 | * 关注号主 |
| 290 | */ | 314 | */ |
-
Please register or login to post a comment