Showing
5 changed files
with
33 additions
and
47 deletions
| @@ -70,6 +70,7 @@ export interface ContentDTO { | @@ -70,6 +70,7 @@ export interface ContentDTO { | ||
| 70 | rmhInfo: RmhInfoDTO; // 人民号信息 | 70 | rmhInfo: RmhInfoDTO; // 人民号信息 |
| 71 | photoNum: number; | 71 | photoNum: number; |
| 72 | corner: string; | 72 | corner: string; |
| 73 | - rmhPlatform: number | 73 | + rmhPlatform: number; |
| 74 | + newTags: string | ||
| 74 | 75 | ||
| 75 | } | 76 | } |
| @@ -7,10 +7,11 @@ export struct CardSourceInfo { | @@ -7,10 +7,11 @@ export struct CardSourceInfo { | ||
| 7 | @State contentDTO: ContentDTO = {} as ContentDTO; | 7 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 8 | build() { | 8 | build() { |
| 9 | Flex() { | 9 | Flex() { |
| 10 | - if(this.contentDTO.corner === '1') { | ||
| 11 | - Text("锐评") | 10 | + if(this.contentDTO.corner) { |
| 11 | + Text(this.contentDTO.corner) | ||
| 12 | .fontSize($r("app.float.font_size_12")) | 12 | .fontSize($r("app.float.font_size_12")) |
| 13 | .fontColor($r("app.color.color_ED2800")) | 13 | .fontColor($r("app.color.color_ED2800")) |
| 14 | + .margin({right: 2}) | ||
| 14 | } | 15 | } |
| 15 | if(this.contentDTO.rmhPlatform === 1) { | 16 | if(this.contentDTO.rmhPlatform === 1) { |
| 16 | Text(this.contentDTO.rmhInfo.rmhName) | 17 | Text(this.contentDTO.rmhInfo.rmhName) |
| @@ -31,6 +32,7 @@ export struct CardSourceInfo { | @@ -31,6 +32,7 @@ export struct CardSourceInfo { | ||
| 31 | .width(16) | 32 | .width(16) |
| 32 | .height(16) | 33 | .height(16) |
| 33 | } | 34 | } |
| 35 | + // TODO 这里还有个判断需要完善,依赖外部,新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | ||
| 34 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 36 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 35 | .fontSize($r("app.float.font_size_12")) | 37 | .fontSize($r("app.float.font_size_12")) |
| 36 | .fontColor($r("app.color.color_B0B0B0")) | 38 | .fontColor($r("app.color.color_B0B0B0")) |
| @@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean'; | @@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean'; | ||
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | import { DateTimeUtils } from 'wdKit'; | 3 | import { DateTimeUtils } from 'wdKit'; |
| 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 5 | - | 5 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| 8 | * 大专题卡--CompStyle: 10 | 9 | * 大专题卡--CompStyle: 10 |
| @@ -76,10 +77,10 @@ export struct Card10Component { | @@ -76,10 +77,10 @@ export struct Card10Component { | ||
| 76 | } | 77 | } |
| 77 | .width(CommonConstants.FULL_WIDTH) | 78 | .width(CommonConstants.FULL_WIDTH) |
| 78 | .padding({ | 79 | .padding({ |
| 79 | - top: 14, | ||
| 80 | - left: 16, | ||
| 81 | - right: 16, | ||
| 82 | - bottom: 14 | 80 | + left: $r('app.float.card_comp_pagePadding_lf'), |
| 81 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 82 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 83 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 83 | }) | 84 | }) |
| 84 | .backgroundColor($r("app.color.white")) | 85 | .backgroundColor($r("app.color.white")) |
| 85 | .margin({ bottom: 8 }) | 86 | .margin({ bottom: 8 }) |
| @@ -95,25 +96,14 @@ export struct Card10Component { | @@ -95,25 +96,14 @@ export struct Card10Component { | ||
| 95 | .fontColor($r('app.color.color_222222')) | 96 | .fontColor($r('app.color.color_222222')) |
| 96 | .maxLines(2) | 97 | .maxLines(2) |
| 97 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 98 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 98 | - Row() { | ||
| 99 | - // 展示发稿人 | ||
| 100 | - if (item.source) { | ||
| 101 | - Text(item.source) | ||
| 102 | - .fontSize($r('app.float.font_size_12')) | ||
| 103 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 104 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 105 | - .maxLines(1) | ||
| 106 | - .width(item.source.length > 10 ? '60%' : '') | ||
| 107 | - | ||
| 108 | - Image($r('app.media.point')) | ||
| 109 | - .width(16) | ||
| 110 | - .height(16) | 99 | + CardSourceInfo( |
| 100 | + { | ||
| 101 | + contentDTO: { | ||
| 102 | + publishTime: item.publishTime || '', | ||
| 103 | + source: item.source || '' | ||
| 104 | + } as ContentDTO | ||
| 111 | } | 105 | } |
| 112 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime)))) | ||
| 113 | - .fontSize($r("app.float.font_size_12")) | ||
| 114 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 115 | - } | ||
| 116 | - .margin({ top: 12 }) | 106 | + ) |
| 117 | } | 107 | } |
| 118 | .layoutWeight(1) | 108 | .layoutWeight(1) |
| 119 | .alignItems(HorizontalAlign.Start) | 109 | .alignItems(HorizontalAlign.Start) |
| @@ -4,7 +4,7 @@ import { CommonConstants } from 'wdConstant/Index'; | @@ -4,7 +4,7 @@ import { CommonConstants } from 'wdConstant/Index'; | ||
| 4 | import { DateTimeUtils } from 'wdKit'; | 4 | import { DateTimeUtils } from 'wdKit'; |
| 5 | import { WDRouterRule } from 'wdRouter'; | 5 | import { WDRouterRule } from 'wdRouter'; |
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | - | 7 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 8 | const TAG = 'Card17Component'; | 8 | const TAG = 'Card17Component'; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| @@ -81,25 +81,8 @@ export struct Card17Component { | @@ -81,25 +81,8 @@ export struct Card17Component { | ||
| 81 | }; | 81 | }; |
| 82 | WDRouterRule.jumpWithAction(taskAction) | 82 | WDRouterRule.jumpWithAction(taskAction) |
| 83 | }) | 83 | }) |
| 84 | - | ||
| 85 | - Row() { | ||
| 86 | - if (this.contentDTO.source) { | ||
| 87 | - Text(this.contentDTO.source) | ||
| 88 | - .fontSize($r('app.float.font_size_13')) | ||
| 89 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 90 | - Image($r('app.media.point')) | ||
| 91 | - .width(16) | ||
| 92 | - .height(16) | ||
| 93 | - } | ||
| 94 | - if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) { | ||
| 95 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 96 | - .fontSize($r('app.float.font_size_13')) | ||
| 97 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 98 | - } | ||
| 99 | - } | ||
| 100 | - .width(CommonConstants.FULL_WIDTH) | ||
| 101 | - .height(16) | ||
| 102 | - .id('label') | 84 | + // 评论等信息 |
| 85 | + CardSourceInfo({ contentDTO: this.contentDTO }) | ||
| 103 | } | 86 | } |
| 104 | .width(CommonConstants.FULL_WIDTH) | 87 | .width(CommonConstants.FULL_WIDTH) |
| 105 | .padding({ | 88 | .padding({ |
| @@ -18,7 +18,17 @@ export struct Card6Component { | @@ -18,7 +18,17 @@ export struct Card6Component { | ||
| 18 | Row() { | 18 | Row() { |
| 19 | Column() { | 19 | Column() { |
| 20 | Column() { | 20 | Column() { |
| 21 | - Text(this.contentDTO.newsTitle) | 21 | + // TODO 这个tag涉及样式问题。待优化。 |
| 22 | + // if (this.contentDTO.newTags) { | ||
| 23 | + // Text(this.contentDTO.newTags) | ||
| 24 | + // .backgroundColor($r('app.color.color_ED2800')) | ||
| 25 | + // .borderRadius($r('app.float.button_border_radius')) | ||
| 26 | + // .fontColor($r('app.color.color_fff')) | ||
| 27 | + // .fontSize($r('app.float.font_size_12')) | ||
| 28 | + // .padding(2) | ||
| 29 | + // .margin({ right: 2 }) | ||
| 30 | + // } | ||
| 31 | + Text(`${this.contentDTO.newsTitle}`) | ||
| 22 | .fontSize(16) | 32 | .fontSize(16) |
| 23 | .fontWeight(FontWeight.Normal) | 33 | .fontWeight(FontWeight.Normal) |
| 24 | .maxLines(3)// | 34 | .maxLines(3)// |
-
Please register or login to post a comment