登录页面

This commit is contained in:
linyudan
2023-12-12 18:36:32 -08:00
parent cbc7cf3e3e
commit ff6b8740bd
16 changed files with 553 additions and 308 deletions

View File

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 53;
objects = {
/* Begin PBXBuildFile section */
@@ -760,6 +760,8 @@
8C2C3F322B28DD95002C3C34 /* NSDate+DDDateUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F312B28DD95002C3C34 /* NSDate+DDDateUtils.m */; };
8C2C3F362B28DDCE002C3C34 /* NSCalendar+DDPick.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F352B28DDCE002C3C34 /* NSCalendar+DDPick.m */; };
8C2C3F3A2B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F392B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.m */; };
8C2C3F492B29335E002C3C34 /* DDLoginAccountModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F482B29335E002C3C34 /* DDLoginAccountModel.m */; };
8C2C3F4B2B294528002C3C34 /* login_logo.svga in Resources */ = {isa = PBXBuildFile; fileRef = 8C2C3F4A2B294528002C3C34 /* login_logo.svga */; };
8CE493992B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */; };
8CE4939C2B23F45C00CA14D5 /* NSArray+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939B2B23F45C00CA14D5 /* NSArray+DDSafe.m */; };
8CE493A02B23F5FA00CA14D5 /* DDUploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939F2B23F5FA00CA14D5 /* DDUploadFile.m */; };
@@ -2175,6 +2177,9 @@
8C2C3F352B28DDCE002C3C34 /* NSCalendar+DDPick.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSCalendar+DDPick.m"; sourceTree = "<group>"; };
8C2C3F382B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YYAnimatedImageView+ShowImage.h"; sourceTree = "<group>"; };
8C2C3F392B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "YYAnimatedImageView+ShowImage.m"; sourceTree = "<group>"; };
8C2C3F472B29335E002C3C34 /* DDLoginAccountModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDLoginAccountModel.h; sourceTree = "<group>"; };
8C2C3F482B29335E002C3C34 /* DDLoginAccountModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDLoginAccountModel.m; sourceTree = "<group>"; };
8C2C3F4A2B294528002C3C34 /* login_logo.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = login_logo.svga; sourceTree = "<group>"; };
8CAB97312B2259EA00ED8639 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
8CE493972B23F44800CA14D5 /* NSMutableDictionary+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+DDSafe.h"; sourceTree = "<group>"; };
8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+DDSafe.m"; sourceTree = "<group>"; };
@@ -2276,6 +2281,7 @@
1802B3C42A540A1C0036DCEF /* Login */ = {
isa = PBXGroup;
children = (
8C2C3F462B293343002C3C34 /* Model */,
1802B3C82A540C830036DCEF /* View */,
1802B3C52A540A620036DCEF /* DDV2LoginVC.h */,
1802B3C62A540A620036DCEF /* DDV2LoginVC.m */,
@@ -4996,6 +5002,7 @@
18E00DDD2A66BBC900FD034C /* Resource */ = {
isa = PBXGroup;
children = (
8C2C3F4A2B294528002C3C34 /* login_logo.svga */,
18E00DDB2A66BABA00FD034C /* airplane_bg.png */,
186777902A42FB540096D802 /* avtarlive.gif */,
18EBAB5B2A42EFD300AEF467 /* noble_xuanguang.png */,
@@ -5697,6 +5704,15 @@
path = YYAnimatedImageView;
sourceTree = "<group>";
};
8C2C3F462B293343002C3C34 /* Model */ = {
isa = PBXGroup;
children = (
8C2C3F472B29335E002C3C34 /* DDLoginAccountModel.h */,
8C2C3F482B29335E002C3C34 /* DDLoginAccountModel.m */,
);
path = Model;
sourceTree = "<group>";
};
8CE493952B23F2B400CA14D5 /* DDBaseTool */ = {
isa = PBXGroup;
children = (
@@ -6083,6 +6099,7 @@
18C1237C2A57EEAA00B89660 /* microrun_9.png in Resources */,
188EC0F02A47CF3200060F03 /* DDMEmoticon2.plist in Resources */,
188EC1CD2A47CF4300060F03 /* messages_icon_11@2x.png in Resources */,
8C2C3F4B2B294528002C3C34 /* login_logo.svga in Resources */,
1802B3BE2A54061C0036DCEF /* messages_icon_29@2x.png in Resources */,
186C9D082A29EE3500209BB5 /* PlayButtonOverlayLarge@3x.png in Resources */,
);
@@ -6600,6 +6617,7 @@
188EC0F32A47CF3200060F03 /* DDMInputHelper.m in Sources */,
23B2A7F92B283ACA001C0913 /* BaseModel.m in Sources */,
188EC13E2A47CF3300060F03 /* HXPhotoEditResizeControl.m in Sources */,
8C2C3F492B29335E002C3C34 /* DDLoginAccountModel.m in Sources */,
1867776F2A4292F70096D802 /* CreatRoomBgImageViewCell.m in Sources */,
181F75482A5407AF006FA7F5 /* DDLabelModel.m in Sources */,
23B2A7F72B283ACA001C0913 /* NSObject+AutoCoding.m in Sources */,
@@ -7061,8 +7079,10 @@
"$(inherited)",
"$(PROJECT_DIR)/DingDangApp/BsaseClass/Third/SdkLib",
);
MARKETING_VERSION = 1.1.1;
PRODUCT_BUNDLE_IDENTIFIER = cn.nnbc123.voices;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = cn.dingdang.voice;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -7119,8 +7139,10 @@
"$(inherited)",
"$(PROJECT_DIR)/DingDangApp/BsaseClass/Third/SdkLib",
);
MARKETING_VERSION = 1.1.1;
PRODUCT_BUNDLE_IDENTIFIER = cn.nnbc123.voices;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = cn.dingdang.voice;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "login_checkbox_checked@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "login_checkbox_checked@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "login_checkbox_uncheck@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "login_checkbox_uncheck@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

View File

@@ -6,10 +6,11 @@
//
#import "WLBaseViewController.h"
#import "DDBaseVC.h"
NS_ASSUME_NONNULL_BEGIN
@interface DDV2LoginVC : WLBaseViewController
@interface DDV2LoginVC : DDBaseVC
@property (nonatomic, strong) NSDictionary *install_params;
@end

View File

@@ -6,10 +6,18 @@
//
#import "DDV2LoginVC.h"
#import "DDProtocolView.h"
/// Controller
#import "DDWebViewController.h"
#import <GeYanSdk/GeYanSdk.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 ()
@@ -17,6 +25,7 @@
@property (nonatomic, strong) UIImageView *bgImgV;
/**logo**/
@property (nonatomic, strong) UIImageView *logoImgV;
@property (nonatomic, strong) SVGAPlayer *logoSVGAPlayer;
/****/
@property (nonatomic, strong) UIButton *phoneBtn;
/****/
@@ -26,12 +35,15 @@
@implementation DDV2LoginVC
#pragma mark - Life Cycle
- (BOOL)ishiddenNavigationView {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.customNavBar.hidden = YES;
self.view.backgroundColor = UIColor.whiteColor;
[self initSubView];
[self initLoginAnimation];
[GeYanSdk preGetToken:^(NSDictionary *preDic) {
NSLog(@"preGetToken: %@ %@", preDic, preDic[@"msg"]);
@@ -41,39 +53,45 @@
}];
}
#pragma mark - Init
- (void)initSubView {
[self.view addSubview:self.bgImgV];
[self.bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.bottom.equalTo(self.view).inset(0);
}];
[self.view addSubview:self.logoImgV];
[self.logoImgV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(145);
make.width.mas_equalTo(102);
make.height.mas_equalTo(150);
make.centerX.equalTo(self.view);
}];
[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.logoImgV.mas_bottom).offset(140);
make.top.equalTo(self.logoSVGAPlayer.mas_bottom);
make.height.mas_equalTo(52);
}];
self.phoneBtn.layer.masksToBounds = YES;
self.phoneBtn.layer.cornerRadius = 52/2;
[self.view addSubview:self.protocolView];
[self.protocolView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view);
make.right.mas_equalTo(self.view);
make.height.mas_equalTo(44);
make.bottom.mas_equalTo(self.view).mas_offset(-DDBottomHeight() - 44 -18);
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 {
@@ -87,7 +105,22 @@
[self.navigationController pushViewController:VC animated:YES];
}
#pragma mark ------ ------
- (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];
@@ -108,9 +141,12 @@
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:UIColor.whiteColor forState:UIControlStateNormal];
[_phoneBtn setBackgroundImage:[UIImage imageNamed:@"v2_com_btn"] 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;
}
@@ -131,18 +167,4 @@
}
return _protocolView;
}
- (void)getLinkPath:(NSString *)path params:(NSDictionary *)params{
self.install_params = params;
[[NSNotificationCenter defaultCenter] postNotificationName:KNoti_InviteCodeUpdateKey object:params userInfo:@{}];
}
/*
#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

View File

@@ -5,11 +5,12 @@
// Created by apple on 2023/7/4.
//
#import "WLBaseViewController.h"
//#import "WLBaseViewController.h"
#import "DDBaseVC.h"
NS_ASSUME_NONNULL_BEGIN
@interface DDV2PhoneLoginVC : WLBaseViewController
@interface DDV2PhoneLoginVC : DDBaseVC
@property (nonatomic, strong) NSDictionary *install_params;
@end

View File

@@ -6,18 +6,43 @@
//
#import "DDV2PhoneLoginVC.h"
#import "AppDelegate.h"
/// View
#import "DDLoginTextView.h"
#import "DDWebViewController.h"
/// Tool
#import "AppDelegate+CYLTabBar.h"
#import "HttpRequestHelper.h"
#import "DDDESEncrypt.h"
//#import "DDLoginAccountModel.h"
/// Model
#import "AccountInfoStorage.h"
#import "AccountModel.h"
/// Third
#import <SVGAPlayer.h>
#import <SVGA.h>
#import <IQKeyboardManager/IQKeyboardManager.h>
#import <GeYanSdk/GeYanSdk.h>
#import "DDLoginTextView.h"
#import "AppDelegate.h"
#import "AppDelegate+CYLTabBar.h"
#import "DDWebViewController.h"
typedef enum : NSUInteger {
DD_Login_Input_Phone,
DD_Login_Input_Password,
DD_Login_Input_Code,
} DDLoignType;
@interface DDV2PhoneLoginVC ()
@property (nonatomic, strong) SVGAPlayer *logoSVGAPlayer;
/****/
@property (nonatomic, strong) UILabel *titleLabel;
//@property (nonatomic, strong) UILabel *titleLabel;
/****/
@property (nonatomic, strong) DDLoginTextView *phoneView;
/** **/
@property (nonatomic, strong) UIButton *codeButton;
/****/
@property (nonatomic, strong) DDLoginTextView *codeView;
/****/
@@ -36,6 +61,121 @@
@end
@implementation DDV2PhoneLoginVC
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:KNoti_InviteCodeUpdateKey object:nil];
}
#pragma mark - Life Cycle
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[IQKeyboardManager sharedManager].enable = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[IQKeyboardManager sharedManager].enable = NO;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.isLoginType = 1;
// [self defaultNavTitle:@"" hideLine:YES];
[self dd_addNavImage:@[@"myinfo_6"] isLeft:YES target:self action:@selector(backButtonAction) tags:nil];
self.view.backgroundColor = [UIColor whiteColor];
[self initSubView];
//
// [self initCLShanYanWithLogin];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(inviteCodeUpdate:) name:KNoti_InviteCodeUpdateKey object:nil];
}
#pragma mark - inviteView
- (void)initSubView {
[self.view addSubview:self.logoSVGAPlayer];
[self.view addSubview:self.phoneView];
[self.logoSVGAPlayer mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.height.mas_equalTo(KScreenWidth * kScaleX);
}];
// [self.view addSubview:self.titleLabel];
// [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.view).offset(25);
// make.top.equalTo(self.view).offset(DDNavigationBarHeight()+20);
// make.width.mas_equalTo(300);
// make.height.mas_equalTo(28);
// }];
//
[self.phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.logoSVGAPlayer.mas_bottom).mas_offset(20);
make.height.mas_equalTo(40);
}];
//
// [self.view addSubview:self.codeView];
// [self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.equalTo(self.view);
// make.top.mas_equalTo(self.phoneView.mas_bottom).mas_offset(22);
// make.height.mas_equalTo(40);
// }];
//
// [self.view addSubview:self.passWordView];
// self.passWordView.hidden = YES;
// [self.passWordView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.equalTo(self.view);
// make.top.mas_equalTo(self.phoneView.mas_bottom).mas_offset(22);
// make.height.mas_equalTo(40);
// }];
//
// [self.view addSubview:self.inviteView];
// [self.inviteView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.equalTo(self.view);
// make.top.mas_equalTo(self.codeView.mas_bottom).mas_offset(22);
// make.height.mas_equalTo(40);
// }];
// [self.view addSubview:self.loginTypeBtn];
// [self.loginTypeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(self.phoneView.mas_bottom).offset(123);
// make.left.equalTo(self.view).offset(25);
// make.width.mas_equalTo(100);
// make.height.mas_equalTo(52);
// }];
// [self.view addSubview:self.noLoginlabel];
// CGFloat width = [ToolsObject sizeWithText:@"如无法登录,请点击这里" andFont:DDFont(12) maxSize:CGSizeMake(230, 52) andlineSpacing:1].width;
// [self.noLoginlabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.right.equalTo(self.view).offset(-25);
// make.height.mas_equalTo(52);
// make.centerY.equalTo(self.loginTypeBtn);
// make.width.mas_equalTo(width+10);
// }];
// [self.view addSubview:self.loginBtn];
// [self.loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.centerX.equalTo(self.view);
// make.width.mas_equalTo(250);
// make.height.mas_equalTo(50);
// make.top.mas_equalTo(self.loginTypeBtn.mas_bottom).mas_offset(30);
// }];
// NSString * invite_code = [ToolsObject getInfoObject:@"invite_code"];
// self.inviteView.textField.text = invite_code?:@"";
}
#pragma mark - Action
- (void)backButtonAction {
[self.navigationController popViewControllerAnimated:NO];
}
- (void)getCodeNumberAction {
}
#pragma mark ------ ------
- (void)initCLShanYanWithLogin {
//
@@ -178,14 +318,14 @@
NSFontAttributeName: [UIFont systemFontOfSize:11]
};
authViewModel.termTextColor = DDHEXColor(0x999999);
NSString * userAgreementUrl = [NSString stringWithFormat:@"%@#/publicpage?position=1010",KWebURL];
NSString * privacyPolicyUrl = [NSString stringWithFormat:@"%@#/publicpage?position=1009",KWebURL];
// html
NSURLRequest *userAgreementUrlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:userAgreementUrl?:@""]];
NSURLRequest *privacyPolicyUrlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:privacyPolicyUrl?:@""]];
GyAuthPrivacyItem *item1 = [[GyAuthPrivacyItem alloc] initWithTitle:@"《啵柚语音用户协议》"
urlRequest:userAgreementUrlRequest
index:1
@@ -230,7 +370,7 @@
authViewModel.authVCTransitionBlock = ^(CGSize size, id <UIViewControllerTransitionCoordinator> coordinator, UIView *customAreaView) {
NSLog(@"页面生命周期 回调: 自定义VIEW");
};
return authViewModel;
}
@@ -255,68 +395,61 @@
AppUserModel * myModel = [AppUserModel new];
myModel.token = response.data[@"token"];
[ToolsObject saveUserModel:myModel];
[ws getUserInfo:response.data[@"token"]];
// [ws getUserInfo:response.data[@"token"]];
}
}];
}
-(void)getUserInfo:(NSString *)token
{
- (void)getUserInfo:(NSString *)uid token:(NSString *)token {
NSMutableDictionary *requestDict = [NSMutableDictionary dictionary];
[NetworkRequest requestPOST:@"/user/info" parameters:requestDict block:^(BaseResponse * _Nonnull response) {
if (response.code == 200){
if ([ToolsObject IsNullWithObject:response.data]) {
return;
}
AppUserModel *model = [AppUserModel yy_modelWithJSON:response.data];
AppUserModel * myModel = [ToolsObject getUserModel];
myModel = model;
myModel.token = token;
[ToolsObject saveUserModel:myModel];
[[DDSocketTool shareTool] starConnection];
[DDSocketTool shareTool].socketConnectBlock = ^(BOOL isSuccess) {
if (!isSuccess){
[ToolsObject removeUserInfo];
}
AppDelegate *delegate =(AppDelegate *)[UIApplication sharedApplication].delegate;
[delegate configureForTabBarController];
};
}
requestDict[@"uid"] = uid;
[HttpRequestHelper GET:@"/user/get" params:requestDict success:^(BaseModel * _Nonnull data) {
AppUserModel *model = [AppUserModel yy_modelWithJSON:data.data];
model.token = token;
[ToolsObject saveUserModel:model];
[ToolsObject addPopVieToText:@"登录成功"];
[self.navigationController popToRootViewControllerAnimated:NO];
AppDelegate *delegate =(AppDelegate *)[UIApplication sharedApplication].delegate;
[delegate configureForTabBarController];
} failure:^(NSInteger resCode, NSString * _Nonnull message) {
}];
// [NetworkRequest requestPOST:@"/user/info" parameters:requestDict block:^(BaseResponse * _Nonnull response) {
// if (response.code == 200){
// if ([ToolsObject IsNullWithObject:response.data]) {
// return;
// }
// AppUserModel *model = [AppUserModel yy_modelWithJSON:response.data];
// AppUserModel * myModel = [ToolsObject getUserModel];
// myModel = model;
// myModel.token = token;
// [ToolsObject saveUserModel:myModel];
// [[DDSocketTool shareTool] starConnection];
// [DDSocketTool shareTool].socketConnectBlock = ^(BOOL isSuccess) {
// if (!isSuccess){
// [ToolsObject removeUserInfo];
// }
// AppDelegate *delegate =(AppDelegate *)[UIApplication sharedApplication].delegate;
// [delegate configureForTabBarController];
// };
// }
// }];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[IQKeyboardManager sharedManager].enable = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[IQKeyboardManager sharedManager].enable = NO;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.isLoginType = 1;
[self defaultNavTitle:@"" hideLine:YES];
self.view.backgroundColor = [UIColor whiteColor];
[self initSubView];
//
[self initCLShanYanWithLogin];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(inviteCodeUpdate:) name:KNoti_InviteCodeUpdateKey object:nil];
}
- (void)inviteCodeUpdate:(NSNotification *)noti {
if ([noti.object isKindOfClass:[NSDictionary class]]){
if ([noti.object isKindOfClass:[NSDictionary class]]){
NSDictionary * dataDic = noti.object;
if ([ToolsObject IsNullWithObject:dataDic]) {
return;
}
self.install_params = dataDic;
if ([ToolsObject IsNullWithObject:dataDic]) {
return;
}
self.install_params = dataDic;
}
}
- (void)loginTypeBtnClick:(UIButton *)btn {
self.loginTypeBtn.selected = !self.loginTypeBtn.selected;
self.passWordView.textField.text = @"";
self.codeView.textField.text = @"";
@@ -340,69 +473,9 @@
}
}
- (void)initSubView {
[self.view addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(25);
make.top.equalTo(self.view).offset(DDNavigationBarHeight()+20);
make.width.mas_equalTo(300);
make.height.mas_equalTo(28);
}];
[self.view addSubview:self.phoneView];
[self.phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(44);
make.height.mas_equalTo(40);
}];
[self.view addSubview:self.codeView];
[self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.phoneView.mas_bottom).mas_offset(22);
make.height.mas_equalTo(40);
}];
[self.view addSubview:self.passWordView];
self.passWordView.hidden = YES;
[self.passWordView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.phoneView.mas_bottom).mas_offset(22);
make.height.mas_equalTo(40);
}];
#pragma mark inviteView
[self.view addSubview:self.inviteView];
[self.inviteView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.codeView.mas_bottom).mas_offset(22);
make.height.mas_equalTo(40);
}];
[self.view addSubview:self.loginTypeBtn];
[self.loginTypeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.phoneView.mas_bottom).offset(123);
make.left.equalTo(self.view).offset(25);
make.width.mas_equalTo(100);
make.height.mas_equalTo(52);
}];
[self.view addSubview:self.noLoginlabel];
CGFloat width = [ToolsObject sizeWithText:@"如无法登录,请点击这里" andFont:DDFont(12) maxSize:CGSizeMake(230, 52) andlineSpacing:1].width;
[self.noLoginlabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.view).offset(-25);
make.height.mas_equalTo(52);
make.centerY.equalTo(self.loginTypeBtn);
make.width.mas_equalTo(width+10);
}];
[self.view addSubview:self.loginBtn];
[self.loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.width.mas_equalTo(250);
make.height.mas_equalTo(50);
make.top.mas_equalTo(self.loginTypeBtn.mas_bottom).mas_offset(30);
}];
NSString * invite_code = [ToolsObject getInfoObject:@"invite_code"];
self.inviteView.textField.text = invite_code?:@"";
}
- (void)setInstall_params:(NSDictionary *)install_params{
_install_params = install_params;
if (![ToolsObject IsNullWithObject:install_params]){
@@ -412,49 +485,15 @@
}
}
#pragma mark ------ ------
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.text = @"登录解锁更多精彩内容";
_titleLabel.font = [UIFont boldSystemFontOfSize:20];
_titleLabel.textColor = DDHEXColor(0x333333);
_titleLabel.textAlignment = NSTextAlignmentLeft;
} return _titleLabel;
- (NSString *)getPhoneEncryptDes{
return [DDDESEncrypt DD_EncryptUseDES:self.phoneView.textField.text key:@"1ea53d260ecf11e7b56e00163e046a26"];
}
-(DDLoginTextView *)phoneView
{
if (!_phoneView) {
_phoneView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldPhone];
}
return _phoneView;
}
-(DDLoginTextView *)passWordView
{
if (!_passWordView) {
_passWordView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldPassWord];
}
return _passWordView;
}
-(DDLoginTextView *)inviteView
{
if (!_inviteView) {
_inviteView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldInvideCode];
}
return _inviteView;
}
-(DDLoginTextView *)codeView
{
if (!_codeView) {
_codeView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldGetCode];
WeakSelf(ws)
_codeView.getCodeBlock = ^{
[ws requestCode];
};
}
return _codeView;
- (NSString *)getPasswordEncryptDes {
return [DDDESEncrypt DD_EncryptUseDES:self.passWordView.textField.text key:@"1ea53d260ecf11e7b56e00163e046a26"];
}
//
- (void)requestCode{
@@ -469,25 +508,179 @@
self.codeView.getCodeBtn.enabled = NO;
WeakSelf(ws)
NSMutableDictionary *parameter = @{@"mobile":self.phoneView.textField.text,@"type":@(1)}.mutableCopy;
[NetworkRequest requestPOST:@"sms/getCode" parameters:parameter block:^(BaseResponse * _Nonnull response) {
if (response.isSuccess) {
[ToolsObject addPopVieToText:response.msg];
[ws.codeView.getCodeBtn startCountDownWithSecond:60];
[ws.codeView.getCodeBtn countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) {
NSString *title = [NSString stringWithFormat:@" %zds后可重发 ",second];
return title;
}];
[ws.codeView.getCodeBtn countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) {
ws.codeView.getCodeBtn.enabled = YES;
return @" 重新获取 ";
}];
} else {
[ToolsObject addPopVieToText:response.msg];
// NSString *desPhone = [DDDESEncrypt DD_EncryptUseDES:self.phoneView.textField.text key:@"1ea53d260ecf11e7b56e00163e046a26"];
NSMutableDictionary *parameter = @{@"mobile":[self getPhoneEncryptDes], @"type":@(1)}.mutableCopy;
[HttpRequestHelper POST:@"sms/getCode" params:parameter success:^(BaseModel * _Nonnull data) {
[ToolsObject addPopVieToText:data.message];
[ws.codeView.getCodeBtn startCountDownWithSecond:60];
[ws.codeView.getCodeBtn countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) {
NSString *title = [NSString stringWithFormat:@" %zds后可重发 ",second];
return title;
}];
[ws.codeView.getCodeBtn countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) {
ws.codeView.getCodeBtn.enabled = YES;
}
return @" 重新获取 ";
}];
} failure:^(NSInteger resCode, NSString * _Nonnull message) {
[ToolsObject addPopVieToText:message];
ws.codeView.getCodeBtn.enabled = YES;
}];
// [NetworkRequest requestPOST:@"sms/getCode" parameters:parameter block:^(BaseResponse * _Nonnull response) {
// if (response.isSuccess) {
// [ToolsObject addPopVieToText:response.msg];
// [ws.codeView.getCodeBtn startCountDownWithSecond:60];
// [ws.codeView.getCodeBtn countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) {
// NSString *title = [NSString stringWithFormat:@" %zds后可重发 ",second];
// return title;
// }];
// [ws.codeView.getCodeBtn countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) {
// ws.codeView.getCodeBtn.enabled = YES;
// return @" 重新获取 ";
// }];
//
// } else {
// [ToolsObject addPopVieToText:response.msg];
// ws.codeView.getCodeBtn.enabled = YES;
// }
// }];
}
- (void)loginBtnClick {
[self loginRequest];
}
- (void)loginRequest
{
[self.view endEditing:YES];
if ([ToolsObject IsNullWithObject:self.phoneView.textField.text]) {
[ToolsObject addPopVieToText:@"手机号不能为空"];
return;
}
if (self.phoneView.textField.text.length != 11) {
[ToolsObject addPopVieToText:@"请输入正确的手机号"];
return;
}
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
NSString *loginUrl = @"oauth/token";
if (self.isLoginType == 1) {
// loginUrl = @"oauth/token";
if ([ToolsObject IsNullWithObject:self.codeView.textField.text]) {
[ToolsObject addPopVieToText:@"请输入验证码"];
return;
}
if (self.codeView.textField.text.length != 5) {
[ToolsObject addPopVieToText:@"请输入6位验证码"];
return;
}
[dic setObject:self.codeView.textField.text forKey:@"code"];
[dic setObject:self.inviteView.textField.text?:@"" forKey:@"invite_code"];
}else if (self.isLoginType == 2){
// loginUrl = @"/pwd/login";
if ([ToolsObject IsNullWithObject:self.passWordView.textField.text]) {
[ToolsObject addPopVieToText:@"请输入密码"];
return;
}
if (self.passWordView.textField.text.length < 6) {
[ToolsObject addPopVieToText:@"密码需要同时包含6-12位字母和数字"];
return;
}
[dic setObject:[self getPasswordEncryptDes] forKey:@"password"];
}
[dic setObject:[self getPhoneEncryptDes] forKey:@"phone"];
[dic setObject:@"uyzjdhds" forKey:@"client_secret"];
[dic setObject:@"1" forKey:@"version"];
[dic setObject:@"erban-client" forKey:@"client_id"];
[dic setObject:@"password" forKey:@"grant_type"];
WeakSelf(ws)
[HttpRequestHelper POST:loginUrl params:dic success:^(BaseModel * _Nonnull data) {
AccountModel *accountModel = [AccountModel DD_ModelWithDict:data.data];
if (accountModel && accountModel.access_token.length > 0) {
[[AccountInfoStorage instance] saveAccountInfo:accountModel];
}
AppUserModel *model = [AppUserModel new];
model.token = accountModel.access_token;
[ToolsObject saveUserModel:model];
[ws getUserInfo:accountModel.uid token:accountModel.access_token];
} failure:^(NSInteger resCode, NSString * _Nonnull message) {
[ToolsObject addPopVieToText:message];
}];
// [NetworkRequest requestPOST:loginUrl parameters:dic block:^(BaseResponse * _Nonnull response) {
// if (response.isSuccess) {
// if ([ToolsObject IsNullWithObject:response.data]) {
// return;
// }
// AppUserModel * myModel = [AppUserModel new];
// myModel.token = response.data[@"token"];
// [ToolsObject saveUserModel:myModel];
// [ws getUserInfo:response.data[@"token"]];
// } else {
// [ToolsObject addPopVieToText:response.msg];
// }
// }];
}
#pragma mark - Get
- (SVGAPlayer *)logoSVGAPlayer {
if (!_logoSVGAPlayer) {
_logoSVGAPlayer = [[SVGAPlayer alloc] init];
_logoSVGAPlayer.loops = 1;
_logoSVGAPlayer.clearsAfterStop = NO;
}
return _logoSVGAPlayer;
}
- (UIButton *)codeButton {
if (!_codeButton) {
_codeButton = [[UIButton alloc] init];
[_codeButton setTitle:@"获取验证码" forState:UIControlStateNormal];
[_codeButton addTarget:self action:@selector(getCodeNumberAction) forControlEvents:UIControlEventTouchUpInside];
}
return _codeButton;
}
- (DDLoginTextView *)phoneView {
if (!_phoneView) {
_phoneView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldPhone];
}
return _phoneView;
}
- (DDLoginTextView *)passWordView {
if (!_passWordView) {
_passWordView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldPassWord];
}
return _passWordView;
}
-(DDLoginTextView *)inviteView {
if (!_inviteView) {
_inviteView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldInvideCode];
}
return _inviteView;
}
- (DDLoginTextView *)codeView {
if (!_codeView) {
_codeView = [[DDLoginTextView alloc]initWithFrame:CGRectZero withType:DDTextFieldGetCode];
WeakSelf(ws)
_codeView.getCodeBlock = ^{
[ws requestCode];
};
}
return _codeView;
}
- (UIButton *)loginTypeBtn {
@@ -503,8 +696,7 @@
} return _loginTypeBtn;
}
-(YYLabel *)noLoginlabel
{
- (YYLabel *)noLoginlabel {
if (!_noLoginlabel) {
_noLoginlabel = [[YYLabel alloc]init];
_noLoginlabel.textColor = DDHEXColor(0x333333);
@@ -523,15 +715,14 @@
return _noLoginlabel;
}
-(UIButton *)loginBtn
{
- (UIButton *)loginBtn {
if (!_loginBtn) {
_loginBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
[_loginBtn setTitle:@"登录" forState:(UIControlStateNormal)];
[_loginBtn setBackgroundImage:[UIImage imageNamed:@"v2_com_btn"] forState:UIControlStateNormal];
[_loginBtn setBackgroundImage:[UIImage imageNamed:@"v2_com_btn3"] forState:UIControlStateDisabled];
[_loginBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateDisabled)];
[_loginBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
_loginBtn.titleLabel.font = DDFont(16);
[_loginBtn addTarget:self action:@selector(loginBtnClick) forControlEvents:UIControlEventTouchUpInside];
@@ -539,77 +730,5 @@
return _loginBtn;
}
- (void)loginBtnClick {
[self loginRequest];
}
-(void)loginRequest
{
[self.view endEditing:YES];
if ([ToolsObject IsNullWithObject:self.phoneView.textField.text]) {
[ToolsObject addPopVieToText:@"手机号不能为空"];
return;
}
if (self.phoneView.textField.text.length != 11) {
[ToolsObject addPopVieToText:@"请输入正确的手机号"];
return;
}
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
[dic setObject:self.phoneView.textField.text forKey:@"tel"];
NSString *loginUrl = @"/sms/login";
if (self.isLoginType == 1) {
loginUrl = @"/sms/login";
if ([ToolsObject IsNullWithObject:self.codeView.textField.text]) {
[ToolsObject addPopVieToText:@"请输入验证码"];
return;
}
if (self.codeView.textField.text.length != 6) {
[ToolsObject addPopVieToText:@"请输入6位验证码"];
return;
}
[dic setObject:self.codeView.textField.text forKey:@"code"];
[dic setObject:self.inviteView.textField.text?:@"" forKey:@"invite_code"];
}else if (self.isLoginType == 2){
loginUrl = @"/pwd/login";
if ([ToolsObject IsNullWithObject:self.passWordView.textField.text]) {
[ToolsObject addPopVieToText:@"请输入密码"];
return;
}
if (self.passWordView.textField.text.length < 6) {
[ToolsObject addPopVieToText:@"密码需要同时包含6-12位字母和数字"];
return;
}
[dic setObject:self.passWordView.textField.text forKey:@"pwd"];
}
[dic setObject:[ToolsObject getDeviceIdentifier] forKey:@"phone_model"];
[dic setObject:[UIDevice currentDevice].systemVersion forKey:@"system_version"];
WeakSelf(ws)
[NetworkRequest requestPOST:loginUrl parameters:dic block:^(BaseResponse * _Nonnull response) {
if (response.isSuccess) {
if ([ToolsObject IsNullWithObject:response.data]) {
return;
}
AppUserModel * myModel = [AppUserModel new];
myModel.token = response.data[@"token"];
[ToolsObject saveUserModel:myModel];
[ws getUserInfo:response.data[@"token"]];
} else {
[ToolsObject addPopVieToText:response.msg];
}
}];
}
/*
#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

View File

@@ -0,0 +1,23 @@
//
// DDLoginAccountModel.h
// DingDangApp
//
// Created by 触海 on 2023/12/12.
//
#import "NSObject+DDExtension.h"
NS_ASSUME_NONNULL_BEGIN
@interface DDLoginAccountModel : NSObject
@property (nonatomic , assign) NSString *uid;
@property (nonatomic , copy) NSString *jti;
@property (nonatomic , copy) NSString *token_type;
@property (nonatomic , copy) NSString *refresh_token;
@property (nonatomic , copy) NSString *netEaseToken;
@property (nonatomic , copy) NSString *access_token;
@property (nonatomic , assign) NSNumber *expires_in;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// DDLoginAccountModel.m
// DingDangApp
//
// Created by on 2023/12/12.
//
#import "DDLoginAccountModel.h"
@implementation DDLoginAccountModel
@end

View File

@@ -6,6 +6,7 @@
//
#import "DDProtocolView.h"
#import "DDAppColor.h"
@implementation DDProtocolView
- (instancetype)initWithFrame:(CGRect)frame {
@@ -29,8 +30,8 @@
- (UIButton *)submitBtn {
if (!_submitBtn) {
_submitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_submitBtn setImage:[UIImage imageNamed:@"v2_com_2"] forState:UIControlStateNormal];
[_submitBtn setImage:[UIImage imageNamed:@"v2_com_1"] forState:UIControlStateSelected];
[_submitBtn setImage:[UIImage imageNamed:@"login_checkbox_uncheck"] forState:UIControlStateNormal];
[_submitBtn setImage:[UIImage imageNamed:@"login_checkbox_checked"] forState:UIControlStateSelected];
[_submitBtn addTarget:self action:@selector(submitBtnClick) forControlEvents:UIControlEventTouchUpInside];
[_submitBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
} return _submitBtn;
@@ -49,13 +50,13 @@
text.yy_alignment = NSTextAlignmentLeft;
text.yy_color = DDHEXColor(0x999999);
WeakSelf(ws)
[text yy_setTextHighlightRange:[text.string rangeOfString:@"《啵柚语音用户协议》"] color:DDHEXColor(0x5981FF) backgroundColor:[UIColor whiteColor] userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
[text yy_setTextHighlightRange:[text.string rangeOfString:@"《啵柚语音用户协议》"] color:[DDAppColor dd_subTitleColor] backgroundColor:[UIColor whiteColor] userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
if (ws.userBlock) {
ws.userBlock();
}
} longPressAction:nil];
[text yy_setTextHighlightRange:[text.string rangeOfString:@"《啵柚语音隐私政策》"] color:DDHEXColor(0x5981FF) backgroundColor:[UIColor whiteColor] userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
[text yy_setTextHighlightRange:[text.string rangeOfString:@"《啵柚语音隐私政策》"] color:[DDAppColor dd_subTitleColor] backgroundColor:[UIColor whiteColor] userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
if (ws.privacyBlock) {
ws.privacyBlock();
}

View File

@@ -591,4 +591,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 4a3e8c3e3691165802b43178346af03c39e4ae9b
COCOAPODS: 1.12.1
COCOAPODS: 1.14.2