TabBar22Comp.ets
1.84 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
/**
* CompStyle:NAV_BAR-22
* 播放详情底部tab
*/
import { CompDTO } from '../bean/CompDTO';
import { Tab22Bean } from '../bean/Tab22Bean';
import { NetDataStatusType } from '../enum/NetDataStatusType';
import { DataFromExtraComp } from './DataFromExtraComp';
import List from '@ohos.util.List';
import { ExtraDTO } from '../bean/ExtraDTO';
import { Tab22DTO } from '../bean/Tab22DTO';
import { WDGroup } from './WDGroup';
import { TabType } from '../enum/TabType';
export class TabBar22Comp extends DataFromExtraComp<Tab22Bean> {
constructor(parent: WDGroup, compDTO: CompDTO, initParams: Map<string, Object>) {
super(parent, compDTO, initParams);
this.status = NetDataStatusType.LOADED
}
public getItems(): List<Tab22Bean> {
return this.items;
}
protected convertDto2Vo(extraDataDTO: ExtraDTO): List<Tab22Bean> {
if (!extraDataDTO) {
return new List<Tab22Bean>();
}
let beanList: List<Tab22Bean> = new List<Tab22Bean>();
// let dtoArray: Tab22DTO[] | undefined = extraDataDTO["tabs"]
let dtoArray: Tab22DTO[] | undefined = extraDataDTO.tabs
if (!dtoArray) {
return new List<Tab22Bean>();
}
for (let index = 0; index < dtoArray.length; index = index + 1) {
let dto: Tab22DTO = dtoArray[index];
if (dto.tabType != TabType.discuss) { // 过滤掉【讨论】tab
let bean: Tab22Bean = new Tab22Bean(dto);
this.buildTextColor(bean)
beanList.add(bean);
}
}
return beanList;
}
private buildTextColor(bean: Tab22Bean): void {
let normalTextColor = bean.unselectedColor;
if (!normalTextColor) {
normalTextColor = "#666666";
}
bean.normalTextColor = normalTextColor;
let activeTextColor = bean.selectedColor;
if (!activeTextColor) {
activeTextColor = "#333333";
}
bean.activeTextColor = activeTextColor;
return
}
}