123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- //
- // NYHomePageOneBigCell.m
- // jiaPei
- //
- // Created by Ning.ge on 2024/11/22.
- // Copyright © 2024 JCZ. All rights reserved.
- //
- #import "NYHomePageOneBigCell.h"
- @interface NYHomePageOneBigCell ()
- @property (nonatomic, readwrite, strong) NYHomePageOneBigItemViewModel *viewModel;
- @property (weak, nonatomic) IBOutlet QMUIButton *btn_left_0;
- @property (weak, nonatomic) IBOutlet QMUIButton *btn_left_1;
- @property (weak, nonatomic) IBOutlet QMUIButton *btn_left_2;
- @property (weak, nonatomic) IBOutlet QMUIButton *btn_left_3;
- @property (weak, nonatomic) IBOutlet QMUIButton *btn_right_0;
- @property (weak, nonatomic) IBOutlet QMUIButton *btn_right_1;
- @property (weak, nonatomic) IBOutlet QMUIButton *btn_right_2;
- @property (weak, nonatomic) IBOutlet QMUIButton *btn_right_3;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *lay_blue_w;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *lay_blue_h;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *lay_green_w;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *lay_green_h;
- @property (weak, nonatomic) IBOutlet UILabel *blue_title_sx;
- @property (weak, nonatomic) IBOutlet UILabel *green_title_mnks;
- @end
- @implementation NYHomePageOneBigCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
- static NSString *ID = @"NYHomePageOneBigCell";
- [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
- NYHomePageOneBigCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
- if (!cell) cell = [self rq_viewFromXib];
- [cell setupUI];
- return cell;
- }
- - (void)setupUI {
- self.btn_left_0.imagePosition = QMUIButtonImagePositionTop;
- self.btn_left_1.imagePosition = QMUIButtonImagePositionTop;
- self.btn_left_2.imagePosition = QMUIButtonImagePositionTop;
- self.btn_left_3.imagePosition = QMUIButtonImagePositionTop;
- self.btn_right_0.imagePosition = QMUIButtonImagePositionTop;
- self.btn_right_1.imagePosition = QMUIButtonImagePositionTop;
- self.btn_right_2.imagePosition = QMUIButtonImagePositionTop;
- self.btn_right_3.imagePosition = QMUIButtonImagePositionTop;
-
- self.btn_left_0.titleEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0);
- self.btn_left_1.titleEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0);
- self.btn_left_2.titleEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0);
- self.btn_left_3.titleEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0);
- self.btn_right_0.titleEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0);
- self.btn_right_1.titleEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0);
- self.btn_right_2.titleEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0);
- self.btn_right_3.titleEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0);
-
- self.lay_blue_w.constant = RQ_FIT_HORIZONTAL(121);
- self.lay_blue_h.constant = RQ_FIT_HORIZONTAL(121);
- self.lay_green_w.constant = RQ_FIT_HORIZONTAL(121);
- self.lay_green_h.constant = RQ_FIT_HORIZONTAL(121);
- }
- - (void)bindViewModel:(NYHomePageOneBigItemViewModel *)viewModel {
- _viewModel = viewModel;
- RAC(self.blue_title_sx, attributedText) = [[RACObserve(viewModel, sxlxtStr) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
- RAC(self.green_title_mnks, attributedText) = [[RACObserve(viewModel, mnksStr) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
- }
- #pragma mark - action
- //顺序练习
- - (IBAction)btnSxlxActiondo:(UIButton *)sender {
- if (RQ_USER_MANAGER.isShouldLogin) {
- NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_Sequential ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) {
- return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
- }].toArray;
-
- // NSArray *arr = (self.homePageSubjectType == RQHomePageSubjectType_SubjectFour)? fourArr.copy : oneArr.copy;
- // arr = [arr.rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) {
- // return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
- // }].toArray;
- RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
- RQHomePageCarTypeKey : @(self.viewModel.homePageCarType),
- RQHomePageSubjectTypeKey : @(self.viewModel.homePageSubjectType),
- RQHomeSubPageTypeKey : @(RQHomeSubPageType_SequentialPractice),
- RQViewModelIDKey : self.viewModel.sxlxtStr,
- RQExerciseTypeKey : @(RQExerciseType_Sequential),
- RQViewModelUtilKey : arr,
- }];
- [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
- }
- }
- //模拟考试
- - (IBAction)btnMnksActiondo:(UIButton *)sender {
-
- if (RQ_USER_MANAGER.isShouldLogin) {
- RQSimulateExamViewModel *viewModel = [[RQSimulateExamViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
- [RQ_APPDELEGATE.services pushViewModel:viewModel animated:YES];
- }
-
- }
- //VIP课程
- - (IBAction)btnVipAction:(UIButton *)sender {
- if (RQ_USER_MANAGER.isShouldLogin) {
- [RQ_VIP_Module isVipWithSubject:0 complete:^(BOOL isVip) {
- if (RQ_VIP_Module.isVip) {
- [RQ_VIP_Module gotoVipCenter];
- } else {
- [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
- }
- }];
- }
- }
- //真实考场
- - (IBAction)btnExaminationAction:(UIButton *)sender {
- if (RQ_USER_MANAGER.isShouldLogin) {
- [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
- if (isVip) {
- // username subject headimg gs 替换-> model
- // NSString *urlStr = [NSString stringWithFormat:@"https://mn.zzxcx.net/#/exam/begin?username=%@&subject=%@&model=%@&headimg=%@",[RQ_USER_MANAGER.currentUser.userName qmui_stringByEncodingUserInputQuery],RQ_YDTQuestion_Module.subjectStr,RQ_YDTQuestion_Module.carTypeStrNew,RQ_USER_MANAGER.currentUser.photo];
- // NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
- // RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
- // webViewModel.prefersNavigationBarHidden = YES;
- // [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
-
- //显示真实考场
- NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
- examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
- [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
-
- } else {
- if (RQ_VIP_Module.freeLookSimExamNum == 1||
- RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告
- // NSString *urlStr = [NSString stringWithFormat:@"https://mn.zzxcx.net/#/exam/begin?username=%@&subject=%@&model=%@&headimg=%@",[RQ_USER_MANAGER.currentUser.userName qmui_stringByEncodingUserInputQuery],RQ_YDTQuestion_Module.subjectStr,RQ_YDTQuestion_Module.carTypeStrNew,RQ_USER_MANAGER.currentUser.photo];
- // NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
- // RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
- // webViewModel.prefersNavigationBarHidden = YES;
- // [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
-
- //显示真实考场
- NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
- examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
- [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
- RQ_VIP_Module.freeLookSimExamNum = 0;
- } else {
- if(!RQ_COMMON_MANAGER.APP_SWITCH){
- [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD title:@"" message:@"" confirmTitle:@"充值会员无限使用" cancelTitle:@"看广告解锁使用" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
- [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
- } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
- [RQ_AD_Module loadRewardvodAd];
- }];
- }
-
- }
- }
- }];
- }
- }
- //分阶段练习
- - (IBAction)btnCateLxAction:(UIButton *)sender {
- if (RQ_USER_MANAGER.isShouldLogin) {
- NYBlockExerciseViewModel *blockExerciseViewModel = [[NYBlockExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
- RQHomePageSubjectTypeKey : @(self.viewModel.homePageSubjectType),
- }];
- [RQ_APPDELEGATE.services pushViewModel:blockExerciseViewModel animated:YES];
- }
- }
- //易错专项
- - (IBAction)btnFallibilityAction:(UIButton *)sender {
- if (RQ_USER_MANAGER.isShouldLogin) {
- NYFailSpecialExerciseViewModel *failSpecialExerciseViewModel = [[NYFailSpecialExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
- RQHomePageSubjectTypeKey : @(self.viewModel.homePageSubjectType),
- }];
- [RQ_APPDELEGATE.services pushViewModel:failSpecialExerciseViewModel animated:YES];
- }
- }
- //500精选
- - (IBAction)btnWBAction:(UIButton *)sender {
- if (RQ_USER_MANAGER.isShouldLogin) {
- [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
- if (isVip) {
- NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_HandPick ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) {
- return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
- }].toArray;
- RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
- RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
- RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
- RQHomeSubPageTypeKey : @(RQHomeSubPageType_SequentialPractice),
- RQViewModelIDKey : @"精选500题",
- RQExerciseTypeKey : @(RQExerciseType_HandPick),
- RQViewModelUtilKey : arr,
- }];
- [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
- } else {
- [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
- }
- }];
- }
- }
- //专项练习
- - (IBAction)btnZxPracticeAction:(UIButton *)sender {
- if (RQ_USER_MANAGER.isShouldLogin) {
- RQSpecialPractiseViewModel *specialPractiseViewModel = [[RQSpecialPractiseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil];
- [RQ_APPDELEGATE.services pushViewModel:specialPractiseViewModel animated:YES];
- }
- }
- //电子资料
- - (IBAction)btnCorpuscleresAction:(UIButton *)sender {
- NSLog(@"点击了-电子资料");
- if (RQ_USER_MANAGER.isShouldLogin) {
- [RQ_SHARE_FUNCTION miniwithUserName:RQ_COMMON_MANAGER.JSJP_XCX_NAME path:RQ_COMMON_MANAGER.JSJP_XCX_PAGE];
- }
- }
- //错题收藏
- - (IBAction)btnErrorCollectAction:(UIButton *)sender {
- if (RQ_USER_MANAGER.isShouldLogin) {
- RQErrorAndCollectViewModel *errorAndCollectViewModel = [[RQErrorAndCollectViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil];
- [RQ_APPDELEGATE.services pushViewModel:errorAndCollectViewModel animated:YES];
- }
- }
- @end
|