Card5Component.ets
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG: string = 'Card5Component';
/**
* 卡片样式:"appStyle":"5"
*/
@Component
export struct Card5Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Stack() {
Image(this.contentDTO.coverUrl)
.width(CommonConstants.FULL_WIDTH)
.autoResize(true)
.borderRadius($r('app.float.image_border_radius'))
if (this.contentDTO.newsTitle) {
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
.linearGradient({
colors: [
['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
]
})
Row() {
Text(this.contentDTO.newsTitle)
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.fontColor(Color.White)
.fontSize($r('app.float.normal_text_size'))
.fontWeight(FontWeight.Bold)
.maxLines(2)
.align(Alignment.Bottom)
}
.justifyContent(FlexAlign.Start)
.height(40)
.margin({ left: 12, bottom: 10, right: 12 })
}
}
.alignContent(Alignment.Bottom)
.width(CommonConstants.FULL_WIDTH)
.padding(
{ top: 16, bottom: 16, left: 14, right: 14 })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}