ExamStatisticsViewModel.m 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // ExamStatisticsViewModel.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/29.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "ExamStatisticsViewModel.h"
  9. #import "ExamStatisticsSubViewController.h"
  10. #import "ExamStatisticsModel.h"
  11. @implementation ExamStatisticsViewModel
  12. - (CGSize)titleSize {
  13. return CGSizeMake(hd_deviceWidth, 44);
  14. }
  15. - (BOOL)headerStop {
  16. return YES;
  17. }
  18. - (NSMutableArray *)titles {
  19. return @[@"科目一",@"科目二",@"科目三",@"科目四"].mutableCopy;
  20. }
  21. - (NSMutableArray *)controllers {
  22. if (!_controllers) {
  23. NSMutableArray *result = @[].mutableCopy;
  24. //仅测试,所以放入同一类型VC
  25. for (int i = 0; i < self.titles.count; i ++) {
  26. ExamStatisticsSubViewController *vc = [ExamStatisticsSubViewController new];
  27. vc.subViewControllerSecArr = @[[self makeSecTwoModel]].mutableCopy;
  28. [result addObject:vc];
  29. }
  30. _controllers = result;
  31. }
  32. return _controllers;
  33. }
  34. - (HDSectionModel*)makeSecZeroModel {
  35. //该段layout
  36. HDYogaFlowLayout *layout = [HDYogaFlowLayout new];
  37. layout.headerSize = CGSizeMake(kScreenWidth, kScreenWidth * 0.25);
  38. //该段的所有数据封装
  39. HDSectionModel *secModel = [HDSectionModel new];
  40. secModel.sectionHeaderClassStr = @"TrainSummaryHeaderView";
  41. secModel.layout = layout;
  42. return secModel;
  43. }
  44. - (HDSectionModel*)makeSecTwoModel {
  45. NSMutableArray *cellModelArr = @[].mutableCopy;
  46. NSInteger cellCount = 15;
  47. for (int i =0; i < cellCount; i++) {
  48. HDCellModel *model = [HDCellModel new];
  49. ExamStatisticsModel *examStatisticsModel = [ExamStatisticsModel new];
  50. examStatisticsModel.time = @"2019-08-08";
  51. examStatisticsModel.carType = @"C1";
  52. examStatisticsModel.examNum = @"1";
  53. examStatisticsModel.passNum = @"10";
  54. examStatisticsModel.passPercent = @"10%";
  55. model.orgData = examStatisticsModel;
  56. model.cellSize = CGSizeMake(kScreenWidth, 141);
  57. model.cellClassStr = @"ExamStatisticsCell";
  58. [cellModelArr addObject:model];
  59. }
  60. //该段layout
  61. HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
  62. layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0);
  63. layout.justify = YGJustifySpaceBetween;
  64. layout.verticalGap = 10;
  65. layout.footerSize = CGSizeMake(kScreenWidth, 10);
  66. //该段的所有数据封装
  67. HDSectionModel *secModel = [HDSectionModel new];
  68. secModel.sectionHeaderClassStr = @"HomePageNumHeaderView";
  69. secModel.sectionFooterClassStr = @"CommonSecFooterView";
  70. secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
  71. secModel.isNeedAutoCountCellHW = NO;
  72. secModel.sectionDataArr = cellModelArr;
  73. secModel.layout = layout;
  74. return secModel;
  75. }
  76. @end