iOS-study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LoginView.swift 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //
  2. // ContentView.swift
  3. // iOSFirst
  4. //
  5. // Created by 孙宇峰 on 2023/1/31.
  6. //
  7. import SwiftUI
  8. import RxSwift
  9. import RxCocoa
  10. import RxRelay
  11. struct LoginView: View {
  12. private var viewModel = LoginViewModel()
  13. var bag = DisposeBag()
  14. var body: some View {
  15. VStack(alignment:.leading,spacing: 0) {
  16. HStack{
  17. Spacer()
  18. Image(systemName: "globe")
  19. .imageScale(.large)
  20. .foregroundColor(.accentColor)
  21. Text("设置").font(.system(size: 14))
  22. }
  23. Text("欢迎来到")
  24. .foregroundColor(.gray)
  25. .font(.system(size: 30))
  26. .multilineTextAlignment(.center)
  27. .bold()
  28. .padding(.top,20)
  29. HStack{
  30. Image("app_logo")
  31. .resizable()
  32. .imageScale(.large)
  33. .foregroundColor(.accentColor)
  34. .scaledToFill()
  35. .frame(width: 50,height: 50)
  36. Image("txtlogo")
  37. .imageScale(.large)
  38. .foregroundColor(.accentColor)
  39. .frame(width: 240,height: 35)
  40. }.frame(height: 40)
  41. .padding(.top,20)
  42. .padding(.bottom,100)
  43. VStack(alignment: .leading, spacing: 400) {
  44. HStack(alignment: .center, spacing: 15) {
  45. Image(systemName: "globe")
  46. .imageScale(.large)
  47. .foregroundColor(.accentColor)
  48. TextField("请输入手机号",text:.constant(""))
  49. .id("etPhoneNum")
  50. .font(.system(size: 16))
  51. .frame(maxWidth: .infinity,alignment: .center)
  52. }
  53. }
  54. .frame(height: 80)
  55. Divider()
  56. VStack(alignment: .leading, spacing: 400) {
  57. HStack(alignment: .center, spacing: 15) {
  58. Image(systemName: "globe")
  59. .imageScale(.large)
  60. .foregroundColor(.accentColor)
  61. TextField("请输入密码",text:.constant(""))
  62. .id("etPassword")
  63. .font(.system(size: 16))
  64. .frame(maxWidth: .infinity,alignment: .center)
  65. }
  66. }.frame(height: 80)
  67. Divider().padding(.bottom,40)
  68. VStack(alignment: .trailing, spacing: 400) {
  69. VStack(alignment: .center, spacing: 15) {
  70. Button(action: {
  71. // let msg="点击了登录按钮"
  72. // print(msg)
  73. viewModel.loginUser()
  74. // SUIToast.show(messageItem: .init(
  75. // message: msg,
  76. // bgColor: .gray,
  77. // messageColor: .white
  78. // ))
  79. }) {
  80. Text("登录")
  81. .font(.system(size: 17))
  82. .bold()
  83. .frame(minWidth: 0, maxWidth: .infinity)
  84. .padding()
  85. .foregroundColor(.white)
  86. .background(.blue)
  87. .cornerRadius(30)
  88. }
  89. }
  90. }
  91. HStack{
  92. Text("验证码登录").font(.system(size:15)).onTapGesture {
  93. let msg="点击了验证码登录"
  94. print(msg)
  95. SUIToast.show(messageItem: .init(
  96. message: msg,
  97. bgColor: .gray,
  98. messageColor: .white
  99. ))
  100. }
  101. Spacer ()
  102. Text("忘记密码?").font(.system(size:15)).onTapGesture {
  103. let msg="点击了密码"
  104. print(msg)
  105. SUIToast.show(messageItem: .init(
  106. message: msg,
  107. bgColor: .gray,
  108. messageColor: .white
  109. ))
  110. }.padding(.vertical,20).font(.system(size: 15))
  111. }
  112. Spacer()
  113. }.padding()
  114. .frame(width: .infinity,height: .infinity)
  115. }
  116. }
  117. struct ContentView_Previews: PreviewProvider {
  118. static var previews: some View {
  119. LoginView()
  120. }
  121. }