LoginPage.ets 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import { YTAvoid, yTRouter } from 'basic'
  2. import { LoginCollect } from 'basic/src/main/ets/models/LoginCollect'
  3. import { RegisterOrResetPassComp } from '../views/RegisterOrResetPassView'
  4. import { LoginView } from '../views/LoginView'
  5. // import { OtherLoginMethods } from '../views/OtherLoginMethods'
  6. @Builder
  7. function LoginBuilder() {
  8. NavDestination() {
  9. LoginPage()
  10. }
  11. .hideTitleBar(true)
  12. }
  13. @Component
  14. struct LoginPage {
  15. @StorageProp(YTAvoid.SAFE_TOP_KEY) private safeTop: number = 0
  16. @StorageProp(YTAvoid.SAFE_BOTTOM_KEY) private safeBottom: number = 0
  17. @State private tabBarIndex: number = 0
  18. private tabController: TabsController = new TabsController()
  19. aboutToAppear(): void {
  20. }
  21. build() {
  22. Column() {
  23. Column() {
  24. Column() {
  25. Text('跳过')
  26. .fontSize(12)
  27. .fontWeight(400)
  28. .alignSelf(ItemAlign.End)
  29. .textAlign(TextAlign.Center)
  30. .fontColor($r('[basic].color.main_ac_color_light'))
  31. .onClick(() => {
  32. yTRouter.routerBack()
  33. })
  34. .height(24)
  35. .width(48)
  36. .borderRadius(12)
  37. .backgroundColor('#4DFFFFFF')
  38. .margin({ bottom: 24, right: 28, top: 20 })
  39. Text('你好,\n欢迎来到盒小仓')
  40. .lineHeight(40)
  41. .fontSize(28)
  42. .fontWeight(600)
  43. .fontColor($r('[basic].color.main_ac_color_dark'))
  44. }
  45. .padding({ left: 16, })
  46. .height(193)
  47. .width('100%')
  48. .alignItems(HorizontalAlign.Start)
  49. Row() {
  50. Text('注册')
  51. .fontSize(16)
  52. .fontWeight(600)
  53. .layoutWeight(1)
  54. .fontColor(this.tabBarIndex == 0 || this.tabBarIndex == 2 ? '#FF141111' : '#80141111')
  55. .backgroundColor(this.tabBarIndex == 0 || this.tabBarIndex == 2 ? Color.White : Color.Transparent)
  56. .textAlign(TextAlign.Center)
  57. .height(48)
  58. .borderRadius({ topLeft: 12, topRight: 12, bottomRight: this.tabBarIndex == 1 ? 12 : 0 })
  59. .onClick(() => {
  60. this.tabBarIndex = 0
  61. this.tabController.changeIndex(0)
  62. })
  63. Text('登录')
  64. .fontSize(16)
  65. .fontWeight(600)
  66. .borderRadius({
  67. topLeft: 12,
  68. topRight: 12,
  69. bottomLeft: this.tabBarIndex == 0 || this.tabBarIndex == 2 ? 12 : 0
  70. })
  71. .backgroundColor(this.tabBarIndex == 1 ? Color.White : Color.Transparent)
  72. .layoutWeight(1)
  73. .height(48)
  74. .textAlign(TextAlign.Center)
  75. .fontColor(this.tabBarIndex == 1 ? '#FF141111' : '#80141111')
  76. .onClick(() => {
  77. this.tabBarIndex = 1
  78. this.tabController.changeIndex(1)
  79. })
  80. }
  81. .alignItems(VerticalAlign.Center)
  82. .justifyContent(FlexAlign.SpaceBetween)
  83. .width('100%')
  84. }
  85. .padding({ top: this.safeTop })
  86. .linearGradient({ angle: 135, colors: [['#CAE2F9', -0.1571], ['#D4D1F4', 0.4709], ['#EDF5FD', 1.1235]] })
  87. .margin({ bottom: 20 })
  88. Tabs({ controller: this.tabController }) {
  89. TabContent() {
  90. RegisterOrResetPassComp({ loginCollect: new LoginCollect("register") })
  91. }
  92. .padding({ left: 20, right: 20 })
  93. TabContent() {
  94. LoginView({
  95. forgetPassClick: () => {
  96. this.tabBarIndex = 2
  97. this.tabController.changeIndex(2)
  98. }
  99. })
  100. }
  101. .padding({ left: 20, right: 20 })
  102. TabContent() {
  103. RegisterOrResetPassComp({ loginCollect: new LoginCollect("reset") })
  104. }
  105. .padding({ left: 20, right: 20 })
  106. }
  107. .scrollable(false)
  108. .layoutWeight(1)
  109. .barHeight(0)
  110. }
  111. .padding({
  112. bottom: this.safeBottom
  113. })
  114. .height('100%')
  115. }
  116. }