ResetPasswordUIView.swift 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // ResetPasswordUIView.swift
  3. // fiveConstant
  4. //
  5. // Created by 李建 on 2023/1/16.
  6. //
  7. import SwiftUI
  8. struct ResetPasswordUIView: View {
  9. @State var phone: String = ""
  10. @State var checkCode: String = ""
  11. @State var password: String = ""
  12. @Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
  13. var body: some View {
  14. VStack {
  15. HStack {
  16. Text("重置密码")
  17. .font(.title)
  18. Spacer()
  19. }
  20. VStack(spacing: 15) {
  21. VStack {
  22. HStack(spacing: 3) {
  23. Image(systemName: "phone.fill")
  24. .foregroundColor(Color("MainColor"))
  25. TextField("请输入您的手机号", text: $phone)
  26. .disableAutocorrection(true)
  27. .padding(8)
  28. }
  29. Divider().foregroundColor(Color.gray)
  30. .opacity(0.5)
  31. }
  32. CheckCodeInputView(checkCode: $checkCode)
  33. VStack {
  34. HStack(spacing: 3) {
  35. Image(systemName: "lock.fill")
  36. .foregroundColor(Color("MainColor"))
  37. SecureField("请输入密码", text: $password)
  38. .disableAutocorrection(true)
  39. .padding(8)
  40. }
  41. Divider().foregroundColor(Color.gray).opacity(0.5)
  42. }
  43. }
  44. Button(action: {
  45. }, label: {
  46. Text("确定")
  47. .foregroundColor(.white)
  48. .padding()
  49. .frame(maxWidth: .infinity)
  50. .background(
  51. Color("MainColor")
  52. .cornerRadius(8)
  53. )
  54. .border(Color("MainColor"), width: 0)
  55. }
  56. ).padding(.top, 20)
  57. Spacer()
  58. }
  59. .navigationBarBackButtonHidden(true)
  60. .navigationBarItems(leading: Button(action: {
  61. self.presentationMode.wrappedValue.dismiss()
  62. }, label: {
  63. Image(systemName: "chevron.left")
  64. .foregroundColor(.gray)
  65. }))
  66. .padding()
  67. }
  68. }
  69. struct ResetPasswordUIView_Previews: PreviewProvider {
  70. static var previews: some View {
  71. ResetPasswordUIView()
  72. }
  73. }
  74. struct CheckCodeInputView: View {
  75. @Binding var checkCode: String
  76. var body: some View {
  77. ZStack(alignment: .trailing) {
  78. VStack {
  79. HStack(spacing: 3) {
  80. Image(systemName: "envelope.fill")
  81. .foregroundColor(Color("MainColor"))
  82. TextField("请输入验证码", text: $checkCode)
  83. .disableAutocorrection(true)
  84. .padding(8)
  85. }
  86. Divider().foregroundColor(Color.gray)
  87. .opacity(0.5)
  88. }
  89. GetCheckCodeButton{
  90. }
  91. }
  92. }
  93. }