123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- //
- // orderCommentVC.m
- // jiaPei
- //
- // Created by EchoShacolee on 2017/2/21.
- // Copyright © 2017年 JCZ. All rights reserved.
- //
- #import "orderCommentVC.h"
- #import "RatingBar.h"
- @interface orderCommentVC ()
- {
- NSDictionary * _dataDic;
- }
- @property (weak, nonatomic) IBOutlet UILabel *coachNameLab;
- @property (weak, nonatomic) IBOutlet UIView *ratingBar;
- @property (weak, nonatomic) IBOutlet UIView *lableView;
- @property (weak, nonatomic) IBOutlet UILabel *timeLab;
- @property (weak, nonatomic) IBOutlet UITextView *textView;
- @end
- @implementation orderCommentVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view from its nib.
-
- self.title = @"我的评价";
- [self configNavigationBar];
- _dataDic = [NSMutableDictionary new];
- if (self.type == 1) {
- [self getClassIdEvaluateById];
- }else if(self.type == 2){
- [self getEvaluationList];
- }
-
- }
- -(void)myInit
- {
- if (_type == 1) {
- _coachNameLab.text = self.dic[@"RO_COACH_NAME"];
- }else if (_type == 2){
- _coachNameLab.text = self.dic[@"coachName"];
- }
-
-
- RatingBar * starBar = [[RatingBar alloc]initWithFrame:_ratingBar.bounds Flag:YES];
- if (_dataDic[@"overall"]) {
- starBar.starNumber = [_dataDic[@"overall"] integerValue];
- }
-
- starBar.enable = NO;
- [_ratingBar addSubview:starBar];
-
- //lableview
- NSArray * array = [_dataDic[@"srvmanner"] componentsSeparatedByString:@","];
- UILabel * lable;
- 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:NormalFont]}];
- w = size.width;
- lable = [[UILabel alloc]setxywh];
- x += bd+w;
- [lable setText:contentStr Font:NormalFont TextColor:kTitleColor Alignment:NSTextAlignmentCenter];
-
- lable.layer.borderWidth = 0.5;
- lable.layer.borderColor = [UIColor grayColor].CGColor;
-
- [_lableView addSubview:lable];
- }
-
- _timeLab.text = [_dataDic[@"evaluateTime"] substringToIndex:10];
-
- _textView.text = _dataDic[@"teachLevel"];
- }
- #pragma mark - 数据请求
- -(void)getClassIdEvaluateById{
-
- [LoadingView showHUD];
- if (![Util connectedToNetWork]) {
- showMsgUnconnect();
- return;
- }
-
- NSMutableArray *arr=[NSMutableArray array];
- [arr addPro:@"classId" Value:self.dic[@"RO_CLASS_ID"]];
- [arr addPro:@"userId" Value:RQ_USER_MANAGER.currentUser._id];
-
- NSString* method = @"getClassIdEvaluateById";
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
- RemoveHUD();
-
- if (!root) {
- return;
- }
-
- if ([root[@"code"] isEqualToString:@"1"]) {
- ShowMsg(root[@"body"]);
- return;
- }
-
- if ([root[@"body"] isKindOfClass:[NSDictionary class]]) {
- _dataDic = [NSMutableDictionary dictionaryWithDictionary:root[@"body"]];
- }
-
- [self myInit];
- }];
-
-
-
- }
- -(void)getEvaluationList {
- [LoadingView showHUD];
- if (![Util connectedToNetWork]) {
- showMsgUnconnect();
- return;
- }
- NSMutableArray *arr=[NSMutableArray array];
- [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city];
- [arr addPro:@"stuOutId" Value:RQ_USER_MANAGER.currentUser.outId];
- [arr addPro:@"classId" Value:self.dic[@"classId"]];
- // [arr addPro:@"isPage" Value:@"0"];//我很尴尬
-
- NSString* method = @"getEvaluationList";
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
- RemoveHUD();
-
- if (!root) {
- return;
- }
-
- if ([root[@"code"] isEqualToString:@"1"]) {
- ShowMsg(root[@"body"]);
- return;
- } else if ([root[@"code"] isEqualToString:@"-1"]) {
- ShowMsg(root[@"msg"]);
- return;
- }
- NSArray * array = root[@"body"];
- if (array.count > 0) {
- NSDictionary * dic = array[0];
- [_dataDic setValue:dic[@"EI_TEACHLEVEL"] forKey:@"teachLevel"];
- [_dataDic setValue:dic[@"EVALUATETIME"] forKey:@"evaluateTime"];
- [_dataDic setValue:dic[@"EI_SRVMANNER"] forKey:@"srvmanner"];
- [_dataDic setValue:dic[@"EI_OVERALL"] forKey:@"overall"];
- }
- [self myInit];
- }];
- }
- @end
|