shishuangxi

优化弹框

  1 +import { WDRouterPage, WDRouterRule } from 'wdRouter';
  2 +
1 const TAG = 'PageComponent'; 3 const TAG = 'PageComponent';
2 4
3 /** 5 /**
@@ -7,7 +9,9 @@ const TAG = 'PageComponent'; @@ -7,7 +9,9 @@ const TAG = 'PageComponent';
7 export struct MinePageComponent { 9 export struct MinePageComponent {
8 // TODO 待完善 10 // TODO 待完善
9 build() { 11 build() {
10 - Text('我的页面') 12 + Text('我的页面').onClick(()=>{
  13 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  14 + })
11 } 15 }
12 } 16 }
13 17
1 @CustomDialog 1 @CustomDialog
2 export struct CustomProtocolDialog { 2 export struct CustomProtocolDialog {
3 - cancel: () => void=()=>{}  
4 - confirm: () => void=()=>{}  
5 controller: CustomDialogController 3 controller: CustomDialogController
6 4
  5 + cancel: () => void = () => {
  6 + }
  7 +
  8 + confirm: () => void = () => {
  9 + }
  10 +
7 build() { 11 build() {
8 Column() { 12 Column() {
9 Text("温馨提示") 13 Text("温馨提示")
10 .fontColor("#222222") 14 .fontColor("#222222")
11 - .fontSize(23) 15 + .fontSize(18)
12 .width("100%") 16 .width("100%")
13 .fontWeight(FontWeight.Bold) 17 .fontWeight(FontWeight.Bold)
14 .textAlign(TextAlign.Center) 18 .textAlign(TextAlign.Center)
15 - .margin({ top: 26 }) 19 + .margin({ top: 20 })
16 Text() { 20 Text() {
17 - Span("为保障您的合法权益,请阅读并同意").fontSize(18).fontColor("#666666")  
18 - Span("《用户协议》").fontSize(18).fontColor("#ED2800")  
19 - Span("及").fontSize(18).fontColor("#666666")  
20 - Span("《隐私政策》").fontSize(18).fontColor("#ED2800")  
21 - Span("后进行登录").fontSize(18).fontColor("#666666")  
22 - }.margin({ top: 15, left: 20, right: 20 }) 21 + Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666")
  22 + Span("《用户协议》").fontSize(14).fontColor("#ED2800")
  23 + Span("及").fontSize(14).fontColor("#666666")
  24 + Span("《隐私政策》").fontSize(14).fontColor("#ED2800")
  25 + Span("后进行登录").fontSize(14).fontColor("#666666")
  26 + }.margin({ top: 12, left: 16, right: 16 })
23 27
24 - Divider().color("#999999").width("100%").margin({ top: 18 }).height('0.5vp') 28 + Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp')
25 Row() { 29 Row() {
26 Text('放弃登录') 30 Text('放弃登录')
27 - .fontSize(20) 31 + .fontSize(16)
28 .fontColor("#999999") 32 .fontColor("#999999")
29 .layoutWeight(1) 33 .layoutWeight(1)
30 .fontWeight(FontWeight.Medium) 34 .fontWeight(FontWeight.Medium)
@@ -35,18 +39,19 @@ export struct CustomProtocolDialog { @@ -35,18 +39,19 @@ export struct CustomProtocolDialog {
35 this.cancel() 39 this.cancel()
36 } 40 }
37 41
38 - }).height('100%') 42 + })
  43 + .height('100%')
39 // Divider().color("#999999").height('100%').width('0.5vp') 44 // Divider().color("#999999").height('100%').width('0.5vp')
40 Text('同意并登录') 45 Text('同意并登录')
41 - .fontSize(20) 46 + .fontSize(16)
42 .fontColor("#ED2800") 47 .fontColor("#ED2800")
43 .layoutWeight(1) 48 .layoutWeight(1)
44 .fontWeight(FontWeight.Medium) 49 .fontWeight(FontWeight.Medium)
45 .textAlign(TextAlign.Center) 50 .textAlign(TextAlign.Center)
46 .border({ 51 .border({
47 - width:{left:1},  
48 - color:"#999999",  
49 - style:{left:BorderStyle.Solid} 52 + width: { left: 1 },
  53 + color: "#999999",
  54 + style: { left: BorderStyle.Solid }
50 55
51 }) 56 })
52 .onClick(() => { 57 .onClick(() => {
@@ -54,8 +59,9 @@ export struct CustomProtocolDialog { @@ -54,8 +59,9 @@ export struct CustomProtocolDialog {
54 if (this.confirm) { 59 if (this.confirm) {
55 this.confirm() 60 this.confirm()
56 } 61 }
57 - }).height('100%') 62 + })
  63 + .height('100%')
58 }.layoutWeight(1).justifyContent(FlexAlign.Center) 64 }.layoutWeight(1).justifyContent(FlexAlign.Center)
59 - }.height(206).backgroundColor(Color.White).borderRadius(8) 65 + }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%')
60 } 66 }
61 } 67 }
@@ -51,7 +51,8 @@ struct LoginPage { @@ -51,7 +51,8 @@ struct LoginPage {
51 this.requestLogin() 51 this.requestLogin()
52 } 52 }
53 }), 53 }),
54 - // alignment:DialogAlignment.Center 54 + customStyle: true,
  55 + alignment:DialogAlignment.Center
55 }) 56 })
56 loginViewModel = new LoginViewModel() 57 loginViewModel = new LoginViewModel()
57 58