You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
5.4 KiB
124 lines
5.4 KiB
// |
|
// NoWatchView.m |
|
// tongxin |
|
// |
|
// Created by ecell on 2023/5/17. |
|
// Copyright © 2023 xTT. All rights reserved. |
|
// |
|
|
|
#import "NoWatchView.h" |
|
#import "User.h" |
|
#import "Device.h" |
|
|
|
@implementation NoWatchView |
|
|
|
-(instancetype)initWithFrame:(CGRect)frame |
|
{ |
|
self = [super initWithFrame:frame]; |
|
if (self) |
|
{ |
|
self.frame = CGRectMake(0, iPhoneX_NavHeight, ScreenWidth, ScreenHeight-iPhoneX_NavHeight); |
|
self.backgroundColor = KKClearColor; |
|
[self subView]; |
|
} |
|
return self; |
|
} |
|
- (void)subView |
|
{ |
|
UIImageView *img = [UICommon ui_imageView:CGRectZero fileName:@"NoWatch_icon"]; |
|
[self addSubview:img]; |
|
[img mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.centerX.equalTo(self); |
|
make.bottom.equalTo(self.mas_centerY).inset(iPhoneX_NavHeight); |
|
make.size.mas_equalTo(CGSizeMake(Adapted(img.image.size.width),(Adapted(img.image.size.height)))); |
|
}]; |
|
|
|
UILabel *tilabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBoldADA_(18) textColor:KKBlack20 text:@"您还没有绑定设备" Radius:0]; |
|
[self addSubview:tilabel]; |
|
[tilabel mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.centerX.equalTo(self); |
|
make.top.equalTo(img.mas_bottom).offset(16); |
|
}]; |
|
|
|
UILabel *tilabel1 = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(14) textColor:KKGrey163 text:@"赶快绑定一个设备体验一下吧" Radius:0]; |
|
[self addSubview:tilabel1]; |
|
[tilabel1 mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.centerX.equalTo(self); |
|
make.top.equalTo(tilabel.mas_bottom).offset(5); |
|
}]; |
|
|
|
UIButton *pusBtn = [UICommon ui_buttonSimple:CGRectZero font:FontBold_(16) normalColor:KKWhiteColorColor normalText:@"添加设备" click:^(id x) { |
|
[self rightBarItemClick]; |
|
}]; |
|
pusBtn.backgroundColor = mainColor; |
|
pusBtn.layer.cornerRadius = 24; |
|
pusBtn.layer.masksToBounds = YES; |
|
[self addSubview:pusBtn]; |
|
[pusBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.centerX.equalTo(self); |
|
make.top.equalTo(tilabel1.mas_bottom).offset(20); |
|
make.size.mas_equalTo(CGSizeMake(Adapted(164), 48)); |
|
}]; |
|
|
|
} |
|
|
|
|
|
/** |
|
添加或切换设备 |
|
*/ |
|
- (void)rightBarItemClick |
|
{ |
|
//跳转 添加设备 指令 |
|
//是微信用户的,判断是否有 手机号了,没有需要添加后才能添加设备 |
|
WEAKSELF |
|
if(cUser.wxid && (cUser.phone == nil || cUser.phone.length == 0)) |
|
{ |
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:@"添加设备需要先绑定手机号" style:LGAlertViewStyleAlert buttonTitles:@[@"确定"] cancelButtonTitle:@"取消" destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) { |
|
|
|
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"请输入手机号"message:@""preferredStyle:UIAlertControllerStyleAlert]; |
|
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { |
|
textField.keyboardType = UIKeyboardTypePhonePad; |
|
}]; |
|
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"取消" |
|
style:UIAlertActionStyleCancel |
|
handler:^(UIAlertAction * _Nonnull action) {}]]; |
|
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"确定" |
|
style:UIAlertActionStyleDefault |
|
handler:^(UIAlertAction * _Nonnull action) |
|
{ |
|
UITextField *textField = alert.textFields[0]; |
|
[User wxUserApplyPhone:textField.text success:^(id responseObject) { |
|
[UICommon MessageSuccessText:@"绑定手机号成功,请添加设备." isImg:YES]; |
|
xLog(@"微信账号绑定 手机号 成功"); |
|
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"LoginStoryboard" bundle:nil]; |
|
UINavigationController *vc = [sb instantiateViewControllerWithIdentifier:@"ScanCodeViewController"]; |
|
[[UICommon currentVC].navigationController pushViewController:vc animated:YES]; |
|
//刷新数据 |
|
} failure:^(id faiObject) { |
|
|
|
}]; |
|
}]]; |
|
[[UICommon currentVC] presentViewController:alert animated:YES completion:nil]; |
|
|
|
} cancelHandler:nil destructiveHandler:nil]; |
|
[alertView showAnimated:YES completionHandler:nil]; |
|
|
|
return; |
|
} |
|
|
|
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"LoginStoryboard" bundle:nil]; |
|
UINavigationController *vc = [sb instantiateViewControllerWithIdentifier:@"ScanCodeViewController"]; |
|
[[UICommon currentVC].navigationController pushViewController:vc animated:YES]; |
|
} |
|
|
|
/* |
|
// Only override drawRect: if you perform custom drawing. |
|
// An empty implementation adversely affects performance during animation. |
|
- (void)drawRect:(CGRect)rect { |
|
// Drawing code |
|
} |
|
*/ |
|
|
|
@end
|
|
|