CoachOrderCommentVC.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //
  2. // CoachOrderCommentVC.m
  3. // jiaPei
  4. //
  5. // Created by apple on 16/6/30.
  6. // Copyright © 2016年 JCZ. All rights reserved.
  7. //
  8. #import "CoachOrderCommentVC.h"
  9. #import "HolderView.h"
  10. #import "OrderCommentCell.h"
  11. @interface CoachOrderCommentVC ()<UITableViewDelegate,UITableViewDataSource>
  12. {
  13. UITableView *mainTableView;
  14. HolderView *holderV;
  15. NSMutableArray *dataArray;
  16. NSInteger currentPage;
  17. }
  18. @end
  19. @implementation CoachOrderCommentVC
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. self.view.backgroundColor = KBackGroundColor;
  23. self.title = @"学员点评";
  24. [self goBackByNavigation];
  25. mainTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStylePlain];
  26. mainTableView.height -= kNavOffSet;
  27. mainTableView.delegate = self;
  28. mainTableView.dataSource = self;
  29. mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  30. [self.view addSubview:mainTableView];
  31. holderV = [[HolderView alloc] initWithFrame:mainTableView.frame];
  32. [holderV freshBlock:^{
  33. currentPage = 1;
  34. [self getEvaluationList];
  35. }];
  36. [self.view addSubview:holderV];
  37. currentPage = 1;
  38. [self getEvaluationList];
  39. }
  40. #pragma mark tableview delegate
  41. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  42. {
  43. return dataArray.count;
  44. }
  45. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  46. {
  47. OrderCommentCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrderCommentCell"];
  48. if (cell == nil)
  49. {
  50. cell = [[OrderCommentCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"OrderCommentCell"];
  51. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  52. }
  53. cell.dataDic = dataArray[indexPath.row];
  54. return cell;
  55. }
  56. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  57. {
  58. //计算的高度加上95
  59. NSDictionary *dic = dataArray[indexPath.row];
  60. CGFloat hei = [dic[@"EI_TEACHLEVEL"] heightForWid:kSize.width - 40 Font:Font16];
  61. return hei + 105;
  62. }
  63. #pragma mark 数据请求
  64. -(void)getEvaluationList
  65. {
  66. if (![NetManager connectedToNetWork]) {
  67. showMsgUnconnect();
  68. return;
  69. }
  70. NSLog(@"%@",defUser.userDict);
  71. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  72. // [dic setValue:@"" forKey:@"stuId"];
  73. // [dic setValue:@"" forKey:@"classId"];
  74. [dic setValue:_coachID forKey:@"coachId"];
  75. [dic setValue:@"1" forKey:@"isPage"];
  76. [dic setValue:@"20" forKey:@"pageSize"];
  77. [dic setValue:[NSString stringWithFormat:@"%d",(int)currentPage] forKey:@"currentPage"];
  78. NSString *method = @"getEvaluationList";
  79. [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root){
  80. [holderV setHidden:NO];
  81. if (!root) {
  82. ShowMsg(@"获取评论列表失败!");
  83. return;
  84. }
  85. if ([root[@"code"] isEqualToString:@"1"]) {
  86. ShowMsg(root[@"body"]);
  87. return;
  88. }
  89. if ([root[@"body"] count] < 1) {
  90. return;
  91. }
  92. if (currentPage == 1) {
  93. dataArray = [NSMutableArray arrayWithArray:root[@"body"]];
  94. }else{
  95. [dataArray addObjectsFromArray:root[@"body"]];
  96. }
  97. currentPage += 1;
  98. [holderV setHidden:YES];
  99. [mainTableView reloadData];
  100. }];
  101. }
  102. - (void)didReceiveMemoryWarning {
  103. [super didReceiveMemoryWarning];
  104. }
  105. @end