GuidePages.ets
2.81 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
import { WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
@Entry
@Component
struct GuidePages {
// guideImage = [$r('app.media.guide_static1'), $r('app.media.guide_static2'), $r('app.media.guide_static3'), $r('app.media.guide_static4'),$r('app.media.guide_static5')]
// guideTitle = [$r('app.media.guide_title1'), $r('app.media.guide_title2'), $r('app.media.guide_title3'), $r('app.media.guide_title4'),$r('app.media.guide_title5')]
// guideIndex = [$r('app.media.guide_index1'), $r('app.media.guide_index2'), $r('app.media.guide_index3'),$r('app.media.guide_index4'), $r('app.media.guide_button')]
guideImage = [$r('app.media.guide_Static'),'']
guideIndex = [$r('app.media.guide_button'),'']
build() {
Column() {
Swiper() {
ForEach(this.guideImage, (item: number, index: number) => {
this.ChildItem(index)
}, (item: number) => JSON.stringify(item))
}.loop(false)
.indicator(false)
.width('100%')
.height('100%')
.effectMode(EdgeEffect.None)
.onChange(index => {
if (index == 1) {
WDRouterRule.jumpWithReplacePage(WDRouterPage.launchInterestsPage)
}
})
}.width('100%')
.height('100%')
}
@Builder
ChildItem(index: number) {
RelativeContainer() {
Image(this.guideImage[index])
.objectFit(ImageFit.Contain)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
})
.margin({bottom:150})
.width('100%')
.height('60%')
.id('image')
// Image('')
// .objectFit(imagefit.scaledown)
// .alignRules({
// bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
// left: { anchor: "__container__", align: HorizontalAlign.Start },
// right: { anchor: "__container__", align: HorizontalAlign.End },
// })
// .margin({ left: 60, bottom: 150, right: 60 })
// .alignSelf(ItemAlign.Center)
// .id('title')
Image(this.guideIndex[index])
.objectFit(ImageFit.Fill)
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
})
.margin({ bottom: 85})
.width(191)
.height(44)
.onClick(() => {
if (index == 0) {
// 跳转到首页
//WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
//跳转到兴趣偏好选择页
WDRouterRule.jumpWithReplacePage(WDRouterPage.launchInterestsPage)
}
})
.id('index')
}.width('100%').height('100%')
}
}