AppointmentManageViewModel.m 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // AppointmentManageViewModel.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/31.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "AppointmentManageViewModel.h"
  9. #import "AppointmentManageSubViewController.h"
  10. #import "AppointmentManageModel.h"
  11. @implementation AppointmentManageViewModel
  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. AppointmentManageSubViewController *vc = [AppointmentManageSubViewController 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. AppointmentManageModel *appointmentManageModel = [AppointmentManageModel new];
  50. appointmentManageModel.date = @"2019-08-08";
  51. appointmentManageModel.name = @"张小凡";
  52. appointmentManageModel.object = @"科目一";
  53. appointmentManageModel.status = (i%2 == 0)? @"结业" : @"科四培训";
  54. model.orgData = appointmentManageModel;
  55. model.cellSize = CGSizeMake(kScreenWidth, 88);
  56. model.cellClassStr = @"AppointmentManageCell";
  57. [cellModelArr addObject:model];
  58. }
  59. //该段layout
  60. HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
  61. layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0);
  62. layout.justify = YGJustifySpaceBetween;
  63. layout.verticalGap = 10;
  64. layout.footerSize = CGSizeMake(kScreenWidth, 10);
  65. //该段的所有数据封装
  66. HDSectionModel *secModel = [HDSectionModel new];
  67. secModel.sectionHeaderClassStr = @"HomePageNumHeaderView";
  68. secModel.sectionFooterClassStr = @"CommonSecFooterView";
  69. secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
  70. secModel.isNeedAutoCountCellHW = NO;
  71. secModel.sectionDataArr = cellModelArr;
  72. secModel.layout = layout;
  73. return secModel;
  74. }
  75. @end