ChartItemComponent.ets
1.69 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
import { LiveRoomItemBean } from 'wdBean/Index'
import { LiveMessageRole } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'
// import { LengthMetrics } from '@kit.ArkUI'
@Component
export struct ChatItemComponent {
item: LiveRoomItemBean = {} as LiveRoomItemBean
aboutToAppear(): void {
}
build() {
Row() {
Text() {
if (this.item.role == LiveMessageRole.host) {
Span(' 主持人 ')
.fontSize(11)
// .lineHeight(16)
.textBackgroundStyle({ color: "#70FFC63F", radius: 2 })
.fontColor('#FFFFFFFF')
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
Span(' ')
}
if (this.item.role == LiveMessageRole.guest) {
Span(' 嘉宾 ')
.fontSize(11)
// .lineHeight(16)
.textBackgroundStyle({ color: "#70FFC63F", radius: 2 })
.fontColor('#FFFFFFFF')
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
Span(' ')
}
Span(this.item.senderUserName + ': ')
.fontSize(14)
.lineHeight(22)
.fontColor('#FFFFC63F')
.padding({ right: 118 })
.fontFamily('PingFang SC-Semibold')
.fontWeight(600)
Span(this.item.text)
.fontSize(14)
.lineHeight(22)
.fontColor('#FFFFFFFF')
.fontFamily('PingFang SC-Semibold')
.fontWeight(600)
}
.textShadow({ offsetX: 1, offsetY: 1, color: '#4D000000', radius: 1 })
}
.backgroundColor('#4D000000')
.borderRadius(3)
.padding({
top: 6,
bottom: 6,
left: 8,
right: 8
})
.margin({ left: 16, bottom: 4 })
}
}