douaojie

fix: 添加标签

... ... @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { Notes } from './notes';
/**
* 大专题卡--CompStyle: 10
... ... @@ -40,19 +41,8 @@ export struct Card10Component {
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
// Text('专题')
// .fontSize($r('app.float.font_size_12'))
// .padding({ left: 8, right: 8, top: 3, bottom: 3 })
// .backgroundColor(Color.Red)
// .fontColor(Color.White)
// .borderRadius($r('app.float.button_border_radius'))
// .margin({ left: 5, bottom: 5 })
ImageSpan($r('app.media.special'))
.width($r('app.float.font_size_36'))
.objectFit(ImageFit.Fill)
.verticalAlign(ImageSpanAlignment.CENTER)
.margin({ left: 5, bottom: 5 })
Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 })
}.alignContent(Alignment.BottomStart)
// 专题列表--后端返回三个,
... ... @@ -99,31 +89,18 @@ export struct Card10Component {
timelineItem(item: slideShows, index: number) {
Row() {
Column() {
Text(item.newsTitle) {
Stack() {
if (item.objectType == '5') {
// Text('专题')
// .fontSize($r('app.float.font_size_12'))
// .padding({ left: 8, right: 8, top: 3, bottom: 3 })
// .backgroundColor(Color.Red)
// .fontColor(Color.White)
// .borderRadius($r('app.float.button_border_radius'))
// .margin({ right: 5 })
ImageSpan($r('app.media.special'))
.width($r('app.float.font_size_36'))
.objectFit(ImageFit.Fill)
.verticalAlign(ImageSpanAlignment.CENTER)
.margin({ right: 5 })
Notes({ objectType: 5 })
}
Span(item.newsTitle)
}
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 40 : 0)
}.alignContent(Alignment.TopStart)
CardSourceInfo(
{
... ...
... ... @@ -2,8 +2,10 @@
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
const TAG: string = 'Card2Component';
/**
... ... @@ -34,13 +36,21 @@ export struct Card2Component {
build() {
Column() {
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
Stack() {
//新闻标题
if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
.textIndent(this.contentDTO.objectType == '5' ? 40 : 0)
}
.alignContent(Alignment.TopStart)
//大图
Stack() {
Image(this.contentDTO.coverUrl)
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { Notes } from './notes';
const TAG: string = 'Card6Component-Card13Component';
/**
... ... @@ -26,12 +28,21 @@ export struct Card6Component {
// .padding(2)
// .margin({ right: 2 })
// }
Text(`${this.contentDTO.newsTitle}`)
.fontSize(16)
.fontWeight(FontWeight.Normal)
.maxLines(3)//
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
Stack() {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
}
Text(`${this.contentDTO.newsTitle}`)
.fontSize(16)
.fontWeight(FontWeight.Normal)
.maxLines(3)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.textIndent(this.contentDTO.newTags.length < 5 && this.contentDTO.newTags.length > 2 ? 60 :
this.contentDTO.newTags.length != 0 && this.contentDTO.newTags.length < 3 ? 30 : 0)
}.alignContent(Alignment.TopStart)
}.height("80%")
.justifyContent(FlexAlign.Start)
... ... @@ -42,6 +53,7 @@ export struct Card6Component {
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
.width('58%')
Stack() {
Image(this.contentDTO.coverUrl)
.backgroundColor($r('app.color.color_B0B0B0'))
... ...
... ... @@ -2,6 +2,7 @@ import { ContentDTO, slideShows } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { Notes } from './notes';
/**
* 时间链卡--CompStyle: 09
... ... @@ -32,12 +33,8 @@ export struct Card9Component {
topLeft: $r('app.float.image_border_radius'),
topRight: $r('app.float.image_border_radius')
})
Text('专题')
.fontSize($r('app.float.font_size_12'))
.padding({ left: 8, right: 8, top: 3, bottom: 3 })
.backgroundColor(Color.Red)
.fontColor(Color.White)
.borderRadius($r('app.float.button_border_radius'))
Notes({ objectType: 5 })
.margin({ left: 5, bottom: 5 })
}.alignContent(Alignment.BottomStart)
... ...
/**
* 表示
* objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
14动态图文,15动态视频16问政;100人民号,101标签
*/
@Preview
@Component
export struct Notes {
@State objectType: number | string = 5
@State newTags: string = ''
build() {
if (this.returnTypeTitleFn()) {
Text(this.returnTypeTitleFn())
.fontSize($r('app.float.font_size_12'))
.padding({
left: 5,
right: 5,
top: 3,
bottom: 3
})
.linearGradient({ angle: 90, colors: [['#FFFF2B00', 0.0], ['#FFFE6A00', 1.0]] })
.fontColor(Color.White)
.borderRadius($r('app.float.button_border_radius'))
}
}
returnTypeTitleFn(): string {
if (this.newTags) {
return this.newTags
} else {
if (this.objectType == 5) {
return '专题'
} else if (this.objectType == 10) {
return 'H5'
} else if (this.objectType == 8) {
return '文章'
}
}
return ''
}
}
\ No newline at end of file
... ...