Showing
1 changed file
with
94 additions
and
79 deletions
| @@ -53,6 +53,8 @@ export struct MultiPictureDetailPageComponent { | @@ -53,6 +53,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 53 | @Provide showCommentList: boolean = false | 53 | @Provide showCommentList: boolean = false |
| 54 | private subScroller: Scroller = new Scroller() | 54 | private subScroller: Scroller = new Scroller() |
| 55 | private scroller: Scroller = new Scroller() | 55 | private scroller: Scroller = new Scroller() |
| 56 | + private listScroller: ListScroller = new ListScroller() | ||
| 57 | + @State contentStartOffset: number = 0; | ||
| 56 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | 58 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 |
| 57 | @State isOffLine: boolean = false // 存储视频下线状态用来展示缺省图 | 59 | @State isOffLine: boolean = false // 存储视频下线状态用来展示缺省图 |
| 58 | @State showDownload: Boolean = false // 控制是否显示下载默认隐藏 | 60 | @State showDownload: Boolean = false // 控制是否显示下载默认隐藏 |
| @@ -73,6 +75,8 @@ export struct MultiPictureDetailPageComponent { | @@ -73,6 +75,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 73 | let _swiperIndex = Number.parseInt(this.currentPageNum) | 75 | let _swiperIndex = Number.parseInt(this.currentPageNum) |
| 74 | Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) | 76 | Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) |
| 75 | this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | 77 | this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex |
| 78 | + this.scroller.scrollEdge(Edge.Top) | ||
| 79 | + this.listScroller.scrollEdge(Edge.Top) | ||
| 76 | } | 80 | } |
| 77 | 81 | ||
| 78 | async aboutToAppear() { | 82 | async aboutToAppear() { |
| @@ -348,6 +352,8 @@ export struct MultiPictureDetailPageComponent { | @@ -348,6 +352,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 348 | .zIndex(1) | 352 | .zIndex(1) |
| 349 | .onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => { | 353 | .onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => { |
| 350 | this.swiperIndex = targetIndex | 354 | this.swiperIndex = targetIndex |
| 355 | + this.scroller.scrollEdge(Edge.Top) | ||
| 356 | + this.listScroller.scrollEdge(Edge.Top) | ||
| 351 | }) | 357 | }) |
| 352 | .onClick(() => { | 358 | .onClick(() => { |
| 353 | this.showDownload = !this.showDownload | 359 | this.showDownload = !this.showDownload |
| @@ -355,96 +361,105 @@ export struct MultiPictureDetailPageComponent { | @@ -355,96 +361,105 @@ export struct MultiPictureDetailPageComponent { | ||
| 355 | } | 361 | } |
| 356 | 362 | ||
| 357 | @Builder | 363 | @Builder |
| 364 | + ListItemHeader() { | ||
| 365 | + if (this.contentDetailData?.photoList?.length) { | ||
| 366 | + Text() { | ||
| 367 | + Span(`${this.swiperIndex + 1}`) | ||
| 368 | + .fontSize(24) | ||
| 369 | + .fontFamily('PingFang SC-Medium') | ||
| 370 | + .fontWeight(500) | ||
| 371 | + .lineHeight(28) | ||
| 372 | + Span(`/${this.contentDetailData?.photoList?.length}`) | ||
| 373 | + .fontSize(14) | ||
| 374 | + .fontFamily('PingFang SC-Medium') | ||
| 375 | + .fontWeight(500) | ||
| 376 | + .lineHeight(19) | ||
| 377 | + } | ||
| 378 | + .fontColor(Color.White) | ||
| 379 | + .margin({ | ||
| 380 | + top: 4, | ||
| 381 | + left: 18, | ||
| 382 | + bottom: 4, | ||
| 383 | + right: 4 | ||
| 384 | + }) | ||
| 385 | + .width('100%') | ||
| 386 | + } | ||
| 387 | + } | ||
| 388 | + | ||
| 389 | + @Builder | ||
| 390 | + ListItemTitle() { | ||
| 391 | + if (this.contentDetailData.newsTitle) { | ||
| 392 | + Text(`${this.contentDetailData.newsTitle}`) | ||
| 393 | + .fontColor(Color.White) | ||
| 394 | + .fontSize(16) | ||
| 395 | + .fontFamily('PingFang SC-Semibold') | ||
| 396 | + .fontWeight(600) | ||
| 397 | + .lineHeight(24) | ||
| 398 | + .margin({ | ||
| 399 | + top: 4, | ||
| 400 | + left: 18, | ||
| 401 | + bottom: 4, | ||
| 402 | + right: 18 | ||
| 403 | + }) | ||
| 404 | + .width('92%') | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + @Builder | ||
| 409 | + ListItemDescription() { | ||
| 410 | + if (this.contentDetailData.photoList?.[this.swiperIndex].picDesc) { | ||
| 411 | + Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`) | ||
| 412 | + .fontColor(Color.White) | ||
| 413 | + .fontSize(14) | ||
| 414 | + .fontFamily('PingFang SC-Regular') | ||
| 415 | + .fontWeight(400) | ||
| 416 | + .lineHeight(22) | ||
| 417 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 418 | + .margin({ | ||
| 419 | + top: 4, | ||
| 420 | + left: 18, | ||
| 421 | + bottom: 4, | ||
| 422 | + right: 18 | ||
| 423 | + }) | ||
| 424 | + .maxLines(32) | ||
| 425 | + .width('92%') | ||
| 426 | + } | ||
| 427 | + } | ||
| 428 | + | ||
| 429 | + @Builder | ||
| 358 | NShowDownload() { | 430 | NShowDownload() { |
| 359 | Column() { | 431 | Column() { |
| 432 | + | ||
| 360 | Scroll(this.scroller) { | 433 | Scroll(this.scroller) { |
| 361 | - Flex({ | ||
| 362 | - direction: FlexDirection.Column, | ||
| 363 | - justifyContent: FlexAlign.Start | ||
| 364 | - }) { | ||
| 365 | - if (this.contentDetailData?.photoList?.length) { | ||
| 366 | - Text() { | ||
| 367 | - Span(`${this.swiperIndex + 1}`) | ||
| 368 | - .fontSize(24) | ||
| 369 | - .fontFamily('PingFang SC-Medium') | ||
| 370 | - .fontWeight(500) | ||
| 371 | - .lineHeight(28) | ||
| 372 | - Span(`/${this.contentDetailData?.photoList?.length}`) | ||
| 373 | - .fontSize(14) | ||
| 374 | - .fontFamily('PingFang SC-Medium') | ||
| 375 | - .fontWeight(500) | ||
| 376 | - .lineHeight(19) | ||
| 377 | - } | ||
| 378 | - .fontColor(Color.White) | ||
| 379 | - .margin({ | ||
| 380 | - top: 4, | ||
| 381 | - left: 18, | ||
| 382 | - bottom: 4, | ||
| 383 | - right: 4 | ||
| 384 | - }) | ||
| 385 | - } | ||
| 386 | - List() { | ||
| 387 | - ListItem(){ | ||
| 388 | - if (this.contentDetailData.newsTitle) { | ||
| 389 | - Text(`${this.contentDetailData.newsTitle}`) | ||
| 390 | - .fontColor(Color.White) | ||
| 391 | - .fontSize(16) | ||
| 392 | - .fontFamily('PingFang SC-Semibold') | ||
| 393 | - .fontWeight(600) | ||
| 394 | - .lineHeight(24) | ||
| 395 | - .margin({ | ||
| 396 | - top: 4, | ||
| 397 | - left: 18, | ||
| 398 | - bottom: 4, | ||
| 399 | - right: 18 | ||
| 400 | - }) | ||
| 401 | - .width('92%') | 434 | + Column() { |
| 435 | + Row() | ||
| 436 | + .width("100%") | ||
| 437 | + .height(this.contentDetailData.photoList?.[this.swiperIndex].picDesc ? 90 : 130) | ||
| 438 | + Flex({ | ||
| 439 | + direction: FlexDirection.Column | ||
| 440 | + }) { | ||
| 441 | + this.ListItemHeader(); | ||
| 442 | + List({ scroller: this.listScroller }) { | ||
| 443 | + ListItem() { | ||
| 444 | + this.ListItemTitle() | ||
| 402 | } | 445 | } |
| 403 | - } | ||
| 404 | - ListItem(){ | ||
| 405 | - if (this.contentDetailData.photoList?.[this.swiperIndex].picDesc) { | ||
| 406 | - Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`) | ||
| 407 | - .fontColor(Color.White) | ||
| 408 | - .fontSize(14) | ||
| 409 | - .fontFamily('PingFang SC-Regular') | ||
| 410 | - .fontWeight(400) | ||
| 411 | - .lineHeight(22) | ||
| 412 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 413 | - .margin({ | ||
| 414 | - top: 4, | ||
| 415 | - left: 18, | ||
| 416 | - bottom: 4, | ||
| 417 | - right: 18 | ||
| 418 | - }) | ||
| 419 | - .maxLines(32) | ||
| 420 | - .width('92%') | 446 | + ListItem() { |
| 447 | + this.ListItemDescription() | ||
| 421 | } | 448 | } |
| 422 | } | 449 | } |
| 423 | - } | ||
| 424 | - .nestedScroll( | ||
| 425 | - { | 450 | + .edgeEffect(EdgeEffect.None) |
| 451 | + .nestedScroll({ | ||
| 426 | scrollForward: NestedScrollMode.PARENT_FIRST, | 452 | scrollForward: NestedScrollMode.PARENT_FIRST, |
| 427 | scrollBackward: NestedScrollMode.SELF_FIRST | 453 | scrollBackward: NestedScrollMode.SELF_FIRST |
| 428 | - } | ||
| 429 | - ) | ||
| 430 | - .constraintSize ( | ||
| 431 | - { | ||
| 432 | - maxHeight: px2vp(this.titleHeight) | ||
| 433 | - } | ||
| 434 | - ) | 454 | + }) |
| 455 | + } | ||
| 456 | + .height('100%') | ||
| 435 | } | 457 | } |
| 436 | - .width('100%') | ||
| 437 | } | 458 | } |
| 438 | - .scrollable(ScrollDirection.Vertical) | 459 | + .height(230) |
| 460 | + .edgeEffect(EdgeEffect.None) | ||
| 439 | .scrollBarWidth(0) | 461 | .scrollBarWidth(0) |
| 440 | - .constraintSize ( | ||
| 441 | - { | ||
| 442 | - maxHeight: px2vp(this.nShowDownloadTitleHeight) | ||
| 443 | - } | ||
| 444 | - ) | ||
| 445 | - // .initialOffset({ | ||
| 446 | - // yOffset: px2vp(this.titleHeight)/2 | ||
| 447 | - // }) | 462 | + .scrollBar(BarState.Off) |
| 448 | 463 | ||
| 449 | OperRowListView({ | 464 | OperRowListView({ |
| 450 | contentDetailData: this.contentDetailData, | 465 | contentDetailData: this.contentDetailData, |
-
Please register or login to post a comment