123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- //
- // JobVC.m
- // LNManager
- //
- // Created by EchoShacolee on 2017/4/13.
- // Copyright © 2017年 lee. All rights reserved.
- //
- #import "JobVC.h"
- #import "SchoolListVC.h"
- #import "RegionsList.h"
- #import "XueShiCheckList.h"
- #import "EvaluationListVC.h"
- #import "ComplaintsListVC.h"
- //#import "ReportListVC.h"
- #import "TerminalVC.h"
- #import "statisticsVC.h"
- #import "NotifySelectObjVC.h"
- @interface JobVC ()<UITableViewDelegate,UITableViewDataSource>
- {
- NSArray *_titleArr;
-
- UITableView * _tableView;
-
- NSMutableArray *_topLabArr;//存放需要更新显示的lab
- }
- @end
- @implementation JobVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.navigationItem.title = @"功能";
- _titleArr = @[@[@"待我审核",@"新增消息",@"待审区域",@"在线终端"],
- @[@"学时审核",@"教学日志",@"通知下发",@"终端管理"],
- @[@"机构管理",
- @"教练管理",
- @"考核员管理",
- @"安全员管理",
- @"教练车管理",
- @"学员管理",
- @"教学区域",
- @"评价管理",@"投诉管理",
- // @"举报管理",
- @"学员统计"]];
- _topLabArr = [NSMutableArray new];
-
- [self myInit];
- }
- -(void)viewDidAppear:(BOOL)animated{
- [super viewDidAppear:animated];
- [self getData];
- }
- -(void)viewWillDisappear:(BOOL)animated{
-
- // [self setHidesBottomBarWhenPushed:NO];
- [super viewWillDisappear:animated];
- }
- -(void)getData{
-
- NSMutableDictionary * mDic = [[NSMutableDictionary alloc]init];
- [mDic setValue:MYAPPDELEGATE.userDic[@"id"] forKey:@"userId"];
- [mDic setValue:MYAPPDELEGATE.userDic[@"qxbh"] forKey:@"qxbh"];
- [mDic setValue:MYAPPDELEGATE.userDic[@"dqbh"] forKey:@"dqbh"];
- [NetworkManager requestWithMethod:@"getStatistics" parameters:mDic type:0 handler:^(NSDictionary *successDic, NSString *failureStr) {
-
- if (failureStr) {
-
- return;
- }
-
- if ([successDic[@"code"] isEqualToString:@"1"]) {
- return;
- }
-
- NSArray * keys = @[@"auditRecCnt",@"msgCnt",@"auditRegionCnt",@"onlineDevCnt"];
- if (successDic) {
- NSDictionary * dic = successDic[@"body"];
- int i=0;
- for (UILabel *lab in _topLabArr) {
- lab.text = [NSString stringWithFormat:@"%@",dic[keys[i]]];
- i++;
- }
- }
- }];
- }
- -(void)myInit{
-
- _tableView = [[UITableView alloc]initWithFrame:kFrame style:UITableViewStylePlain];
- _tableView.backgroundColor = KBackGroundColor;
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.showsVerticalScrollIndicator = NO;
- _tableView.estimatedSectionHeaderHeight = 0;
- _tableView.estimatedSectionFooterHeight = 0;
- [self.view addSubview:_tableView];
-
- // UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 100)];
- // _tableView.tableFooterView = view;
- }
- #pragma mark tableview代理相关
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
-
- return 3;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-
- return 1;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- CGFloat height = kSize.width/4;
- switch (indexPath.section) {
- case 0:
- return (height+40)+height + 20;
- break;
- case 1:
- return height+40 + 10;
- break;
- case 2:
- return height*3+40 + 20;
- break;
-
- default:
- break;
- }
- return 0;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- NSArray * imgTitles = @[@[@"ic_check_train",@"ic_teach_log",@"ic_notify",@"ic_terminal_manager"],
- @[@"ic_school_manager",
- @"ic_coach_manager",
- @"ic_assessor_manager",
- @"ic_securitor_manager",
- @"ic_car_manager",
- @"ic_student_manager",
- @"ic_teach_area",
- @"ic_pingjia_manager",
- @"ic_tousu_manager",
- // @"ic_jubao_manager",
- @"ic_waring_manager",
- ]];
- NSString * cellId = [NSString stringWithFormat:@"cellId%ld",(long)indexPath.row];
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
-
- if (cell) {
-
- return cell;
- }else{
-
- cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
-
- CGSize size = kSize;//cell.contentView.frame.size因为上面的特殊处理导致这个行不通了
- CGFloat height = kSize.width/4;
-
- if (indexPath.section == 0) {
-
- //顶部图片
- UIImageView *imgV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, size.width, height+40)];
- imgV.image = [UIImage imageNamed:@"job_top"];
- [cell.contentView addSubview:imgV];
-
- for (int i=0; i<[_titleArr[0] count]; i++) {
-
- UILabel *topLab = [[UILabel alloc]init];
- topLab.text = @"0";
- [_topLabArr addObject:topLab];
- UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
- button.frame = CGRectMake(i*size.width/4, height+50, size.width/4, height);
- [button setTitleUnderImgWithTitle:_titleArr[0][i] TitleColor:[UIColor grayColor] Image:nil label:topLab];
- button.tag = 10+i;
- [button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- [cell.contentView addSubview:button];
- }
-
- }else if (indexPath.section == 1){
-
- // UILabel * lab2 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, kSize.width, 50)];
- // lab2.text = [NSString stringWithFormat:@" %@,欢迎您!",MYAPPDELEGATE.userDic[@"realName"]];
- // lab2.textColor = RGB_COLOR(70, 70, 70);
- // lab2.font = [UIFont systemFontOfSize:20];
- // lab2.layer.borderWidth = .7f;
- // lab2.layer.borderColor = [UIColor colorWithRed:230/255.0f green:230/255.0f blue:230/255.0f alpha:1].CGColor;
- // [cell.contentView addSubview:lab2];
-
- //
- UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 5, kSize.width, 40)];
- lab.text = @" 常用功能";
- lab.textColor = [UIColor darkGrayColor];
- lab.font = [UIFont systemFontOfSize:17];
- [cell.contentView addSubview:lab];
-
- //
- for (int i=0; i<[_titleArr[1] count]; i++) {
-
- UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
- button.frame = CGRectMake(i*size.width/4, 45, size.width/4, height);
- [button setTitleUnderImgWithTitle:_titleArr[1][i] TitleColor:[UIColor blackColor] Image:[UIImage imageNamed:imgTitles[0][i]] label:nil];
- button.tag = 100+i;
- [button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- [cell.contentView addSubview:button];
- }
-
- }else if (indexPath.section == 2){
-
- UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 5, kSize.width, 40)];
- lab.text = @" 其它功能";
- lab.textColor = [UIColor darkGrayColor];
- lab.font = [UIFont systemFontOfSize:17];
- [cell.contentView addSubview:lab];
-
- for (int i=0; i<[_titleArr[2] count]; i++) {
-
- UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
- button.frame = CGRectMake(i%4*size.width/4, 45+i/4*height, size.width/4, height);
- [button setTitleUnderImgWithTitle:_titleArr[2][i] TitleColor:[UIColor blackColor] Image:[UIImage imageNamed:imgTitles[1][i]] label:nil];
- button.tag = 1000+i;
- [button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- [cell.contentView addSubview:button];
- }
-
- }
-
- return cell;
- }
-
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 0.1f;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
- return .1;
- }
- -(void)btnClick:(UIButton *)sender{
-
- //type/@[@"驾校管理0",@"教练管理1",@"考核员管理2",@"安全员管理3",@"教练车管理5",@"学员管理4",@"学时审核6"] @"教学日志"7 @"通知下发"8 终端管理9 家学区域 10
- switch (sender.tag) {
- case 10:
- {
- XueShiCheckList * vc = [[XueShiCheckList alloc]init];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 11:
- {
- //未读消息
- self.tabBarController.selectedIndex = 0;
- }
- break;
- case 12:
- {
- //待审核教学区域
- RegionsList * vc = [[RegionsList alloc]init];
- vc.type = @"1";
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 13:
- {
- //在线终端
- TerminalVC * vc = [[TerminalVC alloc]init];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 100:
- {
- XueShiCheckList * vc = [[XueShiCheckList alloc]init];
- vc.navigationItem.title = @"学时审核";
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 101:
- {
- SchoolListVC *vc = [[SchoolListVC alloc]init];
- vc.navigationItem.title = @"教学日志";
- vc.type = 7;//教学日志
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 102:
- {
- //通知下发
- NotifySelectObjVC *vc = [[NotifySelectObjVC alloc]init];
- vc.navigationItem.title = @"通知下发";
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 103:
- {
- SchoolListVC *vc = [[SchoolListVC alloc]init];
- vc.navigationItem.title = @"终端管理";
- vc.type = 9;//终端管理
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1000:
- {
- SchoolListVC *vc = [[SchoolListVC alloc]init];
- vc.navigationItem.title = @"驾校管理";
- vc.type = 0;//驾校管理0
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1001:
- {
- SchoolListVC *vc = [[SchoolListVC alloc]init];
- vc.navigationItem.title = @"教练管理";
- vc.type = 1;//教练管理1
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1002:
- {
- SchoolListVC *vc = [[SchoolListVC alloc]init];
- vc.navigationItem.title = @"考核员管理";
- vc.type = 2;//考核员管理2
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1003:
- {
- SchoolListVC *vc = [[SchoolListVC alloc]init];
- vc.navigationItem.title = @"安全员管理";
- vc.type = 3;//安全员管理3
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1004:
- {
- SchoolListVC *vc = [[SchoolListVC alloc]init];
- vc.navigationItem.title = @"教练车管理";
- vc.type = 5;//@""教练车管理5
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1005:
- {
- SchoolListVC *vc = [[SchoolListVC alloc]init];
- vc.navigationItem.title = @"学员管理";
- vc.type = 4;//学员管理4
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1006:
- {
- //教学区域
- RegionsList *vc = [[RegionsList alloc]init];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1007:
- {
- //评价管理
- EvaluationListVC *vc = [[EvaluationListVC alloc]init];
- vc.navigationItem.title = @"评价管理";
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1008:
- {
- //投诉管理
- ComplaintsListVC *vc = [[ComplaintsListVC alloc]init];
- vc.navigationItem.title = @"投诉管理";
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 1009:
- {
- //学员统计
- statisticsVC *vc = [[statisticsVC alloc] init];
- [self.navigationController pushViewController:vc animated:YES];
-
- // WaringVC *vc = [[WaringVC alloc] init];
- // [self.navigationController pushViewController:vc animated:YES];
-
- }
- break;
- //举报管理
- // ReportListVC *vc = [[ReportListVC alloc]init];
- // vc.navigationItem.title = @"举报管理";
- // [self.navigationController pushViewController:vc animated:YES];
-
- default:
- break;
- }
-
- }
- - (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
|