EvaluationAndPayVC.m 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. //
  2. // EvaluationAndPayVC.m
  3. // jiaPei
  4. //
  5. // Created by apple on 16/6/8.
  6. // Copyright © 2016年 JCZ. All rights reserved.
  7. //
  8. #import "EvaluationAndPayVC.h"
  9. #import "CDPStarEvaluation.h"
  10. @interface EvaluationAndPayVC ()
  11. {
  12. // CDPStarEvaluation *serverStar;//星形评价
  13. // CDPStarEvaluation *payStar;
  14. // CDPStarEvaluation *teachStar;
  15. // UILabel *serverLabel;//评论级别label
  16. // UILabel *payLabel;
  17. // UILabel *teachLabel;
  18. //
  19. // UILabel *timeLabel;
  20. // UILabel *remarkLabel;
  21. UIView * _lableView;
  22. HolderView *_holderV;
  23. }
  24. @end
  25. @implementation EvaluationAndPayVC
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28. self.title = @"评价";
  29. [self configNavBar];
  30. self.view.backgroundColor = backGroundColor;
  31. [self getOrderEvaluateById];
  32. _holderV = [[HolderView alloc]initWithFrame:self.view.frame];
  33. _holderV.title = @"暂无评价";
  34. [self.view addSubview:_holderV];
  35. }
  36. -(void)viewDidDisappear:(BOOL)animated
  37. {
  38. [super viewDidDisappear:animated];
  39. [self.view endEditing:YES];
  40. }
  41. -(void)myInitDic:(NSDictionary *)dic
  42. {
  43. CGFloat x,y,w,h,bd;
  44. x = bd = 10;
  45. y = kNavOffSet+20;
  46. w = 90;
  47. h = 40;
  48. //
  49. UILabel * ratLab = [[UILabel alloc] setxywh];
  50. [ratLab setText:@"综合评分" Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
  51. [self.view addSubview:ratLab];
  52. x += w;
  53. w = kSize.width/2-bd;
  54. CDPStarEvaluation * ratbar = [[CDPStarEvaluation alloc]initWithFrame:CGRectMake(x, y, w, h) onTheView:self.view];
  55. [ratbar setStarWithFloat:[dic[@"overall"] floatValue]];
  56. x = bd;
  57. y += h+bd+20;
  58. w = (kSize.width - 90)/2 - bd;
  59. h = 1;
  60. UIView * left = [[UIView alloc] setxywh];
  61. left.layer.borderWidth = 0.5;
  62. left.layer.borderColor = [UIColor grayColor].CGColor;
  63. left.backgroundColor = contentTextColor;
  64. [self.view addSubview:left];
  65. x += w+90;
  66. UIView * right = [[UIView alloc] setxywh];
  67. right.layer.borderWidth = 0.5;
  68. right.layer.borderColor = [UIColor grayColor].CGColor;
  69. right.backgroundColor = contentTextColor;
  70. [self.view addSubview:right];
  71. x -= 90;
  72. y -= 20;
  73. w = 100;
  74. h = 40;
  75. UILabel * yxLab = [[UILabel alloc] setxywh];
  76. [yxLab setText:@"对我的印象" Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentCenter];
  77. [self.view addSubview:yxLab];
  78. x = bd;
  79. y += h+bd;
  80. w = kSize.width - 2*bd;
  81. //lableview
  82. _lableView = [[UIView alloc]setxywh];
  83. NSArray * array = [dic[@"srvmanner"] componentsSeparatedByString:@","];
  84. [self setLableViewWithArray:array];
  85. [self.view addSubview:_lableView];
  86. y += h+bd;
  87. w = 90;
  88. UILabel *stuCommentLab = [[UILabel alloc]setxywh];
  89. [stuCommentLab setText:@"学员评价:" Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
  90. [self.view addSubview:stuCommentLab];
  91. w = 100;
  92. x = kSize.width - w - bd;
  93. UILabel *timeLab = [[UILabel alloc]setxywh];
  94. [timeLab setText:[dic[@"evaluateTime"] substringToIndex:10] Font:Font14 TextColor:contentTextColor Alignment:NSTextAlignmentRight];
  95. [self.view addSubview:timeLab];
  96. x = 2*bd;
  97. y += h+2*bd;
  98. w = kSize.width - 4*bd;
  99. h = 150;
  100. UILabel * contentLable = [[UILabel alloc]setxywh];
  101. [contentLable setText:dic[@"teachLevel"] Font:Font14 TextColor:contentTextColor Alignment:NSTextAlignmentLeft];
  102. contentLable.height = [dic[@"teachLevel"] heightForWid:w Font:Font14];
  103. [self.view addSubview:contentLable];
  104. // //CDPStarEvaluation星形评价
  105. // y += 2*bd + kNavOffSet;
  106. // h = 20;
  107. // UILabel *starLabel = [[UILabel alloc] setxywh];
  108. // starLabel.text = @"星级评价:";
  109. // [starLabel setFont:[UIFont scaleSize:Font16]];
  110. // [self.view addSubview:starLabel];
  111. //
  112. // y += h + bd/2.0;
  113. // h = (kSize.width-2*bd)*0.5/4.98;
  114. // NSArray *nameArray = @[@"服务星级",@"收费星级",@"教学星级"];
  115. // NSMutableArray *stars = [NSMutableArray arrayWithCapacity:3];
  116. // NSMutableArray *labels = [NSMutableArray arrayWithCapacity:3];
  117. // for (int i = 0; i < 3; i ++) {
  118. //
  119. // x = bd;
  120. // w = (kSize.width-2*bd)*0.2;
  121. // UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x, y + i*(h + bd/2.0), w, h)];
  122. // label.text = nameArray[i];
  123. // label.textAlignment = NSTextAlignmentLeft;
  124. // [label setFont:[UIFont scaleSize:Font16]];
  125. // [self.view addSubview:label];
  126. //
  127. // x += w;
  128. // w = (kSize.width-2*bd)*0.5;
  129. // CDPStarEvaluation *evaluation=[[CDPStarEvaluation alloc] initWithFrame:CGRectMake(x, y + i*(h + bd/2.0), w, h) onTheView:self.view];
  130. // evaluation.delegateTag = i;
  131. // [stars addObject:evaluation];
  132. //
  133. // x += w;
  134. // w = (kSize.width-2*bd)*0.3;
  135. // label = [[UILabel alloc] initWithFrame:CGRectMake(x, y + i*(h + bd/2.0), w, h)];
  136. // label.textAlignment = NSTextAlignmentRight;
  137. // [label setFont:[UIFont scaleSize:Font16]];
  138. // [self.view addSubview:label];
  139. // [labels addObject:label];
  140. // }
  141. //
  142. // serverStar = stars[0];
  143. // payStar = stars[1];
  144. // teachStar = stars[2];
  145. // serverLabel = labels[0];
  146. // payLabel = labels[1];
  147. // teachLabel = labels[2];
  148. //
  149. // x = 2*bd;
  150. // y += 3*(h + bd/2.0) + 2*bd;
  151. // w = kSize.width - 2*x;
  152. // h = 30;
  153. // timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
  154. // [timeLabel setText:@"" Font:Font16 TextColor:contentTextColor Alignment:NSTextAlignmentRight];
  155. // [self.view addSubview:timeLabel];
  156. // [timeLabel addViewWithRect:CGRectMake(10, y+h, kSize.width - 20, 1)];
  157. //
  158. //
  159. // x = 2 * bd;
  160. // y += h + 5;
  161. // w = kSize.width - 2*x;
  162. // h = 30;
  163. // remarkLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
  164. // [remarkLabel setText:@"" Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
  165. // [self.view addSubview:remarkLabel];
  166. // [self getOrderEvaluateById];
  167. }
  168. #pragma mark 数据请求
  169. -(void)getOrderEvaluateById
  170. {
  171. [LoadingView showHUD];
  172. if (![Util connectedToNetWork]) {
  173. return;
  174. }
  175. NSMutableArray *arr=[NSMutableArray array];
  176. [arr addPro:@"classId" Value:_dataDic[@"RO_CLASS_ID"]];
  177. [arr addPro:@"userId" Value:_dataDic[@"RO_USER_ID"]];
  178. NSString* method = @"getOrderEvaluateByClassId";
  179. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
  180. RemoveHUD();
  181. //NSLog(@"评价内容-->%@-->%@",arr,root);
  182. if (!root) {
  183. ShowMsgFailed();
  184. return;
  185. }
  186. if ([root[@"code"] isEqualToString:@"1"]) {
  187. ShowMsg(root[@"body"]);
  188. return;
  189. }
  190. NSDictionary *dic = root[@"body"];
  191. if ([dic isKindOfClass:[NSDictionary class]]) {
  192. [self myInitDic:dic];
  193. _holderV.hidden = YES;
  194. }
  195. }];
  196. }
  197. -(void)setLableViewWithArray:(NSArray *)array{
  198. CGFloat x = 0;
  199. CGFloat y = 5;
  200. CGFloat w = 0;
  201. CGFloat h = 30;
  202. CGFloat bd = (kSize.width - 20 - 300)/2+5;
  203. for (int i=0;i<array.count;i++) {
  204. NSString * contentStr = array[i];
  205. CGSize size =[contentStr sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:Font16]}];
  206. w = size.width+10;
  207. UILabel * lable = [[UILabel alloc]setxywh];
  208. x += bd+w;
  209. [lable setText:contentStr Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentCenter];
  210. lable.layer.borderWidth = 0.5;
  211. lable.layer.borderColor = [UIColor grayColor].CGColor;
  212. [_lableView addSubview:lable];
  213. }
  214. }
  215. - (void)didReceiveMemoryWarning {
  216. [super didReceiveMemoryWarning];
  217. }
  218. @end