Commit 33397f25 authored by IOS-张 博's avatar IOS-张 博

首页和登陆逻辑开发

parent cd98c630
......@@ -285,7 +285,7 @@
7F58DCD222C4AA9200F2A15F /* QGHelpCenterModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F58DCD122C4AA9200F2A15F /* QGHelpCenterModel.m */; };
7F58DCD522C4AF8200F2A15F /* QGHelpCenterSelfServiceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F58DCD422C4AF8200F2A15F /* QGHelpCenterSelfServiceCell.m */; };
7F58DCDB22C4CD1800F2A15F /* QGFeedbackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F58DCDA22C4CD1800F2A15F /* QGFeedbackViewController.m */; };
7FFD452022B7232C0025DDD0 /* QGMainLoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD451C22B7232C0025DDD0 /* QGMainLoginViewController.m */; };
7FFD452022B7232C0025DDD0 /* QGPasswordLoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD451C22B7232C0025DDD0 /* QGPasswordLoginViewController.m */; };
7FFD452122B7232C0025DDD0 /* QGInputVerifyCodeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD451E22B7232C0025DDD0 /* QGInputVerifyCodeView.m */; };
7FFD452422B792480025DDD0 /* QGLoginTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD452322B792480025DDD0 /* QGLoginTableViewCell.m */; };
7FFD452722B7A89A0025DDD0 /* QGLoginInputPasswordTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FFD452622B7A89A0025DDD0 /* QGLoginInputPasswordTableViewCell.m */; };
......@@ -356,6 +356,8 @@
9E2AEDB42407B76F00FFA083 /* QGUpdateAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E2AEDB32407B76F00FFA083 /* QGUpdateAlertView.m */; };
9E2AEDB72408BD2300FFA083 /* QGMallBaseOpenUrlModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E2AEDB62408BD2300FFA083 /* QGMallBaseOpenUrlModel.m */; };
9E2AEDBA2408C63E00FFA083 /* QGAuthAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E2AEDB92408C63E00FFA083 /* QGAuthAlertView.m */; };
9E35683824776D8E00FB725B /* QGLoginBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E35683724776D8E00FB725B /* QGLoginBottomView.m */; };
9E35683B2477B04100FB725B /* QGCardBindingBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E35683A2477B04100FB725B /* QGCardBindingBottomView.m */; };
9E4609B023B1E73E004FD96E /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EA79A7C2282AAFD00CDCB80 /* libz.tbd */; };
9E4609B123B1E748004FD96E /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EA79A7E2282AB0700CDCB80 /* libsqlite3.tbd */; };
9E4609B323B1E750004FD96E /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E4609B223B1E750004FD96E /* JavaScriptCore.framework */; };
......@@ -1222,8 +1224,8 @@
7F58DCD422C4AF8200F2A15F /* QGHelpCenterSelfServiceCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGHelpCenterSelfServiceCell.m; sourceTree = "<group>"; };
7F58DCD922C4CD1800F2A15F /* QGFeedbackViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGFeedbackViewController.h; sourceTree = "<group>"; };
7F58DCDA22C4CD1800F2A15F /* QGFeedbackViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGFeedbackViewController.m; sourceTree = "<group>"; };
7FFD451B22B7232C0025DDD0 /* QGMainLoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGMainLoginViewController.h; sourceTree = "<group>"; };
7FFD451C22B7232C0025DDD0 /* QGMainLoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGMainLoginViewController.m; sourceTree = "<group>"; };
7FFD451B22B7232C0025DDD0 /* QGPasswordLoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGPasswordLoginViewController.h; sourceTree = "<group>"; };
7FFD451C22B7232C0025DDD0 /* QGPasswordLoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGPasswordLoginViewController.m; sourceTree = "<group>"; };
7FFD451E22B7232C0025DDD0 /* QGInputVerifyCodeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGInputVerifyCodeView.m; sourceTree = "<group>"; };
7FFD451F22B7232C0025DDD0 /* QGInputVerifyCodeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGInputVerifyCodeView.h; sourceTree = "<group>"; };
7FFD452222B792480025DDD0 /* QGLoginTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGLoginTableViewCell.h; sourceTree = "<group>"; };
......@@ -1365,6 +1367,10 @@
9E2AEDB62408BD2300FFA083 /* QGMallBaseOpenUrlModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGMallBaseOpenUrlModel.m; sourceTree = "<group>"; };
9E2AEDB82408C63E00FFA083 /* QGAuthAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGAuthAlertView.h; sourceTree = "<group>"; };
9E2AEDB92408C63E00FFA083 /* QGAuthAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGAuthAlertView.m; sourceTree = "<group>"; };
9E35683624776D8E00FB725B /* QGLoginBottomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGLoginBottomView.h; sourceTree = "<group>"; };
9E35683724776D8E00FB725B /* QGLoginBottomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGLoginBottomView.m; sourceTree = "<group>"; };
9E3568392477B04100FB725B /* QGCardBindingBottomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGCardBindingBottomView.h; sourceTree = "<group>"; };
9E35683A2477B04100FB725B /* QGCardBindingBottomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGCardBindingBottomView.m; sourceTree = "<group>"; };
9E4609B223B1E750004FD96E /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
9E4609B423B1E758004FD96E /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
9E4609B623B1E75E004FD96E /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
......@@ -3125,6 +3131,8 @@
7FFD454722B9DBDB0025DDD0 /* QGMessageVerifyBottomTableViewCell.m */,
7F2467DF22CA30FB002A67A5 /* QGUserProtocolTableViewCell.h */,
7F2467E022CA30FB002A67A5 /* QGUserProtocolTableViewCell.m */,
9E35683624776D8E00FB725B /* QGLoginBottomView.h */,
9E35683724776D8E00FB725B /* QGLoginBottomView.m */,
);
path = View;
sourceTree = "<group>";
......@@ -3352,6 +3360,7 @@
7FFD451822B7232C0025DDD0 /* Function */ = {
isa = PBXGroup;
children = (
9E35683C2477BCBF00FB725B /* QGBindingPhone */,
7FFD451922B7232C0025DDD0 /* QGLogin */,
7F58DC7122C079BB00F2A15F /* QGRegisterOrVerifyLogin */,
7F58DC7922C0BB5C00F2A15F /* QGForgetPassword */,
......@@ -3372,8 +3381,8 @@
7FFD451A22B7232C0025DDD0 /* ViewController */ = {
isa = PBXGroup;
children = (
7FFD451B22B7232C0025DDD0 /* QGMainLoginViewController.h */,
7FFD451C22B7232C0025DDD0 /* QGMainLoginViewController.m */,
7FFD451B22B7232C0025DDD0 /* QGPasswordLoginViewController.h */,
7FFD451C22B7232C0025DDD0 /* QGPasswordLoginViewController.m */,
);
path = ViewController;
sourceTree = "<group>";
......@@ -3621,6 +3630,13 @@
path = CommonView;
sourceTree = "<group>";
};
9E35683C2477BCBF00FB725B /* QGBindingPhone */ = {
isa = PBXGroup;
children = (
);
path = QGBindingPhone;
sourceTree = "<group>";
};
9E4609A223B1E673004FD96E /* ByteDanceApm */ = {
isa = PBXGroup;
children = (
......@@ -4044,6 +4060,8 @@
9E74E1312382762A006E4926 /* QGBindingCardCell.m */,
9E74E1332382766D006E4926 /* QGBindingCardSubCell.h */,
9E74E1342382766D006E4926 /* QGBindingCardSubCell.m */,
9E3568392477B04100FB725B /* QGCardBindingBottomView.h */,
9E35683A2477B04100FB725B /* QGCardBindingBottomView.m */,
);
path = BindingCard;
sourceTree = "<group>";
......@@ -5949,7 +5967,7 @@
97CDB62922891D3200257F77 /* MJRefreshFooter.m in Sources */,
9E927BEB23F2B6FD00ECE581 /* QGFuLuWebViewController.m in Sources */,
97CDB62B22891D3200257F77 /* MJRefreshBackFooter.m in Sources */,
7FFD452022B7232C0025DDD0 /* QGMainLoginViewController.m in Sources */,
7FFD452022B7232C0025DDD0 /* QGPasswordLoginViewController.m in Sources */,
9EBE2424242CBB55009C83A1 /* QGOperateStyleImgModel.m in Sources */,
9EA7981522827EB800CDCB80 /* QGBaseTableViewController.m in Sources */,
9E74E1482382A345006E4926 /* QGBindingWalletInfoSubCell.m in Sources */,
......@@ -6278,6 +6296,7 @@
462E005722C45D5D0010C0E2 /* QGRepamentHistoryListViewController.m in Sources */,
9EA79BCB2282D61300CDCB80 /* MKAnnotationView+WebCache.m in Sources */,
466175DF22D5DCBE0025437A /* QGAppBusinessStateEvent.m in Sources */,
9E35683B2477B04100FB725B /* QGCardBindingBottomView.m in Sources */,
9EA79C3D2284091900CDCB80 /* MBProgressHUD.m in Sources */,
9EF866F224176E4100BF0F2B /* WMMenuItem.m in Sources */,
9E74E13C23828FBB006E4926 /* QGBindingWalletController.m in Sources */,
......@@ -6363,6 +6382,7 @@
9E74E1452382A2FE006E4926 /* QGBindingWalletInfoCell.m in Sources */,
9EA797F3228179F600CDCB80 /* UIView+Layer.m in Sources */,
9E2AEDB02407AD7C00FFA083 /* MagnifyImageView.m in Sources */,
9E35683824776D8E00FB725B /* QGLoginBottomView.m in Sources */,
466175E222D5DD0A0025437A /* QGAppCoreModelClickEvent.m in Sources */,
9EA7979E227ECC9100CDCB80 /* QGDeviceTool.m in Sources */,
9EBE246724370694009C83A1 /* QGTransactionTipsCell.m in Sources */,
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "login_apple@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "login_apple@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "login_wechat@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "login_wechat@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
//
// QGCardBindingBottomView.h
// VirtualPayment
//
// Created by 张博 on 2020/5/22.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "QGBindingCardCell.h"
NS_ASSUME_NONNULL_BEGIN
typedef void(^QGCardBindingBottomViewClickBlock)(BindingCardClickType type);
@interface QGCardBindingBottomView : UIView
/// 按钮点击事件
@property (nonatomic, copy) QGCardBindingBottomViewClickBlock clickBlock;
@end
NS_ASSUME_NONNULL_END
//
// QGCardBindingBottomView.m
// VirtualPayment
//
// Created by 张博 on 2020/5/22.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import "QGCardBindingBottomView.h"
#import "QGBasicUITool.h"
@implementation QGCardBindingBottomView
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor clearColor];
//承载内容容器
UIView * contentView = [UIView creatViewWithSuperView:self backgroundColor:[[UIColor blackColor] colorWithAlphaComponent:0.4]];
contentView.layer.cornerRadius = 6;
contentView.clipsToBounds = YES;
[contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.bottom.inset(0);
}];
//文案
UILabel * titleLabel = [UILabel creatLabelWithSuperView:contentView title:@"绑定微信、支付宝去支付" titleFontSize:[UIFont qg_regularFontOfSize:12] textColor:[UIColor whiteColor] alignment:NSTextAlignmentLeft];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.inset(15);
make.centerY.offset(0);
}];
//支付宝支付
UIButton * alipyButton = [UIButton creatButtonWithSuperView:contentView title:@"支付宝" titleFont:[UIFont qg_regularFontOfSize:12] textColor:[UIColor whiteColor]];
alipyButton.tag = BindingCardClickTypeAlipay;
[alipyButton setBackgroundColor:[UIColor colorWithHexString:@"42B0F4"]];
alipyButton.layer.cornerRadius = 3;
alipyButton.clipsToBounds = YES;
[alipyButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(74, 24));
make.right.inset(7);
make.centerY.offset(0);
}];
[alipyButton addTarget:self action:@selector(bindingButtonClick:) forControlEvents:UIControlEventTouchUpInside];
//微信支付
UIButton * wechatPayButton = [UIButton creatButtonWithSuperView:contentView title:@"微信支付" titleFont:[UIFont qg_regularFontOfSize:12] textColor:[UIColor whiteColor]];
wechatPayButton.tag = BindingCardClickTypeWechat;
[wechatPayButton setBackgroundColor:[UIColor colorWithHexString:@"56CD2F"]];
wechatPayButton.layer.cornerRadius = 3;
wechatPayButton.clipsToBounds = YES;
[wechatPayButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(74, 24));
make.right.mas_equalTo(alipyButton.mas_left).offset(-5);
make.centerY.offset(0);
}];
[wechatPayButton addTarget:self action:@selector(bindingButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return self;
}
- (void)bindingButtonClick:(UIButton *)button
{
if (self.clickBlock) {
self.clickBlock(button.tag);
}
}
@end
......@@ -29,6 +29,7 @@
#import "QGCardAccountNormalCell.h"
#import "QGCardAccountReviewingCell.h"
#import "QGCardAccountReviewSuccessCell.h"
#import "QGCardBindingBottomView.h"
//Tool
#import "QGApplicationOpenURL.h"
......@@ -58,6 +59,9 @@
/// 客服按钮
@property (nonatomic, strong) UIButton * serviceButton;
/// 绑卡浮窗
@property (nonatomic, strong) QGCardBindingBottomView * bindingBottomView;
@end
@implementation QGCardViewController
......@@ -118,6 +122,22 @@
UIBarButtonItem * serviceBtnItem = [[UIBarButtonItem alloc]initWithCustomView:self.serviceButton];
self.navigationItem.rightBarButtonItems = @[messageBtnItem,serviceBtnItem];
//底部绑定视图
self.bindingBottomView = [[QGCardBindingBottomView alloc] init];
[self.view addSubview:self.bindingBottomView];
self.bindingBottomView.hidden = YES;
[self.bindingBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.inset(15 + [DeviceAdaptation getTabBarHeight]);
make.left.right.inset(15);
make.height.mas_equalTo(40);
}];
@weakify(self);
self.bindingBottomView.clickBlock = ^(BindingCardClickType type) {
@strongify(self);
[self addWalletClick:type];
};
}
///添加下拉刷新
......@@ -161,6 +181,15 @@
}
[self.tableView endHeaderRefreshWithBlock:nil];
[self.tableView reloadData];
//底部绑卡是否展示
BOOL hiddenBindingView = YES;
//已激活二类户
if (self.cardDataModel.blankNote.depositAccountStatusEnumType.integerValue == 1) {
hiddenBindingView = !self.cardDataModel.blankNote.showCreditDesc.boolValue;
}
self.bindingBottomView.hidden = hiddenBindingView;
} failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
@strongify(self);
[self.tableView endHeaderRefreshWithBlock:nil];
......@@ -677,6 +706,22 @@
return view;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.y > 0) {
self.bindingBottomView.hidden = YES;
}
else
{
BOOL hiddenBindingView = YES;
//已激活二类户
if (self.cardDataModel.blankNote.depositAccountStatusEnumType.integerValue == 1) {
hiddenBindingView = !self.cardDataModel.blankNote.showCreditDesc.boolValue;
}
self.bindingBottomView.hidden = hiddenBindingView;
}
}
#pragma mark - Action
/// 消息点击事件
......
......@@ -11,6 +11,6 @@
/**
登录
*/
@interface QGMainLoginViewController : QGLoginBaseTableViewController
@interface QGPasswordLoginViewController : QGLoginBaseTableViewController
@end
......@@ -6,7 +6,7 @@
// Copyright © 2019年 bo.zhang. All rights reserved.
//
#import "QGMainLoginViewController.h"
#import "QGPasswordLoginViewController.h"
#import "QGBasicUITool.h"
#import "QGLoginTableViewCell.h"
#import "QGLoginInputPasswordTableViewCell.h"
......@@ -17,7 +17,7 @@
#import "QGCalendarManager.h"
#import "QGCustomAlertView.h"
#import "QGPushService.h"
@interface QGMainLoginViewController ()<QGCustomAlertViewDelegate>
@interface QGPasswordLoginViewController ()<QGCustomAlertViewDelegate>
///自定义tableView header
@property (nonatomic, strong)UIView *tableHeaderView;
///手机号
......@@ -53,7 +53,7 @@
@end
@implementation QGMainLoginViewController
@implementation QGPasswordLoginViewController
-(BOOL)checkParameters:(NSDictionary *)param
{
......
//
// QGLoginBottomView.h
// VirtualPayment
//
// Created by 张博 on 2020/5/22.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, QGLoginType) {
QGLoginTypeWechat = 1,
QGLoginTypeApple
};
///登录点击事件
typedef void(^QGLoginBottomViewClickBlock)(QGLoginType type);
NS_ASSUME_NONNULL_BEGIN
@interface QGLoginBottomView : UIView
/// 点击事件
@property (nonatomic, copy) QGLoginBottomViewClickBlock clickBlock;
@end
@interface QGLoginBottomCell : UIControl
/// 图标
@property (nonatomic, strong) UIImageView * iconImgView;
/// 标题
@property (nonatomic, strong) UILabel * titleLabel;
/// 初始化方法
/// @param imageName 图标名称
/// @param title 标题
- (instancetype)initWithIconImageName:(NSString *)imageName title:(NSString *)title;
@end
NS_ASSUME_NONNULL_END
//
// QGLoginBottomView.m
// VirtualPayment
//
// Created by 张博 on 2020/5/22.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import "QGLoginBottomView.h"
#import "QGBasicUITool.h"
#import "ZHWeChatTool.h"
@implementation QGLoginBottomView
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
//微信未安装,不初始化下面UI
if ([[ZHWeChatTool share] isWXInstalled]) {
[self initNormalUI];
}
}
return self;
}
//初始化UI
- (void)initNormalUI
{
//线条
UIView * lineView = [UIView creatViewWithSuperView:self backgroundColor:[UIColor lineSeparatorColorDCDC]];
[lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.inset(40);
make.top.inset(10);
make.height.mas_equalTo(0.5);
}];
//标题
UILabel * titleLabel = [UILabel creatLabelWithSuperView:self title:@"第三方登录" titleFontSize:[UIFont qg_lightFontOfSize:12] textColor:[UIColor textColor9999] alignment:NSTextAlignmentCenter];
titleLabel.backgroundColor = [UIColor whiteColor];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(82, 17));
make.centerX.offset(0);
make.centerY.mas_equalTo(lineView);
}];
//微信登录
QGLoginBottomCell * wechatCell = [[QGLoginBottomCell alloc] initWithIconImageName:@"login_wechat" title:@"微信登录"];
[self addSubview:wechatCell];
wechatCell.tag = QGLoginTypeWechat;
[wechatCell addTarget:self action:@selector(loginButtonClick:) forControlEvents:UIControlEventTouchUpInside];
//apple登录
QGLoginBottomCell * appleCell = [[QGLoginBottomCell alloc] initWithIconImageName:@"login_apple" title:@"Apple登录"];
[self addSubview:appleCell];
appleCell.tag = QGLoginTypeApple;
[appleCell addTarget:self action:@selector(loginButtonClick:) forControlEvents:UIControlEventTouchUpInside];
//iOS13以上才有apple登录
if (iOS13) {
//微信登录
[wechatCell mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.mas_centerX).multipliedBy(0.5);
make.width.mas_equalTo(60);
make.top.mas_equalTo(titleLabel.mas_bottom).offset(19);
}];
//apple登录
[appleCell mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.mas_centerX).multipliedBy(1.5);
make.width.mas_equalTo(60);
make.top.mas_equalTo(titleLabel.mas_bottom).offset(19);
}];
}
else
{
//微信登录
[wechatCell mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.mas_centerX);
make.width.mas_equalTo(60);
make.top.mas_equalTo(titleLabel.mas_bottom).offset(19);
}];
appleCell.hidden = YES;
}
}
/// 登录按钮点击事件
- (void)loginButtonClick:(QGLoginBottomCell *)loginCell
{
if (self.clickBlock) {
self.clickBlock(loginCell.tag);
}
}
@end
@implementation QGLoginBottomCell
/// 初始化方法
/// @param imageName 图标名称
/// @param title 标题
- (instancetype)initWithIconImageName:(NSString *)imageName title:(NSString *)title
{
if (self = [super init]) {
//图标
self.iconImgView = [UIImageView creatImageViewWithSuperView:self imageName:imageName];
[self.iconImgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(40, 40));
make.top.inset(0);
make.centerX.offset(0);
}];
//标题
self.titleLabel = [UILabel creatLabelWithSuperView:self title:title titleFontSize:[UIFont qg_lightFontOfSize:12] textColor:[UIColor textColor6666] alignment:NSTextAlignmentCenter];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.iconImgView.mas_bottom).offset(5);
make.height.mas_equalTo(17);
make.centerX.offset(0);
make.bottom.inset(0);
}];
}
return self;
}
@end
......@@ -11,15 +11,17 @@
//Tool
#import "QGBasicUITool.h"
#import "QGSendMessageCodeManger.h"
#import "QGThirdPlatformService.h"
//View
#import "QGPhoneInputWithTitleCell.h"
#import "QGLoginBottomBtnTableViewCell.h"
#import "QGBottomLittleBtnTableViewCell.h"
#import "QGLoginProtocolCell.h"
#import "QGLoginBottomView.h"
#import <AuthenticationServices/AuthenticationServices.h>
@interface QGRegisterViewController ()<UITextViewDelegate>
@interface QGRegisterViewController ()<UITextViewDelegate, ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding>
///header
@property (nonatomic, strong)UIView *tableHeaderView;
///用于记录输入的手机号
......@@ -51,7 +53,7 @@
make.height.mas_equalTo(30);
}];
self.tableView.tableHeaderView = self.tableHeaderView;
self.tableView.bounces = NO;
@weakify(self);
[self customLeftBarButtonItemWithImgName:@"vc_close" action:^(UIButton * _Nonnull button) {
@strongify(self);
......@@ -61,6 +63,37 @@
}
}];
//底部三方登录
QGLoginBottomView * bottomView = [[QGLoginBottomView alloc] init];
[self.view addSubview:bottomView];
[bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.inset(0);
make.height.mas_equalTo(110 + [DeviceAdaptation getBottomSafeAreaHeight]);
}];
//点击事件
bottomView.clickBlock = ^(QGLoginType type) {
@strongify(self);
switch (type) {
///微信登录
case QGLoginTypeWechat:
[self signInWithWechat];
break;
///apple登录
case QGLoginTypeApple:
{
if (@available(iOS 13.0, *)) {
[self signInWithApple];
}
}
break;
default:
break;
}
};
}
......@@ -173,7 +206,7 @@
case LittleBtnPasswordLogin://密码登录
{
//密码登录页面跳转
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGMainLoginViewController] parameters:@{@"phone":IsStringNull(self.phoneString)} handlerBlock:^(NSString *tag, NSDictionary *parameters) {
[Mediator performTarget:[QGMediatorClassTools QGClassNameWithHeaderType:QGHeaderTypeQGPasswordLoginViewController] parameters:@{@"phone":IsStringNull(self.phoneString)} handlerBlock:^(NSString *tag, NSDictionary *parameters) {
if ([tag isEqualToString:LoginTag_QGLoginViewController_ChangePhoneNum]) {
self.phoneString = [parameters valueForKey:@"phone"];
......@@ -236,13 +269,28 @@
return _tableHeaderView;
}
#pragma mark - 微信登录
/// 微信登录
- (void)signInWithWechat
{
//微信登录
[[QGThirdPlatformService shareInstance] wxAuthWithSuccess:^(NSDictionary *infoDic) {
}];
}
#pragma mark - Apple登录
///AppleID登录
- (void)signInWithApple API_AVAILABLE(ios(13.0))
{
//创建授权请求
ASAuthorizationAppleIDProvider *provider = [[ASAuthorizationAppleIDProvider alloc] init];
ASAuthorizationAppleIDRequest *request = [provider createRequest];
request.requestedScopes = @[ASAuthorizationScopeFullName, ASAuthorizationScopeEmail];
ASAuthorizationAppleIDRequest * request = [provider createRequest];
//在用户授权期间请求的联系信息
request.requestedScopes = @[ASAuthorizationScopeFullName];
//弹出授权页面
ASAuthorizationController *vc = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]];
vc.delegate = self;
vc.presentationContextProvider = self;
......@@ -250,35 +298,30 @@
}
#pragma mark - ASAuthorizationControllerPresentationContextProviding
///设置展示的window层级
- (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;
//苹果用户唯一标识,同一开发者账号下的APP获取到是一样的
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));
}
}
......
......@@ -35,7 +35,7 @@
//#import "QGLoginResetPasswordViewController.h"
//#import "QGMessageRegisterOrLoginViewController.h"
//#import "QGRegisterViewController.h"
//#import "QGMainLoginViewController.h"
//#import "QGPasswordLoginViewController.h"
//#import "QGIncreaseAmountController.h"
//#import "CWWebViewController.h"
//#import "QGSelectTermViewController.h"
......
......@@ -27,7 +27,7 @@ typedef enum : NSUInteger {
QGHeaderTypeQGLoginResetPasswordViewController,
QGHeaderTypeQGMessageRegisterOrLoginViewController,
QGHeaderTypeQGRegisterViewController,
QGHeaderTypeQGMainLoginViewController,
QGHeaderTypeQGPasswordLoginViewController,
QGHeaderTypeQGIncreaseAmountController,
QGHeaderTypeCWWebViewController,
QGHeaderTypeQGSelectTermViewController,
......
......@@ -68,8 +68,8 @@ NSString * ClassNameWithHeadType(QGHeaderType headerType)
return @"QGMessageRegisterOrLoginViewController";
case QGHeaderTypeQGRegisterViewController:
return @"QGRegisterViewController";
case QGHeaderTypeQGMainLoginViewController:
return @"QGMainLoginViewController";
case QGHeaderTypeQGPasswordLoginViewController:
return @"QGPasswordLoginViewController";
case QGHeaderTypeQGIncreaseAmountController:
return @"QGIncreaseAmountController";
case QGHeaderTypeCWWebViewController:
......
......@@ -7,7 +7,7 @@
//
#import "UIViewController+CommonConfig.h"
#import "QGMainLoginViewController.h"
#import "QGPasswordLoginViewController.h"
#import "UIColor+QGColor.h"
#import "Masonry.h"
......
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