NYClassRoomVC.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // NYClassRoomVC.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2024/2/4.
  6. // Copyright © 2024 JCZ. All rights reserved.
  7. //
  8. #import "NYClassRoomVC.h"
  9. #import "NYClassRoomViewModel.h"
  10. #import "NYGetjobStartRuleCell.h"
  11. #import "CultivateInfoModel.h"
  12. #import "CultivatePhotoModel.h"
  13. #import "NYClassRoomPeiCell.h"
  14. #import "RQQRCodeViewController.h"
  15. @interface NYClassRoomVC ()
  16. /// viewModel
  17. @property (nonatomic, readonly, strong) NYClassRoomViewModel *viewModel;
  18. @property (nonatomic, readwrite, strong) UIBarButtonItem *signInOrsignOutItem;
  19. @property (nonatomic, readwrite, strong) NYClassRoomPeiCell *nyClassRoomPeiCell;
  20. @end
  21. @implementation NYClassRoomVC
  22. @dynamic viewModel;
  23. #pragma mark - SystemMethod
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. // Do any additional setup after loading the view.
  27. self.view.backgroundColor = UIColor.whiteColor;
  28. self.collectionView.backgroundColor = UIColor.clearColor;
  29. self.collectionView.backgroundView.backgroundColor = UIColor.clearColor;
  30. UIImageView *bgImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"classroom_bgbg"]];
  31. [self.view insertSubview:bgImageView atIndex:0];
  32. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.left.top.right.mas_equalTo(self.view);
  34. make.height.mas_equalTo(184.f);
  35. }];
  36. if(self.viewModel.isSimulationRoom){ //模拟训练
  37. self.viewModel.classRoomPeiViewModel.isSimulationRoom = self.viewModel.isSimulationRoom;
  38. [self.navigationItem setRightBarButtonItems:@[self.signInOrsignOutItem]];
  39. }
  40. }
  41. - (UIColor *)qmui_titleViewTintColor
  42. {
  43. return UIColor.whiteColor;
  44. }
  45. - (UIImage *)qmui_navigationBarBackgroundImage
  46. {
  47. return [UIImage qmui_imageWithColor:UIColor.clearColor];
  48. }
  49. #pragma mark - OverrideMethods
  50. /// 配置collectionView的区域
  51. - (UIEdgeInsets)contentInset {
  52. return UIEdgeInsetsMake(RQ_APPLICATION_STATUS_BAR_HEIGHT + RQ_APPLICATION_NAV_BAR_HEIGHT, 0, 0, 0);
  53. }
  54. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  55. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  56. RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  57. UICollectionViewCell *cell = [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  58. if([itemViewModel.itemClassName isEqualToString:@"NYClassRoomPeiCell"]){
  59. self.nyClassRoomPeiCell = (NYClassRoomPeiCell *)cell;
  60. self.nyClassRoomPeiCell.signInOrsignOutItem = self.signInOrsignOutItem;
  61. }
  62. return cell;
  63. }
  64. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  65. [cell bindViewModel:object];
  66. }
  67. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
  68. switch (section) {
  69. case 1: {
  70. return UIEdgeInsetsMake(0, 16, 0, 16);
  71. }
  72. default: {
  73. return UIEdgeInsetsZero;
  74. }
  75. }
  76. }
  77. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
  78. switch (section) {
  79. case 1:
  80. return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 3)) / 2.f;
  81. default:
  82. return 8;
  83. }
  84. }
  85. - (UIBarButtonItem *)signInOrsignOutItem {
  86. if (!_signInOrsignOutItem) {
  87. _signInOrsignOutItem = [UIBarButtonItem rq_systemItemWithTitle:@"签到" titleColor:RQ_LIST_BACKGROUNDCOLOR imageName:nil target:self selector:@selector(gotoSignInOrsignOut) textType:YES];
  88. }
  89. return _signInOrsignOutItem;
  90. }
  91. - (void)gotoSignInOrsignOut {
  92. [self.nyClassRoomPeiCell gotoSignInOrsignOut];
  93. }
  94. @end