76 lines
1.8 KiB
Plaintext
76 lines
1.8 KiB
Plaintext
|
|
@CustomDialog
|
||
|
|
export default struct errorMsgDialog {
|
||
|
|
private controller?: CustomDialogController
|
||
|
|
cancel: () => void = () => {
|
||
|
|
}
|
||
|
|
confirm: () => void = () => {
|
||
|
|
}
|
||
|
|
title?: string
|
||
|
|
type: string //1 tip 2loading 3Dialog
|
||
|
|
@State angle: number = 0
|
||
|
|
|
||
|
|
build() {
|
||
|
|
Column() {
|
||
|
|
if(this.title){
|
||
|
|
Text(this.title)
|
||
|
|
.fontSize(30)
|
||
|
|
.margin(120)
|
||
|
|
}
|
||
|
|
if (this.type=='3') {
|
||
|
|
Row() {
|
||
|
|
Button('取消')
|
||
|
|
.onClick(() => {
|
||
|
|
if (this.controller != undefined) {
|
||
|
|
this.confirm()
|
||
|
|
this.controller.close()
|
||
|
|
}
|
||
|
|
})
|
||
|
|
.margin(20)
|
||
|
|
Button('确定')
|
||
|
|
.onClick(() => {
|
||
|
|
if (this.controller != undefined) {
|
||
|
|
this.cancel()
|
||
|
|
this.controller.close()
|
||
|
|
}
|
||
|
|
})
|
||
|
|
.margin(20)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (this.type=='2') {
|
||
|
|
Image($r('app.media.open_loading'))
|
||
|
|
.width(200)
|
||
|
|
.rotate({ angle: this.angle })
|
||
|
|
.height(200)
|
||
|
|
.animation({
|
||
|
|
duration: 5000, // 动画时长
|
||
|
|
curve: Curve.EaseOut, // 动画曲线
|
||
|
|
delay: 500, // 动画延迟
|
||
|
|
iterations: -1, // 播放次数
|
||
|
|
playMode: PlayMode.Normal, // 动画模式
|
||
|
|
})
|
||
|
|
.margin(50)
|
||
|
|
}
|
||
|
|
}.backgroundColor('#E6E3DF')
|
||
|
|
.borderRadius(19 * globalThis.ratio)
|
||
|
|
.constraintSize({ minWidth: 520 })
|
||
|
|
}
|
||
|
|
|
||
|
|
aboutToAppear() {
|
||
|
|
AppStorage.SetOrCreate('errorMsg', 0);
|
||
|
|
setTimeout(() => {
|
||
|
|
console.log('this.type',this.type,this.angle)
|
||
|
|
if (this.type=='2') {
|
||
|
|
this.angle = 360
|
||
|
|
}
|
||
|
|
},1000)
|
||
|
|
if(this.type=='1'){
|
||
|
|
setTimeout(()=>{
|
||
|
|
this.controller.close()
|
||
|
|
},2000)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
aboutToDisappear() {
|
||
|
|
this.title=''
|
||
|
|
this.angle = 0
|
||
|
|
}
|
||
|
|
}
|