// // ChangeSchoolDetailViewController.m // jiaPei // // Created by 张嵘 on 2019/7/2. // Copyright © 2019 JCZ. All rights reserved. // #import "ChangeSchoolDetailViewController.h" #import "ChangeSchoolDetailListViewController.h" #import "ChangeSchoolDetailFileViewController.h" @interface ChangeSchoolDetailViewController () @property (nonatomic, readwrite, strong) UIView *noticeView; @end @implementation ChangeSchoolDetailViewController #pragma mark - Life Circle - (void)viewDidLoad { [super viewDidLoad]; [self initUI]; } #pragma mark - Public Function + (instancetype)suspendChangeSchoolDetailPageVC { YNPageConfigration *configration = [YNPageConfigration defaultConfig]; configration.pageStyle = YNPageStyleTop; configration.showNavigation = YES; configration.scrollMenu = NO; configration.aligmentModeCenter = NO; /// Item configration.selectedItemColor = UIColor.blackColor; configration.normalItemColor = UIColor.lightGrayColor; configration.itemFont = [UIFont systemFontOfSize:17]; configration.selectedItemFont = [UIFont systemFontOfSize:17]; /// bottomLine configration.showBottomLine = YES; configration.bottomLineBgColor = UIColor.groupTableViewBackgroundColor; configration.bottomLineHeight = .5; /// line configration.lineColor = defGreen; configration.lineHeight = 3; configration.lineWidthEqualFontWidth = true; return [self suspendChangeSchoolDetailPageVCWithConfig:configration]; } + (NSArray *)getArrayVCs { ChangeSchoolDetailListViewController *listVC = [[ChangeSchoolDetailListViewController alloc] init]; ChangeSchoolDetailFileViewController *fileVC = [[ChangeSchoolDetailFileViewController alloc] init]; return @[listVC, fileVC]; } + (NSArray *)getArrayTitles { return @[@"转校详情", @"文件查看"]; } + (instancetype)suspendChangeSchoolDetailPageVCWithConfig:(YNPageConfigration *)config { ChangeSchoolDetailViewController *vc = [ChangeSchoolDetailViewController pageViewControllerWithControllers:[self getArrayVCs] titles:[self getArrayTitles] config:config]; vc.dataSource = vc; vc.delegate = vc; /// 指定默认选择index 页面 vc.pageIndex = 0; return vc; } #pragma mark - Private Functions - (void)initUI { /// 导航栏设置 self.title = @"转校详情"; [self configNavigationBar]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(0, kScreenHeight - 44 - kNavOffSet - (kSafeAreaBottomHeight/2.0), kScreenWidth, 44 + (kSafeAreaBottomHeight/2.0)); [btn setBackgroundColor:defGreen]; [btn setTitle:@"确认转校信息" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside]; ConfirmStatusType confirm = self.changeSchoolListModel.ZXINFO.TZI_STU_CONFIRM; if (confirm == ConfirmStatusFalseType) { [self.view addSubview:btn]; } } - (void)btnAction { SCLAlertView *alert = [[SCLAlertView alloc] initWithNewWindowWidth:kScreenWidth - 32]; alert.customViewColor = defGreen; SCLSwitchView *switchView = [[SCLSwitchView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - 32, 31.f)]; switchView.labelText = @"我已认真阅读《办理须知》,并同意相关条款要求。"; [alert addCustomView:switchView]; alert.viewText.textAlignment = NSTextAlignmentLeft; [alert addButton:@"确定" actionBlock:^(void) { if (switchView.isSelected) { NSMutableArray *arr = [NSMutableArray array]; [arr addPro:@"dqbh" Value:defUser.userDict[@"city"]]; [arr addPro:@"zxInfoId" Value:self.changeSchoolListModel.ZXINFO.TZI_ID]; [arr addPro:@"idcard" Value:self.changeSchoolListModel.ZXINFO.TSO_IDCARD]; NSString *method = @"updZxInfoState"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) { if (!root) { ShowMsgFailed(); return; } if ([root[@"code"] isEqualToString:@"0"]) { if (_kUpResultBlock) { [self.navigationController popViewControllerAnimated:YES]; _kUpResultBlock(YES); } }else { ShowMsg(root[@"body"]? ([[NSString stringWithFormat:@"%@",root[@"body"]] isEqualToString:@""]? [NSString stringWithFormat:@"%@",root[@"body"]] : (root[@"msg"]? : @"请求出错")) : (root[@"msg"]? : @"请求出错")); return; } }]; }else { [LoadingView showMsg:@"请同意相关条款要求"]; } }]; [alert showInfo:@"办理须知" subTitle:@" 2019年6月1日,公安部门推出10项公安交管“放管服”改革新举措,其中第二项为“分科目考试可申请变更一次考试地。申请人申领小型汽车驾驶证期间已通过部分科目考试后,因工作、学习、生活等需要居住地发生变更的,可以在全国范围内申请变更一次考试地。申请人可以持本人身份证件至现居住地车辆管理所申请继续参加其他科目考试,已通过的科目考试成绩继续有效”。根据便民要求,系统进行相关程序设计以满足学员的变更要求。请驾校、学员在办理过程中对以下问题进行确认:\n\n1.驾校已经按照双方签订的《培训合同》或事先约定,办理了相关退费手续,双方无任何经济纠纷。\n\n2.驾校已经按照双方签订的《培训合同》或事先预定,完成责任和义务。\n\n3.因各校管理责任、安全管理区别,学员变更培训机构均按照整科目进行变更。单科目已开展培训,但学时尚未达到单科目学时总数要求,这部分学时将不予保留。转出后,需重新进行该科目培训,重新进行该科目计时。" closeButtonTitle:@"取消" duration:0.0f]; } - (void)initNoticeView { _noticeView = [[UIView alloc] initWithFrame:kFrame]; _noticeView.backgroundColor = windowBlockColor; [[UIApplication sharedApplication].keyWindow addSubview:_noticeView]; NSString *noticeString = @"2019年6月1日,公安部门推出10项公安交管“放管服”改革新举措,其中第二项为“分科目考试可申请变更一次考试地。申请人申领小型汽车驾驶证期间已通过部分科目考试后,因工作、学习、生活等需要居住地发生变更的,可以在全国范围内申请变更一次考试地。申请人可以持本人身份证件至现居住地车辆管理所申请继续参加其他科目考试,已通过的科目考试成绩继续有效”。根据便民要求,系统进行相关程序设计以满足学员的变更要求。请驾校、学员在办理过程中对以下问题进行确认:\n\n1.驾校已经按照双方签订的《培训合同》或事先约定,办理了相关退费手续,双方无任何经济纠纷。\n\n2.驾校已经按照双方签订的《培训合同》或事先预定,完成责任和义务。\n\n3.因各校管理责任、安全管理区别,学员变更培训机构均按照整科目进行变更。单科目已开展培训,但学时尚未达到单科目学时总数要求,这部分学时将不予保留。转出后,需重新进行该科目培训,重新进行该科目计时。"; CGFloat noticeH = [noticeString heightForWid:kSize.width - 80 Font:Font17] + 10; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(20, kNavOffSet, kSize.width - 40, kSize.height - kNavOffSet - 100 - kSafeAreaBottomHeight)]; scrollView.contentSize = CGSizeMake(kSize.width - 40, noticeH + 50); scrollView.backgroundColor = backGroundColor; [_noticeView addSubview:scrollView]; [scrollView addViewWithRect:CGRectMake(20, scrollView.y + scrollView.height, scrollView.width, 1)]; UILabel *noticeLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, kSize.width - 80, noticeH)]; noticeLabel.numberOfLines = 0; [noticeLabel setText:noticeString Font:Font17 TextColor:kTitleColor]; [scrollView addSubview:noticeLabel]; UIView *btnView = [[UIView alloc] initWithFrame:CGRectMake(20, scrollView.y + scrollView.height + 1, scrollView.width, 40)]; btnView.backgroundColor = backGroundColor; [_noticeView addSubview:btnView]; NSArray *titles = @[@"确定"]; CGFloat w = scrollView.width/4.0; for (int i = 0; i < 2; i ++) { UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; if (i == 0) { btn.frame = CGRectMake(0, 0, 2*w, 40); }else{ btn.frame = CGRectMake(w + i*w, 0, w, 40); } [btn setTitle:titles[i] textColor:kTitleColor font:FontTitle fotState:UIControlStateNormal]; [btn target:self tag:20 + i]; [btnView addSubview:btn]; } } - (void)initWithUpResultBlock:(upResultBlock)kUpResultBlock { self.kUpResultBlock = kUpResultBlock; } #pragma mark - YNPageViewControllerDataSource - (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index { UIViewController *vc = pageViewController.controllersM[index]; if ([vc isKindOfClass:[ChangeSchoolDetailListViewController class]]) { ChangeSchoolDetailListViewController *listVC = (ChangeSchoolDetailListViewController *)vc; listVC.info = self.changeSchoolListModel.ZXINFO; return [(ChangeSchoolDetailListViewController *)vc tableView]; }else if ([vc isKindOfClass:[ChangeSchoolDetailFileViewController class]]) { ChangeSchoolDetailFileViewController *fileVC = (ChangeSchoolDetailFileViewController *)vc; fileVC.filesItems = self.changeSchoolListModel.FILES; return [(ChangeSchoolDetailFileViewController *)vc collectionView];; }else { return nil; } } #pragma mark - YNPageViewControllerDelegate - (void)pageViewController:(YNPageViewController *)pageViewController contentOffsetY:(CGFloat)contentOffset progress:(CGFloat)progress { // NSLog(@"--- contentOffset = %f, progress = %f", contentOffset, progress); } /// 返回列表的高度 默认是控制器的高度大小 //- (CGFloat)pageViewController:(YNPageViewController *)pageViewController heightForScrollViewAtIndex:(NSInteger)index { // return kScreenHeight + (kScreenWidth * 0.53) + kScreenHeight; //} - (void)pageViewController:(YNPageViewController *)pageViewController didScrollMenuItem:(UIButton *)itemButton index:(NSInteger)index { NSLog(@"didScrollMenuItem index %ld", index); } @end