CardAdvBigImageComponent.ets
1.97 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
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
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 CardAdvBigImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
pageModel: PageModel = new PageModel();
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
aboutToDisappear(): void {
}
build() {
Column() {
//新闻标题
Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
//大图
Image(this.loadImg ? this.compDTO.matInfo.matImageUrl[0] : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.width(CommonConstants.FULL_WIDTH)
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).margin({
top: 8,
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: 10,
right: 10,
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
}
/*
标题样式
*/
@Extend(Text)
function bottomTextStyle() {
.fontSize('18fp')
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.width('100%')
.lineHeight(25)
}