123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- //
- // TrainSummaryViewModel.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/26.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "TrainSummaryViewModel.h"
- #import "TrainSummarySubViewController.h"
- @implementation TrainSummaryViewModel
- - (CGSize)titleSize {
- return CGSizeMake(hd_deviceWidth, 44);
- }
- - (BOOL)headerStop {
- return YES;
- }
- - (NSMutableArray *)topSecArr {
- if (!_topSecArr) {
- _topSecArr = @[[self makeSecZeroModel]].mutableCopy;
- }
- return _topSecArr;
- }
- - (NSMutableArray *)titles {
- return @[@"学时要求",@"学时",@"状态"].mutableCopy;
- }
- - (NSMutableArray *)controllers {
- if (!_controllers) {
- NSMutableArray *result = @[].mutableCopy;
- //仅测试,所以放入同一类型VC
- for (int i=0; i<3; i++) {
- TrainSummarySubViewController *vc = [TrainSummarySubViewController new];
- vc.subViewControllerSecArr = @[[self makeSecTwoModelWithTrainSummaryPageType:i]].mutableCopy;
- [result addObject:vc];
- }
- _controllers = result;
- }
- return _controllers;
- }
- - (HDSectionModel*)makeSecZeroModel {
-
- //该段layout
- HDYogaFlowLayout *layout = [HDYogaFlowLayout new];
- layout.headerSize = CGSizeMake(kScreenWidth, kScreenWidth * 0.25);
- //该段的所有数据封装
- HDSectionModel *secModel = [HDSectionModel new];
- secModel.sectionHeaderClassStr = @"TrainSummaryHeaderView";
- secModel.layout = layout;
- return secModel;
- }
- - (HDSectionModel*)makeSecTwoModelWithTrainSummaryPageType:(TrainSummaryPageType)trainSummaryPageType {
- NSMutableArray *cellModelArr = @[].mutableCopy;
- switch (trainSummaryPageType) {
- case TrainSummaryPageTypeHoursRequirements: {
- NSInteger cellCount = 15;
- for (int i =0; i < cellCount; i++) {
- HDCellModel *model = [HDCellModel new];
- // SignUpSituationModel *signUpSituationModel = [SignUpSituationModel new];
- // signUpSituationModel.imageName = @"HeaderPlacehold";
- // signUpSituationModel.name = @"张三丰";
- // signUpSituationModel.sex = @"女";
- // signUpSituationModel.school = @"金安驾校";
- // model.orgData = signUpSituationModel;
- model.cellSize = CGSizeMake(kScreenWidth, 140);
- model.cellClassStr = @"TrainSummaryHoursRequirementsCell";
- [cellModelArr addObject:model];
- }
- //该段layout
- HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
- layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0);
- layout.justify = YGJustifySpaceBetween;
- layout.verticalGap = 10;
- layout.footerSize = CGSizeMake(kScreenWidth, 10);
-
- //该段的所有数据封装
- HDSectionModel *secModel = [HDSectionModel new];
- secModel.sectionHeaderClassStr = @"HomePageNumHeaderView";
- secModel.sectionFooterClassStr = @"CommonSecFooterView";
- secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
- secModel.isNeedAutoCountCellHW = NO;
- secModel.sectionDataArr = cellModelArr;
- secModel.layout = layout;
- return secModel;
- }
- case TrainSummaryPageTypeHours: {
- NSInteger cellCount = 15;
- for (int i =0; i < cellCount; i++) {
- HDCellModel *model = [HDCellModel new];
- // SignUpSituationModel *signUpSituationModel = [SignUpSituationModel new];
- // signUpSituationModel.imageName = @"HeaderPlacehold";
- // signUpSituationModel.name = @"张三丰";
- // signUpSituationModel.sex = @"女";
- // signUpSituationModel.school = @"金安驾校";
- // model.orgData = signUpSituationModel;
- model.cellSize = CGSizeMake(kScreenWidth, 192);
- model.cellClassStr = @"TrainSummaryHoursCell";
- [cellModelArr addObject:model];
- }
- //该段layout
- HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
- layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0);
- layout.justify = YGJustifySpaceBetween;
- layout.verticalGap = 10;
- layout.footerSize = CGSizeMake(kScreenWidth, 10);
-
- //该段的所有数据封装
- HDSectionModel *secModel = [HDSectionModel new];
- secModel.sectionHeaderClassStr = @"HomePageNumHeaderView";
- secModel.sectionFooterClassStr = @"CommonSecFooterView";
- secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
- secModel.isNeedAutoCountCellHW = NO;
- secModel.sectionDataArr = cellModelArr;
- secModel.layout = layout;
- return secModel;
- }
- case TrainSummaryPageTypeStage: {
- NSInteger cellCount = 15;
- for (int i =0; i < cellCount; i++) {
- HDCellModel *model = [HDCellModel new];
- // SignUpSituationModel *signUpSituationModel = [SignUpSituationModel new];
- // signUpSituationModel.imageName = @"HeaderPlacehold";
- // signUpSituationModel.name = @"张三丰";
- // signUpSituationModel.sex = @"女";
- // signUpSituationModel.school = @"金安驾校";
- // model.orgData = signUpSituationModel;
- model.cellSize = CGSizeMake(kScreenWidth, 212);
- model.cellClassStr = @"TrainSummaryStageCell";
- [cellModelArr addObject:model];
- }
- //该段layout
- HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout
- layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0);
- layout.justify = YGJustifySpaceBetween;
- layout.verticalGap = 10;
- layout.footerSize = CGSizeMake(kScreenWidth, 10);
-
- //该段的所有数据封装
- HDSectionModel *secModel = [HDSectionModel new];
- secModel.sectionHeaderClassStr = @"HomePageNumHeaderView";
- secModel.sectionFooterClassStr = @"CommonSecFooterView";
- secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal;
- secModel.isNeedAutoCountCellHW = NO;
- secModel.sectionDataArr = cellModelArr;
- secModel.layout = layout;
- return secModel;
- }
-
- default:
- return nil;
- }
- }
- @end
|