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.
 
 
 
 

93 lines
3.9 KiB

//
// HomeEmptyViewCell.m
// tongxin
//
// Created by Apple on 2020/4/9.
// Copyright © 2020 xTT. All rights reserved.
//
#import "HomeEmptyViewCell.h"
#import "HomeEmptyView.h"
#import "User.h"
#import "Device.h"
@interface HomeEmptyViewCell ()
@end
@implementation HomeEmptyViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
[self.addDeviceBtn setCornerRadius:3];
self.addDeviceBtn.backgroundColor = mainColor;
[self.addDeviceBtn addTarget:self action:@selector(toAddDeviceVC) forControlEvents:UIControlEventTouchUpInside];
}
/**
跳转 添加设备 指令
*/
-(void)toAddDeviceVC{
//是微信用户的,判断是否有 手机号了,没有需要添加后才能添加设备
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];
// add by lsz 21-12-28 @try{}@catch{}
@try {
[User wxUserApplyPhone:textField.text success:^(id responseObject) {
[UICommon MessageSuccessText:@"绑定手机号成功,请添加设备." isImg:YES];
xLog(@"微信账号绑定 手机号 成功");
//刷新数据
[weakSelf.getViewController viewWillAppear:YES];
} failure:^(id faiObject) {
}];
} @catch (NSException *exception) {
xLog(@"微信账号绑定手机号异常=%@",exception);
}
}]];
[weakSelf.getViewController 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"];
[self.getViewController.navigationController pushViewController:vc animated:YES];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end