LaunchAdvertisingPage.ets
2.29 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
import router from '@ohos.router'
@Entry
@Component
struct LaunchAdvertisingPage {
@State time: number = 4
timer :number = -1
enter() {
router.replaceUrl({
url:'pages/MainPage'
})
}
onPageShow(){
this.timer = setInterval(() => {
this.time--
if (this.time < 1) {
this.enter()
clearInterval(this.timer)
}
},1000)
}
build(){
Column(){
Stack({alignContent:Alignment.Bottom}){
Stack({alignContent:Alignment.Bottom}){
Column(){
Image($r('app.media.app_icon'))
.margin({
top:'128lpx',left:'48lpx',right:'48lpx',bottom:'128lpx'
})
}
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
.margin({
bottom: 0
})
Stack({alignContent:Alignment.TopEnd}){
Button(){
Text(this.time + 's 跳过')
.fontSize('27lpx')
.fontColor(Color.White)
.margin({left:'28lpx',right:'28lpx'})
}
.width('148lpx')
.height('56lpx')
.margin({top:'54lpx',right:'19lpx'})
.backgroundColor('#80000000')
.onClick(() => {
this.enter()
})
}
.width('100%')
.height('100%')
Button(){
Row(){
Text('点击跳转至详情或第三方应用')
.fontSize('31lpx')
.fontColor(Color.White)
.margin({
left:'55lpx'
})
Image($r('app.media.Slice'))
.width('46lpx')
.height('46lpx')
.margin({right:'55lpx'})
}.alignItems(VerticalAlign.Center)
}
.width('566lpx')
.height('111lpx')
.margin({
bottom: '51lpx'
})
.backgroundColor('#80000000')
}
}
.width('100%')
.height('84%')
.backgroundColor('#FF6C75')
.margin({top:'0'})
Image($r('app.media.LaunchPage_logo'))
.width('278lpx')
.height('154lpx')
.margin({bottom: '48lpx'})
}
.width('100%')
.height('100%')
.backgroundColor(Color.White)
}
}