// // WD_Detail_ShenHe.m // LNManager // // Created by EchoShacolee on 2017/6/8. // Copyright © 2017年 lee. All rights reserved. // #import "WD_Detail_ShenHe.h" @interface WD_Detail_ShenHe () { UITextView * _tx; UISegmentedControl * _seg; } @end @implementation WD_Detail_ShenHe - (void)viewDidLoad { [super viewDidLoad]; /* 1驾校审核通知 2教练审核通知 3教练车审核通知 4终端审核通知 */ switch ([self.shenheType integerValue]) { case 1: self.navigationItem.title = @"驾校审核"; break; case 2: self.navigationItem.title = @"教练审核"; break; case 3: self.navigationItem.title = @"教练车审核"; break; case 4: self.navigationItem.title = @"终端审核"; break; default: break; } // // UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 60, 25)]; // btn.backgroundColor = COLOR_THEME; // [btn setTitle:@"发送" textColor:[UIColor whiteColor] font:15 fotState:0]; // [btn addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside]; // // self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:btn]; // UIScrollView * scrV = [[UIScrollView alloc]initWithFrame:kFrame]; scrV.contentSize = CGSizeMake(0, kSize.height); scrV.showsVerticalScrollIndicator = NO; scrV.delegate = self; [self.view addSubview:scrV]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapHandle)]; [scrV addGestureRecognizer:tap]; UILabel *lab1 = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, 130, 40)]; lab1.text = @"请选择审核结果:"; lab1.font = [UIFont systemFontOfSize:17]; [scrV addSubview:lab1]; _seg = [[UISegmentedControl alloc]initWithItems:@[@"同意",@"不同意"]]; _seg.frame = CGRectMake(150, 25, kSize.width-60-130, 30); _seg.selectedSegmentIndex = 0; _seg.tintColor = COLOR_THEME; [scrV addSubview:_seg]; UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(10, 80, kSize.width, 30)]; lab.text = @"请输入审核原因:"; lab.font = [UIFont systemFontOfSize:17]; [scrV addSubview:lab]; _tx = [[UITextView alloc]initWithFrame:CGRectMake(20, 120, kSize.width-40, 180)]; _tx.delegate = self; _tx.returnKeyType = UIReturnKeyDone; _tx.font = [UIFont systemFontOfSize:15]; [scrV addSubview:_tx]; UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(10, 320, kSize.width-20, 50)]; btn.backgroundColor = COLOR_THEME; btn.clipsToBounds = YES; btn.layer.cornerRadius = 5; [btn setTitle:@"确定审核" textColor:[UIColor whiteColor] font:15 fotState:0]; [btn addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside]; [scrV addSubview:btn]; } -(void)rightBtnClick{ [self.view endEditing:YES]; if (_tx.text.length == 0) { [self showMsgByAlertVCWithString:@"请输入审核原因"]; return; } //审核 NSString *resultStr = [NSString stringWithFormat:@"%ld",_seg.selectedSegmentIndex+1]; NSMutableString *mStr = [NSMutableString new]; for (NSString *theId in self.ids) { [mStr appendString:[NSString stringWithFormat:@"%@,",theId]]; } NSString *ids = [mStr substringToIndex:mStr.length-1]; NSMutableDictionary * mDic = [NSMutableDictionary new]; [mDic setObject:self.shenheType forKey:@"type"]; [mDic setObject:ids forKey:@"ids"]; [mDic setObject:MYAPPDELEGATE.userDic[@"id"] forKey:@"userId"]; [mDic setObject:resultStr forKey:@"result"];//1同意 2不同意 [mDic setObject:_tx.text forKey:@"reason"]; // [self showMsgByAlertVCWithString:[NSString stringWithFormat:@"结果:%@,意见:%@,ids:%@",resultStr,_tx.text,mStr]]; [self getDataWithDic:mDic method:@"auditRecord" block:^(NSDictionary *successDic) { UIAlertController * alert = [UIAlertController alertControllerWithTitle:nil message:@"审核成功" preferredStyle:UIAlertControllerStyleAlert]; [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSArray *vcs = self.navigationController.childViewControllers; [self.navigationController popToViewController:vcs[1] animated:YES]; if (self.block) { self.block(); } }]]; [self.tabBarController presentViewController:alert animated:YES completion:nil]; }]; } -(void)tapHandle{ [self.view endEditing:YES]; } -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ [self.view endEditing:YES]; } -(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ if ([text isEqualToString:@"\n"]) { [textView resignFirstResponder]; return NO; } return YES; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end