王士厅

多图详情页开发

@@ -23,7 +23,7 @@ export { Pic } from './src/main/ets/bean/content/Pic' @@ -23,7 +23,7 @@ export { Pic } from './src/main/ets/bean/content/Pic'
23 23
24 export { InteractDataDTO } from './src/main/ets/bean/content/InteractDataDTO'; 24 export { InteractDataDTO } from './src/main/ets/bean/content/InteractDataDTO';
25 25
26 -export { InteractDataStatusDTO } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; 26 +export { InteractDataStatusBean, PhotoListBean } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
27 27
28 export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; 28 export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
29 29
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * 多图(图集)详情 2 * 多图(图集)详情
3 * */ 3 * */
4 // 批量查询内容当前用户点赞、收藏状态 4 // 批量查询内容当前用户点赞、收藏状态
5 -export interface InteractDataStatusDTO { 5 +export interface InteractDataStatusBean {
6 contentId: string; 6 contentId: string;
7 contentType: number; 7 contentType: number;
8 contentRelId: string; 8 contentRelId: string;
@@ -10,3 +10,11 @@ export interface InteractDataStatusDTO { @@ -10,3 +10,11 @@ export interface InteractDataStatusDTO {
10 likeStatus: number; 10 likeStatus: number;
11 collectStatus: number; 11 collectStatus: number;
12 } 12 }
  13 +
  14 +// 【图文、图集稿件正文图片】图片信息数组
  15 +export interface PhotoListBean {
  16 + height: number;
  17 + width: number;
  18 + picPath: string;
  19 + picDesc: number;
  20 +}
  1 +import { PhotoListBean } from 'wdBean';
  2 +
  3 +@Component
  4 +export struct MultiPictureDetailItemComponent {
  5 + private newsTitle: string = '';
  6 + private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean
  7 +
  8 + build() {
  9 + Stack() {
  10 + Image(this.MultiPictureDetailItem.picPath)
  11 + .width('100%')
  12 + .aspectRatio(378 / 566)
  13 + .objectFit(ImageFit.Fill)
  14 + }
  15 + .padding({ top: 16, right: 16, bottom: 16, left: 16 })
  16 + .margin({ left: 10, right: 10 })
  17 + .backgroundColor(Color.White)
  18 + .width('100%')
  19 + }
  20 +}
1 import { Logger } from 'wdKit'; 1 import { Logger } from 'wdKit';
2 -import { ContentDetailDTO } from 'wdBean'; 2 +import { ContentDetailDTO, PhotoListBean } from 'wdBean';
3 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 3 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
4 import display from '@ohos.display'; 4 import display from '@ohos.display';
5 import font from '@ohos.font'; 5 import font from '@ohos.font';
  6 +import { OperRowListView } from './view/OperRowListView';
  7 +import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
6 8
7 const TAG = 'MultiPictureDetailPageComponent'; 9 const TAG = 'MultiPictureDetailPageComponent';
8 10
@@ -48,10 +50,11 @@ export struct MultiPictureDetailPageComponent { @@ -48,10 +50,11 @@ export struct MultiPictureDetailPageComponent {
48 50
49 build() { 51 build() {
50 RelativeContainer() { 52 RelativeContainer() {
51 - if (this.contentDetailData && this.contentDetailData.length > 0) { 53 + RelativeContainer() {
  54 + if (this.contentDetailData?.[0].photoList?.length > 0) {
52 Swiper(this.swiperController) { 55 Swiper(this.swiperController) {
53 - ForEach(this.contentDetailData, (item: ContentDetailDTO, index: number) => {  
54 - // ENewspaperItemComponent({ newspaperListItemBean: item }) 56 + ForEach(this.contentDetailData[0].photoList, (item: PhotoListBean, index: number) => {
  57 + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
55 }) 58 })
56 } 59 }
57 .index(this.swiperIndex) 60 .index(this.swiperIndex)
@@ -63,15 +66,32 @@ export struct MultiPictureDetailPageComponent { @@ -63,15 +66,32 @@ export struct MultiPictureDetailPageComponent {
63 .indicator(false) 66 .indicator(false)
64 .displayCount(1) 67 .displayCount(1)
65 .margin({ top: 35, left: 10, right: 10 }) 68 .margin({ top: 35, left: 10, right: 10 })
66 - .id('e_newspaper_content') 69 + .id('e_picture_content')
67 .alignRules({ 70 .alignRules({
68 - top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom }, 71 + top: { anchor: "e_picture_container", align: VerticalAlign.Bottom },
69 middle: { anchor: "__container__", align: HorizontalAlign.Center } 72 middle: { anchor: "__container__", align: HorizontalAlign.Center }
70 }) 73 })
71 .onChange((index: number) => { 74 .onChange((index: number) => {
72 this.swiperIndex = index 75 this.swiperIndex = index
73 }) 76 })
74 - }} 77 + }
  78 + }
  79 + RelativeContainer() {
  80 + OperRowListView()
  81 + .alignRules({
  82 + top: { anchor: "e_picture_container", align: VerticalAlign.Bottom },
  83 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  84 + })
  85 + }
  86 + .width('100%')
  87 + .height(100)
  88 + .margin({ left: 20 })
  89 + .border({ width: 2, color: '#6699FF' })
  90 + }
  91 + .width('100%')
  92 + .height('100%')
  93 + .backgroundColor($r('app.color.color_80000000'))
  94 + .id('e_picture_container')
75 } 95 }
76 96
77 private async getContentDetailData() { 97 private async getContentDetailData() {