Showing
2 changed files
with
16 additions
and
17 deletions
| 1 | import { PhotoListBean } from 'wdBean'; | 1 | import { PhotoListBean } from 'wdBean'; |
| 2 | import { Logger } from 'wdKit'; | 2 | import { Logger } from 'wdKit'; |
| 3 | -import router from '@ohos.router'; | ||
| 4 | -import display from '@ohos.display'; | ||
| 5 | 3 | ||
| 6 | const TAG = 'MultiPictureDetailPageComponent'; | 4 | const TAG = 'MultiPictureDetailPageComponent'; |
| 7 | 5 | ||
| @@ -11,14 +9,10 @@ export struct MultiPictureDetailItemComponent { | @@ -11,14 +9,10 @@ export struct MultiPictureDetailItemComponent { | ||
| 11 | //alt app.media.picture_loading 设计稿尺寸 | 9 | //alt app.media.picture_loading 设计稿尺寸 |
| 12 | @State imageWidth:string | number = 167 | 10 | @State imageWidth:string | number = 167 |
| 13 | @State ratio:number = 167/60 | 11 | @State ratio:number = 167/60 |
| 14 | - private scroller: Scroller = new Scroller() | ||
| 15 | - private displayTool = display.getDefaultDisplaySync() | ||
| 16 | - @State picHeight: number = 0 | ||
| 17 | 12 | ||
| 18 | 13 | ||
| 19 | async aboutToAppear() { | 14 | async aboutToAppear() { |
| 20 | Logger.info(TAG, 'pictures preview') | 15 | Logger.info(TAG, 'pictures preview') |
| 21 | - this.picHeight = this.displayTool.width * 578 / 375 | ||
| 22 | } | 16 | } |
| 23 | 17 | ||
| 24 | build() { | 18 | build() { |
| @@ -33,16 +27,6 @@ export struct MultiPictureDetailItemComponent { | @@ -33,16 +27,6 @@ export struct MultiPictureDetailItemComponent { | ||
| 33 | this.imageWidth = '100%' | 27 | this.imageWidth = '100%' |
| 34 | this.ratio = this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height | 28 | this.ratio = this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height |
| 35 | }) | 29 | }) |
| 36 | - /*.onDrop(event => { | ||
| 37 | - router.back(); | ||
| 38 | - }) | ||
| 39 | - .draggable(true)*/ | ||
| 40 | - /*Scroll(this.scroller) { | ||
| 41 | - | ||
| 42 | - } | ||
| 43 | - .scrollable(ScrollDirection.Vertical) | ||
| 44 | - .scrollBarWidth(0) | ||
| 45 | - .height(px2vp(this.picHeight))*/ | ||
| 46 | } | 30 | } |
| 47 | .height('100%') | 31 | .height('100%') |
| 48 | .width('100%') | 32 | .width('100%') |
| @@ -18,6 +18,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | @@ -18,6 +18,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 19 | import { PageRepository } from '../repository/PageRepository'; | 19 | import { PageRepository } from '../repository/PageRepository'; |
| 20 | import { SpConstants } from 'wdConstant/Index'; | 20 | import { SpConstants } from 'wdConstant/Index'; |
| 21 | +import { router } from '@kit.ArkUI'; | ||
| 21 | 22 | ||
| 22 | const TAG = 'MultiPictureDetailPageComponent'; | 23 | const TAG = 'MultiPictureDetailPageComponent'; |
| 23 | 24 | ||
| @@ -34,6 +35,7 @@ export struct MultiPictureDetailPageComponent { | @@ -34,6 +35,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 34 | @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 35 | @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 35 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | 36 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' |
| 36 | private swiperController: SwiperController = new SwiperController() | 37 | private swiperController: SwiperController = new SwiperController() |
| 38 | + private swiperControllerItem: SwiperController = new SwiperController() | ||
| 37 | @State swiperIndex: number = 0; | 39 | @State swiperIndex: number = 0; |
| 38 | @Provide followStatus: string = '0' // 关注状态 | 40 | @Provide followStatus: string = '0' // 关注状态 |
| 39 | private scroller: Scroller = new Scroller() | 41 | private scroller: Scroller = new Scroller() |
| @@ -71,7 +73,19 @@ export struct MultiPictureDetailPageComponent { | @@ -71,7 +73,19 @@ export struct MultiPictureDetailPageComponent { | ||
| 71 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { | 73 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { |
| 72 | Swiper(this.swiperController) { | 74 | Swiper(this.swiperController) { |
| 73 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { | 75 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { |
| 74 | - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 76 | + Swiper(this.swiperController) { |
| 77 | + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | ||
| 78 | + } | ||
| 79 | + .width('100%') | ||
| 80 | + .height('100%') | ||
| 81 | + .vertical(true) | ||
| 82 | + .autoPlay(false) | ||
| 83 | + .cachedCount(1) | ||
| 84 | + .indicator(false) | ||
| 85 | + .displayCount(1) | ||
| 86 | + .onAnimationEnd(event => { | ||
| 87 | + router.back() | ||
| 88 | + }) | ||
| 75 | }) | 89 | }) |
| 76 | } | 90 | } |
| 77 | .index(this.swiperIndex) | 91 | .index(this.swiperIndex) |
| @@ -82,6 +96,7 @@ export struct MultiPictureDetailPageComponent { | @@ -82,6 +96,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 82 | .cachedCount(3) | 96 | .cachedCount(3) |
| 83 | .indicator(false) | 97 | .indicator(false) |
| 84 | .displayCount(1) | 98 | .displayCount(1) |
| 99 | + .loop(false) | ||
| 85 | .id('e_swiper_content') | 100 | .id('e_swiper_content') |
| 86 | .alignRules({ | 101 | .alignRules({ |
| 87 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 102 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
-
Please register or login to post a comment