Commit 4703bbe53e38aa82fb1fde3b9b283e5cf9f43856

Authored by iOS-Xiaowen
1 parent ad0dff04

no message

Showing 27 changed files with 462 additions and 70 deletions
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_apple.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "login_binding_apple@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "login_binding_apple@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_apple.imageset/login_binding_apple@2x.png 0 → 100644

1.83 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_apple.imageset/login_binding_apple@3x.png 0 → 100644

3.51 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_logo.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "login_binding_logo@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "login_binding_logo@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_logo.imageset/login_binding_logo@2x.png 0 → 100644

10.8 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_logo.imageset/login_binding_logo@3x.png 0 → 100644

17.6 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_qq.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "login_binding_qq@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "login_binding_qq@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_qq.imageset/login_binding_qq@2x.png 0 → 100644

6.43 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_qq.imageset/login_binding_qq@3x.png 0 → 100644

15.1 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_ways.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "login_binding_ways@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "login_binding_ways@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_ways.imageset/login_binding_ways@2x.png 0 → 100644

572 Bytes

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_ways.imageset/login_binding_ways@3x.png 0 → 100644

1.05 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_wechat.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "login_binding_wechat@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "login_binding_wechat@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_wechat.imageset/login_binding_wechat@2x.png 0 → 100644

4.47 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_wechat.imageset/login_binding_wechat@3x.png 0 → 100644

11.2 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_weibo.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "login_binding_weibo@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "login_binding_weibo@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_weibo.imageset/login_binding_weibo@2x.png 0 → 100644

11.9 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_binding_weibo.imageset/login_binding_weibo@3x.png 0 → 100644

25.4 KB

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_down.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "login_down@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "login_down@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_down.imageset/login_down@2x.png 0 → 100644

250 Bytes

CNLiveBLoginModule/Assets/CNLiveBLoginModule.xcassets/login_down.imageset/login_down@3x.png 0 → 100644

441 Bytes

CNLiveBLoginModule/Classes/Controller/CNLiveLoginController.m
... ... @@ -152,6 +152,9 @@
152 152 model.faceUrl = userInfo.faceUrl;
153 153 model.thirdPartyId = userInfo.thirdPartyId;
154 154  
  155 + model.countryName = self.loginView.countryName;
  156 + model.countryCode = self.loginView.countryName;
  157 +
155 158 switch (type) {
156 159 case CNLiveSendAuthRespApple:
157 160 {
... ...
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveBindingTelController.m
... ... @@ -84,14 +84,14 @@
84 84  
85 85 - (CNLiveBindingTelView *)bindingTelView {
86 86 if (!_bindingTelView) {
87   - _bindingTelView = [[CNLiveBindingTelView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/8.0, NavigationContentTop, self.view.frame.size.width*3/4.0, 400) model:self.model];
  87 + _bindingTelView = [[CNLiveBindingTelView alloc] initWithFrame:CGRectMake(0, NavigationContentTop+20, self.view.frame.size.width, 400) model:self.model];
88 88 }
89 89 return _bindingTelView;
90 90 }
91 91  
92 92 - (YYLabel *)protocol {
93 93 if (!_protocol) {
94   - _protocol = [[YYLabel alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-30-NavigationContentTop-SafeAreaInsetsConstantForDeviceWithNotch.bottom, self.view.frame.size.width, 30)];
  94 + _protocol = [[YYLabel alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-40-SafeAreaInsetsConstantForDeviceWithNotch.bottom, self.view.frame.size.width, 30)];
95 95 _protocol.textAlignment = NSTextAlignmentCenter;
96 96 _protocol.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
97 97 _protocol.font = [UIFont systemFontOfSize:14.0];
... ... @@ -107,7 +107,7 @@
107 107 __strong typeof(weakSelf) strongSelf = weakSelf;
108 108 if(!strongSelf) return;
109 109 [strongSelf.view endEditing:YES];
110   - [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementUser];
  110 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementAccountBinding];
111 111  
112 112 }];
113 113 _protocol.attributedText = text;
... ...
CNLiveBLoginModule/Classes/ThreeLogin/CNLiveBindingTelView.m
... ... @@ -17,6 +17,7 @@
17 17 #import <CNLiveUserSystemSDK/CNLiveUserSystemTypeDef.h>
18 18 #import "CNUserInfoManager.h"
19 19 #import "CNLiveManager.h"
  20 +#import "CNLiveChooseCountryController.h"
20 21  
21 22 #import "CNLiveLoginCountryView.h"
22 23 #import "CNLiveLoginTextField.h"
... ... @@ -24,82 +25,221 @@
24 25 #import "CNLiveThreeLoginModel.h"
25 26 #import "CNLiveLoginRequest.h"
26 27  
27   -@interface CNLiveBindingTelView()<UITextFieldDelegate,CNLiveCountDownButtonDataSource, CNLiveCountDownButtonDelegate>
  28 +@interface CNLiveBindingTelView()<UITextFieldDelegate,CNLiveCountDownButtonDataSource, CNLiveCountDownButtonDelegate,ChooseCountriesDelegate>
28 29 {
29 30 NSString *_countryCode; // 国家Code
  31 + NSString *_countryName; // 国家Code
30 32 NSString *_verificationCode; // 验证码
31 33 }
32 34  
33   -@property (nonatomic, weak) CNLiveLoginTextField *account;
34   -@property (nonatomic, weak) CNLiveLoginTextField *code;
35   -@property (nonatomic, strong) CNLiveCountDownButton *countDown;
  35 +@property (nonatomic, weak) QMUIButton *three;
  36 +@property (nonatomic, weak) UIImageView *bindingImage;
  37 +@property (nonatomic, weak) QMUIButton *netadd;
  38 +@property (nonatomic, weak) UILabel *desc;
  39 +@property (nonatomic, weak) UIView *line;
  40 +@property (nonatomic, weak) UIView *countryBox;
  41 +@property (nonatomic, weak) UIView *telBox;
  42 +@property (nonatomic, weak) UIView *codeBox;
  43 +
  44 +@property (nonatomic, strong) CNLiveLoginTextField *telTF;
  45 +@property (nonatomic, strong) CNLiveLoginTextField *codeTF;
  46 +
  47 +@property (nonatomic, strong) UILabel *country;
  48 +@property (nonatomic, strong) UIButton *code;
  49 +@property (nonatomic, strong) CNLiveCountDownButton *codeBtn;
  50 +
36 51 @property (nonatomic, weak) UIButton *binding;
  52 +
37 53 @property (nonatomic, strong) CNLiveThreeLoginModel *model;
  54 +@property (nonatomic, assign) CNLiveSendAuthResp type;
38 55  
39 56 @end
40 57  
41 58 @implementation CNLiveBindingTelView
42 59 #define XWKeyWindow [UIApplication sharedApplication].keyWindow
  60 +static NSInteger const space = 10;
43 61 static NSInteger const rowHeight = 40;
44   -static NSInteger const space = 40;
45 62 static const NSInteger timeValue = 1.5;
46 63  
47 64 - (instancetype)initWithFrame:(CGRect)frame model:(CNLiveThreeLoginModel *)model {
48 65 self = [super initWithFrame:frame];
49 66 if (self) {
50 67 self.userInteractionEnabled = YES;
51   - _countryCode = @"86";
52   - self.model = model;
53 68 [self createSubviews:frame];
54   -
  69 + _countryName = model.countryName;
  70 + _countryCode = model.countryCode;
  71 + self.model = model;
  72 + self.type = model.type;
  73 + [self addSubview:self.country];
  74 + [self addSubview:self.code];
  75 +
  76 + [self addSubview:self.telTF];
  77 + [self addSubview:self.codeTF];
  78 + [self addSubview:self.codeBtn];
55 79 }
56 80 return self;
57 81  
58 82 }
  83 +
  84 +- (void)setType:(CNLiveSendAuthResp)type{
  85 + switch (type) {
  86 + case CNLiveSendAuthRespWX:
  87 + {
  88 + UIImage *image = [self getImageWithImageName:@"login_binding_wechat" bundleName:@"CNLiveBLoginModule" targetClass:[self class]];
  89 + [self.three setImage:image forState:UIControlStateNormal];
  90 + [self.three setTitle:@"微信" forState:UIControlStateNormal];
  91 + self.desc.text = @"确定后,此微信账号将与网家家账号绑定";
  92 + }
  93 + break;
  94 + case CNLiveSendAuthRespQQ:
  95 + {
  96 + UIImage *image = [self getImageWithImageName:@"login_binding_qq" bundleName:@"CNLiveBLoginModule" targetClass:[self class]];
  97 + [self.three setImage:image forState:UIControlStateNormal];
  98 + [self.three setTitle:@"QQ" forState:UIControlStateNormal];
  99 + self.desc.text = @"确定后,此QQ账号将与网家家账号绑定";
  100 + }
  101 + break;
  102 + case CNLiveSendAuthRespWB:
  103 + {
  104 + UIImage *image = [self getImageWithImageName:@"login_binding_weibo" bundleName:@"CNLiveBLoginModule" targetClass:[self class]];
  105 + [self.three setImage:image forState:UIControlStateNormal];
  106 + [self.three setTitle:@"微博" forState:UIControlStateNormal];
  107 + self.desc.text = @"确定后,此微博账号将与网家家账号绑定";
  108 + }
  109 + break;
  110 + case CNLiveSendAuthRespApple:
  111 + {
  112 + UIImage *image = [self getImageWithImageName:@"login_binding_apple" bundleName:@"CNLiveBLoginModule" targetClass:[self class]];
  113 + [self.three setImage:image forState:UIControlStateNormal];
  114 + [self.three setTitle:@"苹果" forState:UIControlStateNormal];
  115 + self.desc.text = @"确定后,此苹果账号将与网家家账号绑定";
  116 + }
  117 + break;
  118 +
  119 + }
  120 +
  121 +}
  122 +
  123 +
59 124 - (void)createSubviews:(CGRect)frame{
60 125  
61   - CNLiveLoginTextField *account = [[CNLiveLoginTextField alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, rowHeight)];
62   - account.keyboardType = UIKeyboardTypeNumberPad;
63   - account.placeholder = @"请输入手机号";
64   - account.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
65   - account.placeholderColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
66   - account.font = [UIFont systemFontOfSize:16];
67   - account.textAlignment = NSTextAlignmentLeft;
68   - [account addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
69   - account.clearButtonMode = UITextFieldViewModeWhileEditing;
70   - account.delegate = self;
71   - [self addSubview:account];
72   - self.account = account;
  126 + CGFloat width = SCREEN_WIDTH - (SCREEN_WIDTH == 320 ? 30 : 60);
  127 +
  128 + CGFloat btnLeft = (SCREEN_WIDTH == 320 ? 30 : 60)/2.0;
  129 + CGFloat btnTop = 20;
  130 + CGFloat btnWidth = width/3.0;
  131 + CGFloat btnHeight = 80;
  132 +
  133 + QMUIButton *three = [QMUIButton buttonWithType:UIButtonTypeCustom];
  134 + three.frame = CGRectMake(btnLeft, btnTop, btnWidth, btnHeight);
  135 + [three setImage:[self getImageWithImageName:@"login_binding_logo" bundleName:@"CNLiveBLoginModule" targetClass:[self class]] forState:UIControlStateNormal];
  136 + three.imagePosition = QMUIButtonImagePositionTop;
  137 + three.spacingBetweenImageAndTitle = 10;
  138 + [three setTitleColor:[UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0] forState:UIControlStateNormal];
  139 + three.titleLabel.font = [UIFont systemFontOfSize:13];
  140 + three.adjustsImageWhenHighlighted = NO;
  141 + three.userInteractionEnabled = NO;
  142 + [self addSubview:three];
  143 + self.three = three;
73 144  
74   - CNLiveLoginTextField *code = [[CNLiveLoginTextField alloc] initWithFrame:CGRectMake(account.left, account.bottom+space, frame.size.width/2.0, rowHeight)];
75   - code.keyboardType = UIKeyboardTypeNumberPad;
76   - code.placeholder = @"请输入验证码";
77   - code.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
78   - code.placeholderColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
79   - code.font = [UIFont systemFontOfSize:16];
80   - code.textAlignment = NSTextAlignmentLeft;
81   - [code addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
82   - code.clearButtonMode = UITextFieldViewModeWhileEditing;
83   - code.delegate = self;
84   - [self addSubview:code];
85   - self.code = code;
  145 + UIImageView *bindingImage = [[UIImageView alloc]initWithFrame:CGRectMake(three.right, three.top, three.width, three.height)];
  146 + UIImage *image1 = [self getImageWithImageName:@"login_binding_ways" bundleName:@"CNLiveBLoginModule" targetClass:[self class]];
  147 + bindingImage.image = image1;
  148 + bindingImage.contentMode = UIViewContentModeCenter;
  149 + [self addSubview:bindingImage];
  150 + self.bindingImage = bindingImage;
86 151  
87   - CNLiveCountDownButton *countDown = [CNLiveCountDownButton buttonWithType:UIButtonTypeCustom];
88   - countDown.dataSource = self;
89   - countDown.delegate = self;
90   - countDown.frame = CGRectMake(frame.size.width-80, account.bottom+space+10, 80, rowHeight-10);
91   - UIImage *image2 = [self getImageWithImageName:BusinessLive?@"login_get_code_b":@"login_get_code" bundleName:@"CNLiveBLoginModule" targetClass:[self class]];
92   - [countDown setImage:image2 forState:UIControlStateNormal];
93   - countDown.adjustsImageWhenHighlighted = NO;
94   - [countDown setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
95   - countDown.titleLabel.font = [UIFont systemFontOfSize:12.0];
96   - countDown.layer.cornerRadius = 15;
97   - countDown.layer.masksToBounds = YES;
98   - [self addSubview:countDown];
99   - self.countDown = countDown;
  152 + QMUIButton *netadd = [QMUIButton buttonWithType:UIButtonTypeCustom];
  153 + netadd.frame = CGRectMake(bindingImage.right, three.top, three.width, three.height);
  154 + [netadd setImage:[self getImageWithImageName:@"login_binding_logo" bundleName:@"CNLiveBLoginModule" targetClass:[self class]] forState:UIControlStateNormal];
  155 + [netadd setTitle:@"网家家企业版" forState:UIControlStateNormal];
  156 + [netadd setTitleColor:[UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0] forState:UIControlStateNormal];
  157 + netadd.titleLabel.font = [UIFont systemFontOfSize:13];
  158 + netadd.imagePosition = QMUIButtonImagePositionTop;
  159 + netadd.spacingBetweenImageAndTitle = 10;
  160 + netadd.adjustsImageWhenHighlighted = NO;
  161 + netadd.userInteractionEnabled = NO;
  162 + [self addSubview:netadd];
  163 + self.netadd = netadd;
  164 +
  165 + UILabel *desc = [[UILabel alloc] initWithFrame:CGRectMake(0, three.bottom+10, SCREEN_WIDTH, btnHeight/2.0)];
  166 + desc.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  167 + desc.font = [UIFont systemFontOfSize:15];
  168 + desc.textAlignment = NSTextAlignmentCenter;
  169 + [self addSubview:desc];
  170 + self.desc = desc;
  171 +
  172 + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, desc.bottom+10, SCREEN_WIDTH, 0.5)];
  173 + line.backgroundColor = [UIColor colorWithRed:238/255.0 green:238/255.0 blue:238/255.0 alpha:1.0];
  174 + [self addSubview:line];
  175 + self.line = line;
  176 +
  177 + UIView *countryBox = [[UIView alloc]initWithFrame:CGRectMake(2*space, self.line.bottom + 2*space, SCREEN_WIDTH - (4*space), 45)];
  178 + countryBox.layer.cornerRadius = 45/2.0;
  179 + countryBox.layer.masksToBounds = YES;
  180 + countryBox.layer.borderWidth = 0.5;
  181 + countryBox.layer.borderColor = [UIColor colorWithRed:204/255.0 green:204/255.0 blue:204/255.0 alpha:1.0].CGColor;
  182 + [self addSubview:countryBox];
  183 + self.countryBox = countryBox;
100 184  
  185 + UIView *telBox = [[UIView alloc]initWithFrame:CGRectMake(_countryBox.left, _countryBox.bottom + space, _countryBox.width, _countryBox.height)];
  186 + telBox.layer.cornerRadius = 45/2.0;
  187 + telBox.layer.masksToBounds = YES;
  188 + telBox.layer.borderWidth = 0.5;
  189 + telBox.layer.borderColor = [UIColor colorWithRed:204/255.0 green:204/255.0 blue:204/255.0 alpha:1.0].CGColor;
  190 + [self addSubview:telBox];
  191 + self.telBox = telBox;
  192 +
  193 + UIView *codeBox = [[UIView alloc]initWithFrame:CGRectMake(_telBox.left, _telBox.bottom + space, _telBox.width, _telBox.height)];
  194 + codeBox.layer.cornerRadius = 45/2.0;
  195 + codeBox.layer.masksToBounds = YES;
  196 + codeBox.layer.borderWidth = 0.5;
  197 + codeBox.layer.borderColor = [UIColor colorWithRed:204/255.0 green:204/255.0 blue:204/255.0 alpha:1.0].CGColor;
  198 + [self addSubview:codeBox];
  199 + self.codeBox = codeBox;
  200 +
  201 +// CNLiveLoginTextField *account = [[CNLiveLoginTextField alloc] initWithFrame:CGRectMake(0, self.codeBox.height+10, frame.size.width, rowHeight)];
  202 +// account.keyboardType = UIKeyboardTypeNumberPad;
  203 +// account.placeholder = @"请输入手机号";
  204 +// account.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  205 +// account.placeholderColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
  206 +// account.font = [UIFont systemFontOfSize:16];
  207 +// account.textAlignment = NSTextAlignmentLeft;
  208 +// [account addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
  209 +// account.clearButtonMode = UITextFieldViewModeWhileEditing;
  210 +// account.delegate = self;
  211 +// [self addSubview:account];
  212 +// self.account = account;
  213 +//
  214 +// CNLiveLoginTextField *code = [[CNLiveLoginTextField alloc] initWithFrame:CGRectMake(account.left, account.bottom+space, frame.size.width/2.0, rowHeight)];
  215 +// code.keyboardType = UIKeyboardTypeNumberPad;
  216 +// code.placeholder = @"请输入验证码";
  217 +// code.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  218 +// code.placeholderColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
  219 +// code.font = [UIFont systemFontOfSize:16];
  220 +// code.textAlignment = NSTextAlignmentLeft;
  221 +// [code addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
  222 +// code.clearButtonMode = UITextFieldViewModeWhileEditing;
  223 +// code.delegate = self;
  224 +// [self addSubview:code];
  225 +// self.code = code;
  226 +//
  227 +// CNLiveCountDownButton *countDown = [CNLiveCountDownButton buttonWithType:UIButtonTypeCustom];
  228 +// countDown.dataSource = self;
  229 +// countDown.delegate = self;
  230 +// countDown.frame = CGRectMake(frame.size.width-80, account.bottom+space+10, 80, rowHeight-10);
  231 +// UIImage *image2 = [self getImageWithImageName:BusinessLive?@"login_get_code_b":@"login_get_code" bundleName:@"CNLiveBLoginModule" targetClass:[self class]];
  232 +// [countDown setImage:image2 forState:UIControlStateNormal];
  233 +// countDown.adjustsImageWhenHighlighted = NO;
  234 +// [countDown setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  235 +// countDown.titleLabel.font = [UIFont systemFontOfSize:12.0];
  236 +// countDown.layer.cornerRadius = 15;
  237 +// countDown.layer.masksToBounds = YES;
  238 +// [self addSubview:countDown];
  239 +// self.countDown = countDown;
  240 +//
101 241 UIButton *binding = [UIButton buttonWithType:UIButtonTypeCustom];
102   - binding.frame = CGRectMake(5, code.bottom+space, frame.size.width-10, rowHeight);
  242 + binding.frame = CGRectMake(2*space, self.codeBox.bottom+2*space, frame.size.width-4*space, rowHeight);
103 243 [binding setTitle:@"确认手机绑定并同意协议" forState:UIControlStateNormal];
104 244 [binding setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
105 245 binding.titleLabel.font = [UIFont systemFontOfSize:15.0];
... ... @@ -114,9 +254,25 @@ static const NSInteger timeValue = 1.5;
114 254  
115 255 }
116 256  
  257 +#pragma mark - CNLiveLoginCountryViewDelegate
  258 +- (void)chooseViewController:(CNLiveChooseCountryController *)controller countryName:(NSString *)countryName countryCode:(NSString *)countryCode {
  259 + _countryName = countryName;
  260 + _country.text = countryName;
  261 + _countryCode = countryCode;
  262 + [_code setTitle:[NSString stringWithFormat:@"+%@",countryCode] forState:UIControlStateNormal];
  263 +}
  264 +#pragma mark - Action
  265 +- (void)countryCodeDidClicked:(UIButton *)btn{
  266 + CNLiveChooseCountryController *vc = [[CNLiveChooseCountryController alloc]init];
  267 + vc.delegate = self;
  268 + vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
  269 + vc.hidesBottomBarWhenPushed = YES;
  270 + [CNLivePageJumpManager presentViewController:vc];
  271 +}
  272 +
117 273 #pragma mark - UITextFieldDelegate
118 274 - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
119   - if ([textField isEqual:_account] || [textField isEqual:_code]) {
  275 + if ([textField isEqual:_telTF] || [textField isEqual:_codeTF]) {
120 276 return YES;
121 277 }
122 278 else {
... ... @@ -126,7 +282,7 @@ static const NSInteger timeValue = 1.5;
126 282 }
127 283  
128 284 - (void)textFieldDidChange:(UITextField *)textField {
129   - if (![_account.text isEqualToString:@""] && ![_code.text isEqualToString:@""]) {
  285 + if (![_telTF.text isEqualToString:@""] && ![_codeTF.text isEqualToString:@""]) {
130 286 _binding.enabled = YES;
131 287  
132 288 }
... ... @@ -138,7 +294,7 @@ static const NSInteger timeValue = 1.5;
138 294 }
139 295  
140 296 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
141   - if ([textField isEqual:_account]) {
  297 + if ([textField isEqual:_telTF]) {
142 298 NSInteger maxTextLength = 20;
143 299 if(string.length == 0) {
144 300 //判断是不是删除键
... ... @@ -205,7 +361,80 @@ static const NSInteger timeValue = 1.5;
205 361 // Drawing code
206 362 }
207 363 */
  364 +#pragma mark - 懒加载
  365 +- (UILabel *)country{
  366 + if (!_country) {
  367 + _country = [[UILabel alloc] initWithFrame:CGRectMake(3.5*space, _countryBox.top, SCREEN_WIDTH - (4*space)-70, _countryBox.height)];
  368 + _country.font = [UIFont systemFontOfSize:16.0];
  369 + _country.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  370 + _country.text = _countryName;
  371 + _country.userInteractionEnabled = YES;
  372 + }
  373 + return _country;
  374 +}
208 375  
  376 +- (UIButton *)code{
  377 + if (!_code) {
  378 + _code = [UIButton buttonWithType:UIButtonTypeCustom];
  379 + _code.frame = CGRectMake(SCREEN_WIDTH-3.5*space-70, _countryBox.top, 70, _countryBox.height);
  380 + [_code setTitle:[NSString stringWithFormat:@"+%@",_countryCode] forState:UIControlStateNormal];
  381 + [_code setTitleColor:[UIColor colorWithRed:49/255.0 green:49/255.0 blue:49/255.0 alpha:1.0] forState:UIControlStateNormal];
  382 + _code.titleLabel.font = [UIFont systemFontOfSize:16.0];
  383 + [_code setImage:[self getImageWithImageName:@"login_down" bundleName:@"CNLiveBLoginModule" targetClass:[self class]] forState:UIControlStateNormal];
  384 + _code.adjustsImageWhenHighlighted = NO;
  385 + //button图片的偏移量,距上左下右分别(0, 0, 0, 0)像素点
  386 + _code.imageEdgeInsets = UIEdgeInsetsMake(0, 60, 0, 0);
  387 + //button标题的偏移量,这个偏移量是相对于图片的
  388 + _code.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 10);
  389 + [_code addTarget:self action:@selector(countryCodeDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  390 + }
  391 + return _code;
  392 +
  393 +}
  394 +- (CNLiveLoginTextField *)telTF {
  395 + if (!_telTF) {
  396 + _telTF = [[CNLiveLoginTextField alloc] initWithFrame:CGRectMake(3.5*space, _countryBox.bottom + space, SCREEN_WIDTH - (7*space), _countryBox.height)];
  397 + _telTF.placeholderColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
  398 + _telTF.textColor = [UIColor blackColor];
  399 + _telTF.keyboardType = UIKeyboardTypeNumberPad;
  400 + _telTF.placeholder = @"请输入手机号";
  401 + _telTF.font = UIFontMake(14);
  402 + _telTF.clearButtonMode = UITextFieldViewModeAlways;
  403 + _telTF.textAlignment = NSTextAlignmentLeft;
  404 + _telTF.delegate = self;
  405 + }
  406 + return _telTF;
  407 +}
  408 +
  409 +- (CNLiveLoginTextField *)codeTF {
  410 + if (!_codeTF) {
  411 + _codeTF = [[CNLiveLoginTextField alloc] initWithFrame:CGRectMake(_telTF.left, _telTF.bottom + space, _telTF.width, _telTF.height)];
  412 + _codeTF.keyboardType = UIKeyboardTypeNumberPad;
  413 + _codeTF.placeholder = @"请输入验证码";
  414 + _codeTF.textColor = [UIColor blackColor];
  415 + _codeTF.placeholderColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
  416 + _codeTF.font = UIFontMake(14);
  417 + _codeTF.textAlignment = NSTextAlignmentLeft;
  418 + _codeTF.delegate = self;
  419 + }
  420 + return _codeTF;
  421 +}
  422 +
  423 +- (CNLiveCountDownButton *)codeBtn {
  424 + if (!_codeBtn) {
  425 + _codeBtn = [CNLiveCountDownButton buttonWithType:UIButtonTypeCustom];
  426 + _codeBtn.frame = CGRectMake(SCREEN_WIDTH-3.5*space-80, _codeTF.top+space/2.0, 80, _telTF.height-space);
  427 + _codeBtn.adjustsImageWhenHighlighted = NO;
  428 + [_codeBtn setTitleColor:[UIColor colorWithRed:72/255.0 green:168/255.0 blue:249/255.0 alpha:1.0] forState:UIControlStateNormal];
  429 + _codeBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
  430 + [_codeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
  431 + [_codeBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
  432 + _codeBtn.backgroundColor = [UIColor whiteColor];
  433 + _codeBtn.delegate = self;
  434 + _codeBtn.dataSource = self;
  435 + }
  436 + return _codeBtn;
  437 +}
209 438 #pragma mark - CNLiveCountdownButton DataSource
210 439 // 设置倒计时总秒数
211 440 - (NSInteger)startCountDownNumOfCountDownButton:(CNLiveCountDownButton *)countdownButton {
... ... @@ -216,7 +445,7 @@ static const NSInteger timeValue = 1.5;
216 445 // 倒计时按钮点击
217 446 - (void)countDownButtonDidClick:(CNLiveCountDownButton *)button {
218 447 //获取验证码
219   - if ([_account.text isEqualToString:@""]) {
  448 + if ([_telTF.text isEqualToString:@""]) {
220 449 [QMUITips showWithText:@"请输入手机号"];
221 450 return;
222 451 }
... ... @@ -224,17 +453,16 @@ static const NSInteger timeValue = 1.5;
224 453 [QMUITips showError:@"无法连接网络" inView:XWKeyWindow hideAfterDelay:timeValue];
225 454 return ;
226 455 }
227   - _code.text = @"";
  456 + _codeTF.text = @"";
228 457 [_code becomeFirstResponder];
229 458  
230 459 button.userInteractionEnabled = NO;
231 460 [QMUITips showLoadingInView:XWKeyWindow];
232 461  
233   - [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeShortcutLogin mobile:_account.text countryCode:@"86" success:^(id result) {
  462 + [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeShortcutLogin mobile:_telTF.text countryCode:@"86" success:^(id result) {
234 463 [QMUITips hideAllToastInView:XWKeyWindow animated:YES];
235 464 [QMUITips showWithText:@"验证码已发送"];
236   -// button.backgroundColor = HexColor(0xdedede);
237   - button.frame = CGRectMake(self.frame.size.width-110, self.account.bottom+space+10, 110, rowHeight-10);
  465 + button.frame = CGRectMake(self.frame.size.width-110-2*space, self.telTF.bottom+space+10, 110, rowHeight-10);
238 466 [button setImage:nil forState:UIControlStateNormal];
239 467 NSString *title = [NSString stringWithFormat:@"%d秒后重新发送", 60];
240 468 [button setTitle:title forState:UIControlStateNormal];
... ... @@ -258,7 +486,7 @@ static const NSInteger timeValue = 1.5;
258 486 // 倒计时进行中
259 487 - (void)countDownButtonDidCountDown:(CNLiveCountDownButton *)button countDownNum:(NSInteger)countDownNum {
260 488 if(button.frame.size.width != 110){
261   - button.frame = CGRectMake(self.frame.size.width-110, self.account.bottom+space+10, 110, rowHeight-10);
  489 + button.frame = CGRectMake(self.frame.size.width-110, self.telTF.bottom+space+10, 110, rowHeight-10);
262 490 }
263 491 NSString *title = [NSString stringWithFormat:@"%ld秒后重新发送", countDownNum];
264 492 [button setTitle:title forState:UIControlStateNormal];
... ... @@ -267,7 +495,7 @@ static const NSInteger timeValue = 1.5;
267 495  
268 496 // 倒计时结束
269 497 - (void)countDownButtonDidEndCountDown:(CNLiveCountDownButton *)button {
270   - button.frame = CGRectMake(self.frame.size.width-80, self.account.bottom+space+10, 80, rowHeight-10);
  498 + button.frame = CGRectMake(self.frame.size.width-80, self.telTF.bottom+space+10, 80, rowHeight-10);
271 499 button.backgroundColor = [UIColor whiteColor];
272 500 button.userInteractionEnabled = YES;
273 501 [button setTitle:@"" forState:UIControlStateNormal];
... ... @@ -277,11 +505,11 @@ static const NSInteger timeValue = 1.5;
277 505  
278 506 #pragma mark - Action
279 507 - (void)bindingDidClicked:(UIButton *)btn{
280   - if ([self.account.text isEqualToString:@""]) {
  508 + if ([self.telTF.text isEqualToString:@""]) {
281 509 [QMUITips showWithText:@"请输入手机号" inView:XWKeyWindow hideAfterDelay:1.5];
282 510 return;
283 511 }
284   - if ([self.code.text isEqualToString:@""]) {
  512 + if ([self.codeTF.text isEqualToString:@""]) {
285 513 [QMUITips showWithText:@"请输入验证码" inView:XWKeyWindow hideAfterDelay:1.5];
286 514 return;
287 515 }
... ... @@ -299,9 +527,9 @@ static const NSInteger timeValue = 1.5;
299 527 // 绑定手机号请求登录
300 528 - (void)thirdPartyLoginBindingTel{
301 529 NSDictionary *params = @{
302   - @"mobile":self.account.text,
303   - @"countryCode":self.model.countryCode?self.model.countryCode:@"",
304   - @"verificationCode":self.code.text,
  530 + @"mobile":self.telTF.text,
  531 + @"countryCode":_countryCode,
  532 + @"verificationCode":self.codeTF.text,
305 533 @"thirdPartyPlat":self.model.thirdPartyPlat?self.model.thirdPartyPlat:@"",
306 534 @"thirdPartyId":self.model.thirdPartyId?self.model.thirdPartyId:@"",
307 535 @"frmId":self.model.frmId?self.model.frmId:@"apple",
... ...
CNLiveBLoginModule/Classes/View/CNLiveLoginView.h
... ... @@ -16,6 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
16 16 @end
17 17 @interface CNLiveLoginView : UIView
18 18 @property (nonatomic, weak) id<CNLiveLoginViewDelegate> delegate;
  19 +@property (nonatomic, copy) NSString *countryCode;
  20 +@property (nonatomic, copy) NSString *countryName;
  21 +@property (nonatomic, copy) NSString *verificationCode;
19 22  
20 23 @end
21 24  
... ...
CNLiveBLoginModule/Classes/View/CNLiveLoginView.m
... ... @@ -27,10 +27,10 @@
27 27 //#import "XWLoginNotification.h"
28 28  
29 29 @interface CNLiveLoginView()<UITextFieldDelegate, CNLiveLoginCountryViewDelegate,CNLiveCountDownButtonDataSource, CNLiveCountDownButtonDelegate>
30   -{
31   - NSString *_countryCode; // 国家Code
32   - NSString *_verificationCode; // 验证码
33   -}
  30 +//{
  31 +// NSString *_countryCode; // 国家Code
  32 +// NSString *_verificationCode; // 验证码
  33 +//}
34 34 @property (nonatomic, weak) UIImageView *logo;
35 35 @property (nonatomic, weak) CNLiveLoginCountryView *country;
36 36 @property (nonatomic, weak) CNLiveLoginTextField *account;
... ... @@ -54,6 +54,7 @@ static const NSInteger timeValue = 1.5;
54 54 self = [super initWithFrame:frame];
55 55 if (self) {
56 56 self.userInteractionEnabled = YES;
  57 + _countryName = @"中国大陆";
57 58 _countryCode = @"86";
58 59 [self createSubviews:frame];
59 60  
... ... @@ -227,6 +228,7 @@ static const NSInteger timeValue = 1.5;
227 228  
228 229 #pragma mark - CNLiveLoginCountryViewDelegate
229 230 - (void)chooseCountryName:(NSString *)countryName countryCode:(NSString *)countryCode{
  231 + _countryName = countryName;
230 232 [_account resignFirstResponder];
231 233 [_code resignFirstResponder];
232 234 if(![_countryCode isEqualToString:countryCode]){
... ...
Example/CNLiveBLoginModule/CNLIVEAppDelegate.m
... ... @@ -12,6 +12,8 @@
12 12 #import "CNLiveEnvironment.h"
13 13 #import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h>
14 14 #import <CNLiveRequestBastKit/CNLiveNetworking.h>
  15 +#import "CNLiveBindingTelController.h"
  16 +
15 17 @implementation CNLIVEAppDelegate
16 18  
17 19 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
... ... @@ -26,8 +28,8 @@
26 28 }
27 29 [self networkParamAction];
28 30  
29   - CNLiveLoginController *vc = [[CNLiveLoginController alloc] init];
30   - vc.isShowClose = NO;
  31 + CNLiveBindingTelController *vc = [[CNLiveBindingTelController alloc] init];
  32 +// vc.isShowClose = NO;
31 33 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
32 34 self.window.rootViewController = nav;
33 35 [self.window makeKeyAndVisible];
... ...