TerminalListVC.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. //
  2. // TerminalListVC.m
  3. // LN_School
  4. //
  5. // Created by EchoShacolee on 2017/8/3.
  6. // Copyright © 2017年 Danson. All rights reserved.
  7. //
  8. #import "TerminalListVC.h"
  9. #import "TerminalListCell.h"
  10. #import "TerminalListCell2.h"
  11. #import "SportPathVC.h"
  12. #import "Ter_SendMsg.h"
  13. @interface TerminalListVC ()<UITableViewDataSource,UITableViewDelegate>
  14. @property(nonatomic,strong)UITableView *tableView;
  15. @end
  16. @implementation TerminalListVC
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. self.title = @"终端列表";
  20. [self goBackByNavigation];
  21. _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kSize.width, kSize.height-kNavOffSet) style:UITableViewStyleGrouped];
  22. _tableView.dataSource = self;
  23. _tableView.delegate = self;
  24. [self.view addSubview:_tableView];
  25. _tableView.backgroundColor = KBackGroundColor;
  26. _tableView.tableFooterView = [UIView new];
  27. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  28. }
  29. #pragma mark tableview代理
  30. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  31. return self.dataArr.count;
  32. }
  33. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  34. return 1;
  35. }
  36. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  37. NSString *str = _dataArr[indexPath.section][@"TDI_TERMTYPE"];
  38. if ([str isEqualToString:@"1"]) {
  39. return 108;
  40. }else{
  41. return 70;
  42. }
  43. }
  44. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  45. NSString *str = _dataArr[indexPath.section][@"TDI_TERMTYPE"];
  46. if ([str isEqualToString:@"1"]) {
  47. TerminalListCell *cell = [TerminalListCell cellForTableView:tableView];
  48. cell.dic = _dataArr[indexPath.section];
  49. NSString *sim = [NSString stringWithFormat:@"%@",_dataArr[indexPath.section][@"TDI_SIM"]];
  50. cell.clickBlock = ^(NSNumber *type) {
  51. switch ([type integerValue]) {
  52. case 1:
  53. {
  54. SportPathVC *vc = [[SportPathVC alloc]init];
  55. vc.carNum = _dataArr[indexPath.section][@"TCO_LICNUM"];
  56. vc.simStr = sim;
  57. [self navPushHideTabbarToVC:vc];
  58. }
  59. break;
  60. case 2:
  61. {
  62. ShowMsg(@"暂未开放!");
  63. // Ter_SendMsg *vc = [[Ter_SendMsg alloc]init];
  64. // vc.sim = sim;
  65. // [self navPushHideTabbarToVC:vc];
  66. }
  67. break;
  68. case 3:
  69. {
  70. ShowMsg(@"暂未开放!");
  71. // [self removeMacWarningWithSim:sim];
  72. }
  73. break;
  74. case 4:
  75. ShowMsg(@"暂未开放!");
  76. // [self captureVideoWithSim:sim];
  77. break;
  78. default:
  79. break;
  80. }
  81. };
  82. return cell;
  83. }
  84. TerminalListCell2 *cell = [TerminalListCell2 cellForTableView:tableView];
  85. cell.dic = _dataArr[indexPath.section];
  86. return cell;
  87. }
  88. #pragma mark - 网络请求
  89. -(void)captureVideoWithSim:(NSString *)simStr{
  90. if (![NetManager connectedToNetWork]) {
  91. showMsgUnconnect();
  92. return;
  93. }
  94. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  95. [dic setObject:simStr forKey:@"sim"];
  96. NSString *method = @"captureVideo";
  97. [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
  98. if (!root) {
  99. ShowMsg(@"解除失败,请重试");
  100. return;
  101. }
  102. if ([root[@"code"] integerValue] == 1) {
  103. ShowMsg(root[@"msg"]);
  104. return;
  105. }
  106. ShowMsg(@"操作成功");
  107. }];
  108. }
  109. -(void)removeMacWarningWithSim:(NSString *)simStr{
  110. if (![NetManager connectedToNetWork]) {
  111. showMsgUnconnect();
  112. return;
  113. }
  114. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  115. // [dic setObject:defUser.userDict[@"school"] forKey:@"schoolId"];
  116. // [dic setObject:@"" forKey:@"mwId"];
  117. // [dic setObject:@"" forKey:@"kind"];
  118. [dic setObject:simStr forKey:@"sim"];
  119. NSString *method = @"removeMacWarning";
  120. [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
  121. if (!root) {
  122. ShowMsg(@"解除失败,请重试");
  123. return;
  124. }
  125. if ([root[@"code"] integerValue] == 1) {
  126. ShowMsg(root[@"msg"]);
  127. return;
  128. }
  129. ShowMsg(@"操作成功");
  130. }];
  131. }
  132. - (void)didReceiveMemoryWarning {
  133. [super didReceiveMemoryWarning];
  134. // Dispose of any resources that can be recreated.
  135. }
  136. /*
  137. #pragma mark - Navigation
  138. // In a storyboard-based application, you will often want to do a little preparation before navigation
  139. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  140. // Get the new view controller using [segue destinationViewController].
  141. // Pass the selected object to the new view controller.
  142. }
  143. */
  144. @end