SelectedColumns.ets
2.45 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
import { CompInfoBean, CompDTO } from 'wdBean'
import { DateTimeUtils } from 'wdKit/Index'
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
/**
* 精选栏目
*/
@Component
export struct SelectedColumns {
@Prop columnsCompInfoBean: CompInfoBean = {} as CompInfoBean // 精选栏目组件信息
@Prop columnsCompTitle: string = ''
build() {
Column(){
Text(this.columnsCompTitle)
.fontSize($r('app.float.selected_text_size'))
.fontColor($r('app.color.color_222222'))
.fontWeight(500)
.width(CommonConstants.FULL_WIDTH)
ForEach(this.columnsCompInfoBean.compList, (item: CompDTO) => {
this.SelectedColumnsItem(item)
})
}
.padding({left: 16,top: 12, right: 16})
.backgroundColor($r('app.color.white'))
}
@Builder
SelectedColumnsItem(item: CompDTO) {
Row() {
Image(item.operDataList[0].coverUrl)
.height(53)
.width(80)
.objectFit(ImageFit.Cover)
.margin({right: 12})
Column({space: 4}){
Text(item.operDataList[0].newsTitle)
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
Text(item.operDataList[0].newsSummary)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_999999'))
.width(CommonConstants.FULL_WIDTH)
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
Row(){
Image($r('app.media.broadcast_clock'))
.width(12)
.height(12)
.margin({right: 4})
Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.operDataList[0].publishTime)))
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_999999'))
.margin({ right :24 })
Image($r('app.media.broadcast_listen'))
.width(12)
.height(12)
.margin({right: 4})
Text('0')
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_999999'))
.margin({ right :24})
}
.width(CommonConstants.FULL_WIDTH)
}
.layoutWeight(1)
}
.onClick((event: ClickEvent) => {
// TODO 跳转到音频专题页
})
.width(CommonConstants.FULL_WIDTH)
.height(73)
}
}