HeadPictureCardComponent.ets
1.33 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
import { CommonConstants } from 'wdConstant';
import thermal from '@ohos.thermal';
import { CompDTO } from '../../repository/bean/CompDTO';
import { ContentDTO } from '../../repository/bean/ContentDTO';
import { CompUtils } from '../../utils/CompUtils';
@Component
export struct HeadPictureCardComponent {
@State compDTO: CompDTO = {} as CompDTO
build() {
Stack() {
Image(this.compDTO.operDataList[0].coverUrl)
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
if (this.compDTO.operDataList[0].newsTitle != null) {
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.compDTO.operDataList[0].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)
}
.height(40)
.margin({left: 12, bottom: 10, right: 12})
}
}
.alignContent(Alignment.Bottom)
.width(CommonConstants.FULL_WIDTH)
.height(200)
}
}