// // CoachOrderCommentVC.m // jiaPei // // Created by apple on 16/6/30. // Copyright © 2016年 JCZ. All rights reserved. // #import "CoachOrderCommentVC.h" #import "HolderView.h" #import "OrderCommentCell.h" @interface CoachOrderCommentVC () { UITableView *mainTableView; HolderView *holderV; NSMutableArray *dataArray; NSInteger currentPage; } @end @implementation CoachOrderCommentVC - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = backGroundColor; self.title = @"学员点评"; [self configNavigationBar]; mainTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStylePlain]; mainTableView.height -= kNavOffSet; mainTableView.delegate = self; mainTableView.dataSource = self; mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone; [self.view addSubview:mainTableView]; holderV = [[HolderView alloc] initWithFrame:mainTableView.frame]; [holderV freshBlock:^{ currentPage = 1; [self getEvaluationList]; }]; [self.view addSubview:holderV]; currentPage = 1; [self getEvaluationList]; } #pragma mark tableview delegate -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return dataArray.count; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { OrderCommentCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrderCommentCell"]; if (cell == nil) { cell = [[OrderCommentCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"OrderCommentCell"]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } cell.dataDic = dataArray[indexPath.row]; return cell; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { //计算的高度加上95 NSDictionary *dic = dataArray[indexPath.row]; CGFloat hei = [dic[@"EI_TEACHLEVEL"] heightForWid:kSize.width - 40 Font:NormalFont]; return hei + 105; } #pragma mark 数据请求 -(void)getEvaluationList { if (![Util connectedToNetWork]) { showMsgUnconnect(); return; } NSMutableArray *arr=[NSMutableArray array]; [arr addPro:@"coachOutId" Value:_coachID]; [arr addPro:@"dqbh" Value:defUser.userDict[@"city"]]; [arr addPro:@"isPage" Value:@"1"]; [arr addPro:@"pageSize" Value:@"20"]; [arr addPro:@"currentPage" Value:[NSString stringWithFormat:@"%d",(int)currentPage]]; NSString* method = @"getEvaluationList";//getCoachOrderEvaluates [MBProgressHUD showLoadToView:self.view]; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) { [MBProgressHUD hideHUDForView:self.view]; [holderV setHidden:NO]; if (!root) { [LoadingView showMsg:@"操作失败"]; return; } if ([root[@"code"] isEqualToString:@"1"]) { [LoadingView showMsg:root[@"body"]]; return; } if ([root[@"body"] count] == 0) { return; } if (currentPage == 1) { dataArray = [NSMutableArray arrayWithArray:root[@"body"]]; }else{ [dataArray addObjectsFromArray:root[@"body"]]; } currentPage += 1; [holderV setHidden:YES]; [mainTableView reloadData]; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end