| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // VclustersGemini
- //
- // Created by APPLE on 2019/6/6.
- // Copyright © 2019 APPLE. All rights reserved.
- //
- #import "LoginForViewController.h"
- #import "IQKeyboardManager.h"
- #import "FLAnimatedImage.h"
- #import "ViewForPhoneAndSMS.h"
- #import "UseAccountManage.h"
- #import "CloudPhoneAPI.h"
- #import "SafeForKey.h"
- @interface LoginForViewController ()<ViewForPhoneAndSMSDelegate>
- {
- ViewForPhoneAndSMS *viewForPhoneAndSMS;
- }
- @end
- @implementation LoginForViewController
- @synthesize delegate;
- - (void)viewDidAppear:(BOOL)animated {
- [super viewDidAppear:animated];
- }
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- [self drawAnyView];
- }
- #pragma mark-UI布局
- - (void)drawAnyView
- {
- [self.view setBackgroundColor:[UIColor clearColor]];
- [self.navigationBar setHidden:YES];
- [self.toolBar setHidden:YES];
-
- UIImageView *bgImageView = [[UIImageView alloc] init];
- [bgImageView setImage:[UIImage imageNamed:@"login_bg"]];
- [self.view addSubview:bgImageView];
-
- [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- }];
-
- viewForPhoneAndSMS = [[ViewForPhoneAndSMS alloc] init];
- viewForPhoneAndSMS.delegate = self;
- [self.view addSubview:viewForPhoneAndSMS];
- [viewForPhoneAndSMS mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(700);
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- }];
- }
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
- [[UIApplication sharedApplication].keyWindow endEditing:YES];
- }
- - (void)smsLoginWithPhonenumber:(NSString *)number code:(NSString *)code{
- [self showNewIndicatorWithCanBack:NO canTouch:NO];
- [[UseAccountManage shareInstance] commonPostCanWithOutTokenCallBackCode:SMSVerCodeRegisterAndLoginAPI
- Parameters:@{@"code":code,@"phone":number}
- success:^(id _Nonnull responseObject) {
- SuperModel *mod = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
- [self removeNewIndicator];
- NSString *showStr = nil;
- showStr = mod.msg;
- if (mod.status && mod.status.integerValue == 0){
- /*本地保存登录数据*/
- NSDictionary *data = [responseObject safeDictionaryForKey:@"data"];
- [[UseAccountManage shareInstance] setLoginInfo:data];
-
- if ([self->delegate respondsToSelector:@selector(loginOk)]){
- [self->delegate loginOk];
- }
- }else if (mod.status && mod.status.integerValue == 1){
- [self->viewForPhoneAndSMS.mInputView.smsErrorTipsLabel setHidden:NO];
- if (mod.msg == nil || [mod.msg isEqualToString:@""]){
- showStr = NSLocalizedString(@"log_login_system_busy",nil);
- }
- }
- else{
- if (mod.msg == nil || [mod.msg isEqualToString:@""]){
- showStr = NSLocalizedString(@"log_login_system_busy",nil);
- }
- }
-
- [[iToast makeText:showStr] show];
- }
- failure:^(NSError * _Nonnull error) {
- [[iToast makeText:NSLocalizedString(@"log_login_system_busy",nil)] show];
- [self removeNewIndicator];
- }];
- }
- @end
|