notes.ets
1.36 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
/**
* 表示
* objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
14动态图文,15动态视频16问政;100人民号,101标签
* objectLevel: 对象分类;频道(1:一级频道,2:二级频道),专题(21:文章专题,22:音频专题,23:直播专题,24:话题专题)
*/
@Preview
@Component
export struct Notes {
@State objectType: number | string = 5
@State objectLevel: number | string = -1
@State newTags: string = ''
@State seoTags: string = ''
build() {
if (this.returnTypeTitleFn()) {
Text(this.returnTypeTitleFn())
.fontSize($r('app.float.font_size_11'))
.padding({
left: 4,
right: 4,
top: 3,
bottom: 3
})
.linearGradient({ angle: 90, colors: [['#FFFF2B00', 0.0], ['#FFFE6A00', 1.0]] })
.fontColor(Color.White)// .borderRadius($r('app.float.button_border_radius'))
.borderRadius(2)
.margin({ top: 1 })
}
}
returnTypeTitleFn(): string {
if (this.newTags) {
return this.newTags
}
if (this.objectType == 5) {
if (this.objectLevel == 24) {
return '调查'
}
return '专题'
}
if (this.objectType == 10) {
return 'H5'
}
if (this.objectType == 8) {
return '文章'
}
return ''
}
}