LoginPage.ets 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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(Color.White)
  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. Row() {
  40. Image($r('app.media.muyubanck')).width(159).height(159).borderRadius(20)
  41. }.width('100%')
  42. .justifyContent(FlexAlign.Center)
  43. }
  44. .padding({ left: 16, })
  45. .height(193)
  46. .width('100%')
  47. .alignItems(HorizontalAlign.Start)
  48. Row() {
  49. Column() {
  50. Text().width(30).height(8).backgroundColor(this.tabBarIndex==1?'#fbdf71':Color.Transparent).offset({y:35}).borderRadius(3)
  51. Text('登录')
  52. .fontSize(20)
  53. .fontWeight(600)
  54. .borderRadius({
  55. topLeft: 12,
  56. topRight: 12,
  57. bottomLeft: this.tabBarIndex == 0 || this.tabBarIndex == 2 ? 12 : 0
  58. })
  59. // .backgroundColor(this.tabBarIndex == 1 ? Color.White : Color.Transparent)
  60. .height(48)
  61. .textAlign(TextAlign.Center)
  62. .fontColor(this.tabBarIndex == 1 ? Color.White : 'rgba(255, 255, 255, 0.35)')
  63. .onClick(() => {
  64. this.tabBarIndex = 1
  65. this.tabController.changeIndex(1)
  66. })
  67. }.justifyContent(FlexAlign.End)
  68. .alignItems(HorizontalAlign.Center)
  69. .layoutWeight(1)
  70. .height(48)
  71. Column() {
  72. Text().width(30).height(8).backgroundColor(this.tabBarIndex==0?'#fbdf71':Color.Transparent).offset({y:35}).borderRadius(3)
  73. Text('注册')
  74. .fontSize(20)
  75. .fontWeight(600)
  76. .fontColor(this.tabBarIndex == 0 || this.tabBarIndex == 2 ? Color.White : 'rgba(255, 255, 255, 0.35)')
  77. // .backgroundColor(this.tabBarIndex == 0 || this.tabBarIndex == 2 ? Color.White : Color.Transparent)
  78. .textAlign(TextAlign.Center)
  79. .height(48)
  80. .borderRadius({ topLeft: 12, topRight: 12, bottomRight: this.tabBarIndex == 1 ? 12 : 0 })
  81. .onClick(() => {
  82. this.tabBarIndex = 0
  83. this.tabController.changeIndex(0)
  84. })
  85. }.justifyContent(FlexAlign.End)
  86. .alignItems(HorizontalAlign.Center)
  87. .layoutWeight(1)
  88. .height(48)
  89. }
  90. .alignItems(VerticalAlign.Center)
  91. .justifyContent(FlexAlign.SpaceBetween)
  92. .width('100%')
  93. .margin({top:20})
  94. }
  95. .padding({ top: this.safeTop })
  96. // .linearGradient({ angle: 135, colors: [['#CAE2F9', -0.1571], ['#D4D1F4', 0.4709], ['#EDF5FD', 1.1235]] })
  97. .margin({ bottom: 20 })
  98. Tabs({ controller: this.tabController }) {
  99. TabContent() {
  100. RegisterOrResetPassComp({ loginCollect: new LoginCollect("register") })
  101. }
  102. .padding({ left: 20, right: 20 })
  103. TabContent() {
  104. LoginView({
  105. forgetPassClick: () => {
  106. this.tabBarIndex = 2
  107. this.tabController.changeIndex(2)
  108. }
  109. })
  110. }
  111. .padding({ left: 20, right: 20 })
  112. TabContent() {
  113. RegisterOrResetPassComp({ loginCollect: new LoginCollect("reset") })
  114. }
  115. .padding({ left: 20, right: 20 })
  116. }
  117. .scrollable(false)
  118. .layoutWeight(1)
  119. .barHeight(0)
  120. .padding({left:10,right:20})
  121. }
  122. .padding({
  123. bottom: this.safeBottom
  124. })
  125. // .backgroundImage(this.tabBarIndex==1?$r('app.media.login'):$r('app.media.register'))
  126. // .backgroundImageSize({width:'100%',height:'100%'})
  127. // .backgroundImage($r('app.media.muyubanck'))
  128. .backgroundColor(Color.Black)
  129. .height('100%')
  130. }
  131. }