// // ApplyPlanStuListVC.m // LN_School // // Created by apple on 2017/7/17. // Copyright © 2017年 Danson. All rights reserved. // #import "ApplyPlanStuListVC.h" @interface ApplyPlanStuListVC () { UITableView *mainTableView; UILabel *noReserveLabel; NSArray *dataArray; } @end @implementation ApplyPlanStuListVC - (void)viewDidLoad { [super viewDidLoad]; self.title = @"已预约学员"; [self.view setBackgroundColor:KBackGroundColor]; [self goBackByNavigation]; dataArray = [NSArray array]; mainTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStylePlain]; mainTableView.delegate = self; mainTableView.dataSource =self; mainTableView.tableFooterView = [UIView new]; [self.view addSubview:mainTableView]; noReserveLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 30, kSize.width - 40, 50)]; [noReserveLabel setText:@"暂未查询到已预约学员" Font:Font21 TextColor:KTitleColor Alignment:NSTextAlignmentCenter]; [self.view addSubview:noReserveLabel]; [self getReserves]; } #pragma mark tableView -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return dataArray.count; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"]; } NSDictionary *dic = dataArray[indexPath.row]; cell.textLabel.text = [NSString stringWithFormat:@"%@ %@",dic[@"USERNAME"],dic[@"TEL"]]; NSString *dateString = dic[@"CRDATE"]; if (dateString.length > 16) { dateString = [dateString substringToIndex:16]; } cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",dateString]; return cell; } #pragma mark 数据 -(void)getReserves { if (![NetManager connectedToNetWork]) { return; } NSMutableDictionary *dic = [NSMutableDictionary dictionary]; [dic setObject:_planDic[@"ID"] forKey:@"planId"]; NSString *method = @"getReserves"; [MBProgressHUD showLoadToView:self.view]; [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) { [MBProgressHUD hideHUDForView:self.view]; if (!root) { ShowMsg(@"网络请求失败"); return; } if ([root[@"code"] intValue] == 1) { ShowMsg(root[@"body"]); return; } dataArray = root[@"body"]; if (dataArray.count > 0) { noReserveLabel.hidden = YES; }else{ noReserveLabel.hidden = NO; } [mainTableView reloadData]; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end