PermissionDesComponent.ets 1.09 KB
@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)
  }
}