123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- //
- // ApplyPlanStuListVC.m
- // LN_School
- //
- // Created by apple on 2017/7/17.
- // Copyright © 2017年 Danson. All rights reserved.
- //
- #import "ApplyPlanStuListVC.h"
- @interface ApplyPlanStuListVC ()<UITableViewDelegate,UITableViewDataSource>
- {
- 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";
- [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
-
- 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
|