Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
王士厅
2024-03-29 15:32:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4610ef215eb75f9dfeb60fe27b5ff02f1c99b498
4610ef21
1 parent
53fa6ed2
多图详情页布局,接口联调获取swiper图片
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
18 deletions
sight_harmony/commons/wdRouter/src/main/ets/router/Action2Page.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/Params.ts
sight_harmony/features/wdBean/src/main/ets/bean/detail/MultiPictureDetailPageDTO.ts
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailItemComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/AlbumCardComponent.ets
sight_harmony/features/wdComponent/src/main/resources/base/media/picture_loading.png
sight_harmony/products/phone/src/main/ets/pages/detail/MultiPictureDetailPage.ets
sight_harmony/commons/wdRouter/src/main/ets/router/Action2Page.ets
View file @
4610ef2
...
...
@@ -54,7 +54,7 @@ export function registerRouter() {
// }
if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) {
return WDRouterPage.detailPlayShortVideoPage
} else if (action.params?.detailPageType ==
9
) {
} else if (action.params?.detailPageType ==
13
) {
return WDRouterPage.multiPictureDetailPage
}
return WDRouterPage.detailPlayVodPage
...
...
sight_harmony/features/wdBean/src/main/ets/bean/content/Params.ts
View file @
4610ef2
...
...
@@ -16,6 +16,6 @@ export interface Params {
// 6.挂件详情页
// 7.沉浸式竖屏详情页
// 8.专辑竖屏详情页
//
9
.多图(图集)详情页
//
13
.多图(图集)详情页
detailPageType
?:
number
;
// 详情页类型
}
...
...
sight_harmony/features/wdBean/src/main/ets/bean/detail/MultiPictureDetailPageDTO.ts
View file @
4610ef2
...
...
@@ -16,5 +16,5 @@ export interface PhotoListBean {
height
:
number
;
width
:
number
;
picPath
:
string
;
picDesc
:
number
;
picDesc
:
string
;
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailItemComponent.ets
View file @
4610ef2
import { PhotoListBean } from 'wdBean';
import { Logger } from 'wdKit';
const TAG = 'MultiPictureDetailPageComponent';
@Component
export struct MultiPictureDetailItemComponent {
private photoListLength: number = 1;
private index: number = 1;
private newsTitle: string = '';
private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean
async aboutToAppear() {
Logger.info(TAG, 'pictures preview')
}
build() {
Stack() {
Image(this.MultiPictureDetailItem.picPath)
.width('100%')
.aspectRatio(this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height)
.objectFit(ImageFit.Fill)
Stack({ alignContent: Alignment.BottomStart }) {
Row() {
Image(this.MultiPictureDetailItem.picPath)
.alt($r('app.media.picture_loading'))
.width('100%')
.aspectRatio(this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height)
.objectFit(ImageFit.Fill)
}
.height('100%')
.width('100%')
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text() {
Span(`${this.index + 1}`).fontSize(24).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(28)
Span(`/${this.photoListLength}`).fontSize(14).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(19)
}.fontColor(Color.White).margin(4)
Text(`${this.newsTitle}`).fontColor(Color.White).fontSize(16).fontFamily('PingFang SC-Semibold')
.fontWeight(600).lineHeight(24)
.margin ({
top: 4,
left: 0,
bottom: 4,
right: 0
})
Text(`${this.MultiPictureDetailItem.picDesc}`).fontColor(Color.White)
.fontSize(14).fontFamily('PingFang SC-Regular').fontWeight(400).lineHeight(22)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin ({
top: 4,
left: 0,
bottom: 4,
right: 18
})
}
}
.width('100%')
.height(178)
.margin ({
top: 8,
left: 18,
bottom: 8,
right: 18
})
}
.backgroundColor(Color.Black)
.width('100%')
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
View file @
4610ef2
...
...
@@ -8,16 +8,15 @@ import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemCompone
const TAG = 'MultiPictureDetailPageComponent';
@Preview
@Component
export struct MultiPictureDetailPageComponent {
private relId: string = ''
private contentId: string = ''
private relType: string = ''
private displayTool = display.getDefaultDisplaySync()
private screenWidth: number = 0
private picWidth: number = 0
@State picHeight: number = 0
@State relId: string = '500005189942'
@State contentId: string = '30043715146'
@State relType: string = '1'
@State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[]
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private swiperController: SwiperController = new SwiperController()
...
...
@@ -35,7 +34,8 @@ export struct MultiPictureDetailPageComponent {
async aboutToAppear() {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
this.picWidth = this.screenWidth - vp2px(52)
// this.picWidth = this.screenWidth - vp2px(52)
this.picWidth = this.screenWidth
this.picHeight = this.picWidth * 566 / 378
//注册字体
font.registerFont({
...
...
@@ -54,12 +54,12 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData && this.contentDetailData.length > 0 && this.contentDetailData[0].photoList && this.contentDetailData[0].photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData[0].photoList, (item: PhotoListBean, index: number) => {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
MultiPictureDetailItemComponent({
photoListLength: this.contentDetailData[0].photoList?.length , index: index, newsTitle: this.contentDetailData[0].newsTitle,
MultiPictureDetailItem: item })
})
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight)
+ 32
)
.height(px2vp(this.picHeight))
.vertical(false)
.autoPlay(false)
.cachedCount(3)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/AlbumCardComponent.ets
View file @
4610ef2
import { Action, CompDTO, Params } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { DateTimeUtils, Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
...
...
@@ -10,7 +11,7 @@ export struct AlbumCardComponent {
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear() {
Logger.debug(TAG + "" + JSON.stringify(this.compDTO.operDataList));
Logger.debug(TAG + "
this.compDTO.operDataList
" + JSON.stringify(this.compDTO.operDataList));
}
...
...
@@ -102,7 +103,12 @@ export struct AlbumCardComponent {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 9
detailPageType: 13,
contentID: this.compDTO.operDataList?.[0].objectId,
extra: {
relType: this.compDTO.operDataList?.[0].relType,
relId: `${this.compDTO.operDataList?.[0].relId}`,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/picture_loading.png
0 → 100644
View file @
4610ef2
3.36 KB
sight_harmony/products/phone/src/main/ets/pages/detail/MultiPictureDetailPage.ets
View file @
4610ef2
import { Logger } from 'wdKit';
import { MultiPictureDetailPageComponent } from 'wdComponent';
import router from '@ohos.router';
import { Params, Action } from 'wdBean';
const TAG = 'MultiPictureDetailPage';
...
...
@@ -10,10 +12,18 @@ const TAG = 'MultiPictureDetailPage';
@Component
struct MultiPictureDetailPage {
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
build() {
Row() {
Column() {
MultiPictureDetailPageComponent()
MultiPictureDetailPageComponent({
relId: this.relId,
contentId: this.contentId,
relType: this.relType
})
}
}
}
...
...
@@ -28,7 +38,13 @@ struct MultiPictureDetailPage {
}
aboutToAppear() {
let par:Action = router.getParams() as Action;
let params = par?.params;
this.relId = params?.extra?.relId || '';
this.relType = params?.extra?.relType || '';
this.contentId = params?.contentID || '';
Logger.info(TAG, 'aboutToAppear');
Logger.info(TAG, 'params', JSON.stringify(params));
}
aboutToDisappear() {
...
...
Please
register
or
login
to post a comment