Files
yinmeng-ios-store/yinmeng-ios/DingDangApp/V2Versions/Login/DDV2PhoneLoginVC.m

178 lines
5.6 KiB
Mathematica
Raw Normal View History

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"
#import "DDV2PasswordLoginVC.h"
#import "DDV2PhoneCodeVC.h"
#import "DDLoginSVGAView.h"
2023-12-12 18:36:32 -08:00
/// Tool
#import "AppDelegate+CYLTabBar.h"
#import "DDRequestTool.h"
#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
@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-07 10:50:21 +08:00
@property (nonatomic, strong) UIButton *loginTypeBtn;
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];
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-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];
[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);
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-12 18:36:32 -08:00
- (void)backButtonAction {
[self.navigationController popViewControllerAnimated:NO];
}
///
2023-12-12 18:36:32 -08:00
- (void)getCodeNumberAction {
//
[self requestCode];
2023-12-07 10:50:21 +08:00
}
///
2023-12-07 10:50:21 +08:00
- (void)loginTypeBtnClick:(UIButton *)btn {
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
#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;
}
[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
- (DDLoginSVGAView *)logoSVGAPlayer {
2023-12-12 18:36:32 -08:00
if (!_logoSVGAPlayer) {
_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];
_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];
_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)];
_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