2023-12-07 10:50:21 +08:00
|
|
|
//
|
|
|
|
// DDV2PhoneLoginVC.m
|
|
|
|
// DingDangApp
|
|
|
|
//
|
|
|
|
// Created by apple on 2023/7/4.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "DDV2PhoneLoginVC.h"
|
|
|
|
#import "AppDelegate.h"
|
2023-12-12 18:36:32 -08:00
|
|
|
/// View
|
|
|
|
#import "DDLoginTextView.h"
|
2023-12-07 10:50:21 +08:00
|
|
|
#import "DDWebViewController.h"
|
2023-12-13 17:47:30 -08:00
|
|
|
#import "DDV2PasswordLoginVC.h"
|
|
|
|
#import "DDV2PhoneCodeVC.h"
|
|
|
|
#import "DDLoginSVGAView.h"
|
2023-12-12 18:36:32 -08:00
|
|
|
/// Tool
|
|
|
|
#import "AppDelegate+CYLTabBar.h"
|
2023-12-14 19:08:53 -08:00
|
|
|
#import "DDRequestTool.h"
|
2023-12-13 17:47:30 -08:00
|
|
|
#import "DDSystemTool.h"
|
|
|
|
#import "DDAppColor.h"
|
|
|
|
#import "UIImage+Custom.h"
|
|
|
|
#import "DDLoginRequest.h"
|
2023-12-12 18:36:32 -08:00
|
|
|
/// Model
|
|
|
|
#import "AccountInfoStorage.h"
|
|
|
|
#import "AccountModel.h"
|
|
|
|
/// Third
|
|
|
|
#import <IQKeyboardManager/IQKeyboardManager.h>
|
|
|
|
#import <GeYanSdk/GeYanSdk.h>
|
|
|
|
|
2023-12-07 10:50:21 +08:00
|
|
|
@interface DDV2PhoneLoginVC ()
|
2023-12-12 18:36:32 -08:00
|
|
|
|
2023-12-13 17:47:30 -08:00
|
|
|
@property (nonatomic, strong) DDLoginSVGAView *logoSVGAPlayer;
|
2023-12-07 10:50:21 +08:00
|
|
|
/**账号**/
|
|
|
|
@property (nonatomic, strong) DDLoginTextView *phoneView;
|
2023-12-12 18:36:32 -08:00
|
|
|
/** 获取验证码 **/
|
|
|
|
@property (nonatomic, strong) UIButton *codeButton;
|
2023-12-13 17:47:30 -08:00
|
|
|
/** 密码登录 */
|
2023-12-07 10:50:21 +08:00
|
|
|
@property (nonatomic, strong) UIButton *loginTypeBtn;
|
2023-12-13 17:47:30 -08:00
|
|
|
|
2023-12-07 10:50:21 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation DDV2PhoneLoginVC
|
2023-12-12 18:36:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Life Cycle
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
|
|
[super viewWillAppear:animated];
|
2023-12-13 17:47:30 -08:00
|
|
|
self.navigationController.navigationBar.hidden = YES;
|
2023-12-12 18:36:32 -08:00
|
|
|
[IQKeyboardManager sharedManager].enable = YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated {
|
|
|
|
[super viewWillDisappear:animated];
|
|
|
|
[IQKeyboardManager sharedManager].enable = NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
[super viewDidLoad];
|
2023-12-13 17:47:30 -08:00
|
|
|
|
2023-12-12 18:36:32 -08:00
|
|
|
self.view.backgroundColor = [UIColor whiteColor];
|
|
|
|
[self initSubView];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - inviteView
|
|
|
|
- (void)initSubView {
|
|
|
|
[self.view addSubview:self.logoSVGAPlayer];
|
|
|
|
[self.view addSubview:self.phoneView];
|
2023-12-13 17:47:30 -08:00
|
|
|
[self.view addSubview:self.codeButton];
|
|
|
|
[self.view addSubview:self.loginTypeBtn];
|
|
|
|
|
|
|
|
[self.loginTypeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.top.mas_equalTo(kStatusBarHeight + 20);
|
|
|
|
make.right.mas_equalTo(-20);
|
|
|
|
}];
|
2023-12-12 18:36:32 -08:00
|
|
|
|
|
|
|
[self.logoSVGAPlayer mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.right.top.mas_equalTo(self.view);
|
|
|
|
make.height.mas_equalTo(KScreenWidth * kScaleX);
|
|
|
|
}];
|
|
|
|
[self.phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.top.mas_equalTo(self.logoSVGAPlayer.mas_bottom).mas_offset(20);
|
2023-12-13 17:47:30 -08:00
|
|
|
make.left.right.equalTo(self.view).inset(50);
|
|
|
|
make.height.mas_equalTo(51);
|
|
|
|
}];
|
|
|
|
[self.codeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerX.equalTo(self.view);
|
|
|
|
make.width.height.mas_equalTo(self.phoneView);
|
|
|
|
make.top.equalTo(self.phoneView.mas_bottom).offset(20);
|
2023-12-12 18:36:32 -08:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Action
|
2023-12-13 17:47:30 -08:00
|
|
|
/// 返回
|
2023-12-12 18:36:32 -08:00
|
|
|
- (void)backButtonAction {
|
|
|
|
[self.navigationController popViewControllerAnimated:NO];
|
|
|
|
}
|
2023-12-13 17:47:30 -08:00
|
|
|
/// 获取验证码
|
2023-12-12 18:36:32 -08:00
|
|
|
- (void)getCodeNumberAction {
|
2023-12-13 17:47:30 -08:00
|
|
|
// 获取成功跳转到下一步
|
|
|
|
[self requestCode];
|
2023-12-07 10:50:21 +08:00
|
|
|
}
|
|
|
|
|
2023-12-13 17:47:30 -08:00
|
|
|
/// 密码登录
|
2023-12-07 10:50:21 +08:00
|
|
|
- (void)loginTypeBtnClick:(UIButton *)btn {
|
2023-12-13 17:47:30 -08:00
|
|
|
DDV2PasswordLoginVC *passwordVC = [[DDV2PasswordLoginVC alloc] init];
|
|
|
|
[self.navigationController pushViewController:passwordVC animated:NO];
|
2023-12-07 10:50:21 +08:00
|
|
|
}
|
|
|
|
|
2023-12-12 18:36:32 -08:00
|
|
|
|
2023-12-13 17:47:30 -08:00
|
|
|
#pragma mark - Request
|
2023-12-12 18:36:32 -08:00
|
|
|
//获取手机验证码
|
|
|
|
- (void)requestCode{
|
|
|
|
if ([ToolsObject IsNullWithObject:self.phoneView.textField.text]) {
|
|
|
|
[ToolsObject addPopVieToText:@"手机号不能为空"];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (self.phoneView.textField.text.length != 11) {
|
|
|
|
[ToolsObject addPopVieToText:@"请输入正确的手机号"];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-12-13 17:47:30 -08:00
|
|
|
[DDLoginRequest DD_LoadRequestPhoneCode:self.phoneView.textField.text success:^{
|
|
|
|
DDV2PhoneCodeVC *codeController = [[DDV2PhoneCodeVC alloc] init];
|
|
|
|
codeController.phoneTitle = self.phoneView.textField.text;
|
|
|
|
[self.navigationController pushViewController:codeController animated:NO];
|
2023-12-12 18:36:32 -08:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Get
|
2023-12-13 17:47:30 -08:00
|
|
|
- (DDLoginSVGAView *)logoSVGAPlayer {
|
2023-12-12 18:36:32 -08:00
|
|
|
if (!_logoSVGAPlayer) {
|
2023-12-13 17:47:30 -08:00
|
|
|
_logoSVGAPlayer = [[DDLoginSVGAView alloc] init];
|
|
|
|
WeakSelf(weakSelf);
|
|
|
|
_logoSVGAPlayer.backButtonCloseEvent = ^{
|
|
|
|
[weakSelf backButtonAction];
|
|
|
|
};
|
2023-12-12 18:36:32 -08:00
|
|
|
}
|
|
|
|
return _logoSVGAPlayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIButton *)codeButton {
|
|
|
|
if (!_codeButton) {
|
|
|
|
_codeButton = [[UIButton alloc] init];
|
|
|
|
[_codeButton setTitle:@"获取验证码" forState:UIControlStateNormal];
|
2023-12-13 17:47:30 -08:00
|
|
|
_codeButton.titleLabel.font = DDFont(16);
|
|
|
|
[_codeButton setTitleColor:[DDAppColor dd_noClickBtnTitleColor] forState:UIControlStateDisabled];
|
|
|
|
[_codeButton setTitleColor:[DDAppColor dd_sureBtnTitleColor] forState:UIControlStateNormal];
|
|
|
|
_codeButton.layer.cornerRadius = 51.0/2;
|
|
|
|
_codeButton.layer.masksToBounds = YES;
|
|
|
|
UIImage *bgImage = [UIImage imageWithColor:[DDAppColor dd_sureBtnGradientBeginColor]];
|
|
|
|
[_codeButton setBackgroundImage:bgImage forState:UIControlStateNormal];
|
2023-12-12 18:36:32 -08:00
|
|
|
[_codeButton addTarget:self action:@selector(getCodeNumberAction) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
}
|
|
|
|
return _codeButton;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (DDLoginTextView *)phoneView {
|
2023-12-07 10:50:21 +08:00
|
|
|
if (!_phoneView) {
|
|
|
|
_phoneView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldPhone];
|
2023-12-13 17:47:30 -08:00
|
|
|
_phoneView.customLeftText = @"+86";
|
2023-12-07 10:50:21 +08:00
|
|
|
}
|
|
|
|
return _phoneView;
|
|
|
|
}
|
2023-12-12 18:36:32 -08:00
|
|
|
|
2023-12-07 10:50:21 +08:00
|
|
|
|
|
|
|
- (UIButton *)loginTypeBtn {
|
|
|
|
if (!_loginTypeBtn) {
|
|
|
|
_loginTypeBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
|
|
|
|
[_loginTypeBtn setTitle:@"密码登录" forState:(UIControlStateNormal)];
|
|
|
|
[_loginTypeBtn setTitleColor:DDHEXColor(0x333333) forState:(UIControlStateNormal)];
|
2023-12-13 17:47:30 -08:00
|
|
|
_loginTypeBtn.titleLabel.font = DDFont(16);
|
|
|
|
_loginTypeBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
|
2023-12-07 10:50:21 +08:00
|
|
|
[_loginTypeBtn addTarget:self action:@selector(loginTypeBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
} return _loginTypeBtn;
|
|
|
|
}
|
|
|
|
@end
|