123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- //
- // EvaluationAndPayVC.m
- // jiaPei
- //
- // Created by apple on 16/6/8.
- // Copyright © 2016年 JCZ. All rights reserved.
- //
- #import "EvaluationAndPayVC.h"
- #import "CDPStarEvaluation.h"
- @interface EvaluationAndPayVC ()
- {
- // CDPStarEvaluation *serverStar;//星形评价
- // CDPStarEvaluation *payStar;
- // CDPStarEvaluation *teachStar;
- // UILabel *serverLabel;//评论级别label
- // UILabel *payLabel;
- // UILabel *teachLabel;
- //
- // UILabel *timeLabel;
- // UILabel *remarkLabel;
-
- UIView * _lableView;
- HolderView *_holderV;
- }
- @end
- @implementation EvaluationAndPayVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.title = @"评价";
- [self configNavBar];
- self.view.backgroundColor = backGroundColor;
- [self getOrderEvaluateById];
-
- _holderV = [[HolderView alloc]initWithFrame:self.view.frame];
- _holderV.title = @"暂无评价";
- [self.view addSubview:_holderV];
- }
- -(void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- [self.view endEditing:YES];
- }
- -(void)myInitDic:(NSDictionary *)dic
- {
- CGFloat x,y,w,h,bd;
- x = bd = 10;
- y = kNavOffSet+20;
- w = 90;
- h = 40;
- //
- UILabel * ratLab = [[UILabel alloc] setxywh];
- [ratLab setText:@"综合评分" Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
- [self.view addSubview:ratLab];
-
- x += w;
- w = kSize.width/2-bd;
- CDPStarEvaluation * ratbar = [[CDPStarEvaluation alloc]initWithFrame:CGRectMake(x, y, w, h) onTheView:self.view];
- [ratbar setStarWithFloat:[dic[@"overall"] floatValue]];
-
- x = bd;
- y += h+bd+20;
- w = (kSize.width - 90)/2 - bd;
- h = 1;
- UIView * left = [[UIView alloc] setxywh];
- left.layer.borderWidth = 0.5;
- left.layer.borderColor = [UIColor grayColor].CGColor;
- left.backgroundColor = contentTextColor;
- [self.view addSubview:left];
-
- x += w+90;
- UIView * right = [[UIView alloc] setxywh];
- right.layer.borderWidth = 0.5;
- right.layer.borderColor = [UIColor grayColor].CGColor;
- right.backgroundColor = contentTextColor;
- [self.view addSubview:right];
-
- x -= 90;
- y -= 20;
- w = 100;
- h = 40;
- UILabel * yxLab = [[UILabel alloc] setxywh];
- [yxLab setText:@"对我的印象" Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentCenter];
- [self.view addSubview:yxLab];
-
- x = bd;
- y += h+bd;
- w = kSize.width - 2*bd;
-
- //lableview
- _lableView = [[UIView alloc]setxywh];
- NSArray * array = [dic[@"srvmanner"] componentsSeparatedByString:@","];
- [self setLableViewWithArray:array];
- [self.view addSubview:_lableView];
-
-
- y += h+bd;
- w = 90;
- UILabel *stuCommentLab = [[UILabel alloc]setxywh];
- [stuCommentLab setText:@"学员评价:" Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
- [self.view addSubview:stuCommentLab];
-
- w = 100;
- x = kSize.width - w - bd;
- UILabel *timeLab = [[UILabel alloc]setxywh];
- [timeLab setText:[dic[@"evaluateTime"] substringToIndex:10] Font:Font14 TextColor:contentTextColor Alignment:NSTextAlignmentRight];
- [self.view addSubview:timeLab];
-
- x = 2*bd;
- y += h+2*bd;
- w = kSize.width - 4*bd;
- h = 150;
- UILabel * contentLable = [[UILabel alloc]setxywh];
- [contentLable setText:dic[@"teachLevel"] Font:Font14 TextColor:contentTextColor Alignment:NSTextAlignmentLeft];
- contentLable.height = [dic[@"teachLevel"] heightForWid:w Font:Font14];
- [self.view addSubview:contentLable];
-
-
- // //CDPStarEvaluation星形评价
- // y += 2*bd + kNavOffSet;
- // h = 20;
- // UILabel *starLabel = [[UILabel alloc] setxywh];
- // starLabel.text = @"星级评价:";
- // [starLabel setFont:[UIFont scaleSize:Font16]];
- // [self.view addSubview:starLabel];
- //
- // y += h + bd/2.0;
- // h = (kSize.width-2*bd)*0.5/4.98;
- // NSArray *nameArray = @[@"服务星级",@"收费星级",@"教学星级"];
- // NSMutableArray *stars = [NSMutableArray arrayWithCapacity:3];
- // NSMutableArray *labels = [NSMutableArray arrayWithCapacity:3];
- // for (int i = 0; i < 3; i ++) {
- //
- // x = bd;
- // w = (kSize.width-2*bd)*0.2;
- // UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x, y + i*(h + bd/2.0), w, h)];
- // label.text = nameArray[i];
- // label.textAlignment = NSTextAlignmentLeft;
- // [label setFont:[UIFont scaleSize:Font16]];
- // [self.view addSubview:label];
- //
- // x += w;
- // w = (kSize.width-2*bd)*0.5;
- // CDPStarEvaluation *evaluation=[[CDPStarEvaluation alloc] initWithFrame:CGRectMake(x, y + i*(h + bd/2.0), w, h) onTheView:self.view];
- // evaluation.delegateTag = i;
- // [stars addObject:evaluation];
- //
- // x += w;
- // w = (kSize.width-2*bd)*0.3;
- // label = [[UILabel alloc] initWithFrame:CGRectMake(x, y + i*(h + bd/2.0), w, h)];
- // label.textAlignment = NSTextAlignmentRight;
- // [label setFont:[UIFont scaleSize:Font16]];
- // [self.view addSubview:label];
- // [labels addObject:label];
- // }
- //
- // serverStar = stars[0];
- // payStar = stars[1];
- // teachStar = stars[2];
- // serverLabel = labels[0];
- // payLabel = labels[1];
- // teachLabel = labels[2];
- //
- // x = 2*bd;
- // y += 3*(h + bd/2.0) + 2*bd;
- // w = kSize.width - 2*x;
- // h = 30;
- // timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
- // [timeLabel setText:@"" Font:Font16 TextColor:contentTextColor Alignment:NSTextAlignmentRight];
- // [self.view addSubview:timeLabel];
- // [timeLabel addViewWithRect:CGRectMake(10, y+h, kSize.width - 20, 1)];
- //
- //
- // x = 2 * bd;
- // y += h + 5;
- // w = kSize.width - 2*x;
- // h = 30;
- // remarkLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
- // [remarkLabel setText:@"" Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
- // [self.view addSubview:remarkLabel];
- // [self getOrderEvaluateById];
- }
- #pragma mark 数据请求
- -(void)getOrderEvaluateById
- {
- [LoadingView showHUD];
- if (![Util connectedToNetWork]) {
- return;
- }
-
- NSMutableArray *arr=[NSMutableArray array];
- [arr addPro:@"classId" Value:_dataDic[@"RO_CLASS_ID"]];
- [arr addPro:@"userId" Value:_dataDic[@"RO_USER_ID"]];
-
- NSString* method = @"getOrderEvaluateByClassId";
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
- RemoveHUD();
- //NSLog(@"评价内容-->%@-->%@",arr,root);
- if (!root) {
- ShowMsgFailed();
- return;
- }
- if ([root[@"code"] isEqualToString:@"1"]) {
- ShowMsg(root[@"body"]);
- return;
- }
-
- NSDictionary *dic = root[@"body"];
- if ([dic isKindOfClass:[NSDictionary class]]) {
- [self myInitDic:dic];
- _holderV.hidden = YES;
- }
-
- }];
- }
- -(void)setLableViewWithArray:(NSArray *)array{
-
- CGFloat x = 0;
- CGFloat y = 5;
- CGFloat w = 0;
- CGFloat h = 30;
- CGFloat bd = (kSize.width - 20 - 300)/2+5;
-
- for (int i=0;i<array.count;i++) {
-
- NSString * contentStr = array[i];
- CGSize size =[contentStr sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:Font16]}];
- w = size.width+10;
- UILabel * lable = [[UILabel alloc]setxywh];
- x += bd+w;
- [lable setText:contentStr Font:Font16 TextColor:kTitleColor Alignment:NSTextAlignmentCenter];
-
- lable.layer.borderWidth = 0.5;
- lable.layer.borderColor = [UIColor grayColor].CGColor;
-
- [_lableView addSubview:lable];
- }
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- }
- @end
|