1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //
- // RQTimeViewController.m
- // jiaPei
- //
- // Created by 张嵘 on 2021/11/19.
- // Copyright © 2021 JCZ. All rights reserved.
- //
- #import "RQTimeViewController.h"
- @interface RQTimeViewController ()
- /// viewModel
- @property (nonatomic, readonly, strong) RQTimeViewModel *viewModel;
- @end
- @implementation RQTimeViewController
- @dynamic viewModel;
- #pragma mark - SystemMethod
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- if(RQ_USER_MANAGER.currentUser.stuNum == nil ||
- [RQ_USER_MANAGER.currentUser.stuNum isEqualToString:@""]){
- [[RQ_HTTP_Service getUserinfoWithUserId:RQ_USER_MANAGER.currentUser._id] subscribeNext:^(RQUserModel *userModel) {
- if(userModel){
- RQ_USER_MANAGER.currentUser.stuNum = userModel.stuNum;
- }
- } error:^(NSError * _Nullable error) {
- } completed:^{
- }];
- }
- }
- #pragma mark - OverrideMethods
- /// 配置collectionView的区域
- - (UIEdgeInsets)contentInset {
- return UIEdgeInsetsMake(RQ_APPLICATION_STATUS_BAR_HEIGHT + RQ_APPLICATION_NAV_BAR_HEIGHT, 0, RQ_APPLICATION_TAB_BAR_HEIGHT + RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT, 0);
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
- RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
- RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
- return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
- }
- - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
- [cell bindViewModel:object];
- }
- - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
- switch (section) {
- case 1: {
- return UIEdgeInsetsMake(0, 16, 0, 16);
- }
- default: {
- return UIEdgeInsetsZero;
- }
- }
- }
- - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
- switch (section) {
- case 1:
- //理论计时,实车认证,我的学时,课堂培训
- return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 4)) / 2.f;
-
- default:
- return 8;
- }
- }
- @end
|