Showing
9 changed files
with
490 additions
and
5 deletions
| @@ -2,10 +2,11 @@ import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO'; | @@ -2,10 +2,11 @@ import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO'; | ||
| 2 | import { LiveInfoDTO } from '../detail/LiveInfoDTO'; | 2 | import { LiveInfoDTO } from '../detail/LiveInfoDTO'; |
| 3 | import { VideoInfoDTO } from '../detail/VideoInfoDTO'; | 3 | import { VideoInfoDTO } from '../detail/VideoInfoDTO'; |
| 4 | import { InteractDataDTO } from './InteractDataDTO'; | 4 | import { InteractDataDTO } from './InteractDataDTO'; |
| 5 | -import { slideShows } from '../morningevening/slideShows' | ||
| 6 | -import { VoiceInfoDTO } from '../detail/VoiceInfoDTO' | 5 | +import { slideShows } from '../morningevening/slideShows'; |
| 6 | +import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; | ||
| 7 | 7 | ||
| 8 | export interface ContentDTO { | 8 | export interface ContentDTO { |
| 9 | + appStyle: string; | ||
| 9 | cityCode: string; | 10 | cityCode: string; |
| 10 | coverSize: string; | 11 | coverSize: string; |
| 11 | coverType: number; | 12 | coverType: number; |
| 1 | +import { CommonConstants } from 'wdConstant'; | ||
| 2 | +import { Card3Component } from './cardview/Card3Component'; | ||
| 3 | +import { Card2Component } from './cardview/Card2Component'; | ||
| 4 | +import { Card4Component } from './cardview/Card4Component'; | ||
| 5 | +import { ContentDTO } from 'wdBean'; | ||
| 6 | +import { Card5Component } from './cardview/Card5Component'; | ||
| 7 | +import { Card6Component } from './cardview/Card6Component'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * card适配器,卡片样式汇总,依据ContentDTO#appStyle | ||
| 11 | + * 卡片样式,最小单元样式布局 | ||
| 12 | + */ | ||
| 13 | +@Component | ||
| 14 | +export struct CardParser { | ||
| 15 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 16 | + | ||
| 17 | + build() { | ||
| 18 | + this.contentBuilder(this.contentDTO); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + @Builder | ||
| 22 | + contentBuilder(contentDTO: ContentDTO) { | ||
| 23 | + if (contentDTO.appStyle === '2') { | ||
| 24 | + Card2Component({ contentDTO }) | ||
| 25 | + } else if (contentDTO.appStyle === '3') { | ||
| 26 | + Card3Component({ contentDTO }) | ||
| 27 | + } else if (contentDTO.appStyle === "4") { | ||
| 28 | + Card4Component({ contentDTO }) | ||
| 29 | + } else if (contentDTO.appStyle === "5") { | ||
| 30 | + Card5Component({ contentDTO }) | ||
| 31 | + } else if (contentDTO.appStyle === "6") { | ||
| 32 | + Card6Component({ contentDTO }) | ||
| 33 | + } | ||
| 34 | + else { | ||
| 35 | + // todo:组件未实现 / Component Not Implemented | ||
| 36 | + Text(contentDTO.appStyle) | ||
| 37 | + .width(CommonConstants.FULL_PARENT) | ||
| 38 | + .padding(10) | ||
| 39 | + // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | +} |
| 1 | +//全标题 "appStyle":"2", | ||
| 2 | +import { ContentDTO } from 'wdBean'; | ||
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +const TAG: string = 'Card2Component'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 大图卡: | ||
| 10 | + * compstyle:2 | ||
| 11 | + * 卡片结构:上下结构 | ||
| 12 | + * 卡片宽度:充满父窗口 | ||
| 13 | + * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: | ||
| 14 | + */ | ||
| 15 | +// @Entry | ||
| 16 | +@Component | ||
| 17 | +export struct Card2Component { | ||
| 18 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 19 | + | ||
| 20 | + build() { | ||
| 21 | + Column() { | ||
| 22 | + | ||
| 23 | + Column() { | ||
| 24 | + //新闻标题 | ||
| 25 | + Text(this.contentDTO.newsTitle) | ||
| 26 | + .fontSize(17) | ||
| 27 | + .fontColor('#222222') | ||
| 28 | + .maxLines(3) | ||
| 29 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 30 | + .align(Alignment.Start) | ||
| 31 | + //大图 | ||
| 32 | + Stack() { | ||
| 33 | + Image(this.contentDTO.coverUrl) | ||
| 34 | + .borderRadius(4) | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + //播放状态+时长 | ||
| 38 | + Row() { | ||
| 39 | + Image($r('app.media.icon_live')) | ||
| 40 | + .width(22) | ||
| 41 | + .height(18) | ||
| 42 | + | ||
| 43 | + Stack() { | ||
| 44 | + Text('直播中') | ||
| 45 | + .fontColor('#FFFFFF') | ||
| 46 | + .fontSize(11) | ||
| 47 | + } | ||
| 48 | + .width(44) | ||
| 49 | + .height(18) | ||
| 50 | + .backgroundColor('#4d000000') | ||
| 51 | + }.margin({ right: 8, bottom: 8 }) | ||
| 52 | + | ||
| 53 | + } | ||
| 54 | + .width('100%') | ||
| 55 | + .height(192) | ||
| 56 | + .alignContent(Alignment.BottomEnd) | ||
| 57 | + .margin({ top: 8 }) | ||
| 58 | + | ||
| 59 | + } | ||
| 60 | + .width('100%') | ||
| 61 | + .justifyContent(FlexAlign.Start) | ||
| 62 | + .alignItems(HorizontalAlign.Start) | ||
| 63 | + .padding({ top: 14 }) | ||
| 64 | + | ||
| 65 | + //bottom | ||
| 66 | + Row() { | ||
| 67 | + Text(this.contentDTO.source) | ||
| 68 | + .bottomTextStyle() | ||
| 69 | + //间隔点 | ||
| 70 | + Image($r('app.media.point')) | ||
| 71 | + .width(12) | ||
| 72 | + .height(12) | ||
| 73 | + | ||
| 74 | + Text(this.contentDTO.source) | ||
| 75 | + .bottomTextStyle() | ||
| 76 | + Text(' ') | ||
| 77 | + | ||
| 78 | + Text(this.contentDTO.subtitle) | ||
| 79 | + .bottomTextStyle() | ||
| 80 | + | ||
| 81 | + } | ||
| 82 | + .width('100%') | ||
| 83 | + .height(18) | ||
| 84 | + .justifyContent(FlexAlign.Start) | ||
| 85 | + // .padding({bottom:14}) | ||
| 86 | + .margin({ top: 8 }) | ||
| 87 | + } | ||
| 88 | + .width('100%') | ||
| 89 | + .padding({ left: 16, right: 16 }) | ||
| 90 | + .onClick((event: ClickEvent) => { | ||
| 91 | + ProcessUtils.processPage(this.contentDTO) | ||
| 92 | + }) | ||
| 93 | + } | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +@Extend(Text) | ||
| 97 | +function bottomTextStyle() { | ||
| 98 | + .fontSize(12) | ||
| 99 | + .fontColor('#B0B0B0') | ||
| 100 | +} |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant' | ||
| 3 | +import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils' | ||
| 4 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 卡片样式:"appStyle":"3" | ||
| 8 | + */ | ||
| 9 | +@Component | ||
| 10 | +export struct Card3Component { | ||
| 11 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 12 | + | ||
| 13 | + build() { | ||
| 14 | + Column() { | ||
| 15 | + Text(this.contentDTO.newsTitle) | ||
| 16 | + .fontSize($r("app.float.font_size_16")) | ||
| 17 | + .fontColor($r("app.color.color_222222")) | ||
| 18 | + .width(CommonConstants.FULL_WIDTH) | ||
| 19 | + Row() { | ||
| 20 | + Text("锐评") | ||
| 21 | + .fontSize($r("app.float.font_size_12")) | ||
| 22 | + .fontColor($r("app.color.color_ED2800")) | ||
| 23 | + Text(this.contentDTO.source) | ||
| 24 | + .fontSize($r("app.float.font_size_12")) | ||
| 25 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 26 | + .margin({ left: 6 }) | ||
| 27 | + Image($r("app.media.point")) | ||
| 28 | + .width(16) | ||
| 29 | + .height(16) | ||
| 30 | + | ||
| 31 | + Text(DateTimeUtils.formatDate(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 32 | + .fontSize($r("app.float.font_size_12")) | ||
| 33 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 34 | + | ||
| 35 | + }.width(CommonConstants.FULL_WIDTH) | ||
| 36 | + .justifyContent(FlexAlign.Start) | ||
| 37 | + .margin({ top: 8 }) | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | + .width("100%") | ||
| 41 | + .padding({ | ||
| 42 | + top: 14, | ||
| 43 | + left: 16, | ||
| 44 | + right: 16, | ||
| 45 | + bottom: 14 | ||
| 46 | + }) | ||
| 47 | + .backgroundColor($r("app.color.white")) | ||
| 48 | + .margin({ bottom: 8 }) | ||
| 49 | + .onClick((event: ClickEvent) => { | ||
| 50 | + ProcessUtils.processPage(this.contentDTO) | ||
| 51 | + }) | ||
| 52 | + } | ||
| 53 | +} |
| 1 | +//全标题 "appStyle":"4", | ||
| 2 | +import { ContentDTO } from 'wdBean'; | ||
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 4 | + | ||
| 5 | +const TAG: string = 'Card4Component'; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 三图卡: | ||
| 9 | + * compstyle:4 | ||
| 10 | + * 卡片结构:上下结构 | ||
| 11 | + * 卡片宽度:充满父窗口 | ||
| 12 | + * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: | ||
| 13 | + */ | ||
| 14 | +@Component | ||
| 15 | +export struct Card4Component { | ||
| 16 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 17 | + | ||
| 18 | + build() { | ||
| 19 | + Column() { | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + //body | ||
| 23 | + Column() { | ||
| 24 | + //新闻标题 | ||
| 25 | + Text(this.contentDTO.newsTitle) | ||
| 26 | + .fontSize(17) | ||
| 27 | + .fontColor('#222222') | ||
| 28 | + .maxLines(3) | ||
| 29 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 30 | + //三图 | ||
| 31 | + Row() { | ||
| 32 | + Image(this.contentDTO.fullColumnImgUrls[0]?.url) | ||
| 33 | + .width('32%') | ||
| 34 | + | ||
| 35 | + .height(75) | ||
| 36 | + .borderRadius({ topLeft:4,bottomLeft:4 }) | ||
| 37 | + | ||
| 38 | + Image(this.contentDTO.fullColumnImgUrls[1]?.url) | ||
| 39 | + .width('32%') | ||
| 40 | + .height(75) | ||
| 41 | + | ||
| 42 | + Image(this.contentDTO.fullColumnImgUrls[2]?.url) | ||
| 43 | + .width('32%') | ||
| 44 | + .height(75) | ||
| 45 | + .borderRadius({ topRight:4,bottomRight:4 }) | ||
| 46 | + | ||
| 47 | + } | ||
| 48 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 49 | + .width('100%') | ||
| 50 | + .height(75) | ||
| 51 | + .margin({top:8}) | ||
| 52 | + .borderRadius(8) | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + .width('100%') | ||
| 56 | + .justifyContent(FlexAlign.Start) | ||
| 57 | + .alignItems(HorizontalAlign.Start) | ||
| 58 | + .padding({top:14}) | ||
| 59 | + .onClick((event: ClickEvent)=>{ | ||
| 60 | + ProcessUtils.processPage(this.contentDTO) | ||
| 61 | + }) | ||
| 62 | + | ||
| 63 | + | ||
| 64 | + //bottom | ||
| 65 | + Row() { | ||
| 66 | + Text(this.contentDTO.source) | ||
| 67 | + .bottomTextStyle() | ||
| 68 | + //间隔点 | ||
| 69 | + Image($r('app.media.point')) | ||
| 70 | + .width(12) | ||
| 71 | + .height(12) | ||
| 72 | + | ||
| 73 | + Text(this.contentDTO.publishTime) | ||
| 74 | + .bottomTextStyle() | ||
| 75 | + Text(' ') | ||
| 76 | + | ||
| 77 | + Text('518条评论') | ||
| 78 | + .bottomTextStyle() | ||
| 79 | + | ||
| 80 | + } | ||
| 81 | + .width('100%') | ||
| 82 | + | ||
| 83 | + .justifyContent(FlexAlign.Start) | ||
| 84 | + // .padding({bottom:14}) | ||
| 85 | + .margin({top:8}) | ||
| 86 | + .padding({bottom:14}) | ||
| 87 | + | ||
| 88 | + } | ||
| 89 | + .width('100%') | ||
| 90 | + .padding({top:8,left:16,right:16}) | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | + | ||
| 96 | +@Extend(Text) function bottomTextStyle() { | ||
| 97 | + .fontSize(12) | ||
| 98 | + .fontColor('#B0B0B0') | ||
| 99 | +} |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant'; | ||
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 4 | + | ||
| 5 | +const TAG: string = 'Card5Component'; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 卡片样式:"appStyle":"5" | ||
| 9 | + */ | ||
| 10 | +@Component | ||
| 11 | +export struct Card5Component { | ||
| 12 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 13 | + | ||
| 14 | + build() { | ||
| 15 | + Stack() { | ||
| 16 | + Image(this.contentDTO.coverUrl) | ||
| 17 | + .width(CommonConstants.FULL_WIDTH) | ||
| 18 | + .autoResize(true) | ||
| 19 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 20 | + if (this.contentDTO.newsTitle) { | ||
| 21 | + Row() | ||
| 22 | + .width(CommonConstants.FULL_WIDTH) | ||
| 23 | + .height(59) | ||
| 24 | + .linearGradient({ | ||
| 25 | + colors: [ | ||
| 26 | + ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0] | ||
| 27 | + ] | ||
| 28 | + }) | ||
| 29 | + Row() { | ||
| 30 | + Text(this.contentDTO.newsTitle) | ||
| 31 | + .width(CommonConstants.FULL_WIDTH) | ||
| 32 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 33 | + .fontColor(Color.White) | ||
| 34 | + .fontSize($r('app.float.normal_text_size')) | ||
| 35 | + .fontWeight(FontWeight.Bold) | ||
| 36 | + .maxLines(2) | ||
| 37 | + .align(Alignment.Bottom) | ||
| 38 | + } | ||
| 39 | + .justifyContent(FlexAlign.Start) | ||
| 40 | + .height(40) | ||
| 41 | + .margin({ left: 12, bottom: 10, right: 12 }) | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + .alignContent(Alignment.Bottom) | ||
| 45 | + .width(CommonConstants.FULL_WIDTH) | ||
| 46 | + .padding( | ||
| 47 | + { top: 16, bottom: 16, left: 14, right: 14 }) | ||
| 48 | + .onClick((event: ClickEvent) => { | ||
| 49 | + ProcessUtils.processPage(this.contentDTO) | ||
| 50 | + }) | ||
| 51 | + | ||
| 52 | + } | ||
| 53 | +} |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 3 | +import { DateTimeUtils } from 'wdKit'; | ||
| 4 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | + | ||
| 6 | +const TAG: string = 'Card6Component'; | ||
| 7 | +const FULL_PARENT: string = '100%'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 卡片样式:"appStyle":"6" | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +export struct Card6Component { | ||
| 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Row() { | ||
| 18 | + Column() { | ||
| 19 | + Column() { | ||
| 20 | + Text(this.contentDTO.newsTitle) | ||
| 21 | + .fontSize(16) | ||
| 22 | + .fontWeight(FontWeight.Normal) | ||
| 23 | + .maxLines(3)// | ||
| 24 | + .alignSelf(ItemAlign.Start) | ||
| 25 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 26 | + }.height("80%") | ||
| 27 | + .justifyContent(FlexAlign.Start) | ||
| 28 | + | ||
| 29 | + Row() { | ||
| 30 | + if (this.contentDTO.source) { | ||
| 31 | + Text(this.contentDTO.source) | ||
| 32 | + .fontSize($r('app.float.font_size_12')) | ||
| 33 | + .fontColor(Color.Gray) | ||
| 34 | + .maxLines(1) | ||
| 35 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 36 | + .width(this.contentDTO.source.length > 8 ? '50%' : '') | ||
| 37 | + Image($r('app.media.point')) | ||
| 38 | + .width(16) | ||
| 39 | + .height(16) | ||
| 40 | + } | ||
| 41 | + if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) { | ||
| 42 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 43 | + .fontSize($r('app.float.font_size_12')) | ||
| 44 | + .fontColor(Color.Gray) | ||
| 45 | + } | ||
| 46 | + Text(this.contentDTO.visitorComment + '评') | ||
| 47 | + .fontSize($r('app.float.font_size_12')) | ||
| 48 | + .fontColor(Color.Gray) | ||
| 49 | + .padding({ | ||
| 50 | + left: 5 | ||
| 51 | + }) | ||
| 52 | + }.alignSelf(ItemAlign.Start) | ||
| 53 | + .height("20%") | ||
| 54 | + .justifyContent(FlexAlign.Start) | ||
| 55 | + } | ||
| 56 | + .alignItems(HorizontalAlign.Start) | ||
| 57 | + .justifyContent(FlexAlign.Start) | ||
| 58 | + .width('58%') | ||
| 59 | + | ||
| 60 | + Blank(16) | ||
| 61 | + if (this.contentDTO.coverUrl) { | ||
| 62 | + Stack() { | ||
| 63 | + Image(this.contentDTO.coverUrl) | ||
| 64 | + .borderRadius(5) | ||
| 65 | + .aspectRatio(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4) | ||
| 66 | + .height(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 90 : 180) | ||
| 67 | + if (this.contentDTO.videoInfo) { | ||
| 68 | + Row() { | ||
| 69 | + Image($r('app.media.iv_card_play_yellow_flag')) | ||
| 70 | + .width(22) | ||
| 71 | + .height(18) | ||
| 72 | + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) | ||
| 73 | + .fontSize($r('app.float.font_size_13')) | ||
| 74 | + .fontWeight(400) | ||
| 75 | + .fontColor($r('app.color.color_fff')) | ||
| 76 | + } | ||
| 77 | + .alignItems(VerticalAlign.Bottom) | ||
| 78 | + .height(18) | ||
| 79 | + .padding({ right: 4 }) | ||
| 80 | + .margin({ | ||
| 81 | + right: 4, | ||
| 82 | + bottom: 4 | ||
| 83 | + }) | ||
| 84 | + .backgroundColor($r('app.color.color_4d000000')) | ||
| 85 | + } else if (this.contentDTO.voiceInfo) { | ||
| 86 | + Row() { | ||
| 87 | + Image($r('app.media.icon_listen')) | ||
| 88 | + .width(22) | ||
| 89 | + .height(18) | ||
| 90 | + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo | ||
| 91 | + .voiceDuration * 1000)) | ||
| 92 | + .fontSize($r('app.float.font_size_13')) | ||
| 93 | + .fontWeight(400) | ||
| 94 | + .fontColor($r('app.color.color_fff')) | ||
| 95 | + } | ||
| 96 | + .alignItems(VerticalAlign.Bottom) | ||
| 97 | + .height(18) | ||
| 98 | + .padding({ right: 4 }) | ||
| 99 | + .margin({ | ||
| 100 | + right: 4, | ||
| 101 | + bottom: 4 | ||
| 102 | + }) | ||
| 103 | + .backgroundColor($r('app.color.color_4d000000')) | ||
| 104 | + } | ||
| 105 | + }.alignContent(Alignment.BottomEnd) | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + .onClick((event: ClickEvent) => { | ||
| 109 | + ProcessUtils.processPage(this.contentDTO) | ||
| 110 | + }) | ||
| 111 | + .padding( | ||
| 112 | + { top: 16, bottom: 16, left: 14, right: 14 }) | ||
| 113 | + .width(FULL_PARENT) | ||
| 114 | + .height(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 127 : 217) | ||
| 115 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 116 | + | ||
| 117 | + } | ||
| 118 | +} |
| 1 | -import { CompDTO } from 'wdBean'; | ||
| 2 | -import { CommonConstants } from 'wdConstant' | 1 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 2 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 3 | +import { CardParser } from '../CardParser'; | ||
| 4 | 4 | ||
| 5 | const TAG: string = 'BigPicCardComponent'; | 5 | const TAG: string = 'BigPicCardComponent'; |
| 6 | 6 | ||
| @@ -15,8 +15,22 @@ const TAG: string = 'BigPicCardComponent'; | @@ -15,8 +15,22 @@ const TAG: string = 'BigPicCardComponent'; | ||
| 15 | @Component | 15 | @Component |
| 16 | export struct BigPicCardComponent { | 16 | export struct BigPicCardComponent { |
| 17 | @State compDTO: CompDTO = {} as CompDTO | 17 | @State compDTO: CompDTO = {} as CompDTO |
| 18 | + contentDTO: ContentDTO = {} as ContentDTO; | ||
| 19 | + | ||
| 20 | + aboutToAppear() { | ||
| 21 | + // 取第一个数据 | ||
| 22 | + this.contentDTO = this.compDTO.operDataList[0]; | ||
| 23 | + this.contentDTO.appStyle = "2"; | ||
| 24 | + } | ||
| 18 | 25 | ||
| 19 | build() { | 26 | build() { |
| 27 | + this.cardBuild(); | ||
| 28 | + // this.originalBuild(); | ||
| 29 | + | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + @Builder | ||
| 33 | + originalBuild() { | ||
| 20 | Column() { | 34 | Column() { |
| 21 | 35 | ||
| 22 | Column() { | 36 | Column() { |
| @@ -86,10 +100,14 @@ export struct BigPicCardComponent { | @@ -86,10 +100,14 @@ export struct BigPicCardComponent { | ||
| 86 | } | 100 | } |
| 87 | .width('100%') | 101 | .width('100%') |
| 88 | .padding({ left: 16, right: 16 }) | 102 | .padding({ left: 16, right: 16 }) |
| 89 | - .onClick((event: ClickEvent) =>{ | 103 | + .onClick((event: ClickEvent) => { |
| 90 | ProcessUtils.processPage(this.compDTO.operDataList[0]) | 104 | ProcessUtils.processPage(this.compDTO.operDataList[0]) |
| 91 | }) | 105 | }) |
| 106 | + } | ||
| 92 | 107 | ||
| 108 | + @Builder | ||
| 109 | + cardBuild() { | ||
| 110 | + CardParser({ contentDTO: this.contentDTO }); | ||
| 93 | } | 111 | } |
| 94 | } | 112 | } |
| 95 | 113 |
-
Please register or login to post a comment