123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- //
- // HomePageViewController.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/9.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "HomePageViewController.h"
- #import "HomePageADHeaderView.h"
- #import "HomePageSubViewController.h"
- #import "TrainSituationNumHeaderModel.h"
- #import "SignUpSituationViewController.h"
- #import "TrainSituationViewController.h"
- #import "StudentDetailViewController.h"
- #import "PreExamMarkViewController.h"
- #import "AppointmentManageViewController.h"
- #import "ExamArrangeViewController.h"
- #import "ExamStatisticsViewController.h"
- #import "AppointDriverViewController.h"
- #import "CoachArrangeClassViewController.h"
- #import "TrainRecordViewController.h"
- @interface HomePageViewController ()
- @property (nonatomic, readwrite, strong) HDCollectionView *collectionView;
- @property (nonatomic, readwrite, strong) HomePageViewModel *homePageViewModel;
- @end
- @implementation HomePageViewController
- #pragma mark - Life Cycle
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- HDSectionModel *sectionModel = self.homePageViewModel.topSecArr.firstObject;
- HomePageADHeaderView *homePageADHeaderView = [[NSClassFromString(sectionModel.sectionHeaderClassStr) alloc] init];
- [homePageADHeaderView.cycleScrollView adjustWhenControllerViewWillAppera];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self initUI];
- }
- - (void)viewDidAppear:(BOOL)animated {
- [super viewDidAppear:animated];
- self.tabBarController.tabBar.hidden = NO;
- }
- #pragma mark - Private Functions
- - (void)initUI {
- self.view.backgroundColor = KBackGroundColor;
-
- [self.multipleSc mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.view.hd_mas_left);
- make.right.mas_equalTo(self.view.hd_mas_right);
- make.bottom.mas_equalTo(-kTabBarHeight);
- make.top.mas_equalTo(self.view.hd_mas_top);
- }];
-
- /// 初始化数据
- __weak typeof(self) weakS = self;
- [self.multipleSc configWithConfiger:^(HDMultipleScrollListConfiger * _Nonnull configer) {
- [weakS setWith:configer];
- }];
-
- /// 点击回调
- [self.multipleSc.mainCollecitonV hd_setAllEventCallBack:^(id backModel, HDCallBackType type) {
- if (type == HDCellCallBack) {
- [weakS clickCell:backModel];
- }else if (type == HDSectionHeaderCallBack){
- [weakS clickHeader:backModel];
- }
- }];
-
- /// 标签个性化设置
- [self jxCustomSetting];
- }
- /// 标签个性化设置
- - (void)jxCustomSetting {
- self.multipleSc.jxTitle.titleSelectedColor = RQSubColor;
- self.multipleSc.jxTitle.titleColorGradientEnabled = YES;
- self.multipleSc.jxLineView.indicatorLineViewColor = RQSubColor;
- self.multipleSc.jxLineView.lineStyle = JXCategoryIndicatorLineStyle_IQIYI;
- self.multipleSc.jxLineView.indicatorWidth = kScreenWidth / 10.0;
- self.multipleSc.jxLineView.indicatorHeight = 3;
- self.multipleSc.jxLineView.indicatorCornerRadius = 3;
- }
- /// 初始化数据
- - (void)setWith:(HDMultipleScrollListConfiger*)configer {
- self.title = @"首页";
- configer.topSecArr = self.homePageViewModel.topSecArr;
- configer.isHeaderNeedStop = self.homePageViewModel.headerStop;
- configer.titleContentSize = self.homePageViewModel.titleSize;
- configer.listHeight = self.homePageViewModel.listHeight;
- configer.diyHeaderClsStr = @"HomePageSecHeaderView";
- configer.controllers = self.homePageViewModel.controllers;
- configer.titles = self.homePageViewModel.titles;
- HDSectionModel *secModel = self.homePageViewModel.bottomSecArr.firstObject;
- if (secModel.sectionDataArr.count > 5) {
- secModel.sectionDataArr = [secModel.sectionDataArr subarrayWithRange:NSMakeRange(0, 5)].mutableCopy;
- [self.homePageViewModel.bottomSecArr replaceObjectAtIndex:0 withObject:secModel];
- }
- configer.bottomSecArr = self.homePageViewModel.bottomSecArr;
- configer.subSecArr = self.homePageViewModel.subViewControllerSecArr;
- }
- - (void)clickCell:(HDCellModel*)cellM {
- NSLog(@"点击了%zd--%zd cell",cellM.indexP.section,cellM.indexP.item);
- switch (cellM.indexP.section) {
- case 1: {
- switch (cellM.indexP.item) {
- case 0: {
- SignUpSituationViewController *vc = [[SignUpSituationViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
- case 1: {
- PreExamMarkViewController *vc = [[PreExamMarkViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
- case 2: {
- AppointmentManageViewController *vc = [[AppointmentManageViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
- case 3: {
- ExamArrangeViewController *vc = [[ExamArrangeViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
- case 4: {
- ExamStatisticsViewController *vc = [[ExamStatisticsViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
- case 5: {
- AppointDriverViewController * vc = [[AppointDriverViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
- case 6: {
- CoachArrangeClassViewController * vc = [[CoachArrangeClassViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
- case 7: {
- TrainRecordViewController * vc = [[TrainRecordViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
-
- default:
- break;
- }
- break;
- }
- case 4 : {
- StudentDetailViewController *vc = [[StudentDetailViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
-
- default:
- break;
- }
- }
- - (void)clickHeader:(HDSectionModel*)secM {
- NSLog(@"点击了段头");
- switch (secM.section) {
- case 2: {
- SignUpSituationViewController *vc = [[SignUpSituationViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
- case 4: {
- TrainSituationViewController *vc = [[TrainSituationViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- break;
- }
-
- default:
- break;
- }
- }
- #pragma mark - Lazy Load
- - (HomePageViewModel *)homePageViewModel {
- if (!_homePageViewModel) {
- _homePageViewModel = [[HomePageViewModel alloc] init];
- }
- return _homePageViewModel;
- }
- @end
|