MinePageComponent.ets
2.9 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import router from '@ohos.router';
import common from '@ohos.app.ability.common';
const TAG = 'PageComponent';
/**
* 我的页面
*/
@Component
export struct MinePageComponent {
//是否是创作者
@State isActive:boolean = false
@State isLogin:boolean = true
private context = getContext(this) as common.UIAbilityContext
aboutToAppear(){
// TODO 获取用户信息
}
build() {
Column(){
Stack({alignContent:Alignment.Top}){
Image($r('app.media.mine_head_bg'))
.setFullWidth()
.height('50%')
.objectFit(ImageFit.Auto)
this.TopUI()
}.setFullWidthAndHeight()
.backgroundColor($r('app.color.color_F5F5F5'))
}.setFullWidthAndHeight()
}
@Builder TopUI(){
Column(){
//头像层
this.HeaderUI()
//Grid 区域
this.GridUI()
//Card
this.CardUI()
//滑动区域
this.ScrollUI()
}
.padding({left:11,right:11})
.setFullWidthAndHeight()
}
@Builder HeaderUI(){
Row(){
//头像
Stack(){
Button({type:ButtonType.Circle})
.backgroundColor($r('app.color.white'))
.width(74)
.height(74)
Image($r('app.media.mine_head_icon'))
.width(70)
.height(70)
.objectFit(ImageFit.Cover)
.borderRadius(50)
}.width(74)
.height(74)
//昵称信息
Column(){
Row(){
Text("人民日报网友ABCDEF")
.fontColor($r('app.color.white'))
Image($r('app.media.mine_user_edit'))
.width(20)
.height(20)
}
Text("等级8")
.textAlign(TextAlign.Center)
.backgroundImage($r('app.media.mine_grade_bg'))
.backgroundImageSize({width:55})
.fontColor($r('app.color.white'))
.fontSize(12)
.width(40)
.margin({top:20})
}.alignItems(HorizontalAlign.Start)
.width(200)
.margin({left:10})
Blank()
Stack({alignContent:Alignment.Start}){
Text("签到")
.textAlign(TextAlign.Center)
.borderRadius({ topLeft:10,bottomLeft:10})
.width(50)
.fontColor($r('app.color.white'))
.backgroundColor($r('app.color.color_FFC460'))
.margin({left:20})
Image($r("app.media.mine_sign_icon"))
.width(30)
.height(30)
}.width(60)
}
.setFullWidth()
.margin({top:30})
}
@Builder GridUI(){
Column(){
}
}
@Builder CardUI(){
Row(){
}
}
@Builder ScrollUI(){
Column(){
Scroll(){
}
}
}
@Styles setFullWidthAndHeight(){
.width('100%')
.height('100%')
}
@Styles setFullWidth(){
.width('100%')
}
@Styles setFullHeight(){
.width('100%')
}
change(){
router.pushUrl({
url: 'pages/IndexPage',
params: {
}
}).catch((error: Error) => {
});
}
}