NYGetjobStartRuleCell.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //
  2. // NYGetjobStartRuleCell.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2023/6/9.
  6. // Copyright © 2023 JCZ. All rights reserved.
  7. //
  8. #import "NYGetjobStartRuleCell.h"
  9. #import "NYChooseTypeAlertViewController.h"
  10. @interface NYGetjobStartRuleCell ()
  11. @property (nonatomic, readwrite, strong) NYGetjobStartRuleViewModel *viewModel;
  12. @end
  13. @implementation NYGetjobStartRuleCell
  14. #pragma mark - PublicMethods
  15. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  16. static NSString *ID = @"NYGetjobStartRuleCell";
  17. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  18. NYGetjobStartRuleCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  19. if (!cell) cell = [self rq_viewFromXib];
  20. if(RQ_USER_MANAGER.cykhPxkmStr.length>0){
  21. switch (RQ_USER_MANAGER.cykhPxkmStr.intValue) {
  22. case 5:{
  23. cell.current_Button = cell.k1_button;
  24. cell.k1_button.selected = YES;
  25. }break;
  26. case 6:{
  27. cell.current_Button = cell.k2_button;
  28. cell.k2_button.selected = YES;
  29. }break;
  30. case 7:{
  31. cell.current_Button = cell.k3_button;
  32. cell.k3_button.selected = YES;
  33. }break;
  34. case 8:{
  35. cell.current_Button = cell.k4_button;
  36. cell.k4_button.selected = YES;
  37. }break;
  38. default:
  39. cell.current_Button = cell.k1_button;
  40. cell.k1_button.selected = YES;
  41. break;
  42. }
  43. }else {
  44. cell.current_Button = cell.k1_button;
  45. cell.k1_button.selected = YES;
  46. RQ_USER_MANAGER.cykhPxkmStr = @"5";
  47. }
  48. return cell;
  49. }
  50. - (void)bindViewModel:(NYGetjobStartRuleViewModel *)viewModel {
  51. self.viewModel = viewModel;
  52. }
  53. #pragma mark - SystemMethods
  54. - (void)awakeFromNib {
  55. [super awakeFromNib];
  56. self.contentView.backgroundColor = UIColor.clearColor;
  57. self.k1_button.imagePosition = QMUIButtonImagePositionTop;
  58. self.k1_button.spacingBetweenImageAndTitle = 8;
  59. self.k1_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
  60. self.k2_button.imagePosition = QMUIButtonImagePositionTop;
  61. self.k2_button.spacingBetweenImageAndTitle = 8;
  62. self.k2_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
  63. self.k3_button.imagePosition = QMUIButtonImagePositionTop;
  64. self.k3_button.spacingBetweenImageAndTitle = 8;
  65. self.k3_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
  66. self.k4_button.imagePosition = QMUIButtonImagePositionTop;
  67. self.k4_button.spacingBetweenImageAndTitle = 8;
  68. self.k4_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
  69. }
  70. - (IBAction)actionSubjectButton:(QMUIButton *)sender {
  71. NSLog(@"点击了");
  72. CGFloat width = 290.f,height = 283.f;
  73. CGFloat ctY = (SL_kScreenHeight - height)*0.5;
  74. CGFloat ctX = (SL_kScreenWidth - width)*0.5;
  75. //弹窗-提示
  76. @weakify(self)
  77. NYChooseTypeAlertViewController *chooseTypeAlertViewController = [[NYChooseTypeAlertViewController alloc] init];
  78. chooseTypeAlertViewController.type = sender.tag;
  79. QMUIModalPresentationViewController *modalPresentationViewController = [[QMUIModalPresentationViewController alloc] init];
  80. chooseTypeAlertViewController.chooseFinishBlock = ^(NSInteger type) {
  81. self.current_Button.selected = NO;
  82. sender.selected = YES;
  83. self.current_Button = sender;
  84. RQ_USER_MANAGER.cykhPxkmStr = [NSString stringWithFormat:@"%zd",type];//从业阶段
  85. [modalPresentationViewController hideWithAnimated:YES
  86. completion:nil];
  87. };
  88. chooseTypeAlertViewController.chooseCancelBlock = ^{
  89. [modalPresentationViewController hideWithAnimated:YES
  90. completion:nil];
  91. };
  92. modalPresentationViewController.contentViewMargins = UIEdgeInsetsMake(ctY, ctX , ctY, ctX);
  93. modalPresentationViewController.contentViewController = chooseTypeAlertViewController;
  94. modalPresentationViewController.modal = YES;
  95. [modalPresentationViewController showWithAnimated:YES completion:nil];
  96. }
  97. @end