12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- //
- // TrainSituationViewController.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/31.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "TrainSituationViewController.h"
- #import "TrainSituationViewModel.h"
- #import "StudentDetailViewController.h"
- @interface TrainSituationViewController ()
- @property (nonatomic, readwrite, strong) HDCollectionView *collectionView;
- @property (nonatomic, readwrite, strong) TrainSituationViewModel *trainSituationViewModel;
- @end
- @implementation TrainSituationViewController
- #pragma mark - Life Cycle
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self initUI];
-
- }
- #pragma mark - Private Functions
- - (void)initUI {
- self.title = @"培训情况";
- self.view.backgroundColor = KBackGroundColor;
- [self goBackByNavigation];
-
- [self.view addSubview:self.collectionView];
- [_collectionView 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(self.view.hd_mas_bottom);
- make.top.mas_equalTo(self.view.hd_mas_top);
- }];
-
-
- /// 初始化数据
- __weak typeof(self) weakS = self;
- [self.trainSituationViewModel loadData:^(BOOL success, id _Nonnull res) {
- if (success) {
- [_collectionView hd_setAllDataArr:res];
- }else{
- //error
- }
- }];
-
- [_collectionView hd_setAllEventCallBack:^(id backModel, HDCallBackType type) {
- if (type == HDCellCallBack) {
- [weakS clickCell:backModel];
- }else if (type == HDSectionHeaderCallBack){
- [weakS clickHeader:backModel];
- }
- }];
- }
- - (void)clickCell:(HDCellModel*)cellM {
- NSLog(@"点击了%zd--%zd cell",cellM.indexP.section,cellM.indexP.item);
- StudentDetailViewController *vc = [[StudentDetailViewController alloc] init];
- [self navPushHideTabbarToVC:vc];
- }
- - (void)clickHeader:(HDSectionModel*)secM {
- NSLog(@"点击了段头");
- }
- #pragma mark - Lazy Load
- - (HDCollectionView *)collectionView {
- if (!_collectionView) {
- _collectionView = [HDCollectionView hd_makeHDCollectionView:^(HDCollectionViewMaker *maker) {
- maker
- .hd_isNeedTopStop(YES)
- .hd_scrollDirection(UICollectionViewScrollDirectionVertical);
- }];
- _collectionView.backgroundColor = RQBackGroundColor;
- }
- return _collectionView;
- }
- - (TrainSituationViewModel *)trainSituationViewModel {
- if (!_trainSituationViewModel) {
- _trainSituationViewModel = [[TrainSituationViewModel alloc] init];
- }
- return _trainSituationViewModel;
- }
- @end
|