PermissionDesComponent.ets
1.09 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
@Component
export struct PermissionDesComponent {
@State translateY: number = 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
aboutToAppear(): void {
this.startDismiss()
}
build() {
Column() {
Row() {
Image($r('app.media.tips')).width(20).height(20)
Text("权限使用说明").fontColor('#FF222222').fontSize(14)
.fontWeight(FontWeight.Bold)
.margin({left:4})
}.height(26)
Text("用于为你推荐你可能感兴趣的资讯内容及附近的相关信息,以提升浏览体验。不授权该权限不影响App正常使用。")
.fontSize(14)
.fontColor('#666666')
}
.translate({ y: this.translateY })
.animation({
duration: 400,
curve: Curve.Linear,
})
.alignItems(HorizontalAlign.Start)
.width('90%')
// .height(60)
.backgroundColor('#FFFFFF')
.border({ radius: 5 })
.margin({ top: px2vp(this.topSafeHeight) })
.padding(12)
.zIndex(20)
}
startDismiss() {
setTimeout(() => {
this.translateY = -250
}, 4000)
}
}