RegisterOrResetPassView.ets 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import { YTButton } from 'basic'
  2. import { LoginCollect } from 'basic/src/main/ets/models/LoginCollect'
  3. import { CodeInputType } from '../models'
  4. import { LoginInput } from '../components/LoginInput'
  5. @Component
  6. export struct RegisterOrResetPassComp {
  7. @State @Require loginCollect: LoginCollect
  8. private mgBottom: number = 24
  9. private inputPhoneNumberType: CodeInputType = {
  10. txt: '+86',
  11. placeHolder: '请输入手机号码'
  12. }
  13. private inputCaptchaType: CodeInputType = {
  14. txt: '验证码',
  15. placeHolder: '请输入验证码'
  16. }
  17. private inputPasswordType: CodeInputType = {
  18. txt: '密码',
  19. placeHolder: '设置密码'
  20. }
  21. private inputConfirmPasswordType: CodeInputType = {
  22. txt: '密码',
  23. placeHolder: '再次确认密码'
  24. }
  25. build() {
  26. Column() {
  27. LoginInput({
  28. item: this.inputPhoneNumberType,
  29. inputData: this.loginCollect.phonenumber,
  30. needCode: false,
  31. inputChange: (value) => {
  32. this.loginCollect.phonenumber = value
  33. }
  34. })
  35. LoginInput({
  36. item: this.inputCaptchaType,
  37. inputData: this.loginCollect.smsCode,
  38. needCode: true,
  39. loginCollect: this.loginCollect,
  40. inputChange: (value) => {
  41. this.loginCollect.smsCode = value
  42. }
  43. })
  44. LoginInput({
  45. item: this.inputPasswordType,
  46. inputData: this.loginCollect.password,
  47. needCode: false,
  48. isPassword: true,
  49. marginBottom: 0,
  50. inputChange: (value) => {
  51. this.loginCollect.password = value
  52. }
  53. })
  54. LoginInput({
  55. item: this.inputConfirmPasswordType,
  56. inputData: this.loginCollect.confirmPassword,
  57. isPassword: true,
  58. needCode: false,
  59. inputChange: (value) => {
  60. this.loginCollect.confirmPassword = value
  61. }
  62. })
  63. Text('*密码必须包含8-20位数字或字母、特殊符号')
  64. .fontSize(10)
  65. .fontColor('#e1e1e1')
  66. .margin({ top: 4, bottom: 48 })
  67. .fontColor('#FFEA4A18')
  68. YTButton({
  69. //: '立即重置'
  70. btContent: this.calcButtonContent(),
  71. click: () => {
  72. this.loginCollect.executeLogin("common")
  73. },
  74. btBorderRadius: 32
  75. })
  76. if(this.loginCollect.getOperation()=='reset'){
  77. }else{
  78. Text('注册成功后将自动登录')
  79. .fontSize(10)
  80. .fontColor($r('[basic].color.main_ac_color_dark'))
  81. .margin({ top: 16 })
  82. }
  83. }
  84. .width('100%')
  85. .height('100%')
  86. .alignItems(HorizontalAlign.Start)
  87. }
  88. private calcButtonContent() {
  89. switch (this.loginCollect.getOperation()) {
  90. case 'register':
  91. return '立即注册'
  92. case 'reset':
  93. return '立即重置'
  94. case 'login':
  95. return '立即登录'
  96. }
  97. }
  98. }