ChangeSchoolDetailViewController.m 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. //
  2. // ChangeSchoolDetailViewController.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2019/7/2.
  6. // Copyright © 2019 JCZ. All rights reserved.
  7. //
  8. #import "ChangeSchoolDetailViewController.h"
  9. #import "ChangeSchoolDetailListViewController.h"
  10. #import "ChangeSchoolDetailFileViewController.h"
  11. @interface ChangeSchoolDetailViewController () <YNPageViewControllerDelegate, YNPageViewControllerDataSource>
  12. @property (nonatomic, readwrite, strong) UIView *noticeView;
  13. @end
  14. @implementation ChangeSchoolDetailViewController
  15. #pragma mark - Life Circle
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. [self initUI];
  19. }
  20. #pragma mark - Public Function
  21. + (instancetype)suspendChangeSchoolDetailPageVC {
  22. YNPageConfigration *configration = [YNPageConfigration defaultConfig];
  23. configration.pageStyle = YNPageStyleTop;
  24. configration.showNavigation = YES;
  25. configration.scrollMenu = NO;
  26. configration.aligmentModeCenter = NO;
  27. /// Item
  28. configration.selectedItemColor = UIColor.blackColor;
  29. configration.normalItemColor = UIColor.lightGrayColor;
  30. configration.itemFont = [UIFont systemFontOfSize:17];
  31. configration.selectedItemFont = [UIFont systemFontOfSize:17];
  32. /// bottomLine
  33. configration.showBottomLine = YES;
  34. configration.bottomLineBgColor = UIColor.groupTableViewBackgroundColor;
  35. configration.bottomLineHeight = .5;
  36. /// line
  37. configration.lineColor = defGreen;
  38. configration.lineHeight = 3;
  39. configration.lineWidthEqualFontWidth = true;
  40. return [self suspendChangeSchoolDetailPageVCWithConfig:configration];
  41. }
  42. + (NSArray *)getArrayVCs {
  43. ChangeSchoolDetailListViewController *listVC = [[ChangeSchoolDetailListViewController alloc] init];
  44. ChangeSchoolDetailFileViewController *fileVC = [[ChangeSchoolDetailFileViewController alloc] init];
  45. return @[listVC, fileVC];
  46. }
  47. + (NSArray *)getArrayTitles {
  48. return @[@"转校详情", @"文件查看"];
  49. }
  50. + (instancetype)suspendChangeSchoolDetailPageVCWithConfig:(YNPageConfigration *)config {
  51. ChangeSchoolDetailViewController *vc = [ChangeSchoolDetailViewController pageViewControllerWithControllers:[self getArrayVCs]
  52. titles:[self getArrayTitles]
  53. config:config];
  54. vc.dataSource = vc;
  55. vc.delegate = vc;
  56. /// 指定默认选择index 页面
  57. vc.pageIndex = 0;
  58. return vc;
  59. }
  60. #pragma mark - Private Functions
  61. - (void)initUI {
  62. /// 导航栏设置
  63. self.title = @"转校详情";
  64. [self configNavigationBar];
  65. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  66. btn.frame = CGRectMake(0, kScreenHeight - 44 - kNavOffSet - (kSafeAreaBottomHeight/2.0), kScreenWidth, 44 + (kSafeAreaBottomHeight/2.0));
  67. [btn setBackgroundColor:defGreen];
  68. [btn setTitle:@"确认转校信息" forState:UIControlStateNormal];
  69. [btn addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside];
  70. ConfirmStatusType confirm = self.changeSchoolListModel.ZXINFO.TZI_STU_CONFIRM;
  71. if (confirm == ConfirmStatusFalseType) {
  72. [self.view addSubview:btn];
  73. }
  74. }
  75. - (void)btnAction {
  76. SCLAlertView *alert = [[SCLAlertView alloc] initWithNewWindowWidth:kScreenWidth - 32];
  77. alert.customViewColor = defGreen;
  78. SCLSwitchView *switchView = [[SCLSwitchView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - 32, 31.f)];
  79. switchView.labelText = @"我已认真阅读《办理须知》,并同意相关条款要求。";
  80. [alert addCustomView:switchView];
  81. alert.viewText.textAlignment = NSTextAlignmentLeft;
  82. [alert addButton:@"确定" actionBlock:^(void) {
  83. if (switchView.isSelected) {
  84. NSMutableArray *arr = [NSMutableArray array];
  85. [arr addPro:@"dqbh" Value:defUser.userDict[@"city"]];
  86. [arr addPro:@"zxInfoId" Value:self.changeSchoolListModel.ZXINFO.TZI_ID];
  87. [arr addPro:@"idcard" Value:self.changeSchoolListModel.ZXINFO.TSO_IDCARD];
  88. NSString *method = @"updZxInfoState";
  89. [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) {
  90. if (!root) {
  91. ShowMsgFailed();
  92. return;
  93. }
  94. if ([root[@"code"] isEqualToString:@"0"]) {
  95. if (_kUpResultBlock) {
  96. [self.navigationController popViewControllerAnimated:YES];
  97. _kUpResultBlock(YES);
  98. }
  99. }else {
  100. ShowMsg(root[@"body"]? ([[NSString stringWithFormat:@"%@",root[@"body"]] isEqualToString:@""]? [NSString stringWithFormat:@"%@",root[@"body"]] : (root[@"msg"]? : @"请求出错")) : (root[@"msg"]? : @"请求出错"));
  101. return;
  102. }
  103. }];
  104. }else {
  105. [LoadingView showMsg:@"请同意相关条款要求"];
  106. }
  107. }];
  108. [alert showInfo:@"办理须知" subTitle:@" 2019年6月1日,公安部门推出10项公安交管“放管服”改革新举措,其中第二项为“分科目考试可申请变更一次考试地。申请人申领小型汽车驾驶证期间已通过部分科目考试后,因工作、学习、生活等需要居住地发生变更的,可以在全国范围内申请变更一次考试地。申请人可以持本人身份证件至现居住地车辆管理所申请继续参加其他科目考试,已通过的科目考试成绩继续有效”。根据便民要求,系统进行相关程序设计以满足学员的变更要求。请驾校、学员在办理过程中对以下问题进行确认:\n\n1.驾校已经按照双方签订的《培训合同》或事先约定,办理了相关退费手续,双方无任何经济纠纷。\n\n2.驾校已经按照双方签订的《培训合同》或事先预定,完成责任和义务。\n\n3.因各校管理责任、安全管理区别,学员变更培训机构均按照整科目进行变更。单科目已开展培训,但学时尚未达到单科目学时总数要求,这部分学时将不予保留。转出后,需重新进行该科目培训,重新进行该科目计时。" closeButtonTitle:@"取消" duration:0.0f];
  109. }
  110. - (void)initNoticeView {
  111. _noticeView = [[UIView alloc] initWithFrame:kFrame];
  112. _noticeView.backgroundColor = windowBlockColor;
  113. [[UIApplication sharedApplication].keyWindow addSubview:_noticeView];
  114. NSString *noticeString = @"2019年6月1日,公安部门推出10项公安交管“放管服”改革新举措,其中第二项为“分科目考试可申请变更一次考试地。申请人申领小型汽车驾驶证期间已通过部分科目考试后,因工作、学习、生活等需要居住地发生变更的,可以在全国范围内申请变更一次考试地。申请人可以持本人身份证件至现居住地车辆管理所申请继续参加其他科目考试,已通过的科目考试成绩继续有效”。根据便民要求,系统进行相关程序设计以满足学员的变更要求。请驾校、学员在办理过程中对以下问题进行确认:\n\n1.驾校已经按照双方签订的《培训合同》或事先约定,办理了相关退费手续,双方无任何经济纠纷。\n\n2.驾校已经按照双方签订的《培训合同》或事先预定,完成责任和义务。\n\n3.因各校管理责任、安全管理区别,学员变更培训机构均按照整科目进行变更。单科目已开展培训,但学时尚未达到单科目学时总数要求,这部分学时将不予保留。转出后,需重新进行该科目培训,重新进行该科目计时。";
  115. CGFloat noticeH = [noticeString heightForWid:kSize.width - 80 Font:Font17] + 10;
  116. UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(20, kNavOffSet, kSize.width - 40, kSize.height - kNavOffSet - 100 - kSafeAreaBottomHeight)];
  117. scrollView.contentSize = CGSizeMake(kSize.width - 40, noticeH + 50);
  118. scrollView.backgroundColor = backGroundColor;
  119. [_noticeView addSubview:scrollView];
  120. [scrollView addViewWithRect:CGRectMake(20, scrollView.y + scrollView.height, scrollView.width, 1)];
  121. UILabel *noticeLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, kSize.width - 80, noticeH)];
  122. noticeLabel.numberOfLines = 0;
  123. [noticeLabel setText:noticeString Font:Font17 TextColor:kTitleColor];
  124. [scrollView addSubview:noticeLabel];
  125. UIView *btnView = [[UIView alloc] initWithFrame:CGRectMake(20, scrollView.y + scrollView.height + 1, scrollView.width, 40)];
  126. btnView.backgroundColor = backGroundColor;
  127. [_noticeView addSubview:btnView];
  128. NSArray *titles = @[@"确定"];
  129. CGFloat w = scrollView.width/4.0;
  130. for (int i = 0; i < 2; i ++) {
  131. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  132. if (i == 0) {
  133. btn.frame = CGRectMake(0, 0, 2*w, 40);
  134. }else{
  135. btn.frame = CGRectMake(w + i*w, 0, w, 40);
  136. }
  137. [btn setTitle:titles[i] textColor:kTitleColor font:FontTitle fotState:UIControlStateNormal];
  138. [btn target:self tag:20 + i];
  139. [btnView addSubview:btn];
  140. }
  141. }
  142. - (void)initWithUpResultBlock:(upResultBlock)kUpResultBlock {
  143. self.kUpResultBlock = kUpResultBlock;
  144. }
  145. #pragma mark - YNPageViewControllerDataSource
  146. - (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index {
  147. UIViewController *vc = pageViewController.controllersM[index];
  148. if ([vc isKindOfClass:[ChangeSchoolDetailListViewController class]]) {
  149. ChangeSchoolDetailListViewController *listVC = (ChangeSchoolDetailListViewController *)vc;
  150. listVC.info = self.changeSchoolListModel.ZXINFO;
  151. return [(ChangeSchoolDetailListViewController *)vc tableView];
  152. }else if ([vc isKindOfClass:[ChangeSchoolDetailFileViewController class]]) {
  153. ChangeSchoolDetailFileViewController *fileVC = (ChangeSchoolDetailFileViewController *)vc;
  154. fileVC.filesItems = self.changeSchoolListModel.FILES;
  155. return [(ChangeSchoolDetailFileViewController *)vc collectionView];;
  156. }else {
  157. return nil;
  158. }
  159. }
  160. #pragma mark - YNPageViewControllerDelegate
  161. - (void)pageViewController:(YNPageViewController *)pageViewController
  162. contentOffsetY:(CGFloat)contentOffset
  163. progress:(CGFloat)progress {
  164. // NSLog(@"--- contentOffset = %f, progress = %f", contentOffset, progress);
  165. }
  166. /// 返回列表的高度 默认是控制器的高度大小
  167. //- (CGFloat)pageViewController:(YNPageViewController *)pageViewController heightForScrollViewAtIndex:(NSInteger)index {
  168. // return kScreenHeight + (kScreenWidth * 0.53) + kScreenHeight;
  169. //}
  170. - (void)pageViewController:(YNPageViewController *)pageViewController didScrollMenuItem:(UIButton *)itemButton index:(NSInteger)index {
  171. NSLog(@"didScrollMenuItem index %ld", index);
  172. }
  173. @end