Showing
2 changed files
with
83 additions
and
53 deletions
| @@ -49,9 +49,12 @@ export struct AccountAndSecurityLayout { | @@ -49,9 +49,12 @@ export struct AccountAndSecurityLayout { | ||
| 49 | 49 | ||
| 50 | confirmDialogController: CustomDialogController = new CustomDialogController({ | 50 | confirmDialogController: CustomDialogController = new CustomDialogController({ |
| 51 | builder: ConfirmLogoutDialog({ | 51 | builder: ConfirmLogoutDialog({ |
| 52 | - cancel: () => { | ||
| 53 | - | ||
| 54 | - }, | 52 | + tipShow:false, |
| 53 | + title:"确认退出登录吗?", | ||
| 54 | + leftText:"确认", | ||
| 55 | + leftTextColor:$r('app.color.color_648DF2'), | ||
| 56 | + rightText:"取消", | ||
| 57 | + cancelIsLeft:false, | ||
| 55 | confirm: () => { | 58 | confirm: () => { |
| 56 | this.logout() | 59 | this.logout() |
| 57 | } | 60 | } |
| @@ -213,17 +216,6 @@ export struct AccountAndSecurityLayout { | @@ -213,17 +216,6 @@ export struct AccountAndSecurityLayout { | ||
| 213 | Column() { | 216 | Column() { |
| 214 | Button('退出登录',{ stateEffect: true ,type: ButtonType.Normal}).width('90%').height('80lpx').backgroundColor('#da3e22').fontColor('#fff').margin('20lpx').borderRadius('8lpx').onClick(()=>{ | 217 | Button('退出登录',{ stateEffect: true ,type: ButtonType.Normal}).width('90%').height('80lpx').backgroundColor('#da3e22').fontColor('#fff').margin('20lpx').borderRadius('8lpx').onClick(()=>{ |
| 215 | this.confirmDialogController.open() | 218 | this.confirmDialogController.open() |
| 216 | - | ||
| 217 | - // AlertDialog.show({ | ||
| 218 | - // title: '🥟id : ' + "button", | ||
| 219 | - // message: '标题:' + '退出登录', | ||
| 220 | - // confirm: { | ||
| 221 | - // value: "OK", | ||
| 222 | - // action: () => { | ||
| 223 | - // | ||
| 224 | - // }, | ||
| 225 | - // } | ||
| 226 | - // }) | ||
| 227 | }) | 219 | }) |
| 228 | } | 220 | } |
| 229 | } | 221 | } |
| @@ -2,6 +2,17 @@ | @@ -2,6 +2,17 @@ | ||
| 2 | 2 | ||
| 3 | @CustomDialog | 3 | @CustomDialog |
| 4 | export struct ConfirmLogoutDialog { | 4 | export struct ConfirmLogoutDialog { |
| 5 | + @State title: string = "标题" | ||
| 6 | + @State titleShow: boolean = true | ||
| 7 | + @State tipValue: string ="提示文字" | ||
| 8 | + @State tipShow: boolean = true | ||
| 9 | + @State cancelIsLeft :boolean = true//取消是否在左边 | ||
| 10 | + @State leftText: string = "取消" | ||
| 11 | + @State rightText: string = "确认" | ||
| 12 | + @State leftTextColor: Resource = $r('app.color.color_333333') | ||
| 13 | + @State rightTextColor: Resource = $r('app.color.color_648DF2') | ||
| 14 | + | ||
| 15 | + | ||
| 5 | controller: CustomDialogController | 16 | controller: CustomDialogController |
| 6 | cancel: () => void = () => { | 17 | cancel: () => void = () => { |
| 7 | } | 18 | } |
| @@ -10,51 +21,78 @@ export struct ConfirmLogoutDialog { | @@ -10,51 +21,78 @@ export struct ConfirmLogoutDialog { | ||
| 10 | 21 | ||
| 11 | build() { | 22 | build() { |
| 12 | Column() { | 23 | Column() { |
| 13 | - Text("确认退出登录吗?") | ||
| 14 | - .fontColor("#222222") | ||
| 15 | - .fontSize(18) | 24 | + Column(){ |
| 25 | + if(this.titleShow){ | ||
| 26 | + Text(this.title) | ||
| 27 | + .fontSize("32lpx") | ||
| 28 | + .fontColor($r('app.color.color_333333')) | ||
| 29 | + .lineHeight('50lpx') | ||
| 30 | + .fontWeight(600) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + if(this.tipShow){ | ||
| 34 | + Text(this.tipValue) | ||
| 35 | + .margin({ top:this.titleShow?"10lpx":"0lpx" }) | ||
| 36 | + .fontSize("27lpx") | ||
| 37 | + .fontWeight(400) | ||
| 38 | + .lineHeight('38lpx') | ||
| 39 | + .fontColor($r('app.color.color_999999')) | ||
| 40 | + } | ||
| 41 | + }.padding({top:"48lpx",bottom:"48lpx"}) | ||
| 42 | + .alignItems(HorizontalAlign.Center) | ||
| 43 | + | ||
| 44 | + Divider() | ||
| 16 | .width("100%") | 45 | .width("100%") |
| 17 | - .fontWeight(FontWeight.Bold) | ||
| 18 | - .textAlign(TextAlign.Center) | ||
| 19 | - .margin({ top: 20 }) | ||
| 20 | - | ||
| 21 | - Divider().color("#999999").width("100%").margin({ top: 20 }).height('1vp') | ||
| 22 | - Row() { | ||
| 23 | - Text('确认') | ||
| 24 | - .fontSize(16) | ||
| 25 | - .fontColor("#648DF2") | ||
| 26 | - .layoutWeight(1) | ||
| 27 | - .fontWeight(FontWeight.Medium) | ||
| 28 | - .textAlign(TextAlign.Center) | 46 | + .strokeWidth('1lpx') |
| 47 | + .height('1lpx') | ||
| 48 | + .color($r('app.color.color_EEEEEE')) | ||
| 49 | + | ||
| 50 | + Row(){ | ||
| 51 | + Text(this.leftText) | ||
| 52 | + .fontSize('35lpx') | ||
| 53 | + .fontWeight(400) | ||
| 54 | + .fontColor(this.leftTextColor) | ||
| 29 | .onClick(() => { | 55 | .onClick(() => { |
| 30 | - this.controller.close() | ||
| 31 | - if (this.confirm) { | ||
| 32 | - this.confirm() | 56 | + if (this.controller != undefined){ |
| 57 | + if(this.cancelIsLeft){ | ||
| 58 | + this.controller.close() | ||
| 59 | + this.cancel() | ||
| 60 | + }else{ | ||
| 61 | + this.controller.close() | ||
| 62 | + this.confirm() | ||
| 63 | + } | ||
| 33 | } | 64 | } |
| 34 | - | ||
| 35 | - }) | ||
| 36 | - .height('100%') | ||
| 37 | - // Divider().color("#999999").height('100%').width('0.5vp') | ||
| 38 | - Text('取消') | ||
| 39 | - .fontSize(16) | ||
| 40 | - .fontColor("#648DF2") | ||
| 41 | - .layoutWeight(1) | ||
| 42 | - .fontWeight(FontWeight.Medium) | 65 | + }).layoutWeight(1) |
| 43 | .textAlign(TextAlign.Center) | 66 | .textAlign(TextAlign.Center) |
| 44 | - .border({ | ||
| 45 | - width: { left: 1 }, | ||
| 46 | - color: "#999999", | ||
| 47 | - style: { left: BorderStyle.Solid } | ||
| 48 | 67 | ||
| 49 | - }) | 68 | + Divider() |
| 69 | + .width("1lpx") | ||
| 70 | + .strokeWidth('1lpx') | ||
| 71 | + .vertical(true) | ||
| 72 | + .height('92lpx') | ||
| 73 | + .color($r('app.color.color_EEEEEE')) | ||
| 74 | + | ||
| 75 | + Text(this.rightText) | ||
| 76 | + .fontSize('35lpx') | ||
| 77 | + .textAlign(TextAlign.Center) | ||
| 78 | + .fontWeight(400) | ||
| 79 | + .fontColor(this.rightTextColor) | ||
| 50 | .onClick(() => { | 80 | .onClick(() => { |
| 51 | - this.controller.close() | ||
| 52 | - if (this.cancel) { | ||
| 53 | - this.cancel() | 81 | + if (this.controller != undefined) { |
| 82 | + if(this.cancelIsLeft){ | ||
| 83 | + this.controller.close() | ||
| 84 | + this.confirm() | ||
| 85 | + }else{ | ||
| 86 | + this.controller.close() | ||
| 87 | + this.cancel() | ||
| 88 | + } | ||
| 54 | } | 89 | } |
| 55 | - }) | ||
| 56 | - .height('100%') | ||
| 57 | - }.layoutWeight(1).justifyContent(FlexAlign.Center) | ||
| 58 | - }.height(110).backgroundColor(Color.White).borderRadius(6).width('74%') | 90 | + }).layoutWeight(1) |
| 91 | + } | ||
| 92 | + .alignItems(VerticalAlign.Center) | ||
| 93 | + .height('96lpx') | ||
| 94 | + }.borderRadius(10) | ||
| 95 | + .width("518lpx") | ||
| 96 | + .backgroundColor("#FFF") | ||
| 59 | } | 97 | } |
| 60 | } | 98 | } |
-
Please register or login to post a comment