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.
 
 
 
 

83 lines
3.6 KiB

//
// EidtDeviceContactWithDeviceTableViewCell.m
// tongxin
//
// Created by WeiChaoZheng on 2018/6/21.
// Copyright © 2018年 xTT. All rights reserved.
//
#import "EidtDeviceContactWithDeviceTableViewCell.h"
#import "User.h"
@interface EidtDeviceContactWithDeviceTableViewCell()
//@property (strong, nonatomic)NSArray *imageNameArr;
@end
@implementation EidtDeviceContactWithDeviceTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
self.contactImageView.layer.cornerRadius = 10;
self.contactImageView.layer.masksToBounds = YES;
self.contactWDLabel.userInteractionEnabled = NO; //默认不可编辑
self.contactWDLabel.textAlignment = 2;
self.selectionStyle = 0;
self.contactView.layer.cornerRadius = 3;
self.contactView.layer.masksToBounds = YES;
self.unbundlingBtn.layer.cornerRadius = 3;
self.unbundlingBtn.layer.masksToBounds = YES;
[self.unbundlingBtn setBackgroundColor:mainColor];
[self.unbundlingBtn setTitleColor:[UIColor whiteColor] forState:0];
[self.unbundlingBtn setTitle:@"解除与设备的绑定" forState:0];
}
- (IBAction)unbundlingBtn:(id)sender {
// 管理员显示--- 您是设备的管理员,如果您进行解绑,其他绑定该设备的用户,将自动解绑,确认解除绑定吗?
NSString *msg = @"是否解除绑定?";
if([cUser.cDevice.identity isEqualToString:@"admin"]){
msg = @"您是设备的管理员,如果您进行解绑,其他绑定该设备的用户,将自动解绑,确认解除绑定吗?";
}
UIAlertController *sheet = [myHelper getAlertWithTitle:msg
actionTitles:@[@"确定"]
style:UIAlertControllerStyleAlert
block:^(UIAlertAction *action)
{
if ([action.title isEqualToString:@"确定"]) {
NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
[parameters setObject:cUser.cDevice.imei forKey:@"imei"];
[cUser deleteDeviceSuccess:^(id responseObject) {
//回到首页
[[self getViewController].navigationController popToRootViewControllerAnimated:YES];
} failure:^(id faiObject) {
}];
}
}];
[[self getViewController] presentViewController:sheet animated:YES completion:nil];
}
-(void)setDevice:(Device*)device WithStatus:(BOOL)isAdd isEdting:(BOOL)isEdting{
self.device = device;
// int imageIndex = [device.relationship_image_id intValue];
// NSString * imageName = self.imageNameArr[imageIndex-1];
self.contactImageView.image = [myHelper getClickRelationshipImageWithCodeID:[device.relationship_image_id intValue] deviceType:cUser.cDevice.deviceType.integerValue];
self.contactWDLabel.text = device.relationship;
if (isEdting) {
self.contactWDLabel.textColor = [UIColor blackColor];
self.unbundlingBtn.hidden = YES;
}else{
self.contactWDLabel.textColor = [UIColor lightGrayColor];
self.unbundlingBtn.hidden = NO;
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end