Commit de5fbd04ffdc7062a531b8f24a710bc9436ef25f

Authored by zhangxiaowen
1 parent 053874a4

no message

CNLiveSettingModule/Classes/AboutUs/CNLiveAboutUsController.m
... ... @@ -12,6 +12,7 @@
12 12  
13 13 #import "CNLiveServices.h"
14 14 #import "CNLiveUserAgreementManager.h"
  15 +#import "CNLiveEnvironment.h"
15 16  
16 17 #import "CNLiveSettingModel.h"
17 18 #import "CNLiveSettingCell.h"
... ... @@ -228,7 +229,7 @@ static const NSInteger timeValue = 1.5;
228 229 _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
229 230 _navigationBar.backgroundColor = [UIColor whiteColor];
230 231 _navigationBar.delegate = self;
231   - _navigationBar.title.text = @"关于网家家";
  232 + _navigationBar.title.text = [NSString stringWithFormat:@"关于%@",DisplayName];
232 233 _navigationBar.right = nil;
233 234 }
234 235 return _navigationBar;
... ...
CNLiveSettingModule/Classes/UpdateTel/CNLiveUpdateTelController.m
... ... @@ -26,9 +26,8 @@
26 26 }
27 27  
28 28 @property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar;
29   -@property (nonatomic, strong) CNLiveUpdateTelView *updateTelView;//背景
30   -@property (nonatomic, strong) UIButton *binding;//改变按钮
31   -@property (nonatomic, strong) YYLabel *connectionLab;
  29 +@property (nonatomic, strong) CNLiveUpdateTelView *updateTel;//背景
  30 +@property (nonatomic, strong) YYLabel *connection;
32 31  
33 32 @end
34 33  
... ... @@ -83,24 +82,17 @@
83 82 #pragma mark - UI
84 83 - (void)createSubViews{
85 84 [self.view addSubview:self.navigationBar];
86   - [self.view addSubview:self.updateTelView];
87   - [self.view addSubview:self.binding];
88   - [self.view addSubview:self.connectionLab];
  85 + [self.view addSubview:self.updateTel];
  86 + [self.view addSubview:self.connection];
89 87 }
90 88  
91 89 - (void)xw_layoutSubviews{
92   - [self.updateTelView mas_makeConstraints:^(MASConstraintMaker *make) {
  90 + [self.updateTel mas_makeConstraints:^(MASConstraintMaker *make) {
93 91 make.left.right.equalTo(self.view);
94 92 make.top.equalTo(self.view).offset(NavigationContentTop+1);
95   - make.height.mas_equalTo(150+10);
  93 + make.height.mas_equalTo(220);
96 94 }];
97   - [self.binding mas_makeConstraints:^(MASConstraintMaker *make) {
98   - make.top.equalTo(self.updateTelView.mas_bottom).offset(16);
99   - make.left.equalTo(self.view).offset(60);
100   - make.right.equalTo(self.view).offset(-60);
101   - make.height.mas_equalTo(45);
102   - }];
103   - [self.connectionLab mas_makeConstraints:^(MASConstraintMaker *make) {
  95 + [self.connection mas_makeConstraints:^(MASConstraintMaker *make) {
104 96 make.left.right.equalTo(self.view);
105 97 make.bottom.equalTo(self.view.mas_bottom).offset(-30);
106 98 }];
... ... @@ -112,64 +104,6 @@
112 104 // Dispose of any resources that can be recreated.
113 105 }
114 106  
115   -#pragma mark - Action
116   -- (void)bindingDidClicked:(UIButton *)sender {
117   - if (self.updateTelView.gotVerificationCode) {
118   - if (self.updateTelView.codeTF.text.length == 6) {
119   - [QMUITips showLoadingInView:self.view];
120   - [CNLiveUserSystemCenter updateMobileWithUid:CNUserShareModel.uid mobile:self.updateTelView.phoneNum countryCode:_code verificationCode:self.updateTelView.codeTF.text success:^(id result) {
121   - CNUserShareModel.mobile = self.updateTelView.phoneNum;
122   - [CNUserInfoModel setLocalUserInfo:self.updateTelView.countryName.text withKey:@"countryname"];
123   - [CNUserInfoModel setLocalUserInfo:self.updateTelView.countryCode.text withKey:@"countrycode"];
124   - [QMUITips hideAllToastInView:self.view animated:YES];
125   - [self.navigationController popViewControllerAnimated:YES];
126   -
127   - } failure:^(NSDictionary *errorDic) {
128   - [QMUITips hideAllToastInView:self.view animated:YES];
129   - [QMUITips showError:errorDic[@"errorMessage"] inView:self.view hideAfterDelay:1.5];
130   -
131   - }];
132   -
133   - } else {
134   - QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
135   - }];
136   - QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"请输入正确的验证码" message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
137   - [alertController addAction:sure];
138   -
139   - NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
140   - titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
141   - sure.buttonAttributes = titleAttributs;
142   -
143   - [alertController showWithAnimated:YES];
144   - }
145   -
146   - } else {
147   - NSString *alertText = @"请先获取验证码";
148   - if (self.updateTelView.numberTF.text.length != 11) {
149   - alertText = @"请先输入正确的手机号码";
150   - } else {
151   - alertText = @"请先获取验证码";
152   - }
153   -
154   - QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
155   - }];
156   - QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:alertText message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
157   - [alertController addAction:sure];
158   -
159   - NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
160   - titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
161   - sure.buttonAttributes = titleAttributs;
162   -
163   - [alertController showWithAnimated:YES];
164   -
165   - }
166   -
167   -}
168   -
169   -- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
170   - [self.updateTelView.numberTF resignFirstResponder];
171   -}
172   -
173 107 #pragma mark - SelectCountriesDelegate
174 108 //- (void)selectViewController:(CNSelectCountriesViewController *)viewController countryName:(NSString *)name countryCode:(NSString *)code{
175 109 // _countryName.text = name;
... ... @@ -186,6 +120,14 @@
186 120 // [self presentViewController:vc animated:YES completion:nil];
187 121 }
188 122  
  123 +- (void)bindingSuccess:(CNLiveUpdateTelView *)view{
  124 + [self.navigationController popViewControllerAnimated:YES];
  125 +}
  126 +
  127 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  128 + [self.updateTel.numberTF resignFirstResponder];
  129 +}
  130 +
189 131 #pragma mark - Lazy Loading
190 132 - (CNLiveSettingNavigationBar *)navigationBar {
191 133 if (!_navigationBar) {
... ... @@ -198,35 +140,20 @@
198 140 return _navigationBar;
199 141 }
200 142  
201   -- (CNLiveUpdateTelView *)updateTelView{
202   - if (!_updateTelView) {
203   - _updateTelView = [[CNLiveUpdateTelView alloc] init];
204   - _updateTelView.backgroundColor = [UIColor whiteColor];
205   - _updateTelView.delegate = self;
206   - _updateTelView.code = _code;
207   - }
208   - return _updateTelView;
209   -}
210   -
211   -- (UIButton *)binding{
212   - if (!_binding) {
213   - _binding = [UIButton buttonWithType:UIButtonTypeCustom];
214   - [_binding setTitle:@"验证后绑定新手机号" forState:UIControlStateNormal];
215   - [_binding setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
216   - _binding.titleLabel.font = [UIFont systemFontOfSize:15];
217   - _binding.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
218   - _binding.layer.cornerRadius = 45/2.0;
219   - _binding.layer.masksToBounds = YES;
220   - [_binding addTarget:self action:@selector(bindingDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  143 +- (CNLiveUpdateTelView *)updateTel{
  144 + if (!_updateTel) {
  145 + _updateTel = [[CNLiveUpdateTelView alloc] init];
  146 + _updateTel.delegate = self;
  147 + _updateTel.code = _code;
221 148 }
222   - return _binding;
  149 + return _updateTel;
223 150 }
224 151  
225   -- (YYLabel *)connectionLab {
226   - if (!_connectionLab) {
227   - _connectionLab = [[YYLabel alloc] init];
228   - [_connectionLab setFont:UIFontMake(12)];
229   - _connectionLab.numberOfLines = 0;
  152 +- (YYLabel *)connection {
  153 + if (!_connection) {
  154 + _connection = [[YYLabel alloc] init];
  155 + [_connection setFont:UIFontMake(12)];
  156 + _connection.numberOfLines = 0;
230 157 NSString *str = @"若当前号码已不用或丢失,请点击联系客服";
231 158 NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:str];
232 159 text.color = [UIColor colorWithRed:34/255.0 green:34/255.0 blue:34/255.0 alpha:1.0];
... ... @@ -262,11 +189,11 @@
262 189 [alertController showWithAnimated:YES];
263 190  
264 191 } ];
265   - _connectionLab.attributedText = text;
266   - _connectionLab.textAlignment = NSTextAlignmentCenter;
  192 + _connection.attributedText = text;
  193 + _connection.textAlignment = NSTextAlignmentCenter;
267 194  
268 195 }
269   - return _connectionLab;
  196 + return _connection;
270 197 }
271 198  
272 199 /*
... ...
CNLiveSettingModule/Classes/UpdateTel/CNLiveUpdateTelView.h
... ... @@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
12 12 @class CNLiveUpdateTelView;
13 13 @protocol CNLiveUpdateTelViewDelegate <NSObject>
14 14 - (void)selectCountry:(CNLiveUpdateTelView *)view;
  15 +- (void)bindingSuccess:(CNLiveUpdateTelView *)view;
15 16  
16 17 @end
17 18 @interface CNLiveUpdateTelView : UIView
... ... @@ -19,12 +20,13 @@ NS_ASSUME_NONNULL_BEGIN
19 20  
20 21 @property (nonatomic, strong) UILabel *countryName;
21 22 @property (nonatomic, strong) UILabel *countryCode;
  23 +
22 24 @property (nonatomic, strong) UITextField *numberTF;
23 25 @property (nonatomic, strong) UITextField *codeTF;
24 26  
25 27 @property (nonatomic, assign) BOOL gotVerificationCode;
26 28 @property (nonatomic, assign) BOOL gotVerificationCodeIng;
27   -@property (nonatomic, copy) NSString *phoneNum;
  29 +@property (nonatomic, copy, nullable) NSString *phoneNum;
28 30 @property (nonatomic, copy) NSString *code;
29 31  
30 32 @end
... ...
CNLiveSettingModule/Classes/UpdateTel/CNLiveUpdateTelView.m
... ... @@ -19,11 +19,14 @@
19 19  
20 20 @interface CNLiveUpdateTelView()<UITextFieldDelegate>
21 21  
22   -@property (nonatomic, strong) UILabel *interval;
  22 +@property (nonatomic, strong) UIView *lineView;
23 23 @property (nonatomic, strong) UIImageView *countryImg;
24 24 @property (nonatomic, strong) UILabel *numberLabel;//手机号
25 25 @property (nonatomic, strong) UILabel *codeLabel;//验证码
26   -@property (nonatomic, strong) UIButton *verificationCodeBtn;//验证码按钮
  26 +@property (nonatomic, strong) UIButton *verification;//验证码按钮
  27 +
  28 +@property (nonatomic, strong) UIView *bindingView;//改变按钮
  29 +@property (nonatomic, strong) UIButton *binding;//改变按钮
27 30  
28 31 @end
29 32  
... ... @@ -38,14 +41,16 @@ static const NSInteger margin = 15;
38 41 }
39 42 return self;
40 43 }
41   -- (void)dealloc{
42   -
  44 +
  45 +#pragma mark - Data
  46 +- (void)setCode:(NSString *)code{
  47 + _code = code;
43 48 }
44 49  
45 50 #pragma mark - UI
46 51 - (void)setup {
47 52 [self addSubview:self.countryName];
48   - [self addSubview:self.interval];
  53 + [self addSubview:self.lineView];
49 54 [self addSubview:self.countryImg];
50 55 [self addSubview:self.countryCode];
51 56  
... ... @@ -55,7 +60,10 @@ static const NSInteger margin = 15;
55 60 [self addSubview:self.codeLabel];
56 61 [self addSubview:self.codeTF];
57 62  
58   - [self addSubview:self.verificationCodeBtn];
  63 + [self addSubview:self.verification];
  64 +
  65 + [self addSubview:self.bindingView];
  66 + [self addSubview:self.binding];
59 67  
60 68 }
61 69 - (void)layoutSubviews{
... ... @@ -66,7 +74,7 @@ static const NSInteger margin = 15;
66 74 make.left.equalTo(self).offset(margin);
67 75 make.height.mas_equalTo(50);
68 76 }];
69   - [self.interval mas_makeConstraints:^(MASConstraintMaker *make) {
  77 + [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
70 78 make.top.equalTo(self.countryName.mas_bottom).offset(0);
71 79 make.left.right.equalTo(self).offset(0);
72 80 make.height.mas_equalTo(10);
... ... @@ -83,12 +91,12 @@ static const NSInteger margin = 15;
83 91 make.height.mas_equalTo(50);
84 92 }];
85 93 [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
86   - make.top.equalTo(self.interval.mas_bottom).offset(0);
  94 + make.top.equalTo(self.lineView.mas_bottom).offset(0);
87 95 make.left.equalTo(self).offset(margin);
88 96 make.height.mas_equalTo(50);
89 97 make.width.mas_equalTo(45);
90 98 }];
91   - [self.verificationCodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  99 + [self.verification mas_makeConstraints:^(MASConstraintMaker *make) {
92 100 make.centerY.equalTo(self.numberLabel);
93 101 make.right.equalTo(self).offset(-margin);
94 102 make.width.mas_equalTo(100);
... ... @@ -97,7 +105,7 @@ static const NSInteger margin = 15;
97 105 [self.numberTF mas_makeConstraints:^(MASConstraintMaker *make) {
98 106 make.centerY.equalTo(self.numberLabel);
99 107 make.left.equalTo(self.numberLabel.mas_right).offset(20);
100   - make.right.equalTo(self.verificationCodeBtn.mas_left).offset(-10);
  108 + make.right.equalTo(self.verification.mas_left).offset(-10);
101 109 }];
102 110 [self.codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
103 111 make.top.equalTo(self.numberLabel.mas_bottom).offset(0);
... ... @@ -111,6 +119,20 @@ static const NSInteger margin = 15;
111 119 make.left.equalTo(self.codeLabel.mas_right).offset(20);
112 120 make.width.equalTo(self.numberTF);
113 121 }];
  122 +
  123 + [self.bindingView mas_makeConstraints:^(MASConstraintMaker *make) {
  124 + make.top.equalTo(self.codeTF.mas_bottom).offset(15);
  125 + make.left.equalTo(self).offset(0);
  126 + make.right.equalTo(self).offset(-0);
  127 + make.bottom.equalTo(self.mas_bottom).offset(-0);
  128 + }];
  129 +
  130 + [self.binding mas_makeConstraints:^(MASConstraintMaker *make) {
  131 + make.top.equalTo(self.codeTF.mas_bottom).offset(30);
  132 + make.left.equalTo(self).offset(60);
  133 + make.right.equalTo(self).offset(-60);
  134 + make.height.mas_equalTo(45);
  135 + }];
114 136 }
115 137  
116 138 /*
... ... @@ -167,12 +189,12 @@ static const NSInteger margin = 15;
167 189 return _countryName;
168 190 }
169 191  
170   -- (UILabel *)interval {
171   - if (!_interval) {
172   - _interval = [[UILabel alloc] init];
173   - _interval.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  192 +- (UIView *)lineView {
  193 + if (!_lineView) {
  194 + _lineView = [[UIView alloc] init];
  195 + _lineView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
174 196 }
175   - return _interval;
  197 + return _lineView;
176 198 }
177 199 - (UIImageView *)countryImg{
178 200 if (!_countryImg) {
... ... @@ -200,12 +222,6 @@ static const NSInteger margin = 15;
200 222 return _countryCode;
201 223 }
202 224  
203   -- (void)countryTap:(UITapGestureRecognizer *)tap{
204   - if (self.delegate && [self.delegate respondsToSelector:@selector(selectCountry:)]) {
205   - [self.delegate selectCountry:self];
206   - }
207   -}
208   -
209 225 - (UILabel *)numberLabel {
210 226 if (!_numberLabel) {
211 227 _numberLabel = [[UILabel alloc] init];
... ... @@ -256,19 +272,43 @@ static const NSInteger margin = 15;
256 272 return _codeTF;
257 273 }
258 274  
259   -- (UIButton *)verificationCodeBtn{
260   - if (!_verificationCodeBtn) {
261   - _verificationCodeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
262   - [_verificationCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
263   - [_verificationCodeBtn setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
264   - _verificationCodeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
265   - _verificationCodeBtn.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
266   - _verificationCodeBtn.layer.cornerRadius = 15;
267   - _verificationCodeBtn.layer.masksToBounds = YES;
268   - [_verificationCodeBtn addTarget:self action:@selector(verificationCodeBtnAction:) forControlEvents:UIControlEventTouchUpInside];
  275 +- (UIButton *)verification{
  276 + if (!_verification) {
  277 + _verification = [UIButton buttonWithType:UIButtonTypeCustom];
  278 + [_verification setTitle:@"获取验证码" forState:UIControlStateNormal];
  279 + [_verification setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
  280 + _verification.titleLabel.font = [UIFont systemFontOfSize:14];
  281 + _verification.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  282 + _verification.layer.cornerRadius = 15;
  283 + _verification.layer.masksToBounds = YES;
  284 + [_verification addTarget:self action:@selector(verificationCodeBtnAction:) forControlEvents:UIControlEventTouchUpInside];
  285 + }
  286 + return _verification;
  287 +}
  288 +
  289 +- (UIView *)bindingView{
  290 + if (!_bindingView) {
  291 + _bindingView = [[UIView alloc]init];
  292 + _bindingView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  293 + }
  294 + return _bindingView;
  295 +}
  296 +
  297 +- (UIButton *)binding{
  298 + if (!_binding) {
  299 + _binding = [UIButton buttonWithType:UIButtonTypeCustom];
  300 + [_binding setTitle:@"验证后绑定新手机号" forState:UIControlStateNormal];
  301 + [_binding setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  302 + _binding.titleLabel.font = [UIFont systemFontOfSize:15];
  303 + _binding.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
  304 + _binding.layer.cornerRadius = 45/2.0;
  305 + _binding.layer.masksToBounds = YES;
  306 + [_binding addTarget:self action:@selector(bindingDidClicked:) forControlEvents:UIControlEventTouchUpInside];
269 307 }
270   - return _verificationCodeBtn;
  308 + return _binding;
271 309 }
  310 +
  311 +#pragma mark - 私有方法
272 312 /**
273 313 * 创建图片
274 314 *
... ... @@ -285,10 +325,14 @@ static const NSInteger margin = 15;
285 325 return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
286 326  
287 327 }
288   -- (void)setCode:(NSString *)code{
289   - _code = code;
290   -}
  328 +
291 329 #pragma mark - Action
  330 +- (void)countryTap:(UITapGestureRecognizer *)tap{
  331 + if (self.delegate && [self.delegate respondsToSelector:@selector(selectCountry:)]) {
  332 + [self.delegate selectCountry:self];
  333 + }
  334 +}
  335 +
292 336 - (void)verificationCodeBtnAction:(UIButton *)sender {
293 337 if ([NSString isEmpty:self.numberTF.text] || [self.numberTF.text isWhitespaceAndNewlines]) {
294 338 QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
... ... @@ -308,9 +352,9 @@ static const NSInteger margin = 15;
308 352 else {
309 353 // 发送验证码
310 354 self.phoneNum = self.numberTF.text;
311   - self.verificationCodeBtn.userInteractionEnabled = NO;
312   - self.verificationCodeBtn.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
313   - [self.verificationCodeBtn setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
  355 + self.verification.userInteractionEnabled = NO;
  356 + self.verification.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  357 + [self.verification setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
314 358 self.gotVerificationCodeIng = YES;
315 359  
316 360 [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeRegister mobile:self.numberTF.text countryCode:_code success:^(id result) {
... ... @@ -330,9 +374,9 @@ static const NSInteger margin = 15;
330 374 [QMUITips showWithText:errMsg inView:self hideAfterDelay:1.5];
331 375 self.phoneNum = nil;
332 376 self.gotVerificationCode = NO;
333   - self.verificationCodeBtn.userInteractionEnabled = YES;
334   - self.verificationCodeBtn.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
335   - [self.verificationCodeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  377 + self.verification.userInteractionEnabled = YES;
  378 + self.verification.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
  379 + [self.verification setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
336 380 self.gotVerificationCodeIng = NO;
337 381  
338 382 }];
... ... @@ -340,9 +384,67 @@ static const NSInteger margin = 15;
340 384  
341 385 }
342 386  
  387 +- (void)bindingDidClicked:(UIButton *)sender {
  388 + if (self.gotVerificationCode) {
  389 + if (self.codeTF.text.length == 6) {
  390 + [QMUITips showLoadingInView:self];
  391 + [CNLiveUserSystemCenter updateMobileWithUid:CNUserShareModel.uid mobile:self.phoneNum countryCode:_code verificationCode:self.codeTF.text success:^(id result) {
  392 + CNUserShareModel.mobile = self.phoneNum;
  393 + [CNUserInfoModel setLocalUserInfo:self.countryName.text withKey:@"countryname"];
  394 + [CNUserInfoModel setLocalUserInfo:self.countryCode.text withKey:@"countrycode"];
  395 + [QMUITips hideAllToastInView:self animated:YES];
  396 + if (self.delegate && [self.delegate respondsToSelector:@selector(bindingSuccess:)]) {
  397 + [self.delegate bindingSuccess:self];
  398 + }
  399 +
  400 + } failure:^(NSDictionary *errorDic) {
  401 + [QMUITips hideAllToastInView:self animated:YES];
  402 + [QMUITips showError:errorDic[@"errorMessage"] inView:self hideAfterDelay:1.5];
  403 +
  404 + }];
  405 +
  406 + } else {
  407 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  408 + }];
  409 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"请输入正确的验证码" message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  410 + [alertController addAction:sure];
  411 +
  412 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  413 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  414 + sure.buttonAttributes = titleAttributs;
  415 +
  416 + [alertController showWithAnimated:YES];
  417 + }
  418 +
  419 + } else {
  420 + NSString *alertText = @"请先获取验证码";
  421 + if (self.numberTF.text.length != 11) {
  422 + alertText = @"请先输入正确的手机号码";
  423 + } else {
  424 + alertText = @"请先获取验证码";
  425 + }
  426 +
  427 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  428 + }];
  429 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:alertText message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  430 + [alertController addAction:sure];
  431 +
  432 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  433 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  434 + sure.buttonAttributes = titleAttributs;
  435 +
  436 + [alertController showWithAnimated:YES];
  437 +
  438 + }
  439 +
  440 +}
  441 +
  442 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  443 + [self.numberTF resignFirstResponder];
  444 +}
  445 +
343 446 #pragma mark - 倒计时
344 447 - (void)countDown {
345   -
346 448 __block NSInteger second = TIMECOUNT;
347 449 //(1)
348 450 dispatch_queue_t quene = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
... ... @@ -354,13 +456,13 @@ static const NSInteger margin = 15;
354 456 dispatch_source_set_event_handler(timer, ^{
355 457 dispatch_async(dispatch_get_main_queue(), ^{
356 458 if (second == 0) {
357   - [self setupTextFieldUI:_numberTF];
  459 + [self setupTextFieldUI:self.numberTF];
358 460 self.gotVerificationCodeIng = NO;
359   - [self.verificationCodeBtn setTitle:[NSString stringWithFormat:@"获取验证码"] forState:UIControlStateNormal];
  461 + [self.verification setTitle:[NSString stringWithFormat:@"获取验证码"] forState:UIControlStateNormal];
360 462 second = TIMECOUNT;
361 463 dispatch_cancel(timer);
362 464 } else {
363   - [self.verificationCodeBtn setTitle:[NSString stringWithFormat:@"%lds",second] forState:UIControlStateNormal];
  465 + [self.verification setTitle:[NSString stringWithFormat:@"%lds",second] forState:UIControlStateNormal];
364 466 second--;
365 467 }
366 468 });
... ... @@ -371,15 +473,14 @@ static const NSInteger margin = 15;
371 473  
372 474 - (void)setupTextFieldUI:(UITextField *)textField{
373 475 if (textField.text.length > 0) {
374   - _verificationCodeBtn.userInteractionEnabled = YES;
375   - _verificationCodeBtn.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
376   - [_verificationCodeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
377   -
  476 + _verification.userInteractionEnabled = YES;
  477 + _verification.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
  478 + [_verification setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
378 479 }
379 480 else {
380   - _verificationCodeBtn.userInteractionEnabled = NO;
381   - _verificationCodeBtn.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
382   - [_verificationCodeBtn setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
  481 + _verification.userInteractionEnabled = NO;
  482 + _verification.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  483 + [_verification setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
383 484 }
384 485 }
385 486  
... ...
Example/CNLiveSettingModule/CNLIVEAppDelegate.m
... ... @@ -8,12 +8,14 @@
8 8  
9 9 #import "CNLIVEAppDelegate.h"
10 10 #import "CNLiveSettingController.h"
  11 +#import "CNLiveEnvironment.h"
11 12  
12 13 @implementation CNLIVEAppDelegate
13 14  
14 15 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
15 16 {
16 17 // Override point for customization after application launch.
  18 + [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore];
17 19 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];//UIScreen mainScreen].bounds个人理解获取屏幕的硬件信息然后设置尺寸大小
18 20 CNLiveSettingController *vc = [[CNLiveSettingController alloc] init];
19 21 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
... ...