TabChatItemComponent.ets
2.3 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
import { LiveRoomItemBean, Action, PhotoListBean, Params } from 'wdBean/Index'
import { StringUtils } from 'wdKit/Index'
// import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
import { WDRouterRule } from 'wdRouter'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
@Component
export struct TabChatItemComponent {
item: LiveRoomItemBean = {} as LiveRoomItemBean
aboutToAppear(): void {
}
build() {
Row() {
Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') : this.item.senderUserAvatarUrl)
.borderRadius(90)
.width(24)
.height(24)
Column() {
Row() {
Text() {
Span(this.item.senderUserName + ': ')
.fontColor('#666666')
Span(this.item.text)
.fontColor('#222222')
}
.margin({ left: 8 })
.lineHeight(20)
.layoutWeight(1)
.fontSize('14fp')
.fontWeight(400)
}
.alignItems(VerticalAlign.Top)
if (this.item.dataType == 'ZH_TEXT_AND_IMAGE_MSG' && this.item.pictureUrls && this.item.pictureUrls.length > 0) {
Image(this.item.pictureUrls[0])
.width(`100%`)
.objectFit(ImageFit.Contain)
.borderRadius(4)
.margin({
top: 10
})
.onClick(() => {
this.gotoMultipleListImagePage(this.item.pictureUrls[0])
})
}
}
.margin({
left: 8,
right: 8
})
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}
.alignItems(VerticalAlign.Top)
.padding({
left: 15,
top: 15,
right: 15
})
}
/**
* 大图列表页
* @param content
* */
gotoMultipleListImagePage(imgUrl: string) {
const photoList: PhotoListBean[] = []
photoList.push({
width: 0,
height: 0,
picPath: imgUrl,
picDesc: '',
itemType:2,
id:0
})
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 18,
extra: {
photoList: photoList,
swiperIndex: 0,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
aboutToDisappear(): void {
}
}