TrainSummaryViewModel.m 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. //
  2. // TrainSummaryViewModel.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/26.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "TrainSummaryViewModel.h"
  9. #import "TrainSummarySubViewController.h"
  10. @implementation TrainSummaryViewModel
  11. - (CGSize)titleSize {
  12. return CGSizeMake(hd_deviceWidth, 44);
  13. }
  14. - (BOOL)headerStop {
  15. return YES;
  16. }
  17. - (NSMutableArray *)topSecArr {
  18. if (!_topSecArr) {
  19. _topSecArr = @[[self makeSecZeroModel]].mutableCopy;
  20. }
  21. return _topSecArr;
  22. }
  23. - (NSMutableArray *)titles {
  24. return @[@"学时要求",@"学时",@"状态"].mutableCopy;
  25. }
  26. - (NSMutableArray *)controllers {
  27. if (!_controllers) {
  28. NSMutableArray *result = @[].mutableCopy;
  29. //仅测试,所以放入同一类型VC
  30. for (int i=0; i<3; i++) {
  31. TrainSummarySubViewController *vc = [TrainSummarySubViewController new];
  32. vc.subViewControllerSecArr = @[[self makeSecTwoModelWithTrainSummaryPageType:i]].mutableCopy;
  33. [result addObject:vc];
  34. }
  35. _controllers = result;
  36. }
  37. return _controllers;
  38. }
  39. - (HDSectionModel*)makeSecZeroModel {
  40. //该段layout
  41. HDYogaFlowLayout *layout = [HDYogaFlowLayout new];
  42. layout.headerSize = CGSizeMake(kScreenWidth, kScreenWidth * 0.25);
  43. //该段的所有数据封装
  44. HDSectionModel *secModel = [HDSectionModel new];
  45. secModel.sectionHeaderClassStr = @"TrainSummaryHeaderView";
  46. secModel.layout = layout;
  47. return secModel;
  48. }
  49. - (HDSectionModel*)makeSecTwoModelWithTrainSummaryPageType:(TrainSummaryPageType)trainSummaryPageType {
  50. NSMutableArray *cellModelArr = @[].mutableCopy;
  51. switch (trainSummaryPageType) {
  52. case TrainSummaryPageTypeHoursRequirements: {
  53. NSInteger cellCount = 15;
  54. for (int i =0; i < cellCount; i++) {
  55. HDCellModel *model = [HDCellModel new];
  56. // SignUpSituationModel *signUpSituationModel = [SignUpSituationModel new];
  57. // signUpSituationModel.imageName = @"HeaderPlacehold";
  58. // signUpSituationModel.name = @"张三丰";
  59. // signUpSituationModel.sex = @"女";
  60. // signUpSituationModel.school = @"金安驾校";
  61. // model.orgData = signUpSituationModel;
  62. model.cellSize = CGSizeMake(kScreenWidth, 140);
  63. model.cellClassStr = @"TrainSummaryHoursRequirementsCell";
  64. [cellModelArr addObject:model];
  65. }
  66. //该段layout
  67. HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
  68. layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0);
  69. layout.justify = YGJustifySpaceBetween;
  70. layout.verticalGap = 10;
  71. layout.footerSize = CGSizeMake(kScreenWidth, 10);
  72. //该段的所有数据封装
  73. HDSectionModel *secModel = [HDSectionModel new];
  74. secModel.sectionHeaderClassStr = @"HomePageNumHeaderView";
  75. secModel.sectionFooterClassStr = @"CommonSecFooterView";
  76. secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
  77. secModel.isNeedAutoCountCellHW = NO;
  78. secModel.sectionDataArr = cellModelArr;
  79. secModel.layout = layout;
  80. return secModel;
  81. }
  82. case TrainSummaryPageTypeHours: {
  83. NSInteger cellCount = 15;
  84. for (int i =0; i < cellCount; i++) {
  85. HDCellModel *model = [HDCellModel new];
  86. // SignUpSituationModel *signUpSituationModel = [SignUpSituationModel new];
  87. // signUpSituationModel.imageName = @"HeaderPlacehold";
  88. // signUpSituationModel.name = @"张三丰";
  89. // signUpSituationModel.sex = @"女";
  90. // signUpSituationModel.school = @"金安驾校";
  91. // model.orgData = signUpSituationModel;
  92. model.cellSize = CGSizeMake(kScreenWidth, 192);
  93. model.cellClassStr = @"TrainSummaryHoursCell";
  94. [cellModelArr addObject:model];
  95. }
  96. //该段layout
  97. HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
  98. layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0);
  99. layout.justify = YGJustifySpaceBetween;
  100. layout.verticalGap = 10;
  101. layout.footerSize = CGSizeMake(kScreenWidth, 10);
  102. //该段的所有数据封装
  103. HDSectionModel *secModel = [HDSectionModel new];
  104. secModel.sectionHeaderClassStr = @"HomePageNumHeaderView";
  105. secModel.sectionFooterClassStr = @"CommonSecFooterView";
  106. secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
  107. secModel.isNeedAutoCountCellHW = NO;
  108. secModel.sectionDataArr = cellModelArr;
  109. secModel.layout = layout;
  110. return secModel;
  111. }
  112. case TrainSummaryPageTypeStage: {
  113. NSInteger cellCount = 15;
  114. for (int i =0; i < cellCount; i++) {
  115. HDCellModel *model = [HDCellModel new];
  116. // SignUpSituationModel *signUpSituationModel = [SignUpSituationModel new];
  117. // signUpSituationModel.imageName = @"HeaderPlacehold";
  118. // signUpSituationModel.name = @"张三丰";
  119. // signUpSituationModel.sex = @"女";
  120. // signUpSituationModel.school = @"金安驾校";
  121. // model.orgData = signUpSituationModel;
  122. model.cellSize = CGSizeMake(kScreenWidth, 212);
  123. model.cellClassStr = @"TrainSummaryStageCell";
  124. [cellModelArr addObject:model];
  125. }
  126. //该段layout
  127. HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
  128. layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0);
  129. layout.justify = YGJustifySpaceBetween;
  130. layout.verticalGap = 10;
  131. layout.footerSize = CGSizeMake(kScreenWidth, 10);
  132. //该段的所有数据封装
  133. HDSectionModel *secModel = [HDSectionModel new];
  134. secModel.sectionHeaderClassStr = @"HomePageNumHeaderView";
  135. secModel.sectionFooterClassStr = @"CommonSecFooterView";
  136. secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
  137. secModel.isNeedAutoCountCellHW = NO;
  138. secModel.sectionDataArr = cellModelArr;
  139. secModel.layout = layout;
  140. return secModel;
  141. }
  142. default:
  143. return nil;
  144. }
  145. }
  146. @end