CardAdvVideoExComponent.ets
3.46 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import { CompDTO } from 'wdBean';
import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
/**
* @Description: 广告---展会广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvVideoExComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
pageModel: PageModel = new PageModel();
@Prop loadImg: boolean = true;
@State compIndex: number = 0;
async aboutToAppear(): Promise<void> {
// this.loadImg = await onlyWifiLoadImg();
let extraData = this.compDTO.matInfo.extraData
let labelDTO = JSON.parse(extraData) as AdvExtraData
this.advExtraData = labelDTO
}
aboutToDisappear(): void {
}
build() {
Column() {
Stack() {
//长图
Image(this.loadImg ? this.advExtraData.itemTopImage : '')
.width(CommonConstants.FULL_WIDTH)
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.aspectRatio(343 / 80)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.borderStyle(BorderStyle.Solid)
.onClick(() => {
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
CardAdvTop({ pageModel: this.pageModel, compDTO: this.compDTO })
}
.alignContent(Alignment.Top)
.width(CommonConstants.FULL_WIDTH)
//
List({ space: 10 }) {
ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
ListItem() {
Text(content.title).fontSize('16fp').fontColor($r('app.color.color_222222')).width('100%').onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: content.linkUrl,
linkType: content.linkType
} as CompAdvMatInfoBean;
ProcessUtils.openAdvDetail(matInfo)
})
}
})
}.width('100%').listDirection(Axis.Vertical).margin({ top: 10, bottom: 10 })
// 更多按钮
this.commonButton()
}
.borderRadius({
topLeft:this.compIndex === 0 ? $r('app.float.image_border_radius'):0,
topRight:this.compIndex === 0 ? $r('app.float.image_border_radius'):0
})
.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')
})
}
/*
标题样式
*/
@Builder
commonButton() {
Row() {
Blank()
Text('查看更多').fontColor('#222222').fontSize('14fp')
Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
Blank()
}
.width('100%')
.backgroundColor('#F5F5F5')
.borderRadius(3)
.padding({ top: 10, bottom: 10, })
.onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: this.advExtraData.itemMore.linkUrl,
linkType: this.advExtraData.itemMore.linkType
} as CompAdvMatInfoBean;
ProcessUtils.openAdvDetail(matInfo)
})
}
}