Showing
3 changed files
with
62 additions
and
2 deletions
| @@ -12,6 +12,7 @@ import { Card17Component } from './cardview/Card17Component'; | @@ -12,6 +12,7 @@ import { Card17Component } from './cardview/Card17Component'; | ||
| 12 | import { Card15Component } from './cardview/Card15Component'; | 12 | import { Card15Component } from './cardview/Card15Component'; |
| 13 | import { Card19Component } from './cardview/Card19Component'; | 13 | import { Card19Component } from './cardview/Card19Component'; |
| 14 | import { Card20Component } from './cardview/Card20Component'; | 14 | import { Card20Component } from './cardview/Card20Component'; |
| 15 | +import { Card21Component } from './cardview/Card21Component'; | ||
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| 17 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle | 18 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle |
| @@ -52,6 +53,8 @@ export struct CardParser { | @@ -52,6 +53,8 @@ export struct CardParser { | ||
| 52 | Card19Component({ contentDTO }) | 53 | Card19Component({ contentDTO }) |
| 53 | } else if (contentDTO.appStyle === CompStyle.Card_20) { | 54 | } else if (contentDTO.appStyle === CompStyle.Card_20) { |
| 54 | Card20Component({ contentDTO }) | 55 | Card20Component({ contentDTO }) |
| 56 | + } else if (contentDTO.appStyle === CompStyle.Card_21) { | ||
| 57 | + Card21Component({ contentDTO }) | ||
| 55 | } | 58 | } |
| 56 | else { | 59 | else { |
| 57 | // todo:组件未实现 / Component Not Implemented | 60 | // todo:组件未实现 / Component Not Implemented |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 4 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 5 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | + | ||
| 7 | +const TAG: string = 'Card6Component-Card13Component'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 卡片样式:"appStyle":"21" 小视频卡人民号 | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +export struct Card21Component { | ||
| 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Column() { | ||
| 18 | + // 顶部 rmh信息 | ||
| 19 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 20 | + // 中间内容 | ||
| 21 | + Grid() { | ||
| 22 | + GridItem() { | ||
| 23 | + Text(`${this.contentDTO.newsTitle}`) | ||
| 24 | + .fontSize($r('app.float.selected_text_size')) | ||
| 25 | + .fontColor($r('app.color.color_222222')) | ||
| 26 | + .width(CommonConstants.FULL_WIDTH) | ||
| 27 | + .maxLines(4) | ||
| 28 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 29 | + .padding({ right: 12 }) | ||
| 30 | + .lineHeight(26) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + GridItem() { | ||
| 34 | + Stack() { | ||
| 35 | + Image(this.contentDTO.coverUrl) | ||
| 36 | + .width(CommonConstants.FULL_WIDTH) | ||
| 37 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 38 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 39 | + } | ||
| 40 | + .alignContent(Alignment.BottomEnd) | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + .columnsTemplate('2fr 1fr') | ||
| 44 | + .maxCount(1) | ||
| 45 | + | ||
| 46 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 47 | + } | ||
| 48 | + .onClick((event: ClickEvent) => { | ||
| 49 | + ProcessUtils.processPage(this.contentDTO) | ||
| 50 | + }) | ||
| 51 | + .padding({ | ||
| 52 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 53 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 54 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 55 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 56 | + }) | ||
| 57 | + .width(CommonConstants.FULL_WIDTH) | ||
| 58 | + } | ||
| 59 | +} |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | -import { DateTimeUtils } from 'wdKit'; | ||
| 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 5 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | const TAG: string = 'Card6Component-Card13Component'; | 6 | const TAG: string = 'Card6Component-Card13Component'; |
| 8 | -const FULL_PARENT: string = '100%'; | ||
| 9 | 7 | ||
| 10 | /** | 8 | /** |
| 11 | * 卡片样式:"appStyle":"6"以及13--- 小视频卡 | 9 | * 卡片样式:"appStyle":"6"以及13--- 小视频卡 |
-
Please register or login to post a comment