// // MinRescord.m // LNManager // // Created by EchoShacolee on 2017/4/14. // Copyright © 2017年 lee. All rights reserved. // #import "MinRescord.h" #import "MinRecordeCell.h" @interface MinRescord () { HolderView *holderV; UITableView *myTableView; } @property(nonatomic,strong)NSMutableArray *dataurce; @end @implementation MinRescord - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"分钟学时记录"; [self configNavBar]; [self myInit]; [self getData]; } -(void)myInit{ myTableView = [[UITableView alloc] initWithFrame:kFrame]; [myTableView setDelegate:self]; [myTableView setDataSource:self]; myTableView.separatorStyle = UITableViewCellSeparatorStyleNone; [self.view addSubview:myTableView]; holderV = [[HolderView alloc] initWithFrame:kFrame]; holderV.y = kNavOffSet; [holderV freshBlock:^{ [self getData]; }]; [self addV:holderV]; } #pragma mark tableview代理相关 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return self.dataurce.count; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 100; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ MinRecordeCell * cell = [tableView dequeueReusableCellWithIdentifier:@"minRecordCellId"]; if (!cell) { cell = [[[NSBundle mainBundle] loadNibNamed:@"MinRecordeCell" owner:nil options:nil] lastObject]; } [cell upDataWithDic:self.dataurce[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[@"cityId"]]; NSString* method = @"getTrainRecordMins"; [LoadingView showHUD]; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) { holderV.hidden = NO; RemoveHUD(); if (!root) { ShowMsg(@"数据请求失败,请重试"); return; } if ([root[@"code"] isEqualToString:@"1"]) { ShowMsg(root[@"body"]); return; } _dataurce = root[@"body"]; if (_dataurce.count != 0) { holderV.hidden = YES; } [myTableView reloadData]; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end