orderCommentVC.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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) {
  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[@"RO_COACH_NAME"];
  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. [LoadingView showHUD];
  71. if (![Util connectedToNetWork]) {
  72. showMsgUnconnect();
  73. return;
  74. }
  75. NSMutableArray *arr=[NSMutableArray array];
  76. [arr addPro:@"classId" Value:self.dic[@"RO_CLASS_ID"]];
  77. [arr addPro:@"userId" Value:RQ_USER_MANAGER.currentUser._id];
  78. NSString* method = @"getClassIdEvaluateById";
  79. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
  80. RemoveHUD();
  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. [LoadingView showHUD];
  96. if (![Util connectedToNetWork]) {
  97. showMsgUnconnect();
  98. return;
  99. }
  100. NSMutableArray *arr=[NSMutableArray array];
  101. [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city];
  102. [arr addPro:@"stuOutId" Value:RQ_USER_MANAGER.currentUser.outId];
  103. [arr addPro:@"classId" Value:self.dic[@"classId"]];
  104. // [arr addPro:@"isPage" Value:@"0"];//我很尴尬
  105. NSString* method = @"getEvaluationList";
  106. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
  107. RemoveHUD();
  108. if (!root) {
  109. return;
  110. }
  111. if ([root[@"code"] isEqualToString:@"1"]) {
  112. ShowMsg(root[@"body"]);
  113. return;
  114. } else if ([root[@"code"] isEqualToString:@"-1"]) {
  115. ShowMsg(root[@"msg"]);
  116. return;
  117. }
  118. NSArray * array = root[@"body"];
  119. if (array.count > 0) {
  120. NSDictionary * dic = array[0];
  121. [_dataDic setValue:dic[@"EI_TEACHLEVEL"] forKey:@"teachLevel"];
  122. [_dataDic setValue:dic[@"EVALUATETIME"] forKey:@"evaluateTime"];
  123. [_dataDic setValue:dic[@"EI_SRVMANNER"] forKey:@"srvmanner"];
  124. [_dataDic setValue:dic[@"EI_OVERALL"] forKey:@"overall"];
  125. }
  126. [self myInit];
  127. }];
  128. }
  129. @end