【feature】注册时支持短信验证码
This commit is contained in:
parent
2a69aca206
commit
77f09aaf07
|
|
@ -90,6 +90,17 @@ typedef void(^kanHuShangJia)(CertificationShopModel*kanHuShangJia);
|
|||
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
|
||||
(NSString*)areaCode result:(void (^)(NSError *err))result;
|
||||
|
||||
/**
|
||||
* 获取验证码 SMS
|
||||
*
|
||||
* @param timeBtn 验证码按钮
|
||||
* @param zone 区域号,不要加"+"号(Area code)
|
||||
* @param isTextCode 是否为短信验证码
|
||||
*/
|
||||
|
||||
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
|
||||
(NSString*)areaCode isTextCode:(BOOL)isTextCode result:(void (^)(NSError *err))result;
|
||||
|
||||
|
||||
/**
|
||||
* 注册
|
||||
|
|
|
|||
|
|
@ -177,12 +177,12 @@
|
|||
addPhoneNumber:(NSString*)phoneNumber
|
||||
addSendType:(NSString*)sendType
|
||||
backData:(backVerifyCode)backVerifyCodeblock{
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber];
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:@"语音验证码"];
|
||||
[self getverifyWithTimerButton:timeBtn addphoneNumber:phoneNumber AddSendType:sendType backData:backVerifyCodeblock];
|
||||
|
||||
}
|
||||
#pragma mark 倒计时
|
||||
-(void)timerFireWithTimerButton:(UIButton*)timeBtn addPhoneNumber:(NSString*)phoneNumber{
|
||||
-(void)timerFireWithTimerButton:(UIButton*)timeBtn addPhoneNumber:(NSString*)phoneNumber timeBtnFinalTitle:(NSString *)title{
|
||||
|
||||
__block int timeout=60; //倒计时时间
|
||||
|
||||
|
|
@ -195,7 +195,7 @@
|
|||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
//设置界面的按钮显示 根据自己需求设置
|
||||
|
||||
[timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
|
||||
[timeBtn setTitle:title forState:UIControlStateNormal];
|
||||
timeBtn.userInteractionEnabled = YES;
|
||||
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
|
||||
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
|
||||
|
|
@ -232,7 +232,7 @@
|
|||
dispatch_source_cancel(_timer1);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
//设置界面的按钮显示 根据自己需求设置
|
||||
[timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
|
||||
[timeBtn setTitle:title forState:UIControlStateNormal];
|
||||
timeBtn.userInteractionEnabled = YES;
|
||||
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
|
||||
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
|
||||
|
|
@ -311,11 +311,42 @@
|
|||
#pragma mark - SMS 新
|
||||
|
||||
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
|
||||
(NSString*)areaCode result:(void (^)(NSError *err))result
|
||||
(NSString*)areaCode isTextCode:(BOOL)isTextCode result:(void (^)(NSError *))result
|
||||
|
||||
{
|
||||
NSString *title = isTextCode ? @"短信验证码" : @"语音验证码";
|
||||
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:title];
|
||||
|
||||
[SMSSDK getVerificationCodeByMethod:isTextCode ? SMSGetCodeMethodSMS : SMSGetCodeMethodVoice phoneNumber:phoneNumber zone:areaCode customIdentifier:nil result:^(NSError *error) {
|
||||
|
||||
if (!error) {
|
||||
NSLog(@"获取验证码成功");
|
||||
|
||||
} else {
|
||||
NSLog(@"错误信息:%@",error);
|
||||
dispatch_source_cancel(_timer1);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
//设置界面的按钮显示 根据自己需求设置
|
||||
[timeBtn setTitle:title forState:UIControlStateNormal];
|
||||
timeBtn.userInteractionEnabled = YES;
|
||||
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
|
||||
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
|
||||
|
||||
});
|
||||
[self showTitle:@"" messsage:@"获取验证失败"];
|
||||
|
||||
}
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
|
||||
(NSString*)areaCode result:(void (^)(NSError *))result
|
||||
|
||||
{
|
||||
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber];
|
||||
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:@"语音验证码"];
|
||||
|
||||
[SMSSDK getVerificationCodeByMethod:SMSGetCodeMethodVoice phoneNumber:phoneNumber zone:areaCode customIdentifier:nil result:^(NSError *error) {
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@
|
|||
@property(nonatomic) double latitude;
|
||||
@property(nonatomic,copy) NSString *adderss;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *qrcodeSwitchLbl;
|
||||
|
||||
@end
|
||||
|
||||
extern BOOL formLogIn;
|
||||
|
|
@ -133,12 +135,21 @@ extern BOOL formLogIn;
|
|||
|
||||
//NSString *zone = [dataContorl areaCode:self.phoneNumberTextField.text];
|
||||
//self.areaCode = zone;
|
||||
|
||||
[IFISHHTTPTOOL getverifyWithTimerButton:_timeBtn addphoneNumber:self.phoneNumberTextField.text zone:self.areaCode result:^(NSError *err) {
|
||||
BOOL isTextCode = [[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"短信验证码"];
|
||||
[IFISHHTTPTOOL getverifyWithTimerButton:_timeBtn addphoneNumber:self.phoneNumberTextField.text zone:self.areaCode isTextCode:isTextCode result:^(NSError *err) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
- (IBAction)qrcodeSwithBtnClicked:(UIButton *)sender {
|
||||
if ([[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"语音验证码"]) {
|
||||
[self.timeBtn setTitle:@"短信验证码" forState:UIControlStateNormal];
|
||||
self.qrcodeSwitchLbl.text = @"语音验证码";
|
||||
} else if ([[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"短信验证码"]) {
|
||||
[self.timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
|
||||
self.qrcodeSwitchLbl.text = @"短信验证码";
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark-设置键盘样式
|
||||
-(void)setTextkeyboadType{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
<outlet property="countryView" destination="42g-iR-QpF" id="SVZ-QG-x9J"/>
|
||||
<outlet property="passwordTextField" destination="7xd-HS-1kK" id="tmw-kh-qyQ"/>
|
||||
<outlet property="phoneNumberTextField" destination="iE3-ny-LX2" id="kOJ-c7-cq8"/>
|
||||
<outlet property="qrcodeSwitchLbl" destination="hT6-V3-AAb" id="np4-Ek-9LA"/>
|
||||
<outlet property="registBtn" destination="I52-cD-mf7" id="Kam-09-yMp"/>
|
||||
<outlet property="timeBtn" destination="JFw-B7-IwK" id="6a6-Xs-pmB"/>
|
||||
<outlet property="verifyTextField" destination="nOn-jr-IQE" id="ijZ-Xl-BiV"/>
|
||||
|
|
@ -118,7 +119,7 @@
|
|||
<action selector="chooseBtn:" destination="-1" eventType="touchUpInside" id="fNS-Yb-Dfi"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pnt-Um-Tap">
|
||||
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pnt-Um-Tap">
|
||||
<rect key="frame" x="49" y="287" width="146" height="28"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="28" id="6Sw-Nc-gLW"/>
|
||||
|
|
@ -164,6 +165,19 @@
|
|||
<constraint firstAttribute="width" secondItem="42g-iR-QpF" secondAttribute="height" multiplier="283:42" id="rdP-1c-cDT"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="短信验证码" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hT6-V3-AAb">
|
||||
<rect key="frame" x="246.5" y="294" width="61.5" height="14.5"/>
|
||||
<gestureRecognizers/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JIR-jc-I5O" userLabel="QRSwitchBtn">
|
||||
<rect key="frame" x="195" y="284" width="113" height="56.5"/>
|
||||
<connections>
|
||||
<action selector="qrcodeSwithBtnClicked:" destination="-1" eventType="touchUpInside" id="pyz-qc-Ryt"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
|
|
@ -173,20 +187,25 @@
|
|||
<constraint firstItem="nOn-jr-IQE" firstAttribute="leading" secondItem="SR2-Pu-ao5" secondAttribute="leading" constant="25" id="6VE-4O-kdQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="I52-cD-mf7" secondAttribute="trailing" constant="25" id="6Vl-Cm-hqd"/>
|
||||
<constraint firstItem="I52-cD-mf7" firstAttribute="leading" secondItem="SR2-Pu-ao5" secondAttribute="leading" constant="25" id="7WF-hP-l9D"/>
|
||||
<constraint firstItem="JIR-jc-I5O" firstAttribute="top" secondItem="I52-cD-mf7" secondAttribute="bottom" id="9nr-cZ-GZo"/>
|
||||
<constraint firstAttribute="trailing" secondItem="42g-iR-QpF" secondAttribute="trailing" constant="25" id="Arw-Vj-JaJ"/>
|
||||
<constraint firstItem="JFw-B7-IwK" firstAttribute="top" secondItem="nOn-jr-IQE" secondAttribute="top" id="B6q-9T-0nQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="nOn-jr-IQE" secondAttribute="trailing" constant="25" id="BqD-SS-c5h"/>
|
||||
<constraint firstItem="Pnt-Um-Tap" firstAttribute="centerY" secondItem="LoQ-C1-iph" secondAttribute="centerY" id="D7n-jE-lyh"/>
|
||||
<constraint firstItem="JIR-jc-I5O" firstAttribute="leading" secondItem="Pnt-Um-Tap" secondAttribute="trailing" id="DP9-DB-YgZ"/>
|
||||
<constraint firstItem="7xd-HS-1kK" firstAttribute="leading" secondItem="SR2-Pu-ao5" secondAttribute="leading" constant="25" id="Ghr-d7-hbN"/>
|
||||
<constraint firstItem="Pnt-Um-Tap" firstAttribute="leading" secondItem="LoQ-C1-iph" secondAttribute="trailing" constant="8" id="H8i-4E-QXN"/>
|
||||
<constraint firstItem="iE3-ny-LX2" firstAttribute="leading" secondItem="SR2-Pu-ao5" secondAttribute="leading" constant="25" id="Mwx-3S-JUa"/>
|
||||
<constraint firstItem="hT6-V3-AAb" firstAttribute="centerY" secondItem="Pnt-Um-Tap" secondAttribute="centerY" id="OBF-Gu-1CW"/>
|
||||
<constraint firstItem="JFw-B7-IwK" firstAttribute="leading" secondItem="nOn-jr-IQE" secondAttribute="trailing" constant="-80" id="QRt-rk-8zr"/>
|
||||
<constraint firstItem="I52-cD-mf7" firstAttribute="top" secondItem="7xd-HS-1kK" secondAttribute="bottom" constant="28" id="TLH-RA-nOC"/>
|
||||
<constraint firstItem="JFw-B7-IwK" firstAttribute="height" secondItem="nOn-jr-IQE" secondAttribute="height" id="TWk-fJ-dMA"/>
|
||||
<constraint firstItem="nOn-jr-IQE" firstAttribute="top" secondItem="iE3-ny-LX2" secondAttribute="bottom" constant="8" symbolic="YES" id="XyG-Qo-cPp"/>
|
||||
<constraint firstItem="hT6-V3-AAb" firstAttribute="trailing" secondItem="I52-cD-mf7" secondAttribute="trailing" id="YIn-l6-t7M"/>
|
||||
<constraint firstItem="iE3-ny-LX2" firstAttribute="centerX" secondItem="SR2-Pu-ao5" secondAttribute="centerX" id="Zaa-h7-urA"/>
|
||||
<constraint firstAttribute="trailing" secondItem="iE3-ny-LX2" secondAttribute="trailing" constant="25" id="aOl-em-1x8"/>
|
||||
<constraint firstItem="7xd-HS-1kK" firstAttribute="top" secondItem="nOn-jr-IQE" secondAttribute="bottom" constant="8" id="biI-hb-OQE"/>
|
||||
<constraint firstItem="JIR-jc-I5O" firstAttribute="trailing" secondItem="I52-cD-mf7" secondAttribute="trailing" id="cit-38-gNN"/>
|
||||
<constraint firstItem="I52-cD-mf7" firstAttribute="centerX" secondItem="SR2-Pu-ao5" secondAttribute="centerX" id="e0y-xf-AYF"/>
|
||||
<constraint firstItem="nOn-jr-IQE" firstAttribute="centerX" secondItem="SR2-Pu-ao5" secondAttribute="centerX" id="eMW-44-dZ3"/>
|
||||
<constraint firstAttribute="width" secondItem="SR2-Pu-ao5" secondAttribute="height" multiplier="333:290" constant="-57.413793103448256" id="hxK-ez-n9r"/>
|
||||
|
|
@ -195,6 +214,7 @@
|
|||
<constraint firstItem="LoQ-C1-iph" firstAttribute="top" secondItem="I52-cD-mf7" secondAttribute="bottom" constant="9" id="loD-LC-V1s"/>
|
||||
<constraint firstItem="42g-iR-QpF" firstAttribute="top" secondItem="SR2-Pu-ao5" secondAttribute="top" constant="21" id="sVJ-BR-cLd"/>
|
||||
<constraint firstItem="JFw-B7-IwK" firstAttribute="bottom" secondItem="nOn-jr-IQE" secondAttribute="bottom" id="wAg-Wh-1lt"/>
|
||||
<constraint firstAttribute="bottom" secondItem="JIR-jc-I5O" secondAttribute="bottom" id="xku-8I-uiZ"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
|
|
|
|||
Loading…
Reference in New Issue