TerminalListCell.m 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // TerminalListCell.m
  3. // LN_School
  4. //
  5. // Created by EchoShacolee on 2017/8/3.
  6. // Copyright © 2017年 Danson. All rights reserved.
  7. //
  8. #import "TerminalListCell.h"
  9. @implementation TerminalListCell
  10. +(instancetype)cellForTableView:(UITableView *)tableView{
  11. TerminalListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"];
  12. if (!cell) {
  13. cell = [[[NSBundle mainBundle]loadNibNamed:@"TerminalListCell" owner:nil options:nil]lastObject];
  14. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  15. }
  16. return cell;
  17. }
  18. -(void)setDic:(NSDictionary *)dic{
  19. self.carNum.textColor = KTitleColor;
  20. self.carNum.text = dic[@"TCO_LICNUM"];
  21. BOOL isOnline = [dic[@"TDI_IS_CONNECT"] integerValue] == 1;
  22. self.status.textColor = isOnline ? [UIColor darkGrayColor] : [UIColor lightGrayColor];
  23. self.status.text = isOnline ? @"在线":@"不在线";
  24. self.type.textColor = KContentTextColor;
  25. NSString *subTitle = @"";
  26. switch ([dic[@"TDI_TERMTYPE"] integerValue]) {
  27. case 1:
  28. subTitle = @"车载计程计时终端";
  29. break;
  30. case 2:
  31. subTitle = @"课堂教学计时终端";
  32. break;
  33. case 3:
  34. subTitle = @"模拟训练计时终端";
  35. break;
  36. case 0:
  37. subTitle = @"教练APP设备";
  38. break;
  39. case 10:
  40. subTitle = @"学员APP设备";
  41. break;
  42. default:
  43. break;
  44. }
  45. self.type.text = [NSString stringWithFormat:@"终端类型:%@",subTitle];
  46. BOOL isRegister = [dic[@"TDI_REG_STATUS"] integerValue] == 1;
  47. self.registerLab.textColor = isRegister ? KContentTextColor : [UIColor redColor];
  48. self.registerLab.text = isRegister ? @"已注册" : @"未注册";
  49. }
  50. - (IBAction)orbitClick:(id)sender {
  51. //轨迹
  52. if (self.clickBlock) {
  53. self.clickBlock(@1);
  54. }
  55. }
  56. - (IBAction)sendMsgClick:(id)sender {
  57. //发送消息
  58. if (self.clickBlock) {
  59. self.clickBlock(@2);
  60. }
  61. }
  62. - (IBAction)cancleAlarmClick:(id)sender {
  63. //解除警报
  64. if (self.clickBlock) {
  65. self.clickBlock(@3);
  66. }
  67. }
  68. - (IBAction)videoClick:(id)sender {
  69. //录像
  70. if (self.clickBlock) {
  71. self.clickBlock(@4);
  72. }
  73. }
  74. - (void)awakeFromNib {
  75. [super awakeFromNib];
  76. // Initialization code
  77. }
  78. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  79. [super setSelected:selected animated:animated];
  80. // Configure the view for the selected state
  81. }
  82. @end