筛分一个v对应一个p
This commit is contained in:
@@ -59,9 +59,12 @@
|
||||
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */; };
|
||||
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308826E89BE000B90D4F /* LoginPhoneViewController.m */; };
|
||||
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308C26E89DAA00B90D4F /* LoginInputView.m */; };
|
||||
E872309026E8D29300B90D4F /* LoginVerifCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308F26E8D29300B90D4F /* LoginVerifCodeViewController.m */; };
|
||||
E872309326E8D31500B90D4F /* LoginVerifCodeView.m in Sources */ = {isa = PBXBuildFile; fileRef = E872309226E8D31500B90D4F /* LoginVerifCodeView.m */; };
|
||||
E8B825BA26E9A9D5009E8E9F /* BaseObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825B926E9A9D5009E8E9F /* BaseObject.m */; };
|
||||
E8B825B726E9A7D8009E8E9F /* BaseObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825B626E9A7D8009E8E9F /* BaseObject.m */; };
|
||||
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825BE26E9E57D009E8E9F /* LoginTicketInfo.m */; };
|
||||
E8B825C226EA00DF009E8E9F /* LoginVerifCodePresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825C126EA00DF009E8E9F /* LoginVerifCodePresent.m */; };
|
||||
E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */ = {isa = PBXBuildFile; fileRef = E8B825C626EA0995009E8E9F /* LoginVerifCodeProtocol.h */; };
|
||||
E8B825CA26EA1231009E8E9F /* LoginVerifCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825C826EA1231009E8E9F /* LoginVerifCodeViewController.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -169,12 +172,17 @@
|
||||
E872308826E89BE000B90D4F /* LoginPhoneViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginPhoneViewController.m; sourceTree = "<group>"; };
|
||||
E872308B26E89DAA00B90D4F /* LoginInputView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginInputView.h; sourceTree = "<group>"; };
|
||||
E872308C26E89DAA00B90D4F /* LoginInputView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginInputView.m; sourceTree = "<group>"; };
|
||||
E872308E26E8D29300B90D4F /* LoginVerifCodeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifCodeViewController.h; sourceTree = "<group>"; };
|
||||
E872308F26E8D29300B90D4F /* LoginVerifCodeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginVerifCodeViewController.m; sourceTree = "<group>"; };
|
||||
E872309126E8D31500B90D4F /* LoginVerifCodeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifCodeView.h; sourceTree = "<group>"; };
|
||||
E872309226E8D31500B90D4F /* LoginVerifCodeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginVerifCodeView.m; sourceTree = "<group>"; };
|
||||
E8B825B826E9A9D5009E8E9F /* BaseObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseObject.h; sourceTree = "<group>"; };
|
||||
E8B825B926E9A9D5009E8E9F /* BaseObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseObject.m; sourceTree = "<group>"; };
|
||||
E8B825B526E9A7D8009E8E9F /* BaseObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseObject.h; sourceTree = "<group>"; };
|
||||
E8B825B626E9A7D8009E8E9F /* BaseObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseObject.m; sourceTree = "<group>"; };
|
||||
E8B825BD26E9E57D009E8E9F /* LoginTicketInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginTicketInfo.h; sourceTree = "<group>"; };
|
||||
E8B825BE26E9E57D009E8E9F /* LoginTicketInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginTicketInfo.m; sourceTree = "<group>"; };
|
||||
E8B825C026EA00DF009E8E9F /* LoginVerifCodePresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifCodePresent.h; sourceTree = "<group>"; };
|
||||
E8B825C126EA00DF009E8E9F /* LoginVerifCodePresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginVerifCodePresent.m; sourceTree = "<group>"; };
|
||||
E8B825C626EA0995009E8E9F /* LoginVerifCodeProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifCodeProtocol.h; sourceTree = "<group>"; };
|
||||
E8B825C826EA1231009E8E9F /* LoginVerifCodeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginVerifCodeViewController.m; sourceTree = "<group>"; };
|
||||
E8B825C926EA1231009E8E9F /* LoginVerifCodeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginVerifCodeViewController.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -289,8 +297,8 @@
|
||||
187EEEEE26E89FE8002833B2 /* AccountInfoStorage.m */,
|
||||
187EEEFD26E8A82C002833B2 /* NSObject+AutoCoding.h */,
|
||||
187EEEFC26E8A82C002833B2 /* NSObject+AutoCoding.m */,
|
||||
E8B825B826E9A9D5009E8E9F /* BaseObject.h */,
|
||||
E8B825B926E9A9D5009E8E9F /* BaseObject.m */,
|
||||
E8B825B526E9A7D8009E8E9F /* BaseObject.h */,
|
||||
E8B825B626E9A7D8009E8E9F /* BaseObject.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
@@ -308,8 +316,8 @@
|
||||
189DD56226DE460400AB55B1 /* Login */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8B825BC26E9E520009E8E9F /* Model */,
|
||||
189DD75326E2211000AB55B1 /* Api */,
|
||||
189DD58926DF977D00AB55B1 /* Model */,
|
||||
189DD58A26DF978700AB55B1 /* View */,
|
||||
189DD58B26DF978F00AB55B1 /* Presenter */,
|
||||
189DD59126DF97F600AB55B1 /* Protocol */,
|
||||
@@ -346,23 +354,16 @@
|
||||
path = UI;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
189DD58926DF977D00AB55B1 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
189DD58A26DF978700AB55B1 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E872308A26E89D5100B90D4F /* CustomView */,
|
||||
189DD56326DE465A00AB55B1 /* LoginViewController.h */,
|
||||
189DD56426DE465A00AB55B1 /* LoginViewController.m */,
|
||||
E872308726E89BE000B90D4F /* LoginPhoneViewController.h */,
|
||||
E872308826E89BE000B90D4F /* LoginPhoneViewController.m */,
|
||||
E872308E26E8D29300B90D4F /* LoginVerifCodeViewController.h */,
|
||||
E872308F26E8D29300B90D4F /* LoginVerifCodeViewController.m */,
|
||||
E8B825C926EA1231009E8E9F /* LoginVerifCodeViewController.h */,
|
||||
E8B825C826EA1231009E8E9F /* LoginVerifCodeViewController.m */,
|
||||
189DD56326DE465A00AB55B1 /* LoginViewController.h */,
|
||||
189DD56426DE465A00AB55B1 /* LoginViewController.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
@@ -372,6 +373,8 @@
|
||||
children = (
|
||||
189DD58D26DF97E700AB55B1 /* LoginPresenter.h */,
|
||||
189DD58E26DF97E700AB55B1 /* LoginPresenter.m */,
|
||||
E8B825C026EA00DF009E8E9F /* LoginVerifCodePresent.h */,
|
||||
E8B825C126EA00DF009E8E9F /* LoginVerifCodePresent.m */,
|
||||
);
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
@@ -380,6 +383,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
189DD59426DF986300AB55B1 /* LoginProtocol.h */,
|
||||
E8B825C626EA0995009E8E9F /* LoginVerifCodeProtocol.h */,
|
||||
);
|
||||
path = Protocol;
|
||||
sourceTree = "<group>";
|
||||
@@ -525,6 +529,15 @@
|
||||
path = CustomView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8B825BC26E9E520009E8E9F /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8B825BD26E9E57D009E8E9F /* LoginTicketInfo.h */,
|
||||
E8B825BE26E9E57D009E8E9F /* LoginTicketInfo.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -656,10 +669,12 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */,
|
||||
E8B825CA26EA1231009E8E9F /* LoginVerifCodeViewController.m in Sources */,
|
||||
189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */,
|
||||
E8B825BA26E9A9D5009E8E9F /* BaseObject.m in Sources */,
|
||||
18E7B22626E8CDCF0064BC9B /* XplanFlutterBoostDelegate.m in Sources */,
|
||||
189DD73E26E21C3F00AB55B1 /* YYUtility.m in Sources */,
|
||||
E8B825B726E9A7D8009E8E9F /* BaseObject.m in Sources */,
|
||||
189DD53426DE255300AB55B1 /* TabbarViewController.m in Sources */,
|
||||
187EEEFE26E8A82C002833B2 /* NSObject+AutoCoding.m in Sources */,
|
||||
189DD55A26DE39D200AB55B1 /* BaseMvpPresenter.m in Sources */,
|
||||
@@ -671,10 +686,12 @@
|
||||
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */,
|
||||
189DD54B26DE338800AB55B1 /* BaseViewController.m in Sources */,
|
||||
18E7B1B726E8B2D10064BC9B /* Api+Main.m in Sources */,
|
||||
E8B825C226EA00DF009E8E9F /* LoginVerifCodePresent.m in Sources */,
|
||||
18E7B1B226E8AF980064BC9B /* MainPresenter.m in Sources */,
|
||||
189DD67E26E1FD8900AB55B1 /* UIImage+Utils.m in Sources */,
|
||||
189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */,
|
||||
189DD56526DE465A00AB55B1 /* LoginViewController.m in Sources */,
|
||||
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */,
|
||||
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */,
|
||||
E872309326E8D31500B90D4F /* LoginVerifCodeView.m in Sources */,
|
||||
189DD73D26E21C3F00AB55B1 /* YYUtility+Device.m in Sources */,
|
||||
@@ -682,7 +699,6 @@
|
||||
189DD74026E21C3F00AB55B1 /* YYUtility+App.m in Sources */,
|
||||
189DD74526E21CCC00AB55B1 /* YYReachability.m in Sources */,
|
||||
187EEEE126E89BFB002833B2 /* AccountModel.m in Sources */,
|
||||
E872309026E8D29300B90D4F /* LoginVerifCodeViewController.m in Sources */,
|
||||
189DD75026E21D9000AB55B1 /* GCDHelper.m in Sources */,
|
||||
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */,
|
||||
18E7B29026EA0E6B0064BC9B /* FlutterBoost+Xplan.m in Sources */,
|
||||
|
@@ -18,6 +18,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param mobile 手机号
|
||||
/// @param type 类型 业务类型,必填,1注册,2登录,3重设密码,4绑定手机,5绑定xczAccount,6重设xcz密码,7解绑手机
|
||||
+ (void)phoneSmsCode:(HttpRequestHelperCompletion)completion mobile:(NSString *)mobile type:(NSString *)type;
|
||||
|
||||
/// 手机验证码登录
|
||||
/// @param completion 完成
|
||||
/// @param phone 手机号
|
||||
/// @param code 验证码
|
||||
+ (void)loginWithCode:(HttpRequestHelperCompletion)completion phone:(NSString *)phone code:(NSString *)code client_secret:(NSString *)client_secret version:(NSString *)version client_id:(NSString *)client_id grant_type:(NSString *)grant_type;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -19,7 +19,15 @@
|
||||
/// @param mobile 手机号
|
||||
/// @param type 类型 业务类型,必填,1注册,2登录,3重设密码,4绑定手机,5绑定xczAccount,6重设xcz密码,7解绑手机
|
||||
+ (void)phoneSmsCode:(HttpRequestHelperCompletion)completion mobile:(NSString *)mobile type:(NSString *)type {
|
||||
[self makeRequest:@"sms/getCode" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, mobile, type];
|
||||
[self makeRequest:@"sms/getCode" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, mobile, type, nil];
|
||||
}
|
||||
|
||||
/// 手机验证码登录
|
||||
/// @param completion 完成
|
||||
/// @param phone 手机号
|
||||
/// @param code 验证码
|
||||
+ (void)loginWithCode:(HttpRequestHelperCompletion)completion phone:(NSString *)phone code:(NSString *)code client_secret:(NSString *)client_secret version:(NSString *)version client_id:(NSString *)client_id grant_type:(NSString *)grant_type {
|
||||
[self makeRequest:@"oauth/token" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,phone,code,client_secret,version, client_id, grant_type, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
20
xplan-ios/Main/Login/Model/LoginTicketInfo.h
Normal file
20
xplan-ios/Main/Login/Model/LoginTicketInfo.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// LoginTicketInfo.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/9/9.
|
||||
//
|
||||
|
||||
#import "BaseObject.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface LoginTicketInfo : BaseObject
|
||||
|
||||
@property(nonatomic, strong) NSString *issue_type;
|
||||
///数组中的第一个 就是ticket 历史遗留问题
|
||||
@property(nonatomic, strong) NSArray* tickets;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
xplan-ios/Main/Login/Model/LoginTicketInfo.m
Normal file
12
xplan-ios/Main/Login/Model/LoginTicketInfo.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// LoginTicketInfo.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/9/9.
|
||||
//
|
||||
|
||||
#import "LoginTicketInfo.h"
|
||||
|
||||
@implementation LoginTicketInfo
|
||||
|
||||
@end
|
@@ -13,14 +13,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)phoneQuickLogin:(NSString *)accessToken token:(NSString*) token;
|
||||
|
||||
/// 获取手机的验证码
|
||||
/// @param phone 手机号
|
||||
/// @param type 类型
|
||||
- (void)phoneSmsCode:(NSString *)phone type:(int)type;
|
||||
|
||||
/// 开启一个倒计时
|
||||
/// @param total 倒计时的时间
|
||||
- (void)openCutDownWithTotal:(int)total;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#import "LoginProtocol.h"
|
||||
#import "Api+Login.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
///Model
|
||||
#import "LoginTicketInfo.h"
|
||||
|
||||
@implementation LoginPresenter
|
||||
|
||||
@@ -26,37 +28,4 @@
|
||||
// todo fail
|
||||
}] accessToken:accessToken token:token];
|
||||
}
|
||||
|
||||
/// 获取手机的验证码
|
||||
/// @param phone 手机号
|
||||
/// @param type 类型
|
||||
- (void)phoneSmsCode:(NSString *)phone type:(int)type {
|
||||
[Api phoneSmsCode:[self createHttpCompletion:^(id _Nonnull data) {
|
||||
[[self getView] phoneSmsCodeSuccess];
|
||||
///开启一个倒计时60
|
||||
[self openCutDownWithTotal:60];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
} showLoading:NO errorToast:YES] mobile:phone type:[NSString stringWithFormat:@"%d", type]];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// 开启一个倒计时
|
||||
/// @param total 倒计时的时间
|
||||
- (void)openCutDownWithTotal:(int)total {
|
||||
__block int blockTotle = total;
|
||||
__block RACDisposable * disposable;
|
||||
disposable = [[RACSignal interval:1 onScheduler:[RACScheduler mainThreadScheduler]] subscribeNext:^(NSDate * _Nullable) {
|
||||
blockTotle--;
|
||||
[[self getView] countDownWithCurrent:blockTotle];
|
||||
///倒计时结束 停止监听
|
||||
if (blockTotle == 0) {
|
||||
[[self getView] countDownFinish];
|
||||
[disposable dispose];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
28
xplan-ios/Main/Login/Presenter/LoginVerifCodePresent.h
Normal file
28
xplan-ios/Main/Login/Presenter/LoginVerifCodePresent.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// LoginVerifCodePresent.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/9/9.
|
||||
//
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface LoginVerifCodePresent : BaseMvpPresenter
|
||||
/// 获取手机的验证码
|
||||
/// @param phone 手机号
|
||||
/// @param type 类型
|
||||
- (void)phoneSmsCode:(NSString *)phone type:(int)type;
|
||||
|
||||
/// 使用手机号和验证码登录
|
||||
/// @param phone 手机号
|
||||
/// @param code 验证码
|
||||
- (void)loginWithPhone:(NSString *)phone code:(NSString *)code;
|
||||
|
||||
/// 开启一个倒计时
|
||||
/// @param total 倒计时的时间
|
||||
- (void)openCutDownWithTotal:(int)total;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
73
xplan-ios/Main/Login/Presenter/LoginVerifCodePresent.m
Normal file
73
xplan-ios/Main/Login/Presenter/LoginVerifCodePresent.m
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// LoginVerifCodePresent.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/9/9.
|
||||
//
|
||||
|
||||
#import "LoginVerifCodePresent.h"
|
||||
///第三方
|
||||
#import <ReactiveObjC/ReactiveObjC.h>
|
||||
///Tool
|
||||
#import "AccountInfoStorage.h"
|
||||
///Api
|
||||
#import "Api+Login.h"
|
||||
///Presenter
|
||||
#import "LoginVerifCodePresent.h"
|
||||
///Protocol
|
||||
#import "LoginVerifCodeProtocol.h"
|
||||
///Model
|
||||
#import "AccountModel.h"
|
||||
|
||||
@implementation LoginVerifCodePresent
|
||||
|
||||
- (id<LoginVerifCodeProtocol>)getView {
|
||||
return ((id<LoginVerifCodeProtocol>) [super getView]);
|
||||
}
|
||||
|
||||
/// 获取手机的验证码
|
||||
/// @param phone 手机号
|
||||
/// @param type 类型
|
||||
- (void)phoneSmsCode:(NSString *)phone type:(int)type {
|
||||
[Api phoneSmsCode:[self createHttpCompletion:^(id _Nonnull data) {
|
||||
[[self getView] phoneSmsCodeSuccess];
|
||||
///开启一个倒计时60
|
||||
[self openCutDownWithTotal:60];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
} showLoading:NO errorToast:YES] mobile:phone type:[NSString stringWithFormat:@"%d", type]];
|
||||
}
|
||||
|
||||
/// 使用手机号和验证码登录
|
||||
/// @param phone 手机号
|
||||
/// @param code 验证码
|
||||
- (void)loginWithPhone:(NSString *)phone code:(NSString *)code {
|
||||
[Api loginWithCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
AccountModel * accountModel = [AccountModel modelWithDictionary:data.data];
|
||||
if (accountModel && accountModel.access_token.length > 0) {
|
||||
[[AccountInfoStorage instance] saveAccountInfo:accountModel];
|
||||
}
|
||||
[[self getView] loginSuccess];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
}] phone:phone code:code client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password"];
|
||||
}
|
||||
|
||||
|
||||
/// 开启一个倒计时
|
||||
/// @param total 倒计时的时间
|
||||
- (void)openCutDownWithTotal:(int)total {
|
||||
__block int blockTotle = total;
|
||||
__block RACDisposable * disposable;
|
||||
disposable = [[RACSignal interval:1 onScheduler:[RACScheduler mainThreadScheduler]] subscribeNext:^(NSDate * _Nullable x) {
|
||||
blockTotle--;
|
||||
[[self getView] countDownWithCurrent:blockTotle];
|
||||
///倒计时结束 停止监听
|
||||
if (blockTotle == 0) {
|
||||
[[self getView] countDownFinish];
|
||||
[disposable dispose];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
@@ -12,12 +12,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol LoginProtocol <NSObject>
|
||||
|
||||
- (void)phoneQuickLoginSuccess;
|
||||
///请求手机号的验证码成功
|
||||
- (void)phoneSmsCodeSuccess;
|
||||
///倒计时进行中
|
||||
- (void)countDownWithCurrent:(int)current;
|
||||
///倒计时结束
|
||||
- (void)countDownFinish;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
23
xplan-ios/Main/Login/Protocol/LoginVerifCodeProtocol.h
Normal file
23
xplan-ios/Main/Login/Protocol/LoginVerifCodeProtocol.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// LoginVerifCodeProtocol.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/9/9.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol LoginVerifCodeProtocol <NSObject>
|
||||
///请求手机号的验证码成功
|
||||
- (void)phoneSmsCodeSuccess;
|
||||
///倒计时进行中
|
||||
- (void)countDownWithCurrent:(int)current;
|
||||
///倒计时结束
|
||||
- (void)countDownFinish;
|
||||
///登录成功
|
||||
- (void)loginSuccess;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -88,7 +88,7 @@
|
||||
_textField.borderStyle = UITextBorderStyleNone;
|
||||
_textField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
_textField.tintColor = ThemeBackgroundColor;
|
||||
_textField.backgroundColor = [UIColor redColor];
|
||||
_textField.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _textField;
|
||||
}
|
||||
|
@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
///输入的验证码 有几位
|
||||
@property (nonatomic,assign) int number;
|
||||
///输入的字符串的
|
||||
@property (nonatomic,copy) void(^textFieldChangeBlock)(NSString *);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -43,11 +43,39 @@
|
||||
}
|
||||
|
||||
- (void)initEvents {
|
||||
@weakify(self);
|
||||
[[self.textField rac_signalForControlEvents:UIControlEventEditingChanged] subscribeNext:^(__kindof UITextField *textField) {
|
||||
NSLog(@"text%@", textField.text);
|
||||
@strongify(self);
|
||||
[self updateLablesWithText:textField];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)updateLablesWithText:(UITextField *)textField {
|
||||
if (textField.text.length > self.lableArray.count) {
|
||||
textField.text = [textField.text substringToIndex:self.lableArray.count];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (textField.text.length >= 5) {
|
||||
[textField resignFirstResponder];
|
||||
if (_textFieldChangeBlock) {
|
||||
_textFieldChangeBlock(textField.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (UILabel *pwLab in self.lableArray) {
|
||||
if (pwLab.tag < (100 + textField.text.length)) {
|
||||
NSRange range = NSMakeRange(pwLab.tag-100, 1);
|
||||
pwLab.text = [textField.text substringWithRange:range];
|
||||
}else{
|
||||
pwLab.text = @"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)configLabelArray {
|
||||
CGFloat itemWidth = 45;
|
||||
CGFloat itemHeight = 45;
|
||||
@@ -60,6 +88,7 @@
|
||||
label.backgroundColor = UIColorFromRGB(0x2A2A39);
|
||||
label.layer.masksToBounds = YES;
|
||||
label.layer.cornerRadius = 10;
|
||||
label.tag = 100 + i;
|
||||
[self addSubview:label];
|
||||
[label mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth, itemHeight));
|
||||
@@ -89,6 +118,9 @@
|
||||
- (UITextField *)textField {
|
||||
if (!_textField) {
|
||||
_textField = [[UITextField alloc] init];
|
||||
_textField.tintColor = [UIColor clearColor];
|
||||
_textField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
[_textField becomeFirstResponder];
|
||||
}
|
||||
return _textField;
|
||||
}
|
||||
|
@@ -17,8 +17,6 @@
|
||||
#import "LoginVerifCodeViewController.h"
|
||||
|
||||
@interface LoginPhoneViewController ()
|
||||
///返回按钮
|
||||
@property (nonatomic,strong) UIButton *backButton;
|
||||
///密码登录
|
||||
@property (nonatomic,strong) UIButton *passwordLoginButton;
|
||||
///标题的容器
|
||||
@@ -47,7 +45,6 @@
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.backButton];
|
||||
[self.view addSubview:self.passwordLoginButton];
|
||||
[self.view addSubview:self.titleStackView];
|
||||
[self.view addSubview:self.phoneView];
|
||||
@@ -58,15 +55,9 @@
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(15, 15));
|
||||
make.left.mas_equalTo(self.view).offset(15);
|
||||
make.top.mas_equalTo(37+ kSafeAreaTopHeight);
|
||||
}];
|
||||
|
||||
[self.passwordLoginButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.view).offset(-15);
|
||||
make.top.mas_equalTo(self.backButton.mas_bottom).offset(15);
|
||||
make.top.mas_equalTo(self.view).offset(79 + kSafeAreaTopHeight);
|
||||
}];
|
||||
|
||||
[self.titleStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -88,10 +79,6 @@
|
||||
|
||||
- (void)initEevents {
|
||||
@weakify(self);
|
||||
///点击了返回的按钮
|
||||
[[self.backButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
|
||||
|
||||
}];
|
||||
///点击了密码登录
|
||||
[[self.passwordLoginButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
|
||||
|
||||
@@ -112,15 +99,6 @@
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIButton *)backButton {
|
||||
if (!_backButton) {
|
||||
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_backButton setImage:[UIImage imageNamed:@"icon_unattention"] forState:UIControlStateNormal];
|
||||
[_backButton setImage:[UIImage imageNamed:@"icon_small_attention"] forState:UIControlStateSelected];
|
||||
}
|
||||
return _backButton;
|
||||
}
|
||||
|
||||
- (UIButton *)passwordLoginButton {
|
||||
if (!_passwordLoginButton) {
|
||||
_passwordLoginButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
|
@@ -12,13 +12,13 @@
|
||||
///Tool
|
||||
#import "XCHUDTool.h"
|
||||
///Presenter
|
||||
#import "LoginPresenter.h"
|
||||
#import "LoginVerifCodePresent.h"
|
||||
///Protocole
|
||||
#import "LoginProtocol.h"
|
||||
#import "LoginVerifCodeProtocol.h"
|
||||
///View
|
||||
#import "LoginVerifCodeView.h"
|
||||
|
||||
@interface LoginVerifCodeViewController ()<LoginProtocol>
|
||||
@interface LoginVerifCodeViewController ()<LoginVerifCodeProtocol>
|
||||
///标题的容器
|
||||
@property (nonatomic,strong) UIStackView *titleStackView;
|
||||
///标题
|
||||
@@ -37,13 +37,8 @@
|
||||
|
||||
@implementation LoginVerifCodeViewController
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
NSLog(@"aaaaa");
|
||||
}
|
||||
|
||||
- (LoginPresenter *)createPresenter {
|
||||
return [[LoginPresenter alloc] init];
|
||||
- (LoginVerifCodePresent *)createPresenter {
|
||||
return [[LoginVerifCodePresent alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
@@ -112,6 +107,10 @@
|
||||
self.cutdownLabel.hidden = NO;
|
||||
}
|
||||
|
||||
- (void)loginSuccess {
|
||||
[XCHUDTool showSuccessWithMessage:@"登录成功"];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIStackView *)titleStackView {
|
||||
if (!_titleStackView) {
|
||||
|
Reference in New Issue
Block a user