123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- //
- // 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 ()<UITableViewDelegate,UITableViewDataSource>
- {
- UITableView *mainTableView;
- HolderView *holderV;
-
-
- NSMutableArray *dataArray;
- NSInteger currentPage;
- }
- @end
- @implementation CoachOrderCommentVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.view.backgroundColor = KBackGroundColor;
- self.title = @"学员点评";
- [self goBackByNavigation];
-
- 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:Font16];
- return hei + 105;
- }
- #pragma mark 数据请求
- -(void)getEvaluationList
- {
-
- if (![NetManager connectedToNetWork]) {
- showMsgUnconnect();
- return;
- }
-
- NSLog(@"%@",defUser.userDict);
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- // [dic setValue:@"" forKey:@"stuId"];
- // [dic setValue:@"" forKey:@"classId"];
- [dic setValue:_coachID forKey:@"coachId"];
- [dic setValue:@"1" forKey:@"isPage"];
- [dic setValue:@"20" forKey:@"pageSize"];
- [dic setValue:[NSString stringWithFormat:@"%d",(int)currentPage] forKey:@"currentPage"];
-
- NSString *method = @"getEvaluationList";
- [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root){
-
- [holderV setHidden:NO];
- if (!root) {
- ShowMsg(@"获取评论列表失败!");
- return;
- }
- if ([root[@"code"] isEqualToString:@"1"]) {
- ShowMsg(root[@"body"]);
- return;
- }
-
- if ([root[@"body"] count] < 1) {
- 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
|