Showing
2 changed files
with
103 additions
and
0 deletions
| @@ -9,6 +9,7 @@ import { Card9Component } from './cardview/Card9Component'; | @@ -9,6 +9,7 @@ import { Card9Component } from './cardview/Card9Component'; | ||
| 9 | import { Card10Component } from './cardview/Card10Component'; | 9 | import { Card10Component } from './cardview/Card10Component'; |
| 10 | import { Card11Component } from './cardview/Card11Component'; | 10 | import { Card11Component } from './cardview/Card11Component'; |
| 11 | import { Card17Component } from './cardview/Card17Component'; | 11 | import { Card17Component } from './cardview/Card17Component'; |
| 12 | +import { Card15Component } from './cardview/Card15Component'; | ||
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| 14 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle | 15 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle |
| @@ -39,6 +40,8 @@ export struct CardParser { | @@ -39,6 +40,8 @@ export struct CardParser { | ||
| 39 | Card9Component({ contentDTO }) | 40 | Card9Component({ contentDTO }) |
| 40 | } else if (contentDTO.appStyle === CompStyle.Card_10) { | 41 | } else if (contentDTO.appStyle === CompStyle.Card_10) { |
| 41 | Card10Component({ contentDTO }) | 42 | Card10Component({ contentDTO }) |
| 43 | + } else if (contentDTO.appStyle === CompStyle.Card_15) { | ||
| 44 | + Card15Component({ contentDTO }) | ||
| 42 | } else if (contentDTO.appStyle === CompStyle.Card_11) { | 45 | } else if (contentDTO.appStyle === CompStyle.Card_11) { |
| 43 | Card11Component({ contentDTO }) | 46 | Card11Component({ contentDTO }) |
| 44 | } else if (contentDTO.appStyle === CompStyle.Card_17) { | 47 | } else if (contentDTO.appStyle === CompStyle.Card_17) { |
| 1 | +//全标题 "appStyle":"2", | ||
| 2 | +import { ContentDTO } from 'wdBean'; | ||
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +const TAG: string = 'Card15Component'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 大图卡人民号: | ||
| 10 | + * compstyle:15 | ||
| 11 | + * 卡片结构:上下结构 | ||
| 12 | + * 卡片宽度:充满父窗口 | ||
| 13 | + * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: | ||
| 14 | + */ | ||
| 15 | +// @Entry | ||
| 16 | +@Component | ||
| 17 | +export struct Card15Component { | ||
| 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 | +} |
-
Please register or login to post a comment