InteractMComponent.ets
4.2 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
95
96
97
98
99
100
101
102
103
104
105
import { ContentDTO } from 'wdBean/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { InteractMessageModel } from '../../model/InteractMessageModel'
@Component
export struct InteractMComponent {
messageModel:InteractMessageModel = new InteractMessageModel;
///"remark": "{"beReply":"乐事薯片,大家的最爱!!",
// "headUrl":"https: //uatjdcdnphoto.aikan.pdnews.cn//zhbj/img/user/2023122211/2A59F725E69849A38CEE8823B0D9D141.jpg",
// "contentId":"30035774121","contentRelObjectid":"2012","contentTitle":"乐事推出华夏风光限定罐七款城市地标包装让出游“有滋有味”",
// "commentContent":"大家都爱吃!!","userName":"人民日报网友a8dKCV","userId":"504964178466309","contentRelId":"500002866426",
// "shareUrl":"https: //pd-people-uat.pdnews.cn/column/30035774121-500002866426","userType":"1",
// "contentRelType":"1","visitor":"0","contentType":"8"}",
build() {
Row(){
Image(this.messageModel.InteractMsubM.headUrl)
.width(36)
.height(36)
.borderRadius(18)
Column(){
Row(){
Text(this.messageModel.InteractMsubM.userName)
.fontSize('14fp').fontColor('#222222')
Text(this.buildContentString())
.fontSize('14fp').fontColor('#999999')
.margin({left:5})
}.width('100%')
Text(this.messageModel.time)
.margin({top:2})
.fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10})
if (this.messageModel.contentType === '208' || this.messageModel.contentType === '209'){
Text(this.messageModel.message)
.margin({bottom:10})
.fontSize('16fp').fontColor('#222222')
.width('100%')
.constraintSize({maxHeight:500})
}
Column(){
if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
.margin({top:15,bottom:10})
.width('100%')
Divider()
.color('#EDEDED')
.backgroundColor('#EDEDED')
.width('100%')
.height(1)
}
Row(){
Image($r('app.media.MessageOriginTextIcon'))
.width('12')
.height('12')
Text(this.messageModel.InteractMsubM.contentTitle)
.fontSize('12fp')
.fontColor('#666666')
.maxLines(1)
.width('90%')
.textOverflow({overflow:TextOverflow.Ellipsis})
Blank()
Image($r('app.media.mine_user_edit'))
.width('12')
.height('12')
}.margin({top:10,bottom:15})
}.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5)
.onClick(()=>{
let contentDTO :ContentDTO = new ContentDTO();
contentDTO.objectType = this.messageModel.InteractMsubM.contentType
contentDTO.objectId = this.messageModel.InteractMsubM.contentId
ProcessUtils.processPage(contentDTO)
})
}.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%')
}.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top)
}
buildContentString(): string {
let contentString: string = ''
if (this.messageModel.contentType === '206') {
contentString = '赞了你的作品'
}else if(this.messageModel.contentType === '207'){
contentString = '赞了你的评论'
}else if(this.messageModel.contentType === '208'){
contentString = '评论了你的作品'
}else if(this.messageModel.contentType === '209'){
contentString = '回复了你的评论'
}else if(this.messageModel.contentType === '210'){
contentString = '转发了您的作品'
}else if(this.messageModel.contentType === '211'){
contentString = '关注了你'
}
return contentString;
}
buildCommentContent(): string {
let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply;
return contentString;
}
}