orderCommentVC.m 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. //
  2. // orderCommentVC.m
  3. // jiaPei
  4. //
  5. // Created by EchoShacolee on 2017/2/21.
  6. // Copyright © 2017年 JCZ. All rights reserved.
  7. //
  8. #import "orderCommentVC.h"
  9. #import "RatingBar.h"
  10. @interface orderCommentVC ()
  11. {
  12. NSDictionary * _dataDic;
  13. }
  14. @property (weak, nonatomic) IBOutlet UILabel *coachNameLab;
  15. @property (weak, nonatomic) IBOutlet UIView *ratingBar;
  16. @property (weak, nonatomic) IBOutlet UIView *lableView;
  17. @property (weak, nonatomic) IBOutlet UILabel *timeLab;
  18. @property (weak, nonatomic) IBOutlet UITextView *textView;
  19. @end
  20. @implementation orderCommentVC
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. // Do any additional setup after loading the view from its nib.
  24. self.title = @"我的评价";
  25. [self configNavigationBar];
  26. _dataDic = [NSMutableDictionary new];
  27. if (self.type == 1) {//type;//1订单
  28. [self getClassIdEvaluateById];
  29. }else if(self.type == 2){
  30. [self getEvaluationList];
  31. }
  32. }
  33. -(void)myInit
  34. {
  35. if (_type == 1) {
  36. _coachNameLab.text = self.dic[@"COACHNAME"];
  37. }else if (_type == 2){
  38. _coachNameLab.text = self.dic[@"coachName"];
  39. }
  40. RatingBar * starBar = [[RatingBar alloc]initWithFrame:_ratingBar.bounds Flag:YES];
  41. if (_dataDic[@"overall"]) {
  42. starBar.starNumber = [_dataDic[@"overall"] integerValue];
  43. }
  44. starBar.enable = NO;
  45. [_ratingBar addSubview:starBar];
  46. //lableview
  47. NSArray * array = [_dataDic[@"srvmanner"] componentsSeparatedByString:@","];
  48. UILabel * lable;
  49. CGFloat x = 0;
  50. CGFloat y = 5;
  51. CGFloat w = 0;
  52. CGFloat h = 30;
  53. CGFloat bd = (kSize.width - 20 - 300)/2+5;
  54. for (int i=0;i<array.count;i++) {
  55. NSString * contentStr = array[i];
  56. CGSize size =[contentStr sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:NormalFont]}];
  57. w = size.width;
  58. lable = [[UILabel alloc]setxywh];
  59. x += bd+w;
  60. [lable setText:contentStr Font:NormalFont TextColor:kTitleColor Alignment:NSTextAlignmentCenter];
  61. lable.layer.borderWidth = 0.5;
  62. lable.layer.borderColor = [UIColor grayColor].CGColor;
  63. [_lableView addSubview:lable];
  64. }
  65. _timeLab.text = [_dataDic[@"evaluateTime"] substringToIndex:10];
  66. _textView.text = _dataDic[@"teachLevel"];
  67. }
  68. #pragma mark - 数据请求
  69. -(void)getClassIdEvaluateById{
  70. if (![Util connectedToNetWork]) {
  71. showMsgUnconnect();
  72. return;
  73. }
  74. NSMutableArray *arr=[NSMutableArray array];
  75. [arr addPro:@"classId" Value:self.dic[@"CLASSID"]];
  76. [arr addPro:@"userId" Value:defUser.userDict[@"id"]];
  77. NSString* method = @"getClassIdEvaluateById";//type;//1订单
  78. [MBProgressHUD showLoadToView:self.view];
  79. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
  80. [MBProgressHUD hideHUDForView:self.view];
  81. if (!root) {
  82. return;
  83. }
  84. if ([root[@"code"] isEqualToString:@"1"]) {
  85. ShowMsg(root[@"body"]);
  86. return;
  87. }
  88. if ([root[@"body"] isKindOfClass:[NSDictionary class]]) {
  89. _dataDic = [NSMutableDictionary dictionaryWithDictionary:root[@"body"]];
  90. }
  91. [self myInit];
  92. }];
  93. }
  94. -(void)getEvaluationList{
  95. if (![Util connectedToNetWork]) {
  96. showMsgUnconnect();
  97. return;
  98. }
  99. NSMutableArray *arr=[NSMutableArray array];
  100. [arr addPro:@"dqbh" Value:defUser.userDict[@"city"]];
  101. [arr addPro:@"stuOutId" Value:defUser.userDict[@"outId"]];
  102. [arr addPro:@"classId" Value:self.dic[@"classId"]];
  103. NSString* method = @"getEvaluationList";
  104. [MBProgressHUD showLoadToView:self.view];
  105. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
  106. [MBProgressHUD hideHUDForView:self.view];
  107. if (!root) {
  108. return;
  109. }
  110. if ([root[@"code"] isEqualToString:@"1"]) {
  111. ShowMsg(root[@"body"]);
  112. return;
  113. }
  114. NSArray * array = root[@"body"];
  115. NSDictionary * dic = array[0];
  116. [_dataDic setValue:dic[@"EI_TEACHLEVEL"] forKey:@"teachLevel"];
  117. [_dataDic setValue:dic[@"EVALUATETIME"] forKey:@"evaluateTime"];
  118. [_dataDic setValue:dic[@"EI_SRVMANNER"] forKey:@"srvmanner"];
  119. [_dataDic setValue:dic[@"EI_OVERALL"] forKey:@"overall"];
  120. [self myInit];
  121. }];
  122. }
  123. - (void)didReceiveMemoryWarning {
  124. [super didReceiveMemoryWarning];
  125. // Dispose of any resources that can be recreated.
  126. }
  127. /*
  128. #pragma mark - Navigation
  129. // In a storyboard-based application, you will often want to do a little preparation before navigation
  130. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  131. // Get the new view controller using [segue destinationViewController].
  132. // Pass the selected object to the new view controller.
  133. }
  134. */
  135. @end