连接错误时错误页面的处理

This commit is contained in:
祝发冬 2023-08-20 23:23:52 +08:00
parent 6871fe6938
commit 1354f012e1
3 changed files with 35 additions and 8 deletions

View File

@ -16101,7 +16101,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = WFX8GD5HFX;
ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES;
@ -16221,7 +16221,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = WFX8GD5HFX;
ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES;

View File

@ -121,7 +121,7 @@ extern BOOL isfromCameraView;
// self.wifiTextFiled.textColor = RGB_51;
self.wifiTextFiled.leftViewMode=UITextFieldViewModeAlways;
[self addTitleViewWithTitle:self.vcTitle];
// [self addTitleViewWithTitle:self.vcTitle];
self.rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
@ -170,6 +170,11 @@ extern BOOL isfromCameraView;
-(void)connectTypeClick:(UIButton *)btn
{
if(self.indicator.isAnimating)
{
[self.view makeToast:@"绑定中..."];
return;
}
WEAK_SELF;
NSString*airkisTitle = @"一键联网";
NSString*smartTitle = @"快捷联网";
@ -179,6 +184,7 @@ extern BOOL isfromCameraView;
NSString*apTips = @"1、插座仅支持2.4G的WiFi网络不支持5G 及 双频合一的网络(需在路由器设置中分开)\n2、先长按插座复位键13秒左右松手后红灯绿灯同时熄灭,只有绿灯偶尔闪烁,再点下一步。";
SPAlertController*alert =[SPAlertController alertControllerWithTitle:nil message:nil preferredStyle:SPAlertControllerStyleActionSheet animationType:SPAlertAnimationTypeDefault];
SPAlertAction*airkiss =[SPAlertAction actionWithTitle:airkisTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) {
[weakSelf connectNormalView];
weakSelf.connectType = ConnectTypeAirKiss;
weakSelf.connectTypeTitle.text = airkisTitle;
weakSelf.connectTipLbl.text = airkisTips;
@ -187,6 +193,7 @@ extern BOOL isfromCameraView;
SPAlertAction*smart =[SPAlertAction actionWithTitle:smartTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) {
[weakSelf connectNormalView];
weakSelf.connectType = ConnectTypeSmartESPTouch;
weakSelf.connectTypeTitle.text = smartTitle;
weakSelf.connectTipLbl.text = smartTips;
@ -194,6 +201,7 @@ extern BOOL isfromCameraView;
}];
SPAlertAction*ap =[SPAlertAction actionWithTitle:apTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) {
[weakSelf connectNormalView];
weakSelf.connectType = ConnectTypeAP;
weakSelf.connectTypeTitle.text = apTitle;
weakSelf.connectTipLbl.text = apTips;
@ -257,6 +265,10 @@ extern BOOL isfromCameraView;
{
self.connectingView.hidden=YES;
self.connectBtn.hidden = NO;
self.reasonBtn.hidden = YES;
self.resultLabel.hidden = YES;
self.line.hidden = YES;
[self.indicator stopAnimating];
}
@ -265,9 +277,22 @@ extern BOOL isfromCameraView;
{
self.connectingView.hidden=NO;
[self.indicator startAnimating];
self.reasonBtn.hidden = YES;
self.resultLabel.hidden = YES;
self.line.hidden = YES;
self.connectBtn.hidden = YES;
}
-(void)showFailResultViewWithMsg:(NSString*)msg
{
self.connectingView.hidden=NO;
[self.indicator stopAnimating];
self.connectBtn.hidden = YES;
self.reasonBtn.hidden = NO;
self.resultLabel.hidden = NO;
self.line.hidden = NO;
self.resultLabel.text = msg?:@"连接失败";
}
-(void)initMacIdString:(NSString *)ssid{
@ -280,6 +305,7 @@ extern BOOL isfromCameraView;
}else{
_maclabel.text = @"无设备mac";
}
[self showFailResultViewWithMsg:_maclabel.text];
NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:_maclabel.text];
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:8];
@ -299,9 +325,9 @@ extern BOOL isfromCameraView;
// [self.view bringSubviewToFront:_maclabel];
self.bakbutton.userInteractionEnabled=YES;
[self connectNormalView];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.view makeToast:@"设备类型不匹配,请重新选择入口绑定"];
[self.view makeToast:_maclabel.text];
});
}
@ -607,7 +633,7 @@ extern BOOL isfromCameraView;
{
[self.view makeToast:msg];
}
[self showFailResultViewWithMsg:msg];
};
ConnectType type = self.connectType;
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
@ -1009,7 +1035,7 @@ extern BOOL isfromCameraView;
[self.view makeToast:msg];
self.bakbutton.userInteractionEnabled=YES;
NSString *str =[NSString stringWithFormat:@"mac%@错误101",bssid];
NSString *str =[NSString stringWithFormat:@"mac%@错误101",bssid];
[self initMacIdString:str];
}else if ([resultDic[@"result"] isEqualToString:@"301"]){
@ -1043,6 +1069,7 @@ extern BOOL isfromCameraView;
self.isBindingDevice = NO;
self.HUD.labelText = err.localizedDescription;
[self.HUD hide:YES afterDelay:2];
[self initMacIdString:err.description];
[self appendTrakContent:[NSString stringWithFormat:@"绑定网络请求错误:%@", err.localizedDescription]];
self.bakbutton.userInteractionEnabled=YES;
}

View File

@ -32,7 +32,7 @@
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="a2I-Bk-68I" userLabel="shuoMingShuBtn">
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="a2I-Bk-68I" userLabel="shuoMingShuBtn">
<rect key="frame" x="288" y="64" width="100" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Keg-ao-If4"/>