// // EleMinRecordListVC.m // JSJPCoach // // Created by EchoShacolee on 2018/1/31. // Copyright © 2018年 Danson. All rights reserved. // #import "EleMinRecordListVC.h" #import "EleDetailCell.h" #import "HolderView.h" @interface EleMinRecordListVC () { HolderView *holderV; } @property(nonatomic,retain)NSMutableArray *dataArr; @end @implementation EleMinRecordListVC - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"分钟学时记录"; [self configNavigationBar]; self.tableView.estimatedRowHeight = 90; [self.tableView registerNib:[UINib nibWithNibName:@"EleDetailCell" bundle:nil] forCellReuseIdentifier:@"cellId"]; self.tableView.tableFooterView = [UIView new]; holderV = [[HolderView alloc] initWithFrame:self.tableView.bounds]; [holderV freshBlock:^{ [self getData]; }]; [self.view addSubview:holderV]; [self getData]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark - Table view data source - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.dataArr.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { EleDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellId" forIndexPath:indexPath]; cell.dataDic = self.dataArr[indexPath.row]; return cell; } #pragma mark 数据请求 -(void)getData{ NSMutableArray *arr=[NSMutableArray array]; [arr addPro:@"stuId" Value:_stuID]; [arr addPro:@"classId" Value:_classId]; [arr addPro:@"dqbh" Value:defUser.userDict[@"city"]]; NSString* method = @"getTrainRecordMins"; [MBProgressHUD showLoadToView:self.view]; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) { holderV.hidden = NO; [MBProgressHUD hideHUDForView:self.view]; if (!root) { ShowMsg(@"数据请求失败,请重试"); return; } if ([root[@"code"] isEqualToString:@"1"]) { ShowMsg(root[@"body"]); return; } self.dataArr = root[@"body"]; if (self.dataArr.count != 0) { holderV.hidden = YES; } [self.tableView reloadData]; }]; } @end