WD_Detail_ShenHe.m 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. //
  2. // WD_Detail_ShenHe.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/6/8.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "WD_Detail_ShenHe.h"
  9. @interface WD_Detail_ShenHe ()<UITextViewDelegate,UIScrollViewDelegate>
  10. {
  11. UITextView * _tx;
  12. UISegmentedControl * _seg;
  13. }
  14. @end
  15. @implementation WD_Detail_ShenHe
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. /*
  19. 1驾校审核通知
  20. 2教练审核通知
  21. 3教练车审核通知
  22. 4终端审核通知
  23. 5学员转校审核通知
  24. */
  25. switch ([self.shenheType integerValue]) {
  26. case 1:
  27. self.navigationItem.title = @"驾校审核";
  28. break;
  29. case 2:
  30. self.navigationItem.title = @"教练审核";
  31. break;
  32. case 3:
  33. self.navigationItem.title = @"教练车审核";
  34. break;
  35. case 4:
  36. self.navigationItem.title = @"终端审核";
  37. break;
  38. case 5:
  39. self.navigationItem.title = @"学员转校审核";
  40. break;
  41. default:
  42. break;
  43. }
  44. //
  45. // UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 60, 25)];
  46. // btn.backgroundColor = COLOR_THEME;
  47. // [btn setTitle:@"发送" textColor:[UIColor whiteColor] font:15 fotState:0];
  48. // [btn addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside];
  49. //
  50. // self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:btn];
  51. //
  52. UIScrollView * scrV = [[UIScrollView alloc]initWithFrame:kFrame];
  53. scrV.contentSize = CGSizeMake(0, kSize.height);
  54. scrV.showsVerticalScrollIndicator = NO;
  55. scrV.delegate = self;
  56. [self.view addSubview:scrV];
  57. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapHandle)];
  58. [scrV addGestureRecognizer:tap];
  59. UILabel *lab1 = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, 130, 40)];
  60. lab1.text = @"请选择审核结果:";
  61. lab1.font = [UIFont systemFontOfSize:17];
  62. [scrV addSubview:lab1];
  63. _seg = [[UISegmentedControl alloc]initWithItems:@[@"同意",@"不同意"]];
  64. _seg.frame = CGRectMake(150, 25, kSize.width-60-130, 30);
  65. _seg.selectedSegmentIndex = 0;
  66. _seg.tintColor = COLOR_THEME;
  67. [scrV addSubview:_seg];
  68. UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(10, 80, kSize.width, 30)];
  69. lab.text = @"请输入审核原因:";
  70. lab.font = [UIFont systemFontOfSize:17];
  71. [scrV addSubview:lab];
  72. _tx = [[UITextView alloc]initWithFrame:CGRectMake(20, 120, kSize.width-40, 180)];
  73. _tx.delegate = self;
  74. _tx.returnKeyType = UIReturnKeyDone;
  75. _tx.font = [UIFont systemFontOfSize:15];
  76. [scrV addSubview:_tx];
  77. UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(10, 320, kSize.width-20, 50)];
  78. btn.backgroundColor = COLOR_THEME;
  79. btn.clipsToBounds = YES;
  80. btn.layer.cornerRadius = 5;
  81. [btn setTitle:@"确定审核" textColor:[UIColor whiteColor] font:15 fotState:0];
  82. [btn addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside];
  83. [scrV addSubview:btn];
  84. }
  85. -(void)rightBtnClick{
  86. [self.view endEditing:YES];
  87. if (_tx.text.length == 0) {
  88. [self showMsgByAlertVCWithString:@"请输入审核原因"];
  89. return;
  90. }
  91. //审核
  92. NSString *resultStr = [NSString stringWithFormat:@"%ld",_seg.selectedSegmentIndex+1];
  93. NSMutableString *mStr = [NSMutableString new];
  94. for (NSString *theId in self.ids) {
  95. [mStr appendString:[NSString stringWithFormat:@"%@,",theId]];
  96. }
  97. NSString *ids = [mStr substringToIndex:mStr.length-1];
  98. NSMutableDictionary * mDic = [NSMutableDictionary new];
  99. [mDic setObject:self.shenheType forKey:@"type"];
  100. [mDic setObject:ids forKey:@"ids"];
  101. [mDic setObject:MYAPPDELEGATE.userDic[@"id"] forKey:@"userId"];
  102. [mDic setObject:resultStr forKey:@"result"];//1同意 2不同意
  103. [mDic setObject:_tx.text forKey:@"reason"];
  104. // [self showMsgByAlertVCWithString:[NSString stringWithFormat:@"结果:%@,意见:%@,ids:%@",resultStr,_tx.text,mStr]];
  105. [self getDataWithDic:mDic method:@"auditRecord" block:^(NSDictionary *successDic) {
  106. UIAlertController * alert = [UIAlertController alertControllerWithTitle:nil message:@"审核成功" preferredStyle:UIAlertControllerStyleAlert];
  107. [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  108. NSArray *vcs = self.navigationController.childViewControllers;
  109. [self.navigationController popToViewController:vcs[1] animated:YES];
  110. if (self.block) {
  111. self.block();
  112. }
  113. }]];
  114. [self.tabBarController presentViewController:alert animated:YES completion:nil];
  115. }];
  116. }
  117. -(void)tapHandle{
  118. [self.view endEditing:YES];
  119. }
  120. -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
  121. [self.view endEditing:YES];
  122. }
  123. -(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
  124. if ([text isEqualToString:@"\n"]) {
  125. [textView resignFirstResponder];
  126. return NO;
  127. }
  128. return YES;
  129. }
  130. - (void)didReceiveMemoryWarning {
  131. [super didReceiveMemoryWarning];
  132. // Dispose of any resources that can be recreated.
  133. }
  134. /*
  135. #pragma mark - Navigation
  136. // In a storyboard-based application, you will often want to do a little preparation before navigation
  137. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  138. // Get the new view controller using [segue destinationViewController].
  139. // Pass the selected object to the new view controller.
  140. }
  141. */
  142. @end