ChangePassword.ets 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import { YTAvoid, YTButton, YTHeader, yTRouter } from 'basic'
  2. import { LoginCollect } from 'basic/src/main/ets/models/LoginCollect'
  3. import { LoginInput } from '../components/LoginInput'
  4. import { CodeInputType } from '../models'
  5. @Component
  6. struct ChangePassWord{
  7. @State private loginCollect: LoginCollect = new LoginCollect('reset')
  8. @StorageProp(YTAvoid.SAFE_TOP_KEY) safeTop: number = 0
  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. private linearInfo: LinearGradientOptions = {
  26. colors: [ ['#B9FD2A', 0.01], ['#F5FD6D', 1] ],
  27. angle: 110
  28. }
  29. build() {
  30. NavDestination(){
  31. Column(){
  32. YTHeader({ title: '用户设置', bgc: 'rgba(0, 0, 0, 0)', leftComp: this.backIcon})
  33. Column(){
  34. // 手机号
  35. LoginInput({
  36. item: this.inputPhoneNumberType,
  37. inputData: this.loginCollect.phonenumber,
  38. isPassword: false,
  39. needCode: false,
  40. // changeStyle: true,
  41. // fontSize: 16,
  42. // fontColor: Color.White,
  43. inputChange: (value: string) => {
  44. this.loginCollect.phonenumber = value
  45. }
  46. })
  47. // 验证码
  48. LoginInput({
  49. item: this.inputCaptchaType,
  50. inputData: this.loginCollect.smsCode,
  51. needCode: true,
  52. loginCollect: this.loginCollect,
  53. // changeStyle: true,
  54. // fontSize: 16,
  55. // fontColor: Color.White,
  56. // codeSize: 12,
  57. inputChange: (value) => {
  58. this.loginCollect.smsCode = value
  59. }
  60. })
  61. // 设置密码
  62. LoginInput({
  63. item: this.inputPasswordType,
  64. inputData: this.loginCollect.password,
  65. needCode: false,
  66. isPassword: true,
  67. marginBottom: 0,
  68. // changeStyle: true,
  69. // fontColor: Color.White,
  70. // fontSize: 16,
  71. inputChange: (value) => {
  72. this.loginCollect.password = value
  73. }
  74. })
  75. // 确认密码
  76. LoginInput({
  77. item: this.inputConfirmPasswordType,
  78. inputData: this.loginCollect.confirmPassword,
  79. isPassword: true,
  80. needCode: false,
  81. // fontColor: Color.White,
  82. // changeStyle: true,
  83. // fontSize: 16,
  84. inputChange: (value) => {
  85. this.loginCollect.confirmPassword = value
  86. }
  87. })
  88. // 空白占位
  89. Blank()
  90. .layoutWeight(1)
  91. YTButton({
  92. btContent: '完成',
  93. btFontColor: Color.Black,
  94. btFontSize: 20,
  95. btlinear: this.linearInfo,
  96. btBorder: {width: 0},
  97. btPadding: {
  98. left: 26,
  99. right: 26,
  100. top: 9,
  101. bottom: 9
  102. },
  103. click: () => {
  104. // 手动同意下, 防止在重置密码时会弹出隐私协议
  105. this.loginCollect.isAgreePrivacy = true
  106. this.loginCollect.executeLogin("common")
  107. }
  108. }).margin({ bottom: 142 })
  109. }
  110. .padding({ left: 14, right: 14})
  111. .width("100%")
  112. .layoutWeight(1)
  113. }
  114. // .padding({ top: this.safeTop })
  115. }
  116. }
  117. @Builder
  118. backIcon(){
  119. Image($r('app.media.diary_back'))
  120. .width(12)
  121. .height(20)
  122. .margin({ left: 16 })
  123. // .fillColor('#FFECD5AF')
  124. .onClick(() => {
  125. yTRouter.pop()
  126. })
  127. }
  128. }
  129. @Builder
  130. function ChangePassWordBuilder() {
  131. NavDestination() {
  132. ChangePassWord()
  133. }
  134. .hideTitleBar(true)
  135. }