CardAdvThreeImageComponent.ets
2.63 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//全标题 "appStyle":"2",
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
/**
* @Description: 广告---三图卡
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvThreeImageComponent {
@State compDTO: CompDTO = {} as CompDTO
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
}
aboutToDisappear(): void {
}
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_18'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
//三图
Row() {
GridRow({ gutter: 2 }) {
ForEach(this.compDTO.matInfo.matImageUrl, (url: string, index: number) => {
if (index < 3) {
GridCol({ span: { xs: 4 } }) {
Image(url)
.width('100%')
.aspectRatio(113 / 75)
.borderRadius({
topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
topRight: index === 2 ? $r('app.float.image_border_radius') : 0,
bottomLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
bottomRight: index === 2 ? $r('app.float.image_border_radius') : 0,
})
.borderColor($r('app.color.color_0D000000'))
}
}
})
}
}
.width(CommonConstants.FULL_PARENT)
.margin({ top: 8 })
// 广告工具组件
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('100%').margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}