wwf
4 天以前 7f2343d38fa048f6ce179ea0ab2c1a04f41a213c
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
/**
 * @Description : 启动页面
 */
@Entry
@Component
struct StartUpPage {
  @State logoY: number = -200
  @State columnY: number = 200
  @State isShow: boolean = false
  aboutToAppear(): void {
 
  }
  build() {
    Column(){
      Image($r('app.media.logo'))
        .width(100)
        .height(100)
        //设置logo图片的Y轴位置
        .translate({y: this.logoY})
        //属性动画
        .animation({
          //动画时长
          duration: 3000,
          //播放速度
          tempo: 1,
          //循环次数  -1无限循环
          iterations: 1,
          curve: Curve.EaseInOut,
          //播放模式:
          playMode: PlayMode.Normal,
          //延时播放
          delay: 500
        })
 
      Blank()
      Column({ space: 10 }) {
        Text('学聘同行').newExtend(30, 700)
        Text('以学习蓄力,以应聘通关').newExtend(20, 400)
          .textCase(TextCase.UpperCase)
        Blank()
      }
      .shadow({
        radius: 8,
        color: '#efefef',
        offsetX: 0,
        offsetY: -10
      })
      .StartColumn()
      .translate({ y: this.columnY })
      .animation({
        duration: 3000,
        delay: 500,
        curve: Curve.EaseInOut,
        iterations: 1
      })
      .onAppear(() => {
        //执行动画操作
        this.logoY = 200
        this.columnY = 0
        //设置倒计时
        let intervalId = setInterval(() => {
          //页面跳转
          this.getUIContext().getRouter().replaceUrl({
            url:'pages/login/LoginPage'
          })
          //销毁计时器
          clearInterval(intervalId)
        },4000)
      })
    }
    .width('100%')
    .height('100%')
    .backgroundImage($r('app.media.start_page_bg'))
    .backgroundImageSize({width: '100%',height:'100%'})
  }
}
 
@Extend(Column)
function StartColumn() {
  .width('100%')
  .height(180)
  .alignItems(HorizontalAlign.Start)
  .borderRadius({ topLeft: 20, topRight: 20 })
  .backgroundColor(Color.White)
  .padding(20)
}
 
@Extend(Text)
function newExtend(mSize: number,mWeight: FontWeight) {
  .fontSize(mSize)
  .fontWeight(mWeight)
}