MinRescord.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // MinRescord.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/14.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "MinRescord.h"
  9. #import "MinRecordeCell.h"
  10. @interface MinRescord ()<UITableViewDelegate,UITableViewDataSource>
  11. {
  12. HolderView *holderV;
  13. UITableView *myTableView;
  14. }
  15. @property(nonatomic,strong)NSMutableArray *dataurce;
  16. @end
  17. @implementation MinRescord
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. self.navigationItem.title = @"分钟学时记录";
  21. [self configNavBar];
  22. [self myInit];
  23. [self getData];
  24. }
  25. -(void)myInit{
  26. myTableView = [[UITableView alloc] initWithFrame:kFrame];
  27. [myTableView setDelegate:self];
  28. [myTableView setDataSource:self];
  29. myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  30. [self.view addSubview:myTableView];
  31. holderV = [[HolderView alloc] initWithFrame:kFrame];
  32. holderV.y = kNavOffSet;
  33. [holderV freshBlock:^{
  34. [self getData];
  35. }];
  36. [self addV:holderV];
  37. }
  38. #pragma mark tableview代理相关
  39. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  40. return self.dataurce.count;
  41. }
  42. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  43. return 100;
  44. }
  45. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  46. MinRecordeCell * cell = [tableView dequeueReusableCellWithIdentifier:@"minRecordCellId"];
  47. if (!cell) {
  48. cell = [[[NSBundle mainBundle] loadNibNamed:@"MinRecordeCell" owner:nil options:nil] lastObject];
  49. }
  50. [cell upDataWithDic:self.dataurce[indexPath.row]];
  51. return cell;
  52. }
  53. #pragma mark 数据请求
  54. -(void)getData{
  55. NSMutableArray *arr=[NSMutableArray array];
  56. [arr addPro:@"stuId" Value:_stuID];
  57. [arr addPro:@"classId" Value:_classId];
  58. [arr addPro:@"dqbh" Value:defUser.userDict[@"cityId"]];
  59. NSString* method = @"getTrainRecordMins";
  60. [LoadingView showHUD];
  61. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) {
  62. holderV.hidden = NO;
  63. RemoveHUD();
  64. if (!root) {
  65. ShowMsg(@"数据请求失败,请重试");
  66. return;
  67. }
  68. if ([root[@"code"] isEqualToString:@"1"]) {
  69. ShowMsg(root[@"body"]);
  70. return;
  71. }
  72. _dataurce = root[@"body"];
  73. if (_dataurce.count != 0) {
  74. holderV.hidden = YES;
  75. }
  76. [myTableView reloadData];
  77. }];
  78. }
  79. - (void)didReceiveMemoryWarning {
  80. [super didReceiveMemoryWarning];
  81. // Dispose of any resources that can be recreated.
  82. }
  83. @end