// // QuitSch.m // LN_School // // Created by EchoShacolee on 2017/4/22. // Copyright © 2017年 Danson. All rights reserved. // #import "QuitSch.h" #import "ApplyQuit.h"//申请退学 #import "QuitShcoolList.h"//是列表的cell #import "MJRefresh.h" #import "MengBanView.h" typedef NS_ENUM(NSInteger, MyGetDataType) { //正常请求数据 MyGetDataTypeNomal=0, //下拉刷新请求数据 MyGetDataTypeHeaderRefresh, //上拉加载更多请求数据 MyGetDataTypeFooterRefresh }; #define JOb_DETAIL_BOTTOMBAR_HEIGHT 50 @interface QuitSch () { UITableView * _tableView; NSMutableArray *_dataSurce; NSMutableDictionary * _requestDic; //记录页书 NSInteger _currentPageNum; //正在加载的状态 BOOL _IS_LOADING; //加载数据的类型 MyGetDataType _getDataType; // HolderView * _holderV; //搜索 MengBanView * _mengBanView; NSString *_name; NSString *_cardNum; NSString *_startDate; NSString *_endDate; BOOL haveRequestPermission; } @end @implementation QuitSch - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"退学学员列表"; self.navigationController.navigationBar.translucent = NO; self.view.backgroundColor = KBackGroundColor; [self goBackByNavigation]; _dataSurce = [NSMutableArray new]; _currentPageNum = 0; _IS_LOADING = NO; _getDataType = MyGetDataTypeNomal; _name = @""; _cardNum = @""; _startDate = @""; _endDate = @""; [self setRefreshAction]; [Tools permissionValidationWithID:@"1103" view:self.view result:^(BOOL isCan, NSString *failureStr) { [self myInitWithPermission:isCan]; [self getData]; }]; } -(void)myInitWithPermission:(BOOL)permission{ [self customRight]; //处理底部”上拉加载更多“显示异常(5c,ios10) UIView *view = [[UIView alloc]init]; [self.view addSubview:view]; CGFloat tableHeight = kSize.height-kNavOffSet-SafeAreaBottomHeight; if (myDelegate.isSchool) { [self createBottomBarWithtoolTitles:@[@"登记"]]; tableHeight = kSize.height-kNavOffSet-SafeAreaBottomHeight-(permission?JOb_DETAIL_BOTTOMBAR_HEIGHT:0); } _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kSize.width, tableHeight)]; _tableView.dataSource = self; _tableView.delegate = self; [self.view addSubview:_tableView]; _tableView.tableFooterView = [UIView new]; _holderV = [[HolderView alloc]initWithFrame:_tableView.frame]; [_holderV freshBlock:^{ [self headerRefresh]; }]; [self.view addSubview:_holderV]; } #pragma mark - 右上角btn -(void)customRight{ UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem]; btn.frame = CGRectMake(0, 0, 43, 44); btn.titleLabel.font = [UIFont systemFontOfSize:17]; [btn setTitle:@"搜索" forState:UIControlStateNormal]; [btn setTitleColor:defGreen forState:UIControlStateNormal]; [btn addTarget:self action:@selector(setMengbanView) forControlEvents:UIControlEventTouchUpInside]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn]; } -(void)setMengbanView{ if (_mengBanView) { [_mengBanView showView]; return; } UITextField * tf = [[UITextField alloc] initWithFrame:CGRectZero]; tf.placeholder = @"请输入学员姓名"; tf.clearButtonMode = UITextFieldViewModeWhileEditing; UITextField * tf2 = [[UITextField alloc] initWithFrame:CGRectZero]; tf2.keyboardType = UIKeyboardTypeNumbersAndPunctuation; tf2.placeholder = @"请输入学员证件号码"; tf2.clearButtonMode = UITextFieldViewModeWhileEditing; NSString *start = @"开始时间"; NSString *end = @"结束时间"; NSArray * buttonsArray = @[@[@"3",tf],@[@"3",tf2],@[@"2",start],@[@"2",end]]; _mengBanView = [[MengBanView alloc]initWithTitileStr:nil buttonsArray:buttonsArray isAllbtn:NO block:^(NSArray *array) { _name = array[0]; _cardNum = array[1]; _startDate = array[2]; if ([_startDate isEqualToString:start]) { _startDate = @""; } _endDate = array[3]; if ([_endDate isEqualToString:end]) { _endDate = @""; } [self getData]; }]; [_mengBanView showView]; } #pragma mark 创建BottomBarButton -(void)createBottomBarWithtoolTitles:(NSArray *)toolTitles{ float widthBtn = (kSize.width-1*toolTitles.count+1)/toolTitles.count; float HeightBth = JOb_DETAIL_BOTTOMBAR_HEIGHT; for (int i=0; i