// // NYGetjobStartRuleCell.m // jiaPei // // Created by Ning.ge on 2023/6/9. // Copyright © 2023 JCZ. All rights reserved. // #import "NYGetjobStartRuleCell.h" #import "NYChooseTypeAlertViewController.h" @interface NYGetjobStartRuleCell () @property (nonatomic, readwrite, strong) NYGetjobStartRuleViewModel *viewModel; @end @implementation NYGetjobStartRuleCell #pragma mark - PublicMethods + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath { static NSString *ID = @"NYGetjobStartRuleCell"; [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID]; NYGetjobStartRuleCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath]; if (!cell) cell = [self rq_viewFromXib]; if(RQ_USER_MANAGER.cykhPxkmStr.length>0){ switch (RQ_USER_MANAGER.cykhPxkmStr.intValue) { case 5:{ cell.current_Button = cell.k1_button; cell.k1_button.selected = YES; }break; case 6:{ cell.current_Button = cell.k2_button; cell.k2_button.selected = YES; }break; case 7:{ cell.current_Button = cell.k3_button; cell.k3_button.selected = YES; }break; case 8:{ cell.current_Button = cell.k4_button; cell.k4_button.selected = YES; }break; default: cell.current_Button = cell.k1_button; cell.k1_button.selected = YES; break; } }else { cell.current_Button = cell.k1_button; cell.k1_button.selected = YES; RQ_USER_MANAGER.cykhPxkmStr = @"5"; } return cell; } - (void)bindViewModel:(NYGetjobStartRuleViewModel *)viewModel { self.viewModel = viewModel; } #pragma mark - SystemMethods - (void)awakeFromNib { [super awakeFromNib]; self.contentView.backgroundColor = UIColor.clearColor; self.k1_button.imagePosition = QMUIButtonImagePositionTop; self.k1_button.spacingBetweenImageAndTitle = 8; self.k1_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; self.k2_button.imagePosition = QMUIButtonImagePositionTop; self.k2_button.spacingBetweenImageAndTitle = 8; self.k2_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; self.k3_button.imagePosition = QMUIButtonImagePositionTop; self.k3_button.spacingBetweenImageAndTitle = 8; self.k3_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; self.k4_button.imagePosition = QMUIButtonImagePositionTop; self.k4_button.spacingBetweenImageAndTitle = 8; self.k4_button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; } - (IBAction)actionSubjectButton:(QMUIButton *)sender { NSLog(@"点击了"); CGFloat width = 290.f,height = 283.f; CGFloat ctY = (SL_kScreenHeight - height)*0.5; CGFloat ctX = (SL_kScreenWidth - width)*0.5; //弹窗-提示 @weakify(self) NYChooseTypeAlertViewController *chooseTypeAlertViewController = [[NYChooseTypeAlertViewController alloc] init]; chooseTypeAlertViewController.type = sender.tag; QMUIModalPresentationViewController *modalPresentationViewController = [[QMUIModalPresentationViewController alloc] init]; chooseTypeAlertViewController.chooseFinishBlock = ^(NSInteger type) { self.current_Button.selected = NO; sender.selected = YES; self.current_Button = sender; RQ_USER_MANAGER.cykhPxkmStr = [NSString stringWithFormat:@"%zd",type];//从业阶段 [modalPresentationViewController hideWithAnimated:YES completion:nil]; }; chooseTypeAlertViewController.chooseCancelBlock = ^{ [modalPresentationViewController hideWithAnimated:YES completion:nil]; }; modalPresentationViewController.contentViewMargins = UIEdgeInsetsMake(ctY, ctX , ctY, ctX); modalPresentationViewController.contentViewController = chooseTypeAlertViewController; modalPresentationViewController.modal = YES; [modalPresentationViewController showWithAnimated:YES completion:nil]; } @end