123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- //
- // LoginViewController.m
- // KulexiuForTeacher
- //
- // Created by Kyle on 2022/3/17.
- //
- #import "LoginViewController.h"
- #import "LoginBodyView.h"
- #import "VefiCodeLoginController.h"
- #import "PasswordLoginController.h"
- #import "KSBaseWKWebViewController.h"
- #import "NSString+phone.h"
- @interface LoginViewController ()
- @property (nonatomic, strong) LoginBodyView *bodyView;
- @end
- @implementation LoginViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.ks_prefersNavigationBarHidden = YES;
- [self configUI];
- }
- - (void)configUI {
- _bodyView = [LoginBodyView shareInstance];
- if (![NSString isEmptyString:UserDefault(PHONEKEY)]) {
- _bodyView.phoneField.text = UserDefault(PHONEKEY);
- }
- CGFloat height = KPortraitHeight;
- [self.scrollView addSubview:_bodyView];
- [_bodyView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.scrollView.mas_top);
- make.right.left.mas_equalTo(self.view);
- make.height.mas_equalTo(height);
- }];
- MJWeakSelf;
- [_bodyView loginActionCallback:^(LOGINACTION action, NSString * _Nonnull phoneNo) {
- [weakSelf operationWithType:action phone:phoneNo];
- }];
- }
- - (void)operationWithType:(LOGINACTION)action phone:(NSString *)phone {
- switch (action) {
- case LOGINACTION_CODE:
- {
- if (![NSString isMobileNum:phone]) {
- [self MBPShow:@"手机号码输入有误"];
- return;
- }
- VefiCodeLoginController *ctrl = [[VefiCodeLoginController alloc] init];
- ctrl.phoneNo = phone;
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- break;
- case LOGINACTION_PASSWORD:
- {
- PasswordLoginController *ctrl = [[PasswordLoginController alloc] init];
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- break;
- case LOGINACTION_REGPROTOCAL: // 注册协议
- {
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = [NSString stringWithFormat:@"%@%@",WEBHOST, @"/#/registerProtocol"];
- [self.navigationController pushViewController:webCtrl animated:YES];
- }
- break;
- case LOGINACTION_PRIVACY: // 隐私协议
- {
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = [NSString stringWithFormat:@"%@%@",WEBHOST, @"/#/privacyProtocol"];
- [self.navigationController pushViewController:webCtrl animated:YES];
- }
- break;
- default:
- break;
- }
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|