EleMinRecordListVC.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // EleMinRecordListVC.m
  3. // JSJPCoach
  4. //
  5. // Created by EchoShacolee on 2018/1/31.
  6. // Copyright © 2018年 Danson. All rights reserved.
  7. //
  8. #import "EleMinRecordListVC.h"
  9. #import "EleDetailCell.h"
  10. #import "HolderView.h"
  11. @interface EleMinRecordListVC ()
  12. {
  13. HolderView *holderV;
  14. }
  15. @property(nonatomic,retain)NSMutableArray *dataArr;
  16. @end
  17. @implementation EleMinRecordListVC
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. self.navigationItem.title = @"分钟学时记录";
  21. [self configNavigationBar];
  22. self.tableView.estimatedRowHeight = 90;
  23. [self.tableView registerNib:[UINib nibWithNibName:@"EleDetailCell" bundle:nil] forCellReuseIdentifier:@"cellId"];
  24. self.tableView.tableFooterView = [UIView new];
  25. holderV = [[HolderView alloc] initWithFrame:self.tableView.bounds];
  26. [holderV freshBlock:^{
  27. [self getData];
  28. }];
  29. [self.view addSubview:holderV];
  30. [self getData];
  31. }
  32. - (void)didReceiveMemoryWarning {
  33. [super didReceiveMemoryWarning];
  34. // Dispose of any resources that can be recreated.
  35. }
  36. #pragma mark - Table view data source
  37. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  38. return self.dataArr.count;
  39. }
  40. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  41. EleDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellId" forIndexPath:indexPath];
  42. cell.dataDic = self.dataArr[indexPath.row];
  43. return cell;
  44. }
  45. #pragma mark 数据请求
  46. -(void)getData{
  47. NSMutableArray *arr=[NSMutableArray array];
  48. [arr addPro:@"stuId" Value:_stuID];
  49. [arr addPro:@"classId" Value:_classId];
  50. [arr addPro:@"dqbh" Value:defUser.userDict[@"city"]];
  51. NSString* method = @"getTrainRecordMins";
  52. [MBProgressHUD showLoadToView:self.view];
  53. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) {
  54. holderV.hidden = NO;
  55. [MBProgressHUD hideHUDForView:self.view];
  56. if (!root) {
  57. ShowMsg(@"数据请求失败,请重试");
  58. return;
  59. }
  60. if ([root[@"code"] isEqualToString:@"1"]) {
  61. ShowMsg(root[@"body"]);
  62. return;
  63. }
  64. self.dataArr = root[@"body"];
  65. if (self.dataArr.count != 0) {
  66. holderV.hidden = YES;
  67. }
  68. [self.tableView reloadData];
  69. }];
  70. }
  71. @end