Commit cd98c630 authored by IOS-张 博's avatar IOS-张 博

修改登录逻辑

parent 8f2edc10
...@@ -299,7 +299,6 @@ ...@@ -299,7 +299,6 @@
7FFD453F22B9090B0025DDD0 /* QGVerifyCodeTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD453E22B9090B0025DDD0 /* QGVerifyCodeTableViewCell.m */; }; 7FFD453F22B9090B0025DDD0 /* QGVerifyCodeTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD453E22B9090B0025DDD0 /* QGVerifyCodeTableViewCell.m */; };
7FFD454522B9D4050025DDD0 /* QGMessageVerifyHeaderTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD454422B9D4050025DDD0 /* QGMessageVerifyHeaderTableViewCell.m */; }; 7FFD454522B9D4050025DDD0 /* QGMessageVerifyHeaderTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD454422B9D4050025DDD0 /* QGMessageVerifyHeaderTableViewCell.m */; };
7FFD454822B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD454722B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.m */; }; 7FFD454822B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD454722B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.m */; };
7FFD454B22BA1A440025DDD0 /* QGSucceedRegisterSetPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD454A22BA1A440025DDD0 /* QGSucceedRegisterSetPasswordViewController.m */; };
7FFD454E22BA1B2F0025DDD0 /* QGRegisterSetPasswordHeaderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD454D22BA1B2F0025DDD0 /* QGRegisterSetPasswordHeaderCell.m */; }; 7FFD454E22BA1B2F0025DDD0 /* QGRegisterSetPasswordHeaderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD454D22BA1B2F0025DDD0 /* QGRegisterSetPasswordHeaderCell.m */; };
7FFD455122BA28190025DDD0 /* QGLoginResetPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD455022BA28190025DDD0 /* QGLoginResetPasswordViewController.m */; }; 7FFD455122BA28190025DDD0 /* QGLoginResetPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD455022BA28190025DDD0 /* QGLoginResetPasswordViewController.m */; };
7FFD455422BA293C0025DDD0 /* QGLoginResetPasswordInputPhoneNumberCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD455322BA293C0025DDD0 /* QGLoginResetPasswordInputPhoneNumberCell.m */; }; 7FFD455422BA293C0025DDD0 /* QGLoginResetPasswordInputPhoneNumberCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD455322BA293C0025DDD0 /* QGLoginResetPasswordInputPhoneNumberCell.m */; };
...@@ -1251,8 +1250,6 @@ ...@@ -1251,8 +1250,6 @@
7FFD454422B9D4050025DDD0 /* QGMessageVerifyHeaderTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGMessageVerifyHeaderTableViewCell.m; sourceTree = "<group>"; }; 7FFD454422B9D4050025DDD0 /* QGMessageVerifyHeaderTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGMessageVerifyHeaderTableViewCell.m; sourceTree = "<group>"; };
7FFD454622B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGMessageVerifyBottomTableViewCell.h; sourceTree = "<group>"; }; 7FFD454622B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGMessageVerifyBottomTableViewCell.h; sourceTree = "<group>"; };
7FFD454722B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGMessageVerifyBottomTableViewCell.m; sourceTree = "<group>"; }; 7FFD454722B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGMessageVerifyBottomTableViewCell.m; sourceTree = "<group>"; };
7FFD454922BA1A440025DDD0 /* QGSucceedRegisterSetPasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGSucceedRegisterSetPasswordViewController.h; sourceTree = "<group>"; };
7FFD454A22BA1A440025DDD0 /* QGSucceedRegisterSetPasswordViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGSucceedRegisterSetPasswordViewController.m; sourceTree = "<group>"; };
7FFD454C22BA1B2F0025DDD0 /* QGRegisterSetPasswordHeaderCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGRegisterSetPasswordHeaderCell.h; sourceTree = "<group>"; }; 7FFD454C22BA1B2F0025DDD0 /* QGRegisterSetPasswordHeaderCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGRegisterSetPasswordHeaderCell.h; sourceTree = "<group>"; };
7FFD454D22BA1B2F0025DDD0 /* QGRegisterSetPasswordHeaderCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGRegisterSetPasswordHeaderCell.m; sourceTree = "<group>"; }; 7FFD454D22BA1B2F0025DDD0 /* QGRegisterSetPasswordHeaderCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGRegisterSetPasswordHeaderCell.m; sourceTree = "<group>"; };
7FFD454F22BA28190025DDD0 /* QGLoginResetPasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGLoginResetPasswordViewController.h; sourceTree = "<group>"; }; 7FFD454F22BA28190025DDD0 /* QGLoginResetPasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGLoginResetPasswordViewController.h; sourceTree = "<group>"; };
...@@ -3139,8 +3136,6 @@ ...@@ -3139,8 +3136,6 @@
7FFD453522B8CD9A0025DDD0 /* QGRegisterViewController.m */, 7FFD453522B8CD9A0025DDD0 /* QGRegisterViewController.m */,
7FFD453722B8E1A10025DDD0 /* QGMessageRegisterOrLoginViewController.h */, 7FFD453722B8E1A10025DDD0 /* QGMessageRegisterOrLoginViewController.h */,
7FFD453822B8E1A10025DDD0 /* QGMessageRegisterOrLoginViewController.m */, 7FFD453822B8E1A10025DDD0 /* QGMessageRegisterOrLoginViewController.m */,
7FFD454922BA1A440025DDD0 /* QGSucceedRegisterSetPasswordViewController.h */,
7FFD454A22BA1A440025DDD0 /* QGSucceedRegisterSetPasswordViewController.m */,
); );
path = ViewController; path = ViewController;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -6490,7 +6485,6 @@ ...@@ -6490,7 +6485,6 @@
9EB1D13A22BC70EC008D28CE /* QGBannerView.m in Sources */, 9EB1D13A22BC70EC008D28CE /* QGBannerView.m in Sources */,
9EB1D93122BCEEDD008D28CE /* QNEtag.m in Sources */, 9EB1D93122BCEEDD008D28CE /* QNEtag.m in Sources */,
9EA79BD62282D61300CDCB80 /* SDWebImageDownloaderConfig.m in Sources */, 9EA79BD62282D61300CDCB80 /* SDWebImageDownloaderConfig.m in Sources */,
7FFD454B22BA1A440025DDD0 /* QGSucceedRegisterSetPasswordViewController.m in Sources */,
46C3C9942457CACB00B4F7BF /* QGBusinessRequestApi.m in Sources */, 46C3C9942457CACB00B4F7BF /* QGBusinessRequestApi.m in Sources */,
9EA79BD42282D61300CDCB80 /* NSBezierPath+RoundedCorners.m in Sources */, 9EA79BD42282D61300CDCB80 /* NSBezierPath+RoundedCorners.m in Sources */,
); );
......
...@@ -4,5 +4,9 @@ ...@@ -4,5 +4,9 @@
<dict> <dict>
<key>aps-environment</key> <key>aps-environment</key>
<string>development</string> <string>development</string>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict> </dict>
</plist> </plist>
...@@ -54,39 +54,22 @@ ...@@ -54,39 +54,22 @@
@end @end
@implementation QGMainLoginViewController @implementation QGMainLoginViewController
-(BOOL)checkParameters:(NSDictionary *)param -(BOOL)checkParameters:(NSDictionary *)param
{ {
return YES; return YES;
} }
-(void)transferParameters:(NSDictionary *)param
{
self.phoneString = [param objectForKey:@"phone"];
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
self.tableView.bounces = NO;
//设置导航栏左右按钮 管理自己的回调事件
@weakify(self);
[self customLeftBarButtonItemWithImgName:@"vc_close" action:^(UIButton * _Nonnull button) {
@strongify(self);
[self dismissViewControllerAnimated:YES completion:nil];
if (self.callBackBlock) {
self.callBackBlock(LoginTag_QGMainLoginViewController_LoginCancle, nil);
}
}];
[self custemRightBarButtonItemWithTitle:@"注册" imageName:nil action:^(UIButton * _Nonnull button) {
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGRegisterViewController] parameters:@{@"phone":IsStringNull(self.phoneString)} handlerBlock:^(NSString *tag, NSDictionary *parameters) {
if (parameters) {
self.phoneString = [parameters valueForKey:@"phone"];
[self.tableView reloadData];
}
if (self.callBackBlock) {
self.callBackBlock(tag, parameters);
}
}];
}];
//设置tableview的header //设置tableview的header
UILabel *welcomeLabel = [UIView creatLabelWithSuperView:self.tableHeaderView title:@"欢迎使用真享生活" titleFontSize:[UIFont qg_regularFontOfSize:30] textColor:[UIColor textColor3333] alignment:NSTextAlignmentLeft]; UILabel *welcomeLabel = [UIView creatLabelWithSuperView:self.tableHeaderView title:@"欢迎使用真享生活" titleFontSize:[UIFont qg_regularFontOfSize:30] textColor:[UIColor textColor3333] alignment:NSTextAlignmentLeft];
...@@ -383,6 +366,11 @@ ...@@ -383,6 +366,11 @@
cell.cellBlock = ^(NSString *phoneNumber) { cell.cellBlock = ^(NSString *phoneNumber) {
@strongify(self) @strongify(self)
self.phoneString = phoneNumber; self.phoneString = phoneNumber;
if (self.callBackBlock) {
self.callBackBlock(LoginTag_QGLoginViewController_ChangePhoneNum, @{@"phone":self.phoneString});
}
if (self.phoneString.isNumber&&self.phoneString.length == 11 && ![NSString isEmpty:self.passwordString]) { if (self.phoneString.isNumber&&self.phoneString.length == 11 && ![NSString isEmpty:self.passwordString]) {
//登录按钮可点击 //登录按钮可点击
self.changeButtonStatus(YES); self.changeButtonStatus(YES);
...@@ -477,22 +465,13 @@ ...@@ -477,22 +465,13 @@
QGBottomLittleBtnTableViewCell *cell = [[QGBottomLittleBtnTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"little" leftBtnTitle:@"验证码登录" rightBtnTitle:@"忘记密码"]; QGBottomLittleBtnTableViewCell *cell = [[QGBottomLittleBtnTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"little" leftBtnTitle:@"验证码登录" rightBtnTitle:@"忘记密码"];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
@weakify(self);
cell.cellBlock = ^(LittleBtnType btnType) {//处理按钮点击逻辑 cell.cellBlock = ^(LittleBtnType btnType) {//处理按钮点击逻辑
@strongify(self);
switch (btnType) { switch (btnType) {
case LittleBtnVerifyCode:{ case LittleBtnVerifyCode:{
//验证码登录页面跳转 //验证码登录页面跳转
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGRegisterViewController] parameters:@{@"phone":IsStringNull(self.phoneString)} handlerBlock:^(NSString *tag, NSDictionary *parameters) { [self.navigationController popViewControllerAnimated:YES];
if (parameters) {
self.phoneString = [parameters valueForKey:@"phone"];
[self.tableView reloadData];
}
if (self.callBackBlock) {
self.callBackBlock(tag, parameters);
}
}];
} }
break; break;
case LittleBtnForgetPassword: case LittleBtnForgetPassword:
......
...@@ -109,15 +109,9 @@ ...@@ -109,15 +109,9 @@
NSDictionary * dataDic = responseObject[@"data"]; NSDictionary * dataDic = responseObject[@"data"];
//保存登录信息 //保存登录信息
[self loginSuccessSaveUserInfo:dataDic]; [self loginSuccessSaveUserInfo:dataDic];
//关闭页面
[self performSelector:@selector(dismissPressed) withObject:nil afterDelay:0.2];
//新注册用户设置密码
if (![QGUserInfo sharedUserInfo].hasPassword) {
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGSucceedRegisterSetPasswordViewController] isPush:YES animation:YES parameters:@{@"phoneNumberStr":self.phoneNumberStr} handlerBlock:self.callBackBlock];
}
//老用户关闭页面
else{
[self performSelector:@selector(dismissPressed) withObject:nil afterDelay:0.2];
}
} }
//业务处理失败 //业务处理失败
else else
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#import "QGBottomLittleBtnTableViewCell.h" #import "QGBottomLittleBtnTableViewCell.h"
#import "QGLoginProtocolCell.h" #import "QGLoginProtocolCell.h"
#import <AuthenticationServices/AuthenticationServices.h>
@interface QGRegisterViewController ()<UITextViewDelegate> @interface QGRegisterViewController ()<UITextViewDelegate>
///header ///header
@property (nonatomic, strong)UIView *tableHeaderView; @property (nonatomic, strong)UIView *tableHeaderView;
...@@ -37,10 +38,6 @@ ...@@ -37,10 +38,6 @@
return YES; return YES;
} }
-(void)transferParameters:(NSDictionary *)param
{
self.phoneString = [param objectForKey:@"phone"];
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
...@@ -55,7 +52,14 @@ ...@@ -55,7 +52,14 @@
}]; }];
self.tableView.tableHeaderView = self.tableHeaderView; self.tableView.tableHeaderView = self.tableHeaderView;
@weakify(self);
[self customLeftBarButtonItemWithImgName:@"vc_close" action:^(UIButton * _Nonnull button) {
@strongify(self);
[self dismissViewControllerAnimated:YES completion:nil];
if (self.callBackBlock) {
self.callBackBlock(LoginTag_QGMainLoginViewController_LoginCancle, nil);
}
}];
} }
...@@ -88,8 +92,6 @@ ...@@ -88,8 +92,6 @@
@strongify(self) @strongify(self)
self.phoneString = phoneNumber; self.phoneString = phoneNumber;
self.callBackBlock(nil, @{@"phone":self.phoneString});
if (self.phoneString.isNumber && self.phoneString.length == 11) { if (self.phoneString.isNumber && self.phoneString.length == 11) {
self.changeButtonStatus(YES); self.changeButtonStatus(YES);
}else{ }else{
...@@ -168,8 +170,23 @@ ...@@ -168,8 +170,23 @@
cell.cellBlock = ^(LittleBtnType btnType) {//处理按钮点击逻辑 cell.cellBlock = ^(LittleBtnType btnType) {//处理按钮点击逻辑
switch (btnType) { switch (btnType) {
case LittleBtnPasswordLogin://密码登录,直接返回 case LittleBtnPasswordLogin://密码登录
[weakSelf.navigationController popViewControllerAnimated:YES]; {
//密码登录页面跳转
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGMainLoginViewController] parameters:@{@"phone":IsStringNull(self.phoneString)} handlerBlock:^(NSString *tag, NSDictionary *parameters) {
if ([tag isEqualToString:LoginTag_QGLoginViewController_ChangePhoneNum]) {
self.phoneString = [parameters valueForKey:@"phone"];
[self.tableView reloadData];
}
else
{
if (self.callBackBlock) {
self.callBackBlock(tag, parameters);
}
}
}];
}
break; break;
default: default:
break; break;
...@@ -220,5 +237,74 @@ ...@@ -220,5 +237,74 @@
} }
- (void)signInWithApple API_AVAILABLE(ios(13.0))
{
ASAuthorizationAppleIDProvider *provider = [[ASAuthorizationAppleIDProvider alloc] init];
ASAuthorizationAppleIDRequest *request = [provider createRequest];
request.requestedScopes = @[ASAuthorizationScopeFullName, ASAuthorizationScopeEmail];
ASAuthorizationController *vc = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]];
vc.delegate = self;
vc.presentationContextProvider = self;
[vc performRequests];
}
#pragma mark - ASAuthorizationControllerPresentationContextProviding
- (ASPresentationAnchor)presentationAnchorForAuthorizationController:(ASAuthorizationController *)controller API_AVAILABLE(ios(13.0))
{
return self.view.window;
}
#pragma mark - ASAuthorizationControllerDelegate
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0))
{
if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) {
ASAuthorizationAppleIDCredential *credential = authorization.credential;
NSString *state = credential.state;
NSString *userID = credential.user;
NSPersonNameComponents *fullName = credential.fullName;
NSString *email = credential.email;
NSString *authorizationCode = [[NSString alloc] initWithData:credential.authorizationCode encoding:NSUTF8StringEncoding]; // refresh token
NSString *identityToken = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding]; // access token
ASUserDetectionStatus realUserStatus = credential.realUserStatus;
NSLog(@"state: %@", state);
NSLog(@"userID: %@", userID);
NSLog(@"fullName: %@", fullName);
NSLog(@"email: %@", email);
NSLog(@"authorizationCode: %@", authorizationCode);
NSLog(@"identityToken: %@", identityToken);
NSLog(@"realUserStatus: %@", @(realUserStatus));
}
}
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error API_AVAILABLE(ios(13.0))
{
NSString *errorMsg = nil;
switch (error.code) {
case ASAuthorizationErrorCanceled:
errorMsg = @"用户取消了授权请求";
break;
case ASAuthorizationErrorFailed:
errorMsg = @"授权请求失败";
break;
case ASAuthorizationErrorInvalidResponse:
errorMsg = @"授权请求响应无效";
break;
case ASAuthorizationErrorNotHandled:
errorMsg = @"未能处理授权请求";
break;
case ASAuthorizationErrorUnknown:
errorMsg = @"授权请求失败未知原因";
break;
}
NSLog(@"%@", errorMsg);
}
@end @end
//
// QGSucceedRegisterSetPasswordViewController.h
// VirtualPayment
//
// Created by 邢超 on 2019/6/19.
// Copyright © 2019年 bo.zhang. All rights reserved.
//
#import "QGLoginBaseTableViewController.h"
@interface QGSucceedRegisterSetPasswordViewController : QGLoginBaseTableViewController
@end
//
// QGSucceedRegisterSetPasswordViewController.m
// VirtualPayment
//
// Created by 邢超 on 2019/6/19.
// Copyright © 2019年 bo.zhang. All rights reserved.
//
#import "QGSucceedRegisterSetPasswordViewController.h"
#import "QGBasicUITool.h"
#import "QGRegisterSetPasswordHeaderCell.h"
#import "QGPasswordInputWithTitleCell.h"
#import "QGLoginBottomBtnTableViewCell.h"
#import "QGAlertView.h"
#import "QGLoginRequestApi.h"
@interface QGSucceedRegisterSetPasswordViewController ()
///记录输入的密码
@property (nonatomic, copy)NSString *password;
///记录确认的密码
@property (nonatomic, copy)NSString *confirmPassword;
///注册成功手机号
@property (nonatomic, copy)NSString *phoneNumberStr;
@end
@implementation QGSucceedRegisterSetPasswordViewController
-(BOOL)checkParameters:(NSDictionary *)param
{
if ([[param objectForKey:@"phoneNumberStr"] isNumber]) {
return YES;
}
return NO;
}
- (void)transferParameters:(NSDictionary *)param {
self.phoneNumberStr = [param objectForKey:@"phoneNumberStr"];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self customLeftBarButtonItemWithImgName:nil action:^(UIButton * _Nonnull button) {
}];
}
#pragma mark --request
//设置密码的网络请求
-(void)setPassword
{
[self.view endEditing:YES];
if (!self.password.isValidPasswordString) {
[QGHUDManager showHud:@"密码格式不正确"];
return;
}
if (![self.confirmPassword isEqualToString:self.password]) {
[QGHUDManager showHud:@"两次输入的密码不一致"];
return;
}
NSMutableDictionary *parame = [[NSMutableDictionary alloc]init];
[parame setObject:self.password forKey:@"password"];
[parame setObject:[QGUserInfo sharedUserInfo].token forKey:@"verifySmsCodeToken"];
[parame setObject:self.phoneNumberStr forKey:@"phone"];
NSString *url = [QGLoginRequestApi urlWithQGLoginRequestServerMethod:QGLoginRequestServerMethodSetNewPasswordCode];
[[QGTalosNetwork shareManager] POST:url parameters:parame success:^(id _Nonnull responseObject) {
//业务处理成功
if ([QGBaseNetwork checkBusinessCodeAndCodeWithResponseObjectObject:responseObject]) {
//设置密码埋点
NSMutableDictionary *info = [[NSMutableDictionary alloc] init];
[info setObject:@"APP注册" forKey:@"abse_page_name"];
[info setObject:@"设置登录密码" forKey:@"abse_action_name"];
[info setObject:@"success" forKey:@"abse_state_value"];
[QGAnalyticsService analyticsTrack:@"AppBusinessStateEvent" withProperties: info];
[QGUserInfo sharedUserInfo].hasPassword = YES;
//密码设置成功
QGAlertView *alert = [[QGAlertView alloc] initWithTitle:@"密码设置成功" message:@"请妥善保管好自己的账号和密码!" cancelButtonTitle:nil sureButtonTitle:@"知道了" clickBlock:^(NSInteger index) {
if (index == 1) {
[self dismissPressed];
}
}];
[alert showInView:self.view];
}
//业务处理异常
else
{
[QGHUDManager showHudWithError:responseObject];
}
} failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
[QGHUDManager showHud:[QGBaseNetwork getMessageWithFailureError:error]];
}];
}
/**
登录完成后取消当前页面
*/
- (void)dismissPressed
{
[self.navigationController dismissViewControllerAnimated:NO
completion:^{
if (self.callBackBlock) {
self.callBackBlock(LoginTag_QGMainLoginViewController_LoginSuccess, nil);
}
}];
}
#pragma mark --tableview
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
__weak typeof(self)weakSelf = self;
if (indexPath.row == 0) {
QGRegisterSetPasswordHeaderCell *cell = [[QGRegisterSetPasswordHeaderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"headerCell"];
return cell;
}else if (indexPath.row == 1 || indexPath.row == 2){
QGPasswordInputWithTitleCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([QGPasswordInputWithTitleCell class])];
if (!cell) {
cell = [[QGPasswordInputWithTitleCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"password" cellTitle:@"登录密码"];
}
cell.cellBlock = ^(NSString *password) {
//首次输入
if (indexPath.row == 1) {
weakSelf.password = password;
}
//二次输入
else if (indexPath.row == 2)
{
weakSelf.confirmPassword = password;
}
};
return cell;
}else{
QGLoginBottomBtnTableViewCell *cell = [[QGLoginBottomBtnTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"loginCell" btnTitle:@"确定" padding:20];
[cell.loginButton setGradientButtonIsClickEnabled:YES];
cell.cellBlock = ^(UIButton *nextBtn) {
//点击确定按钮的回调,请求网络成功后切换到主页
[weakSelf setPassword];
};
return cell;
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0) {
return 81;
}else if (indexPath.row == 1){
return 81;
}else{
return 85;
}
}
@end
...@@ -43,15 +43,6 @@ ...@@ -43,15 +43,6 @@
} }
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if (![QGUserInfo sharedUserInfo].hasPassword && [QGUserInfo sharedUserInfo].login) {
//需设置密码
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGSucceedRegisterSetPasswordViewController] isPush:NO animation:YES parameters:@{@"phoneNumberStr":[QGUserInfo sharedUserInfo].userName} handlerBlock:nil];
}
}
- (void)initNormalVC { - (void)initNormalVC {
NSMutableArray * barItems = [NSMutableArray arrayWithCapacity:0]; NSMutableArray * barItems = [NSMutableArray arrayWithCapacity:0];
......
...@@ -231,11 +231,7 @@ ...@@ -231,11 +231,7 @@
if ([QGUserInfo sharedUserInfo].login) {//去到消息中心 if ([QGUserInfo sharedUserInfo].login) {//去到消息中心
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGMessageCenterVC] parameters:nil handlerBlock:nil]; [Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGMessageCenterVC] parameters:nil handlerBlock:nil];
}else{ }else{
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGMainLoginViewController] isPush:NO parameters:nil handlerBlock:^(NSString *tag, NSDictionary *parameters) { [self showLoginViewControllerCompletion:nil];
if ([tag isEqualToString:LoginTag_QGMainLoginViewController_LoginSuccess]) {
[self.tableView reloadData];
}
}];
} }
} }
......
...@@ -101,10 +101,8 @@ ...@@ -101,10 +101,8 @@
@strongify(self); @strongify(self);
[self.navigationController popToRootViewControllerAnimated:NO]; [self.navigationController popToRootViewControllerAnimated:NO];
//修改密码完成后进入登录页面 //修改密码完成后进入登录页面
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGMainLoginViewController] isPush:NO parameters:nil handlerBlock:^(NSString *tag, NSDictionary *parameters) { [self showLoginViewControllerCompletion:^{
if ([tag isEqualToString:LoginTag_QGMainLoginViewController_LoginSuccess]) { [[SystemManager shareInstance].tabbarController jumpCard];
[[SystemManager shareInstance].tabbarController jumpCard];
}
}]; }];
}]; }];
}]; }];
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
///登录完成 ///登录完成
#define LoginTag_QGMainLoginViewController_LoginSuccess @"Login_QGMainLoginViewController_LoginSuccess" #define LoginTag_QGMainLoginViewController_LoginSuccess @"Login_QGMainLoginViewController_LoginSuccess"
///修改手机号
#define LoginTag_QGLoginViewController_ChangePhoneNum @"LoginTag_QGLoginViewController_ChangePhoneNum"
///登录取消 ///登录取消
#define LoginTag_QGMainLoginViewController_LoginCancle @"LoginTag_QGMainLoginViewController_LoginCancle" #define LoginTag_QGMainLoginViewController_LoginCancle @"LoginTag_QGMainLoginViewController_LoginCancle"
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
//#import "QGRetriecePasswordViewController.h" //#import "QGRetriecePasswordViewController.h"
//#import "QGLoginSelectResetPasswordTypeViewController.h" //#import "QGLoginSelectResetPasswordTypeViewController.h"
//#import "QGLoginResetPasswordViewController.h" //#import "QGLoginResetPasswordViewController.h"
//#import "QGSucceedRegisterSetPasswordViewController.h"
//#import "QGMessageRegisterOrLoginViewController.h" //#import "QGMessageRegisterOrLoginViewController.h"
//#import "QGRegisterViewController.h" //#import "QGRegisterViewController.h"
//#import "QGMainLoginViewController.h" //#import "QGMainLoginViewController.h"
......
...@@ -25,7 +25,6 @@ typedef enum : NSUInteger { ...@@ -25,7 +25,6 @@ typedef enum : NSUInteger {
QGHeaderTypeQGRetriecePasswordViewController, QGHeaderTypeQGRetriecePasswordViewController,
QGHeaderTypeQGLoginSelectResetPasswordTypeViewController, QGHeaderTypeQGLoginSelectResetPasswordTypeViewController,
QGHeaderTypeQGLoginResetPasswordViewController, QGHeaderTypeQGLoginResetPasswordViewController,
QGHeaderTypeQGSucceedRegisterSetPasswordViewController,
QGHeaderTypeQGMessageRegisterOrLoginViewController, QGHeaderTypeQGMessageRegisterOrLoginViewController,
QGHeaderTypeQGRegisterViewController, QGHeaderTypeQGRegisterViewController,
QGHeaderTypeQGMainLoginViewController, QGHeaderTypeQGMainLoginViewController,
......
...@@ -64,8 +64,6 @@ NSString * ClassNameWithHeadType(QGHeaderType headerType) ...@@ -64,8 +64,6 @@ NSString * ClassNameWithHeadType(QGHeaderType headerType)
return @"QGLoginSelectResetPasswordTypeViewController"; return @"QGLoginSelectResetPasswordTypeViewController";
case QGHeaderTypeQGLoginResetPasswordViewController: case QGHeaderTypeQGLoginResetPasswordViewController:
return @"QGLoginResetPasswordViewController"; return @"QGLoginResetPasswordViewController";
case QGHeaderTypeQGSucceedRegisterSetPasswordViewController:
return @"QGSucceedRegisterSetPasswordViewController";
case QGHeaderTypeQGMessageRegisterOrLoginViewController: case QGHeaderTypeQGMessageRegisterOrLoginViewController:
return @"QGMessageRegisterOrLoginViewController"; return @"QGMessageRegisterOrLoginViewController";
case QGHeaderTypeQGRegisterViewController: case QGHeaderTypeQGRegisterViewController:
......
...@@ -206,12 +206,7 @@ ...@@ -206,12 +206,7 @@
/// @param cancleBlock 取消回调 /// @param cancleBlock 取消回调
- (void)showLoginViewControllerCompletion:(void(^)())successBlock cancleBlock:(dispatch_block_t)cancleBlock - (void)showLoginViewControllerCompletion:(void(^)())successBlock cancleBlock:(dispatch_block_t)cancleBlock
{ {
QGMainLoginViewController * loginVC = [[QGMainLoginViewController alloc]init]; [Mediator performTarget:ClassNameWithHeadType(QGHeaderTypeQGRegisterViewController) isPush:NO parameters:nil handlerBlock:^(NSString *tag, NSDictionary *parameters) {
UINavigationController * loginNav = [[UINavigationController alloc] initWithRootViewController:loginVC];
[self presentViewController:loginNav animated:YES completion:nil];
//登录回调
loginVC.callBackBlock = ^(NSString *tag, NSDictionary *params) {
//登录成功回调 //登录成功回调
if ([tag isEqualToString:LoginTag_QGMainLoginViewController_LoginSuccess]) { if ([tag isEqualToString:LoginTag_QGMainLoginViewController_LoginSuccess]) {
if (successBlock) { if (successBlock) {
...@@ -225,7 +220,7 @@ ...@@ -225,7 +220,7 @@
cancleBlock(); cancleBlock();
} }
} }
}; }];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment