123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- //
- // NYClassRoomVC.m
- // jiaPei
- //
- // Created by Ning.ge on 2024/2/4.
- // Copyright © 2024 JCZ. All rights reserved.
- //
- #import "NYClassRoomVC.h"
- #import "NYClassRoomViewModel.h"
- #import "NYGetjobStartRuleCell.h"
- #import "CultivateInfoModel.h"
- #import "CultivatePhotoModel.h"
- #import "NYClassRoomPeiCell.h"
- #import "RQQRCodeViewController.h"
- @interface NYClassRoomVC ()
- /// viewModel
- @property (nonatomic, readonly, strong) NYClassRoomViewModel *viewModel;
- @property (nonatomic, readwrite, strong) UIButton *signInOrsignOutItem;
- @property (nonatomic, readwrite, strong) NYClassRoomPeiCell *nyClassRoomPeiCell;
- @end
- @implementation NYClassRoomVC
- @dynamic viewModel;
- #pragma mark - SystemMethod
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
-
- self.view.backgroundColor = UIColor.whiteColor;
- self.collectionView.backgroundColor = UIColor.clearColor;
- self.collectionView.backgroundView.backgroundColor = UIColor.clearColor;
- UIImageView *bgImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"classroom_bgbg"]];
- [self.view insertSubview:bgImageView atIndex:0];
- [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.right.mas_equalTo(self.view);
- make.height.mas_equalTo(184.f);
- }];
-
- if(self.viewModel.isSimulationRoom){ //模拟训练
- self.viewModel.classRoomPeiViewModel.isSimulationRoom = self.viewModel.isSimulationRoom;
- UIBarButtonItem *baritem = [[UIBarButtonItem alloc] initWithCustomView:self.signInOrsignOutItem];
- [self.navigationItem setRightBarButtonItems:@[baritem]];
- }
-
- }
- - (UIColor *)qmui_titleViewTintColor
- {
- return UIColor.whiteColor;
- }
- - (UIImage *)qmui_navigationBarBackgroundImage
- {
- return [UIImage qmui_imageWithColor:UIColor.clearColor];
- }
- #pragma mark - OverrideMethods
- /// 配置collectionView的区域
- - (UIEdgeInsets)contentInset {
- return UIEdgeInsetsMake(RQ_APPLICATION_STATUS_BAR_HEIGHT + RQ_APPLICATION_NAV_BAR_HEIGHT, 0, 0, 0);
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
- RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
- RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
- UICollectionViewCell *cell = [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
- if([itemViewModel.itemClassName isEqualToString:@"NYClassRoomPeiCell"]){
- self.nyClassRoomPeiCell = (NYClassRoomPeiCell *)cell;
- self.nyClassRoomPeiCell.signInOrsignOutItem = self.signInOrsignOutItem;
- }
- return cell;
- }
- - (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) * 3)) / 2.f;
-
- default:
- return 8;
- }
- }
- - (UIButton *)signInOrsignOutItem {
- if (!_signInOrsignOutItem) {
-
- UIButton *customButton = [UIButton buttonWithType:UIButtonTypeCustom];
- customButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
- [customButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
- [customButton setTitle:@"签到" forState:UIControlStateNormal];
- [customButton addTarget:self action:@selector(gotoSignInOrsignOut) forControlEvents:UIControlEventTouchUpInside];
- _signInOrsignOutItem = customButton;
-
- // _signInOrsignOutItem = [UIBarButtonItem rq_systemItemWithTitle:@"签到" titleColor:RQ_LIST_BACKGROUNDCOLOR imageName:nil target:self selector:@selector(gotoSignInOrsignOut) textType:YES];
- }
- return _signInOrsignOutItem;
- }
- - (void)gotoSignInOrsignOut {
- [self.nyClassRoomPeiCell gotoSignInOrsignOut];
- }
- @end
|