ApplyPlanStuListVC.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // ApplyPlanStuListVC.m
  3. // LN_School
  4. //
  5. // Created by apple on 2017/7/17.
  6. // Copyright © 2017年 Danson. All rights reserved.
  7. //
  8. #import "ApplyPlanStuListVC.h"
  9. @interface ApplyPlanStuListVC ()<UITableViewDelegate,UITableViewDataSource>
  10. {
  11. UITableView *mainTableView;
  12. UILabel *noReserveLabel;
  13. NSArray *dataArray;
  14. }
  15. @end
  16. @implementation ApplyPlanStuListVC
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. self.title = @"已预约学员";
  20. [self.view setBackgroundColor:KBackGroundColor];
  21. [self goBackByNavigation];
  22. dataArray = [NSArray array];
  23. mainTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStylePlain];
  24. mainTableView.delegate = self;
  25. mainTableView.dataSource =self;
  26. mainTableView.tableFooterView = [UIView new];
  27. [self.view addSubview:mainTableView];
  28. noReserveLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 30, kSize.width - 40, 50)];
  29. [noReserveLabel setText:@"暂未查询到已预约学员" Font:Font21 TextColor:KTitleColor Alignment:NSTextAlignmentCenter];
  30. [self.view addSubview:noReserveLabel];
  31. [self getReserves];
  32. }
  33. #pragma mark tableView
  34. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  35. return dataArray.count;
  36. }
  37. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  38. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
  39. if (cell == nil) {
  40. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
  41. }
  42. NSDictionary *dic = dataArray[indexPath.row];
  43. cell.textLabel.text = [NSString stringWithFormat:@"%@ %@",dic[@"USERNAME"],dic[@"TEL"]];
  44. NSString *dateString = dic[@"CRDATE"];
  45. if (dateString.length > 16) {
  46. dateString = [dateString substringToIndex:16];
  47. }
  48. cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",dateString];
  49. return cell;
  50. }
  51. #pragma mark 数据
  52. -(void)getReserves
  53. {
  54. if (![NetManager connectedToNetWork]) {
  55. return;
  56. }
  57. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  58. [dic setObject:_planDic[@"ID"] forKey:@"planId"];
  59. NSString *method = @"getReserves";
  60. [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
  61. if (!root)
  62. {
  63. ShowMsg(@"网络请求失败");
  64. return;
  65. }
  66. if ([root[@"code"] intValue] == 1) {
  67. ShowMsg(root[@"body"]);
  68. return;
  69. }
  70. dataArray = root[@"body"];
  71. if (dataArray.count > 0) {
  72. noReserveLabel.hidden = YES;
  73. }else{
  74. noReserveLabel.hidden = NO;
  75. }
  76. [mainTableView reloadData];
  77. }];
  78. }
  79. - (void)didReceiveMemoryWarning {
  80. [super didReceiveMemoryWarning];
  81. }
  82. @end