rmhTitle.ets
2.53 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
/**
* 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等
*/
import { RmhInfoDTO } from 'wdBean'
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils } from 'wdKit/Index';
interface RmhInfo extends RmhInfoDTO {
isSelected: boolean;
headPhotoUrl: string;
introduction: string;
userName: string;
publishTime: string;
}
@Entry
@Component
export struct rmhTitle {
// TODO 这里需要传入rmh信息及是否显示关注,是否已关注
@State isAttentionShow: Boolean = true
@State rmhInfo: RmhInfo = {
authIcon: "https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png",
authTitle: "四川农业大学",
headPhotoUrl: "https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20221208/a_785146000057561088.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
introduction: "四川农业大学",
userId: "554708665557894",
userName: "四川农业大学",
userType: "2",
publishTime: '1712912775606'
} as RmhInfo
build() {
Row() {
Stack() {
Image(this.rmhInfo.headPhotoUrl)
.width(36)
.height(36).borderRadius(50)
Image(this.rmhInfo.authIcon)
.width(14)
.height(14)
.borderRadius(50)
}
.margin({ right: 8 })
.alignContent(Alignment.BottomEnd)
Column() {
Text(this.rmhInfo.userName)
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.alignSelf(ItemAlign.Start)
Row() {
Text(DateTimeUtils.formatDate(Number.parseFloat(this.rmhInfo.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
Image($r("app.media.point"))
.width(16)
.height(16)
Text(this.rmhInfo.introduction)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.margin({ left: 6 })
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
}
.align(Alignment.Start)
Blank()
if(this.isAttentionShow) {
Row(){
Image($r('app.media.rmh_follow'))
.width(16)
.height(16)
Text('关注')
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_ED2800'))
}
}
}
.width(CommonConstants.FULL_WIDTH)
.margin({bottom: 10})
}
}