CompParser.ets
6.06 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
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { LabelComponent } from './view/LabelComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import {
HorizontalStrokeCardThreeTwoRadioForMoreComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow03 } from './compview/ZhSingleRow03';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow05 } from './compview/ZhSingleRow05';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';
import { ZhSingleColumn09 } from './compview/ZhSingleColumn09';
import { ZhGridLayout03 } from './compview/ZhGridLayout03';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
import { CardParser } from './CardParser';
import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
/**
* comp适配器.
* 首页楼层comp解析器.
*/
@Preview
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
compIndex: number = 0;
build() {
Column() {
this.componentBuilder(this.compDTO, this.compIndex);
}
}
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
// if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {
LiveHorizontalCardComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
if (compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO })
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
}
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
ZhSingleRow05({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0] })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ contentDTO: compDTO.operDataList[0] })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
// ZhSingleColumn05({ compDTO: compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
ZhSingleColumn09({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({compDTO})
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0] });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
else {
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
.onClick(() => {
if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
}
})
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
}
// }
}