123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- //
- // TerminalListVC.m
- // LN_School
- //
- // Created by EchoShacolee on 2017/8/3.
- // Copyright © 2017年 Danson. All rights reserved.
- //
- #import "TerminalListVC.h"
- #import "TerminalListCell.h"
- #import "TerminalListCell2.h"
- #import "SportPathVC.h"
- #import "Ter_SendMsg.h"
- @interface TerminalListVC ()<UITableViewDataSource,UITableViewDelegate>
- @property(nonatomic,strong)UITableView *tableView;
- @end
- @implementation TerminalListVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.title = @"终端列表";
- [self goBackByNavigation];
-
- _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kSize.width, kSize.height-kNavOffSet) style:UITableViewStyleGrouped];
- _tableView.dataSource = self;
- _tableView.delegate = self;
- [self.view addSubview:_tableView];
- _tableView.backgroundColor = KBackGroundColor;
- _tableView.tableFooterView = [UIView new];
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- }
- #pragma mark tableview代理
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
-
- return self.dataArr.count;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-
- return 1;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- NSString *str = _dataArr[indexPath.section][@"TDI_TERMTYPE"];
- if ([str isEqualToString:@"1"]) {
- return 108;
- }else{
- return 70;
- }
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- NSString *str = _dataArr[indexPath.section][@"TDI_TERMTYPE"];
- if ([str isEqualToString:@"1"]) {
- TerminalListCell *cell = [TerminalListCell cellForTableView:tableView];
- cell.dic = _dataArr[indexPath.section];
- NSString *sim = [NSString stringWithFormat:@"%@",_dataArr[indexPath.section][@"TDI_SIM"]];
- cell.clickBlock = ^(NSNumber *type) {
- switch ([type integerValue]) {
- case 1:
- {
- SportPathVC *vc = [[SportPathVC alloc]init];
- vc.carNum = _dataArr[indexPath.section][@"TCO_LICNUM"];
- vc.simStr = sim;
- [self navPushHideTabbarToVC:vc];
- }
- break;
- case 2:
- {
- ShowMsg(@"暂未开放!");
-
- // Ter_SendMsg *vc = [[Ter_SendMsg alloc]init];
- // vc.sim = sim;
- // [self navPushHideTabbarToVC:vc];
- }
- break;
- case 3:
- {
- ShowMsg(@"暂未开放!");
-
- // [self removeMacWarningWithSim:sim];
- }
- break;
- case 4:
- ShowMsg(@"暂未开放!");
-
- // [self captureVideoWithSim:sim];
- break;
-
- default:
- break;
- }
- };
- return cell;
- }
-
- TerminalListCell2 *cell = [TerminalListCell2 cellForTableView:tableView];
- cell.dic = _dataArr[indexPath.section];
- return cell;
- }
- #pragma mark - 网络请求
- -(void)captureVideoWithSim:(NSString *)simStr{
-
- if (![NetManager connectedToNetWork]) {
- showMsgUnconnect();
- return;
- }
-
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setObject:simStr forKey:@"sim"];
-
- NSString *method = @"captureVideo";
- [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
-
- if (!root) {
- ShowMsg(@"解除失败,请重试");
- return;
- }
- if ([root[@"code"] integerValue] == 1) {
- ShowMsg(root[@"msg"]);
- return;
- }
-
- ShowMsg(@"操作成功");
- }];
- }
- -(void)removeMacWarningWithSim:(NSString *)simStr{
- if (![NetManager connectedToNetWork]) {
- showMsgUnconnect();
- return;
- }
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- // [dic setObject:defUser.userDict[@"school"] forKey:@"schoolId"];
- // [dic setObject:@"" forKey:@"mwId"];
- // [dic setObject:@"" forKey:@"kind"];
- [dic setObject:simStr forKey:@"sim"];
- NSString *method = @"removeMacWarning";
- [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
- if (!root) {
- ShowMsg(@"解除失败,请重试");
- return;
- }
- if ([root[@"code"] integerValue] == 1) {
- ShowMsg(root[@"msg"]);
- return;
- }
- ShowMsg(@"操作成功");
- }];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|