// // ContentView.swift // iOSFirst // // Created by 孙宇峰 on 2023/1/31. // import SwiftUI import RxSwift import RxCocoa import RxRelay struct LoginView: View { private var viewModel = LoginViewModel() var bag = DisposeBag() var body: some View { VStack(alignment:.leading,spacing: 0) { HStack{ Spacer() Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) Text("设置").font(.system(size: 14)) } Text("欢迎来到") .foregroundColor(.gray) .font(.system(size: 30)) .multilineTextAlignment(.center) .bold() .padding(.top,20) HStack{ Image("app_logo") .resizable() .imageScale(.large) .foregroundColor(.accentColor) .scaledToFill() .frame(width: 50,height: 50) Image("txtlogo") .imageScale(.large) .foregroundColor(.accentColor) .frame(width: 240,height: 35) }.frame(height: 40) .padding(.top,20) .padding(.bottom,100) VStack(alignment: .leading, spacing: 400) { HStack(alignment: .center, spacing: 15) { Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) TextField("请输入手机号",text:.constant("")) .id("etPhoneNum") .font(.system(size: 16)) .frame(maxWidth: .infinity,alignment: .center) } } .frame(height: 80) Divider() VStack(alignment: .leading, spacing: 400) { HStack(alignment: .center, spacing: 15) { Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) TextField("请输入密码",text:.constant("")) .id("etPassword") .font(.system(size: 16)) .frame(maxWidth: .infinity,alignment: .center) } }.frame(height: 80) Divider().padding(.bottom,40) VStack(alignment: .trailing, spacing: 400) { VStack(alignment: .center, spacing: 15) { Button(action: { // let msg="点击了登录按钮" // print(msg) viewModel.loginUser() // SUIToast.show(messageItem: .init( // message: msg, // bgColor: .gray, // messageColor: .white // )) }) { Text("登录") .font(.system(size: 17)) .bold() .frame(minWidth: 0, maxWidth: .infinity) .padding() .foregroundColor(.white) .background(.blue) .cornerRadius(30) } } } HStack{ Text("验证码登录").font(.system(size:15)).onTapGesture { let msg="点击了验证码登录" print(msg) SUIToast.show(messageItem: .init( message: msg, bgColor: .gray, messageColor: .white )) } Spacer () Text("忘记密码?").font(.system(size:15)).onTapGesture { let msg="点击了密码" print(msg) SUIToast.show(messageItem: .init( message: msg, bgColor: .gray, messageColor: .white )) }.padding(.vertical,20).font(.system(size: 15)) } Spacer() }.padding() .frame(width: .infinity,height: .infinity) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { LoginView() } }