douaojie

fix: 添加标签

@@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant'; @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; 4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
  6 +import { Notes } from './notes';
6 7
7 /** 8 /**
8 * 大专题卡--CompStyle: 10 9 * 大专题卡--CompStyle: 10
@@ -40,19 +41,8 @@ export struct Card10Component { @@ -40,19 +41,8 @@ export struct Card10Component {
40 .onClick((event: ClickEvent) => { 41 .onClick((event: ClickEvent) => {
41 ProcessUtils.processPage(this.contentDTO) 42 ProcessUtils.processPage(this.contentDTO)
42 }) 43 })
43 - // Text('专题')  
44 - // .fontSize($r('app.float.font_size_12'))  
45 - // .padding({ left: 8, right: 8, top: 3, bottom: 3 })  
46 - // .backgroundColor(Color.Red)  
47 - // .fontColor(Color.White)  
48 - // .borderRadius($r('app.float.button_border_radius'))  
49 - // .margin({ left: 5, bottom: 5 })  
50 44
51 - ImageSpan($r('app.media.special'))  
52 - .width($r('app.float.font_size_36'))  
53 - .objectFit(ImageFit.Fill)  
54 - .verticalAlign(ImageSpanAlignment.CENTER)  
55 - .margin({ left: 5, bottom: 5 }) 45 + Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 })
56 }.alignContent(Alignment.BottomStart) 46 }.alignContent(Alignment.BottomStart)
57 47
58 // 专题列表--后端返回三个, 48 // 专题列表--后端返回三个,
@@ -99,31 +89,18 @@ export struct Card10Component { @@ -99,31 +89,18 @@ export struct Card10Component {
99 timelineItem(item: slideShows, index: number) { 89 timelineItem(item: slideShows, index: number) {
100 Row() { 90 Row() {
101 Column() { 91 Column() {
102 -  
103 - Text(item.newsTitle) { 92 + Stack() {
104 if (item.objectType == '5') { 93 if (item.objectType == '5') {
105 - // Text('专题')  
106 - // .fontSize($r('app.float.font_size_12'))  
107 - // .padding({ left: 8, right: 8, top: 3, bottom: 3 })  
108 - // .backgroundColor(Color.Red)  
109 - // .fontColor(Color.White)  
110 - // .borderRadius($r('app.float.button_border_radius'))  
111 - // .margin({ right: 5 })  
112 - ImageSpan($r('app.media.special'))  
113 - .width($r('app.float.font_size_36'))  
114 - .objectFit(ImageFit.Fill)  
115 - .verticalAlign(ImageSpanAlignment.CENTER)  
116 - .margin({ right: 5 })  
117 - }  
118 -  
119 - Span(item.newsTitle) 94 + Notes({ objectType: 5 })
120 } 95 }
  96 + Text(item.newsTitle)
121 .fontSize($r('app.float.font_size_17')) 97 .fontSize($r('app.float.font_size_17'))
122 .fontWeight(400) 98 .fontWeight(400)
123 .fontColor($r('app.color.color_222222')) 99 .fontColor($r('app.color.color_222222'))
124 .maxLines(2) 100 .maxLines(2)
125 .textOverflow({ overflow: TextOverflow.Ellipsis }) 101 .textOverflow({ overflow: TextOverflow.Ellipsis })
126 - 102 + .textIndent(item.objectType == '5' ? 40 : 0)
  103 + }.alignContent(Alignment.TopStart)
127 104
128 CardSourceInfo( 105 CardSourceInfo(
129 { 106 {
@@ -2,8 +2,10 @@ @@ -2,8 +2,10 @@
2 import { ContentDTO } from 'wdBean'; 2 import { ContentDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 5 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
  6 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
  7 +import { Notes } from './notes';
  8 +
7 const TAG: string = 'Card2Component'; 9 const TAG: string = 'Card2Component';
8 10
9 /** 11 /**
@@ -34,13 +36,21 @@ export struct Card2Component { @@ -34,13 +36,21 @@ export struct Card2Component {
34 build() { 36 build() {
35 Column() { 37 Column() {
36 Column() { 38 Column() {
  39 + Stack() {
37 //新闻标题 40 //新闻标题
  41 + if (this.contentDTO.objectType == '5') {
  42 + Notes({ objectType: this.contentDTO.objectType })
  43 + }
38 Text(this.contentDTO.newsTitle) 44 Text(this.contentDTO.newsTitle)
39 .fontSize($r('app.float.font_size_17')) 45 .fontSize($r('app.float.font_size_17'))
40 .fontColor($r('app.color.color_222222')) 46 .fontColor($r('app.color.color_222222'))
41 .maxLines(2) 47 .maxLines(2)
42 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 48 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
43 .align(Alignment.Start) 49 .align(Alignment.Start)
  50 + .textIndent(this.contentDTO.objectType == '5' ? 40 : 0)
  51 + }
  52 + .alignContent(Alignment.TopStart)
  53 +
44 //大图 54 //大图
45 Stack() { 55 Stack() {
46 Image(this.contentDTO.coverUrl) 56 Image(this.contentDTO.coverUrl)
1 import { ContentDTO } from 'wdBean'; 1 import { ContentDTO } from 'wdBean';
2 import { CommonConstants, CompStyle } from 'wdConstant'; 2 import { CommonConstants, CompStyle } from 'wdConstant';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 4 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
  5 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
  6 +import { Notes } from './notes';
  7 +
6 const TAG: string = 'Card6Component-Card13Component'; 8 const TAG: string = 'Card6Component-Card13Component';
7 9
8 /** 10 /**
@@ -26,12 +28,21 @@ export struct Card6Component { @@ -26,12 +28,21 @@ export struct Card6Component {
26 // .padding(2) 28 // .padding(2)
27 // .margin({ right: 2 }) 29 // .margin({ right: 2 })
28 // } 30 // }
  31 + Stack() {
  32 + if (this.contentDTO.newTags) {
  33 + Notes({ newTags: this.contentDTO.newTags })
  34 + }
  35 +
29 Text(`${this.contentDTO.newsTitle}`) 36 Text(`${this.contentDTO.newsTitle}`)
30 .fontSize(16) 37 .fontSize(16)
31 .fontWeight(FontWeight.Normal) 38 .fontWeight(FontWeight.Normal)
32 - .maxLines(3)// 39 + .maxLines(3)
33 .alignSelf(ItemAlign.Start) 40 .alignSelf(ItemAlign.Start)
34 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 41 + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
  42 + .textIndent(this.contentDTO.newTags.length < 5 && this.contentDTO.newTags.length > 2 ? 60 :
  43 + this.contentDTO.newTags.length != 0 && this.contentDTO.newTags.length < 3 ? 30 : 0)
  44 + }.alignContent(Alignment.TopStart)
  45 +
35 }.height("80%") 46 }.height("80%")
36 .justifyContent(FlexAlign.Start) 47 .justifyContent(FlexAlign.Start)
37 48
@@ -42,6 +53,7 @@ export struct Card6Component { @@ -42,6 +53,7 @@ export struct Card6Component {
42 .alignItems(HorizontalAlign.Start) 53 .alignItems(HorizontalAlign.Start)
43 .justifyContent(FlexAlign.Start) 54 .justifyContent(FlexAlign.Start)
44 .width('58%') 55 .width('58%')
  56 +
45 Stack() { 57 Stack() {
46 Image(this.contentDTO.coverUrl) 58 Image(this.contentDTO.coverUrl)
47 .backgroundColor($r('app.color.color_B0B0B0')) 59 .backgroundColor($r('app.color.color_B0B0B0'))
@@ -2,6 +2,7 @@ import { ContentDTO, slideShows } from 'wdBean'; @@ -2,6 +2,7 @@ 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 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
  5 +import { Notes } from './notes';
5 6
6 /** 7 /**
7 * 时间链卡--CompStyle: 09 8 * 时间链卡--CompStyle: 09
@@ -32,12 +33,8 @@ export struct Card9Component { @@ -32,12 +33,8 @@ export struct Card9Component {
32 topLeft: $r('app.float.image_border_radius'), 33 topLeft: $r('app.float.image_border_radius'),
33 topRight: $r('app.float.image_border_radius') 34 topRight: $r('app.float.image_border_radius')
34 }) 35 })
35 - Text('专题')  
36 - .fontSize($r('app.float.font_size_12'))  
37 - .padding({ left: 8, right: 8, top: 3, bottom: 3 })  
38 - .backgroundColor(Color.Red)  
39 - .fontColor(Color.White)  
40 - .borderRadius($r('app.float.button_border_radius')) 36 +
  37 + Notes({ objectType: 5 })
41 .margin({ left: 5, bottom: 5 }) 38 .margin({ left: 5, bottom: 5 })
42 }.alignContent(Alignment.BottomStart) 39 }.alignContent(Alignment.BottomStart)
43 40
  1 +/**
  2 + * 表示
  3 + * objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
  4 + 14动态图文,15动态视频16问政;100人民号,101标签
  5 + */
  6 +
  7 +@Preview
  8 +@Component
  9 +export struct Notes {
  10 + @State objectType: number | string = 5
  11 + @State newTags: string = ''
  12 +
  13 + build() {
  14 + if (this.returnTypeTitleFn()) {
  15 + Text(this.returnTypeTitleFn())
  16 + .fontSize($r('app.float.font_size_12'))
  17 + .padding({
  18 + left: 5,
  19 + right: 5,
  20 + top: 3,
  21 + bottom: 3
  22 + })
  23 + .linearGradient({ angle: 90, colors: [['#FFFF2B00', 0.0], ['#FFFE6A00', 1.0]] })
  24 + .fontColor(Color.White)
  25 + .borderRadius($r('app.float.button_border_radius'))
  26 + }
  27 + }
  28 +
  29 + returnTypeTitleFn(): string {
  30 + if (this.newTags) {
  31 + return this.newTags
  32 + } else {
  33 + if (this.objectType == 5) {
  34 + return '专题'
  35 + } else if (this.objectType == 10) {
  36 + return 'H5'
  37 + } else if (this.objectType == 8) {
  38 + return '文章'
  39 + }
  40 + }
  41 +
  42 + return ''
  43 + }
  44 +}