Showing
1 changed file
with
105 additions
and
9 deletions
| @@ -55,6 +55,7 @@ struct LoginPage { | @@ -55,6 +55,7 @@ struct LoginPage { | ||
| 55 | alignment:DialogAlignment.Center | 55 | alignment:DialogAlignment.Center |
| 56 | }) | 56 | }) |
| 57 | loginViewModel = new LoginViewModel() | 57 | loginViewModel = new LoginViewModel() |
| 58 | + @State isProtocol:boolean=false | ||
| 58 | 59 | ||
| 59 | onCodeSend() { | 60 | onCodeSend() { |
| 60 | Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") | 61 | Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") |
| @@ -72,6 +73,7 @@ struct LoginPage { | @@ -72,6 +73,7 @@ struct LoginPage { | ||
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | build() { | 75 | build() { |
| 76 | + Stack() { | ||
| 75 | RelativeContainer() { | 77 | RelativeContainer() { |
| 76 | 78 | ||
| 77 | //注册内容 | 79 | //注册内容 |
| @@ -105,13 +107,13 @@ struct LoginPage { | @@ -105,13 +107,13 @@ struct LoginPage { | ||
| 105 | Text() { | 107 | Text() { |
| 106 | Span("我已阅读并同意").fontColor("#999999").fontSize(12) | 108 | Span("我已阅读并同意").fontColor("#999999").fontSize(12) |
| 107 | Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { | 109 | Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { |
| 108 | - let bean={contentID:"1",pageID:""} as Params | ||
| 109 | - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 110 | + let bean = { contentID: "1", pageID: "" } as Params |
| 111 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | ||
| 110 | }) | 112 | }) |
| 111 | Span("及").fontColor("#999999").fontSize(12) | 113 | Span("及").fontColor("#999999").fontSize(12) |
| 112 | Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { | 114 | Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { |
| 113 | - let bean={contentID:"2",pageID:""} as Params | ||
| 114 | - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 115 | + let bean = { contentID: "2", pageID: "" } as Params |
| 116 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | ||
| 115 | }) | 117 | }) |
| 116 | } | 118 | } |
| 117 | }.margin({ top: 48 }).alignItems(VerticalAlign.Center) | 119 | }.margin({ top: 48 }).alignItems(VerticalAlign.Center) |
| @@ -119,16 +121,16 @@ struct LoginPage { | @@ -119,16 +121,16 @@ struct LoginPage { | ||
| 119 | Row() { | 121 | Row() { |
| 120 | Text("登录") | 122 | Text("登录") |
| 121 | .borderRadius(4) | 123 | .borderRadius(4) |
| 122 | - .fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF") | 124 | + .fontColor(this.isSubmit ? "#FFFFFFFF" : "#66FFFFFF") |
| 123 | .fontSize(18) | 125 | .fontSize(18) |
| 124 | .fontWeight(FontWeight.Medium) | 126 | .fontWeight(FontWeight.Medium) |
| 125 | .margin({ top: 20 }) | 127 | .margin({ top: 20 }) |
| 126 | .height(44) | 128 | .height(44) |
| 127 | .textAlign(TextAlign.Center) | 129 | .textAlign(TextAlign.Center) |
| 128 | .width("100%") | 130 | .width("100%") |
| 129 | - .backgroundColor(this.isSubmit?"#FFED2800":"#99ED2800") | 131 | + .backgroundColor(this.isSubmit ? "#FFED2800" : "#99ED2800") |
| 130 | .onClick(() => { | 132 | .onClick(() => { |
| 131 | - if(!this.isSubmit){ | 133 | + if (!this.isSubmit) { |
| 132 | return | 134 | return |
| 133 | } | 135 | } |
| 134 | this.loginSubmit() | 136 | this.loginSubmit() |
| @@ -141,7 +143,7 @@ struct LoginPage { | @@ -141,7 +143,7 @@ struct LoginPage { | ||
| 141 | Text('忘记密码').fontColor('#666666').fontSize(14).margin({ top: 16 }) | 143 | Text('忘记密码').fontColor('#666666').fontSize(14).margin({ top: 16 }) |
| 142 | .onClick(() => { | 144 | .onClick(() => { |
| 143 | // router.pushUrl({ url: 'pages/login/ForgetPasswordPage' }) | 145 | // router.pushUrl({ url: 'pages/login/ForgetPasswordPage' }) |
| 144 | - let pageType = {'pageType': 0} as Record<string, number>; | 146 | + let pageType = { 'pageType': 0 } as Record<string, number>; |
| 145 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) | 147 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) |
| 146 | }) | 148 | }) |
| 147 | } | 149 | } |
| @@ -174,6 +176,16 @@ struct LoginPage { | @@ -174,6 +176,16 @@ struct LoginPage { | ||
| 174 | .id('id_close') | 176 | .id('id_close') |
| 175 | 177 | ||
| 176 | }.width('100%').height('100%') | 178 | }.width('100%').height('100%') |
| 179 | + | ||
| 180 | + ProtocolComponent({ | ||
| 181 | + cancelMethod: (): void => this.cancelProtocol(), | ||
| 182 | + agreeMethod: (): void => this.agreeProtocol() | ||
| 183 | + }) | ||
| 184 | + .visibility(this.isProtocol ? Visibility.Visible : Visibility.None) | ||
| 185 | + | ||
| 186 | + }.width('100%') | ||
| 187 | + .height('100%') | ||
| 188 | + | ||
| 177 | } | 189 | } |
| 178 | 190 | ||
| 179 | @Builder | 191 | @Builder |
| @@ -366,8 +378,92 @@ struct LoginPage { | @@ -366,8 +378,92 @@ struct LoginPage { | ||
| 366 | if (this.protocolState) { | 378 | if (this.protocolState) { |
| 367 | this.requestLogin() | 379 | this.requestLogin() |
| 368 | } else { | 380 | } else { |
| 369 | - this.dialogController.open() | 381 | + // this.dialogController.open() |
| 382 | + this.isProtocol=true | ||
| 383 | + } | ||
| 384 | + | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + agreeProtocol(): void { | ||
| 388 | + this.isProtocol = false | ||
| 389 | + this.protocolState = true | ||
| 390 | + this.requestLogin() | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + cancelProtocol(): void { | ||
| 394 | + this.isProtocol = false | ||
| 370 | } | 395 | } |
| 396 | +} | ||
| 397 | + | ||
| 398 | + | ||
| 399 | +@Component | ||
| 400 | +struct ProtocolComponent { | ||
| 401 | + cancelMethod?: () => void | ||
| 402 | + agreeMethod?: () => void | ||
| 403 | + | ||
| 404 | + build() { | ||
| 405 | + Stack() { | ||
| 406 | + Column() { | ||
| 407 | + Text("温馨提示") | ||
| 408 | + .fontColor("#222222") | ||
| 409 | + .fontSize(18) | ||
| 410 | + .width("100%") | ||
| 411 | + .fontWeight(FontWeight.Bold) | ||
| 412 | + .textAlign(TextAlign.Center) | ||
| 413 | + .margin({ top: 20 }) | ||
| 414 | + Text() { | ||
| 415 | + Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666") | ||
| 416 | + Span("《用户协议》").fontSize(14).fontColor("#ED2800").onClick(() => { | ||
| 417 | + let bean = { contentID: "1", pageID: "" } as Params | ||
| 418 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | ||
| 419 | + }) | ||
| 420 | + Span("及").fontSize(14).fontColor("#666666") | ||
| 421 | + Span("《隐私政策》").fontSize(14).fontColor("#ED2800").onClick(() => { | ||
| 422 | + let bean = { contentID: "2", pageID: "" } as Params | ||
| 423 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | ||
| 424 | + }) | ||
| 425 | + Span("后进行登录").fontSize(14).fontColor("#666666") | ||
| 426 | + }.margin({ top: 12, left: 16, right: 16 }) | ||
| 427 | + | ||
| 428 | + Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp') | ||
| 429 | + Row() { | ||
| 430 | + Text('放弃登录') | ||
| 431 | + .fontSize(16) | ||
| 432 | + .fontColor("#999999") | ||
| 433 | + .layoutWeight(1) | ||
| 434 | + .fontWeight(FontWeight.Medium) | ||
| 435 | + .textAlign(TextAlign.Center) | ||
| 436 | + .onClick(() => { | ||
| 437 | + if (this.cancelMethod) { | ||
| 438 | + this.cancelMethod() | ||
| 439 | + } | ||
| 440 | + }) | ||
| 441 | + .height('100%') | ||
| 442 | + // Divider().color("#999999").height('100%').width('0.5vp') | ||
| 443 | + Text('同意并登录') | ||
| 444 | + .fontSize(16) | ||
| 445 | + .fontColor("#ED2800") | ||
| 446 | + .layoutWeight(1) | ||
| 447 | + .fontWeight(FontWeight.Medium) | ||
| 448 | + .textAlign(TextAlign.Center) | ||
| 449 | + .border({ | ||
| 450 | + width: { left: 1 }, | ||
| 451 | + color: "#999999", | ||
| 452 | + style: { left: BorderStyle.Solid } | ||
| 453 | + | ||
| 454 | + }) | ||
| 455 | + .onClick(() => { | ||
| 456 | + if (this.agreeMethod) { | ||
| 457 | + this.agreeMethod() | ||
| 458 | + } | ||
| 459 | + }) | ||
| 460 | + .height('100%') | ||
| 461 | + }.layoutWeight(1).justifyContent(FlexAlign.Center) | ||
| 462 | + }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%') | ||
| 463 | + | ||
| 464 | + }.width('100%') | ||
| 465 | + .height('100%') | ||
| 466 | + .backgroundColor('#66000000') | ||
| 371 | 467 | ||
| 372 | } | 468 | } |
| 373 | } | 469 | } |
-
Please register or login to post a comment