SignUpSituationViewModel.m 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // SignUpSituationViewModel.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/31.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "SignUpSituationViewModel.h"
  9. #import "SignUpSituationModel.h"
  10. #import "SignUpSituationHeaderModel.h"
  11. #import "SignUpSituationSubViewController.h"
  12. @implementation SignUpSituationViewModel
  13. - (CGSize)titleSize {
  14. return CGSizeMake(hd_deviceWidth, 44);
  15. }
  16. - (BOOL)headerStop {
  17. return YES;
  18. }
  19. - (NSMutableArray *)titles {
  20. return @[@"昨日报名",@"今日报名",@"本月报名",@"本季报名"].mutableCopy;
  21. }
  22. - (NSMutableArray *)controllers {
  23. if (!_controllers) {
  24. NSMutableArray *result = @[].mutableCopy;
  25. //仅测试,所以放入同一类型VC
  26. for (int i=0; i<4; i++) {
  27. SignUpSituationSubViewController *vc = [SignUpSituationSubViewController new];
  28. vc.subViewControllerSecArr = @[[self makeSecModel]].mutableCopy;
  29. SignUpSituationHeaderModel *signUpSituationHeaderModel = [[SignUpSituationHeaderModel alloc] init];
  30. switch (i) {
  31. case 0: {
  32. signUpSituationHeaderModel.leftLabelText = @"昨日报名人数:100人";
  33. break;
  34. }
  35. case 1: {
  36. signUpSituationHeaderModel.leftLabelText = @"今日报名人数:100人";
  37. break;
  38. }
  39. case 2: {
  40. signUpSituationHeaderModel.leftLabelText = @"本月报名人数:200人";
  41. break;
  42. }
  43. case 3: {
  44. signUpSituationHeaderModel.leftLabelText = @"本季报名人数:200人";
  45. break;
  46. }
  47. default:
  48. break;
  49. }
  50. vc.signUpSituationHeaderModel = signUpSituationHeaderModel;
  51. [result addObject:vc];
  52. }
  53. _controllers = result;
  54. }
  55. return _controllers;
  56. }
  57. - (HDSectionModel*)makeSecModel {
  58. NSMutableArray *cellModelArr = @[].mutableCopy;
  59. NSInteger cellCount = 15;
  60. for (int i =0; i < cellCount; i++) {
  61. HDCellModel *model = [HDCellModel new];
  62. SignUpSituationModel *signUpSituationModel = [SignUpSituationModel new];
  63. signUpSituationModel.imageName = @"HeaderPlacehold";
  64. signUpSituationModel.name = @"张三丰";
  65. signUpSituationModel.sex = @"女";
  66. signUpSituationModel.school = @"金安驾校";
  67. model.orgData = signUpSituationModel;
  68. model.cellSize = CGSizeMake(kScreenWidth, 80);
  69. model.cellClassStr = @"SignUpSituationCell";
  70. [cellModelArr addObject:model];
  71. }
  72. //该段layout
  73. HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
  74. layout.justify = YGJustifySpaceBetween;
  75. layout.headerSize = CGSizeMake(kScreenWidth, 50);
  76. layout.footerSize = CGSizeMake(kScreenWidth, 10);
  77. //该段的所有数据封装
  78. HDSectionModel *secModel = [HDSectionModel new];
  79. secModel.sectionHeaderClassStr = @"SignUpSituationHeaderView";
  80. secModel.sectionFooterClassStr = @"CommonSecFooterView";
  81. secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
  82. secModel.isNeedAutoCountCellHW = NO;
  83. secModel.sectionDataArr = cellModelArr;
  84. secModel.layout = layout;
  85. return secModel;
  86. }
  87. @end