123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- //
- // workVC.m
- // LN_School
- //
- // Created by apple on 2017/4/5.
- // Copyright © 2017年 Danson. All rights reserved.
- //
- #import "workVC.h"
- #import "SIcon_button.h"
- #import "SignUpVC.h"
- #import "CheckCourseVC.h"
- #import "TerminalMapVC.h"
- #import "StudentList.h"
- #import "CoachListVC.h"
- #import "SafeList.h"
- #import "AssessorList.h"
- #import "CarList.h"
- #import "payinRealityVC.h"
- #import "TrainPriceList.h"
- #import "QuitSch.h"
- #import "RepairViewController.h"
- #import "EvaluationListVC.h"
- #import "ComplaintsListVC.h"
- #import "RegionsList.h"
- #import "StuExamSearchSetVC.h"
- #import "AllCoachPlanVC.h"
- #import "FenceSiteVC.h"
- #import "NewMessage.h"
- #import "WaringVC.h"
- #import "FaceColloectVC.h"
- @interface workVC ()
- {
- //待办事项
- SIcon_button *btn1;
- SIcon_button *btn2;
- SIcon_button *btn3;
- SIcon_button *btn4;
- }
- @end
- @implementation workVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.title = @"工作";//某某驾校
- self.navigationController.navigationBar.translucent = NO;
- self.view.backgroundColor = KBackGroundColor;
-
- [self myInit];
-
- }
- -(void)viewDidAppear:(BOOL)animated {
- [super viewDidAppear:animated];
- self.tabBarController.tabBar.hidden = NO;
- //刷新待办事项
-
- [self getStatistics];
- }
- - (void)myInit {
-
- // UIView *noUseView = [UIView new];
- // [self.view addSubview:noUseView];
-
- CGFloat x, y, w, h, bd;
- x = 0;
- y = 0;
- w = kSize.width;
- h = kSize.height - kNavOffSet - kTabBarHeight;
- UIScrollView *mainScroll = [[UIScrollView alloc] initWithFrame:KSetDIYFrame];
- mainScroll.showsVerticalScrollIndicator = NO;
- [self.view addSubview:mainScroll];
-
-
-
- bd = 10;
- x = 0;
- y = 0;
- w = kSize.width;
- h = 120;
- UIImageView *imageAD = [[UIImageView alloc] KSetxywh];
- imageAD.contentMode = UIViewContentModeScaleAspectFill;
- imageAD.layer.masksToBounds = YES;
- imageAD.image = [UIImage imageNamed:@"defaultImg"];
- [mainScroll addSubview:imageAD];
-
- y += h;
- h = 40;
- UILabel *label = [[UILabel alloc] KSetxywh];
- label.backgroundColor = [UIColor whiteColor];
- NSString * nameString = [NSString stringWithFormat:@" %@,欢迎您!",defUser.userDict[@"realName"]];
- [label setText:nameString Font:24 TextColor:KTitleColor];
- [mainScroll addSubview:label];
- [label addViewWithRect:CGRectMake(x, y + h - 1, w, 1)];
-
-
- //待办事项
- y += h + bd;
- h = 30;
- label = [[UILabel alloc] KSetxywh];
- label.backgroundColor = [UIColor whiteColor];
- [label setText:@" 待办事项" Font:Font18 TextColor:KTitleColor];
- [mainScroll addSubview:label];
- [label addViewWithRect:CGRectMake(x, y, w, 1)];
- [label addViewWithRect:CGRectMake(x, y + h - 1, w, 1)];
-
- y += h;
- w = h = kSize.width/4.0;
-
- NSArray *imageArray = @[@"work_1",@"work_1",@"work_1",@"work_1"];
- NSArray *titleArray = @[@"待我审核",@"未读消息",@"教学区域",@"终端在线"];
- for (int i = 0; i < 4; i ++) {
-
- SIcon_button *btn = [[SIcon_button alloc] initWithFrame:CGRectMake(i*w, y, w, h)];
- [btn setImage:[UIImage imageNamed:imageArray[i]] withTitle:titleArray[i] textColor:KTitleColor Font:Font16 forState:UIControlStateNormal];
- [btn target:self Tag:i + 1];
- [mainScroll addSubview:btn];
- btn.contentLabel.text = @"0";
-
- switch (i) {
- case 0:
- btn1 = btn;
- break;
- case 1:
- btn2 = btn;
- break;
- case 2:
- btn3 = btn;
- break;
- case 3:
- btn4 = btn;
- break;
- default:
- break;
- }
- }
-
-
- //常用功能
- y += h + bd;
- w = kSize.width;
- h = 30;
- label = [[UILabel alloc] KSetxywh];
- label.backgroundColor = [UIColor whiteColor];
- [label setText:@" 常用功能" Font:Font18 TextColor:KTitleColor];
- [mainScroll addSubview:label];
- [label addViewWithRect:CGRectMake(x, y, w, 1)];
- [label addViewWithRect:CGRectMake(x, y + h - 1, w, 1)];
-
- y += h;
- w = h = kSize.width/4.0;
-
- //添加功能 直接在这里添加 注意:图片数要和title数一致
- //@RQ-MARK 1.0.2修改:”学时送审“模块取消 人脸采集模块位置上移至原“学时送审位置”
- titleArray = @[@"学员报名",@"退学管理",@"人脸采集",@"线下支付",@"培训价格",@"教练车辆",@"终端管理",@"设备报修",@"预约管理",@"报警信息"];
- imageArray = @[@"work_4",@"work_5",@"work_face",@"work_7",@"work_8",@"work_9",@"work_10",@"work_Rep",@"work_Pla",@"work_waring"];
-
- int maxI = (int)ceilf(titleArray.count/4.0) * 4;
- for (int i = 0; i < maxI; i ++) {
-
- int row = i/4;
- int column = i%4;
-
- SIcon_button *btn = [[SIcon_button alloc] initWithFrame:CGRectMake(column*w, y + row*h, w, h)];
-
- if (i < titleArray.count) {
- [btn setImage:[UIImage imageNamed:imageArray[i]] withTitle:titleArray[i] textColor:KTitleColor Font:Font16 forState:UIControlStateNormal];
- [btn target:self Tag:i + 5];
- }else {
- btn.userInteractionEnabled = NO;
- }
-
- [mainScroll addSubview:btn];
-
- if (i%4 != 3) {
- [btn addViewWithRect:CGRectMake((column + 1) * w - 1, y + row * h, 1, h)];
- }else{
- [btn addViewWithRect:CGRectMake(0, y + (row + 1) * h - 1, kSize.width, 1)];
- }
- }
-
-
- //其他功能
- int maxRow = (int)ceilf(titleArray.count/4.0);
- y += maxRow * h + bd;
-
- w = kSize.width;
- h = 30;
- label = [[UILabel alloc] KSetxywh];
- label.backgroundColor = [UIColor whiteColor];
- [label setText:@" 其它功能" Font:Font18 TextColor:KTitleColor];
- [mainScroll addSubview:label];
- [label addViewWithRect:CGRectMake(x, y, w, 1)];
- [label addViewWithRect:CGRectMake(x, y + h - 1, w, 1)];
-
- y += h;
- w = h = kSize.width/4.0;
- //添加功能 直接在这里添加 注意:图片数要和title数一致
- titleArray = @[@"学员",@"教练员",@"安全员",@"考核员",@"评价管理",@"投诉管理",@"电子围栏",@"预考成绩"];
- imageArray = @[@"work_11",@"work_12",@"work_13",@"work_14",@"work_Eva",@"work_Com",@"work_Reg",@"work_Exa"];
-
- maxI = (int)ceilf(titleArray.count/4.0) * 4;
-
- for (int i = 0; i < maxI; i ++) {
-
- int row = i/4;
- int column = i%4;
-
- SIcon_button *btn = [[SIcon_button alloc] initWithFrame:CGRectMake(column*w, y + row*h, w, h)];
-
- if (i < titleArray.count) {
- [btn setImage:[UIImage imageNamed:imageArray[i]] withTitle:titleArray[i] textColor:KTitleColor Font:Font16 forState:UIControlStateNormal];
- [btn target:self Tag:i + 20];
- }else {
- btn.userInteractionEnabled = NO;
- }
-
- [mainScroll addSubview:btn];
-
- if (i%4 != 3) {
- [btn addViewWithRect:CGRectMake((column + 1) * w - 1, y + row * h, 1, h)];
- }else{
- [btn addViewWithRect:CGRectMake(0, y + (row + 1) * h - 1, kSize.width, 1)];
- }
- }
-
-
- UIView *lastView = mainScroll.subviews.lastObject;
- [mainScroll setContentSize:CGSizeMake(kSize.width, lastView.bottom + 2*bd)];
-
- }
- - (void)btnClick:(UIButton *)sender {
-
- // SIcon_button *btn = (SIcon_button *)sender;
- // NSLog(@"工作点击----><>%@",btn.contentLabel.text);
-
- switch (sender.tag) {
- case 1://待我审核
- {
- CheckCourseVC *vc = [[CheckCourseVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- }
- break;
- case 2://未读消息
- {
- // NewMessage *vc = [[NewMessage alloc]init];
- // [self navPushHideTabbarToVC:vc];
- }
- break;
- case 3://教学区域
-
- break;
- case 4://终端在线
- {
- // [Tools permissionValidationWithID:@"81" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- // if (!isCan) {
- // if (failureStr) {
- // showMsgByAlert(self, failureStr);
- // }
- // return;
- //
- // }
- // TerminalMapVC *vc = [[TerminalMapVC alloc] init];
- // [self navPushHideTabbarToVC:vc];
- // }];
- }
- break;
- case 5://学员报名
- {
- SignUpVC *vc = [[SignUpVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- }
- break;
- case 6://退学管理
- {
- [Tools permissionValidationWithID:@"1102" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- QuitSch * vc = [[QuitSch alloc]init];
- [self navPushHideTabbarToVC:vc];
-
- }];
- }
- break;
- case 7://人脸采集
- {
- // StudentList * vc = [[StudentList alloc]init];
- // vc.pageType = PageType_FaceCapture;
- // [self navPushHideTabbarToVC:vc];
- FaceColloectVC *vc = [[FaceColloectVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- }
- break;
- case 8://线下支付
- {
- payinRealityVC *vc = [[payinRealityVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- }
- break;
- case 9://培训价格
- {
- [Tools permissionValidationWithID:@"12" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- TrainPriceList * vc = [[TrainPriceList alloc]init];
- [self navPushHideTabbarToVC:vc];
- }];
- }
- break;
- case 10://教练车辆
- {
- [Tools permissionValidationWithID:@"9" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- CarList * vc = [[CarList alloc]init];
- [self navPushHideTabbarToVC:vc];
- }];
- }
- break;
- case 11://终端管理
- {
- ShowMsgUnOpen();
- // [Tools permissionValidationWithID:@"81" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- // if (!isCan) {
- // if (failureStr) {
- // showMsgByAlert(self, failureStr);
- // }
- // return;
- //
- // }
- // TerminalMapVC *vc = [[TerminalMapVC alloc] init];
- // [self navPushHideTabbarToVC:vc];
- // }];
- }
- break;
- case 12://设备报修
- {
- RepairViewController *vc = [[RepairViewController alloc]init];
- [self navPushHideTabbarToVC:vc];
- }
- break;
- case 13://预约管理
- {
- [Tools permissionValidationWithID:@"1082" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- [self getSchPlaces];
- }];
- }
- break;
- case 14://报警
- {
- [Tools permissionValidationWithID:@"81" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- WaringVC *vc = [[WaringVC alloc] init];
- [self navPushHideTabbarToVC:vc];
-
- }];
- }
- break;
-
-
- //其他功能
- case 20://学员
- {
- [Tools permissionValidationWithID:@"52" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- StudentList * vc = [[StudentList alloc]init];
- [self navPushHideTabbarToVC:vc];
-
- }];
- }
- break;
- case 21://教练员
- {
- [Tools permissionValidationWithID:@"8" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- CoachListVC * vc = [[CoachListVC alloc]init];
- [self navPushHideTabbarToVC:vc];
- }];
- }
- break;
- case 22://安全员
- {
- [Tools permissionValidationWithID:@"11" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- SafeList *vc = [[SafeList alloc]init];
- [self navPushHideTabbarToVC:vc];
- }];
- }
- break;
- case 23://考核员
- {
- [Tools permissionValidationWithID:@"10" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- AssessorList * vc = [[AssessorList alloc]init];
- [self navPushHideTabbarToVC:vc];
- }];
- }
- break;
- case 24://评价
- {
- EvaluationListVC * vc = [[EvaluationListVC alloc]init];
- [self navPushHideTabbarToVC:vc];
- }
- break;
- case 25://投诉
- {
- ComplaintsListVC * vc = [[ComplaintsListVC alloc]init];
- [self navPushHideTabbarToVC:vc];
- }
- break;
- case 26://电子围栏
- {
- [Tools permissionValidationWithID:@"13" view:self.view result:^(BOOL isCan, NSString *failureStr) {
- if (!isCan) {
- if (failureStr) {
- showMsgByAlert(self, failureStr);
- }
- return;
-
- }
-
- RegionsList * vc = [[RegionsList alloc]init];
- [self navPushHideTabbarToVC:vc];
- }];
- }
- break;
- case 27://预考成绩
- {
- StuExamSearchSetVC * vc = [[StuExamSearchSetVC alloc]init];
- [self navPushHideTabbarToVC:vc];
- }
- break;
- default:
- break;
- }
- }
- #pragma mark 数据请求
- - (void)getStatistics {
-
- if (![NetManager connectedToNetWork]) {
- showMsgUnconnect();
- return;
- }
-
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setObject:defUser.userDict[@"id"] forKey:@"userId"];
- [dic setObject:defUser.userDict[@"dqbh"] forKey:@"dqbh"];
- [dic setObject:defUser.userDict[@"qxbh"] forKey:@"qxbh"];
-
- NSString *method = @"getStatistics";
- [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
-
- if (!root) {
- return;
- }
- if ([root[@"code"] integerValue] == 1) {
- return;
- }
-
- NSDictionary * dic = root[@"body"];
- self->btn1.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"TRAIN_CT"]];
- self->btn2.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"MSG_CT"]];
- self->btn3.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"REGION_CT"]];
- self->btn4.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"CONNECT_CT"]];
-
- }];
- }
- #pragma mark 查是否有场地
- - (void)getSchPlaces
- {
- if (![NetManager connectedToNetWork]) {
-
- AllCoachPlanVC *vc = [[AllCoachPlanVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- return;
- }
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setObject:defUser.userDict[@"school"] forKey:@"schid"];
-
- NSString *method = @"getSchPlaces";
-
- [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
-
- if (!root) {
- AllCoachPlanVC *vc = [[AllCoachPlanVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- return;
- }
- if ([root[@"code"] integerValue] == 1) {
- AllCoachPlanVC *vc = [[AllCoachPlanVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- return;
- }
-
- if ([root[@"body"] count] < 1) {
- AllCoachPlanVC *vc = [[AllCoachPlanVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- }else {
-
- FenceSiteVC *vc = [[FenceSiteVC alloc] init];
- vc.dataArray = root[@"body"];
- [self navPushHideTabbarToVC:vc];
- }
- }];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- }
- @end
|