WD_Detail_ShenHe.m 5.6 KB

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