177 lines
5.6 KiB
Objective-C
177 lines
5.6 KiB
Objective-C
//
|
|
// DDV2LoginVC.m
|
|
// DingDangApp
|
|
//
|
|
// Created by apple on 2023/7/4.
|
|
//
|
|
|
|
#import "DDV2LoginVC.h"
|
|
/// Controller
|
|
#import "DDWebViewController.h"
|
|
#import "DDV2PhoneLoginVC.h"
|
|
/// View
|
|
#import "DDProtocolView.h"
|
|
/// Third
|
|
#import <GeYanSdk/GeYanSdk.h>
|
|
#import <SVGAPlayer.h>
|
|
#import <SVGA.h>
|
|
/// Tool
|
|
#import "DDAppColor.h"
|
|
#import "UIImage+Custom.h"
|
|
|
|
|
|
@interface DDV2LoginVC ()
|
|
/**bg**/
|
|
@property (nonatomic, strong) UIImageView *bgImgV;
|
|
/**logo**/
|
|
@property (nonatomic, strong) UIImageView *logoImgV;
|
|
@property (nonatomic, strong) SVGAPlayer *logoSVGAPlayer;
|
|
/**手机号登录**/
|
|
@property (nonatomic, strong) UIButton *phoneBtn;
|
|
/**协议**/
|
|
@property (nonatomic, strong) DDProtocolView *protocolView;
|
|
|
|
@end
|
|
|
|
@implementation DDV2LoginVC
|
|
|
|
#pragma mark - Life Cycle
|
|
- (BOOL)ishiddenNavigationView {
|
|
return YES;
|
|
}
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
self.view.backgroundColor = UIColor.whiteColor;
|
|
[self initSubView];
|
|
[self initLoginAnimation];
|
|
|
|
[GeYanSdk preGetToken:^(NSDictionary *preDic) {
|
|
NSLog(@"preGetToken: %@ %@", preDic, preDic[@"msg"]);
|
|
if (![GeYanSdk isPreGettedTokenValidate]) {
|
|
return;
|
|
}
|
|
}];
|
|
}
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated {
|
|
[super viewWillDisappear:animated];
|
|
// self.navigationController.navigationBar.hidden = YES;
|
|
}
|
|
|
|
#pragma mark - Init
|
|
- (void)initSubView {
|
|
[self.view addSubview:self.logoSVGAPlayer];
|
|
[self.view addSubview:self.phoneBtn];
|
|
[self.view addSubview:self.protocolView];
|
|
|
|
|
|
[self.logoSVGAPlayer mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.top.mas_equalTo(self.view);
|
|
make.height.mas_equalTo(KScreenWidth * kScaleX);
|
|
}];
|
|
|
|
[self.phoneBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.equalTo(self.view).inset(49);
|
|
make.top.equalTo(self.logoSVGAPlayer.mas_bottom);
|
|
make.height.mas_equalTo(52);
|
|
}];
|
|
|
|
|
|
[self.protocolView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(self.view);
|
|
make.right.mas_equalTo(self.view);
|
|
make.height.mas_equalTo(44);
|
|
make.top.mas_equalTo(self.phoneBtn.mas_bottom).offset(20);
|
|
}];
|
|
}
|
|
|
|
- (void)initLoginAnimation {
|
|
SVGAParser *parser = [[SVGAParser alloc] init];
|
|
WeakSelf(weakSelf);
|
|
[parser parseWithNamed:@"login_logo" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
|
if (videoItem != nil) {
|
|
weakSelf.logoSVGAPlayer.videoItem = videoItem;
|
|
[weakSelf.logoSVGAPlayer startAnimation];
|
|
}
|
|
} failureBlock:nil];
|
|
|
|
}
|
|
|
|
//登录
|
|
- (void)phoneBtnClick {
|
|
|
|
if (self.protocolView.submitBtn.selected == NO) {
|
|
[ToolsObject addPopVieToText:@"请先阅读并同意《啵柚语音用户协议》和《啵柚语音隐私政策》"];
|
|
return;
|
|
}
|
|
|
|
DDV2PhoneLoginVC *VC = [[DDV2PhoneLoginVC alloc] init];
|
|
VC.install_params = self.install_params;
|
|
[self.navigationController pushViewController:VC animated:YES];
|
|
}
|
|
|
|
- (void)getLinkPath:(NSString *)path params:(NSDictionary *)params{
|
|
self.install_params = params;
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:KNoti_InviteCodeUpdateKey object:params userInfo:@{}];
|
|
}
|
|
|
|
|
|
#pragma mark - Get
|
|
- (SVGAPlayer *)logoSVGAPlayer {
|
|
if (!_logoSVGAPlayer) {
|
|
_logoSVGAPlayer = [[SVGAPlayer alloc] init];
|
|
_logoSVGAPlayer.loops = 1;
|
|
_logoSVGAPlayer.clearsAfterStop = NO;
|
|
}
|
|
return _logoSVGAPlayer;
|
|
}
|
|
|
|
- (UIImageView *)bgImgV {
|
|
if (!_bgImgV) {
|
|
_bgImgV = [UIImageView new];
|
|
_bgImgV.image = [UIImage imageNamed:@"login_bg_icon_1"];
|
|
_bgImgV.contentMode = UIViewContentModeScaleAspectFill;
|
|
_bgImgV.clipsToBounds = YES;
|
|
} return _bgImgV;
|
|
}
|
|
|
|
- (UIImageView *)logoImgV {
|
|
if (!_logoImgV) {
|
|
_logoImgV = [UIImageView new];
|
|
_logoImgV.image = [UIImage imageNamed:@"login_bg_icon_2"];
|
|
} return _logoImgV;
|
|
}
|
|
|
|
- (UIButton *)phoneBtn {
|
|
if (!_phoneBtn) {
|
|
_phoneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
_phoneBtn.titleLabel.font = DDFont(16);
|
|
_phoneBtn.layer.masksToBounds = YES;
|
|
_phoneBtn.layer.cornerRadius = 52/2;
|
|
[_phoneBtn setTitle:@"手机号码登录" forState:UIControlStateNormal];
|
|
[_phoneBtn setTitleColor:[DDAppColor dd_MajorTitleColor] forState:UIControlStateNormal];
|
|
UIImage *bgImage = [UIImage imageWithColor:[DDAppColor dd_sureBtnGradientBeginColor]];
|
|
[_phoneBtn setBackgroundImage:bgImage forState:UIControlStateNormal];
|
|
[_phoneBtn addTarget:self action:@selector(phoneBtnClick) forControlEvents:UIControlEventTouchUpInside];
|
|
} return _phoneBtn;
|
|
}
|
|
|
|
- (DDProtocolView *)protocolView{
|
|
if (!_protocolView) {
|
|
_protocolView = [[DDProtocolView alloc] init];
|
|
_protocolView.privacyBlock = ^{
|
|
DDWebViewController * webVC = [DDWebViewController webControlerWithUrlStr:[NSString stringWithFormat:@"%@/boyou/modules/rule/privacy-wap.html",DD__HOST_H5_API_URL] isShowNavBar:YES navTitle:@"隐私协议"];
|
|
webVC.view.backgroundColor = UIColor.whiteColor;
|
|
[[ToolsObject getCurrentViewController].navigationController pushViewController:webVC animated:NO];
|
|
};
|
|
_protocolView.userBlock = ^{
|
|
DDWebViewController * webVC = [DDWebViewController webControlerWithUrlStr:[NSString stringWithFormat:@"%@/boyou/modules/rule/protocol.html",DD__HOST_H5_API_URL] isShowNavBar:YES navTitle:@"用户协议"];
|
|
webVC.view.backgroundColor = UIColor.whiteColor;
|
|
[[ToolsObject getCurrentViewController].navigationController pushViewController:webVC animated:NO];
|
|
};
|
|
}
|
|
return _protocolView;
|
|
}
|
|
@end
|