CustomLogoutDialog.ets 2.62 KB
import { router } from '@kit.ArkUI'

@CustomDialog
export struct CustomLogoutDialog {
  controller: CustomDialogController
  cancel: () => void = () => {
  }
  confirm: () => void = () => {
  }
  @Prop logOffWaitTime: string = "7"
  @Prop logOffMsg: string = ""
  @Prop userType: number = 0

  build() {
    Column() {
      Text(this.userType !== 1 ? "温馨提醒" : "注销账号")
        .fontColor("#222222")
        .fontSize(18)
        .width("100%")
        .fontWeight(FontWeight.Bold)
        .textAlign(TextAlign.Center)
        .margin({ top: 20 })

      if (this.userType !== 1) {
        Text(this.logOffMsg.length > 0 ? this.logOffMsg : "您确认要注销账号吗? 请联系rmh@pdnews.cn邮箱") {
        }.margin({ top: 12, left: 16, right: 16 })
        .fontColor("#999999")
        Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp')
        Text('知道了')
          .fontSize(16)
          .layoutWeight(1)
          .fontWeight(FontWeight.Medium)
          .textAlign(TextAlign.Center)
          .onClick(() => {
            this.controller.close()
            if (this.cancel) {
              this.cancel()
            }
            router.back()
          })
          .height('100%')

      } else {
        Text(`注销后${this.logOffWaitTime}天内无法重新登录注册人民日报app,是否确认注销?`) {
        }.margin({ top: 12, left: 16, right: 16 })

        Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp')
        Row() {
          Text('放弃')
            .fontSize(16)
            .fontColor("#999999")
            .layoutWeight(1)
            .fontWeight(FontWeight.Medium)
            .textAlign(TextAlign.Center)
            .onClick(() => {
              this.controller.close()
              if (this.cancel) {
                this.cancel()
              }

            })
            .height('100%')
          // Divider().color("#999999").height('100%').width('0.5vp')
          Text('同意注销')
            .fontSize(16)
            .fontColor("#ED2800")
            .layoutWeight(1)
            .fontWeight(FontWeight.Medium)
            .textAlign(TextAlign.Center)
            .border({
              width: { left: 1 },
              color: "#999999",
              style: { left: BorderStyle.Solid }

            })
            .onClick(() => {
              this.controller.close()
              if (this.confirm) {
                this.confirm()
              }
            })
            .height('100%')
        }.layoutWeight(1).justifyContent(FlexAlign.Center)
      }
    }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%')
  }
}