Showing
8 changed files
with
95 additions
and
18 deletions
| @@ -54,7 +54,7 @@ export function registerRouter() { | @@ -54,7 +54,7 @@ export function registerRouter() { | ||
| 54 | // } | 54 | // } |
| 55 | if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { | 55 | if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { |
| 56 | return WDRouterPage.detailPlayShortVideoPage | 56 | return WDRouterPage.detailPlayShortVideoPage |
| 57 | - } else if (action.params?.detailPageType == 9 ) { | 57 | + } else if (action.params?.detailPageType == 13 ) { |
| 58 | return WDRouterPage.multiPictureDetailPage | 58 | return WDRouterPage.multiPictureDetailPage |
| 59 | } | 59 | } |
| 60 | return WDRouterPage.detailPlayVodPage | 60 | return WDRouterPage.detailPlayVodPage |
| @@ -16,6 +16,6 @@ export interface Params { | @@ -16,6 +16,6 @@ export interface Params { | ||
| 16 | // 6.挂件详情页 | 16 | // 6.挂件详情页 |
| 17 | // 7.沉浸式竖屏详情页 | 17 | // 7.沉浸式竖屏详情页 |
| 18 | // 8.专辑竖屏详情页 | 18 | // 8.专辑竖屏详情页 |
| 19 | - // 9.多图(图集)详情页 | 19 | + // 13.多图(图集)详情页 |
| 20 | detailPageType?:number; // 详情页类型 | 20 | detailPageType?:number; // 详情页类型 |
| 21 | } | 21 | } |
| 1 | import { PhotoListBean } from 'wdBean'; | 1 | import { PhotoListBean } from 'wdBean'; |
| 2 | +import { Logger } from 'wdKit'; | ||
| 3 | + | ||
| 4 | +const TAG = 'MultiPictureDetailPageComponent'; | ||
| 2 | 5 | ||
| 3 | @Component | 6 | @Component |
| 4 | export struct MultiPictureDetailItemComponent { | 7 | export struct MultiPictureDetailItemComponent { |
| 8 | + private photoListLength: number = 1; | ||
| 9 | + private index: number = 1; | ||
| 5 | private newsTitle: string = ''; | 10 | private newsTitle: string = ''; |
| 6 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean | 11 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean |
| 7 | 12 | ||
| 13 | + | ||
| 14 | + async aboutToAppear() { | ||
| 15 | + Logger.info(TAG, 'pictures preview') | ||
| 16 | + } | ||
| 17 | + | ||
| 8 | build() { | 18 | build() { |
| 9 | - Stack() { | ||
| 10 | - Image(this.MultiPictureDetailItem.picPath) | ||
| 11 | - .width('100%') | ||
| 12 | - .aspectRatio(this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height) | ||
| 13 | - .objectFit(ImageFit.Fill) | 19 | + Stack({ alignContent: Alignment.BottomStart }) { |
| 20 | + Row() { | ||
| 21 | + Image(this.MultiPictureDetailItem.picPath) | ||
| 22 | + .alt($r('app.media.picture_loading')) | ||
| 23 | + .width('100%') | ||
| 24 | + .aspectRatio(this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height) | ||
| 25 | + .objectFit(ImageFit.Fill) | ||
| 26 | + } | ||
| 27 | + .height('100%') | ||
| 28 | + .width('100%') | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + Row() { | ||
| 32 | + Flex({ | ||
| 33 | + direction: FlexDirection.Column, | ||
| 34 | + justifyContent: FlexAlign.Start | ||
| 35 | + }) { | ||
| 36 | + Text() { | ||
| 37 | + Span(`${this.index + 1}`).fontSize(24).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(28) | ||
| 38 | + Span(`/${this.photoListLength}`).fontSize(14).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(19) | ||
| 39 | + }.fontColor(Color.White).margin(4) | ||
| 40 | + | ||
| 41 | + Text(`${this.newsTitle}`).fontColor(Color.White).fontSize(16).fontFamily('PingFang SC-Semibold') | ||
| 42 | + .fontWeight(600).lineHeight(24) | ||
| 43 | + .margin ({ | ||
| 44 | + top: 4, | ||
| 45 | + left: 0, | ||
| 46 | + bottom: 4, | ||
| 47 | + right: 0 | ||
| 48 | + }) | ||
| 49 | + Text(`${this.MultiPictureDetailItem.picDesc}`).fontColor(Color.White) | ||
| 50 | + .fontSize(14).fontFamily('PingFang SC-Regular').fontWeight(400).lineHeight(22) | ||
| 51 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 52 | + .margin ({ | ||
| 53 | + top: 4, | ||
| 54 | + left: 0, | ||
| 55 | + bottom: 4, | ||
| 56 | + right: 18 | ||
| 57 | + }) | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + .width('100%') | ||
| 61 | + .height(178) | ||
| 62 | + .margin ({ | ||
| 63 | + top: 8, | ||
| 64 | + left: 18, | ||
| 65 | + bottom: 8, | ||
| 66 | + right: 18 | ||
| 67 | + }) | ||
| 68 | + | ||
| 14 | } | 69 | } |
| 15 | .backgroundColor(Color.Black) | 70 | .backgroundColor(Color.Black) |
| 16 | .width('100%') | 71 | .width('100%') |
| @@ -8,16 +8,15 @@ import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemCompone | @@ -8,16 +8,15 @@ import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemCompone | ||
| 8 | 8 | ||
| 9 | const TAG = 'MultiPictureDetailPageComponent'; | 9 | const TAG = 'MultiPictureDetailPageComponent'; |
| 10 | 10 | ||
| 11 | -@Preview | ||
| 12 | @Component | 11 | @Component |
| 13 | export struct MultiPictureDetailPageComponent { | 12 | export struct MultiPictureDetailPageComponent { |
| 13 | + private relId: string = '' | ||
| 14 | + private contentId: string = '' | ||
| 15 | + private relType: string = '' | ||
| 14 | private displayTool = display.getDefaultDisplaySync() | 16 | private displayTool = display.getDefaultDisplaySync() |
| 15 | private screenWidth: number = 0 | 17 | private screenWidth: number = 0 |
| 16 | private picWidth: number = 0 | 18 | private picWidth: number = 0 |
| 17 | @State picHeight: number = 0 | 19 | @State picHeight: number = 0 |
| 18 | - @State relId: string = '500005189942' | ||
| 19 | - @State contentId: string = '30043715146' | ||
| 20 | - @State relType: string = '1' | ||
| 21 | @State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[] | 20 | @State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[] |
| 22 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | 21 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' |
| 23 | private swiperController: SwiperController = new SwiperController() | 22 | private swiperController: SwiperController = new SwiperController() |
| @@ -35,7 +34,8 @@ export struct MultiPictureDetailPageComponent { | @@ -35,7 +34,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 35 | async aboutToAppear() { | 34 | async aboutToAppear() { |
| 36 | //获取宽高尺寸 | 35 | //获取宽高尺寸 |
| 37 | this.screenWidth = this.displayTool.width | 36 | this.screenWidth = this.displayTool.width |
| 38 | - this.picWidth = this.screenWidth - vp2px(52) | 37 | + // this.picWidth = this.screenWidth - vp2px(52) |
| 38 | + this.picWidth = this.screenWidth | ||
| 39 | this.picHeight = this.picWidth * 566 / 378 | 39 | this.picHeight = this.picWidth * 566 / 378 |
| 40 | //注册字体 | 40 | //注册字体 |
| 41 | font.registerFont({ | 41 | font.registerFont({ |
| @@ -54,12 +54,12 @@ export struct MultiPictureDetailPageComponent { | @@ -54,12 +54,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 54 | if (this.contentDetailData && this.contentDetailData.length > 0 && this.contentDetailData[0].photoList && this.contentDetailData[0].photoList?.length > 0) { | 54 | if (this.contentDetailData && this.contentDetailData.length > 0 && this.contentDetailData[0].photoList && this.contentDetailData[0].photoList?.length > 0) { |
| 55 | Swiper(this.swiperController) { | 55 | Swiper(this.swiperController) { |
| 56 | ForEach(this.contentDetailData[0].photoList, (item: PhotoListBean, index: number) => { | 56 | ForEach(this.contentDetailData[0].photoList, (item: PhotoListBean, index: number) => { |
| 57 | - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 57 | + MultiPictureDetailItemComponent({ photoListLength: this.contentDetailData[0].photoList?.length , index: index, newsTitle: this.contentDetailData[0].newsTitle, MultiPictureDetailItem: item }) |
| 58 | }) | 58 | }) |
| 59 | } | 59 | } |
| 60 | .index(this.swiperIndex) | 60 | .index(this.swiperIndex) |
| 61 | .width('100%') | 61 | .width('100%') |
| 62 | - .height(px2vp(this.picHeight) + 32) | 62 | + .height(px2vp(this.picHeight)) |
| 63 | .vertical(false) | 63 | .vertical(false) |
| 64 | .autoPlay(false) | 64 | .autoPlay(false) |
| 65 | .cachedCount(3) | 65 | .cachedCount(3) |
| 1 | import { Action, CompDTO, Params } from 'wdBean'; | 1 | import { Action, CompDTO, Params } from 'wdBean'; |
| 2 | +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | ||
| 2 | import { DateTimeUtils, Logger } from 'wdKit'; | 3 | import { DateTimeUtils, Logger } from 'wdKit'; |
| 3 | import { WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterRule } from 'wdRouter'; |
| 4 | 5 | ||
| @@ -10,7 +11,7 @@ export struct AlbumCardComponent { | @@ -10,7 +11,7 @@ export struct AlbumCardComponent { | ||
| 10 | @State compDTO: CompDTO = {} as CompDTO | 11 | @State compDTO: CompDTO = {} as CompDTO |
| 11 | 12 | ||
| 12 | aboutToAppear() { | 13 | aboutToAppear() { |
| 13 | - Logger.debug(TAG + "" + JSON.stringify(this.compDTO.operDataList)); | 14 | + Logger.debug(TAG + "this.compDTO.operDataList" + JSON.stringify(this.compDTO.operDataList)); |
| 14 | 15 | ||
| 15 | } | 16 | } |
| 16 | 17 | ||
| @@ -102,7 +103,12 @@ export struct AlbumCardComponent { | @@ -102,7 +103,12 @@ export struct AlbumCardComponent { | ||
| 102 | let taskAction: Action = { | 103 | let taskAction: Action = { |
| 103 | type: 'JUMP_DETAIL_PAGE', | 104 | type: 'JUMP_DETAIL_PAGE', |
| 104 | params: { | 105 | params: { |
| 105 | - detailPageType: 9 | 106 | + detailPageType: 13, |
| 107 | + contentID: this.compDTO.operDataList?.[0].objectId, | ||
| 108 | + extra: { | ||
| 109 | + relType: this.compDTO.operDataList?.[0].relType, | ||
| 110 | + relId: `${this.compDTO.operDataList?.[0].relId}`, | ||
| 111 | + } as ExtraDTO | ||
| 106 | } as Params, | 112 | } as Params, |
| 107 | }; | 113 | }; |
| 108 | WDRouterRule.jumpWithAction(taskAction) | 114 | WDRouterRule.jumpWithAction(taskAction) |
3.36 KB
| 1 | import { Logger } from 'wdKit'; | 1 | import { Logger } from 'wdKit'; |
| 2 | import { MultiPictureDetailPageComponent } from 'wdComponent'; | 2 | import { MultiPictureDetailPageComponent } from 'wdComponent'; |
| 3 | +import router from '@ohos.router'; | ||
| 4 | +import { Params, Action } from 'wdBean'; | ||
| 3 | 5 | ||
| 4 | const TAG = 'MultiPictureDetailPage'; | 6 | const TAG = 'MultiPictureDetailPage'; |
| 5 | 7 | ||
| @@ -10,10 +12,18 @@ const TAG = 'MultiPictureDetailPage'; | @@ -10,10 +12,18 @@ const TAG = 'MultiPictureDetailPage'; | ||
| 10 | @Component | 12 | @Component |
| 11 | struct MultiPictureDetailPage { | 13 | struct MultiPictureDetailPage { |
| 12 | 14 | ||
| 15 | + @State relId: string = '' | ||
| 16 | + @State contentId: string = '' | ||
| 17 | + @State relType: string = '' | ||
| 18 | + | ||
| 13 | build() { | 19 | build() { |
| 14 | Row() { | 20 | Row() { |
| 15 | Column() { | 21 | Column() { |
| 16 | - MultiPictureDetailPageComponent() | 22 | + MultiPictureDetailPageComponent({ |
| 23 | + relId: this.relId, | ||
| 24 | + contentId: this.contentId, | ||
| 25 | + relType: this.relType | ||
| 26 | + }) | ||
| 17 | } | 27 | } |
| 18 | } | 28 | } |
| 19 | } | 29 | } |
| @@ -28,7 +38,13 @@ struct MultiPictureDetailPage { | @@ -28,7 +38,13 @@ struct MultiPictureDetailPage { | ||
| 28 | } | 38 | } |
| 29 | 39 | ||
| 30 | aboutToAppear() { | 40 | aboutToAppear() { |
| 41 | + let par:Action = router.getParams() as Action; | ||
| 42 | + let params = par?.params; | ||
| 43 | + this.relId = params?.extra?.relId || ''; | ||
| 44 | + this.relType = params?.extra?.relType || ''; | ||
| 45 | + this.contentId = params?.contentID || ''; | ||
| 31 | Logger.info(TAG, 'aboutToAppear'); | 46 | Logger.info(TAG, 'aboutToAppear'); |
| 47 | + Logger.info(TAG, 'params', JSON.stringify(params)); | ||
| 32 | } | 48 | } |
| 33 | 49 | ||
| 34 | aboutToDisappear() { | 50 | aboutToDisappear() { |
-
Please register or login to post a comment