123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- //
- // RQHomeSubPageToolBarView.m
- // jiaPei
- //
- // Created by 张嵘 on 2021/12/10.
- // Copyright © 2021 JCZ. All rights reserved.
- //
- #import "RQHomeSubPageToolBarView.h"
- #import "TRListVC.h"
- #import "MyGradeVC.h"
- #import "ScoreRankVC.h"
- @interface RQHomeSubPageToolBarView ()
- @property (nonatomic, readwrite, strong) RQHomeSubPageToolBarGroupViewModel *viewModel;
- @end
- @implementation RQHomeSubPageToolBarView
- + (instancetype)reusableViewWithCollectionView:(UICollectionView *)collectionView OfKind:(NSString *)elementKind forIndexPath:(NSIndexPath *)indexPath {
- NSString *ID = [NSString stringWithFormat:@"%@%@", @"RQHomeSubPageToolBarView",elementKind];
- [collectionView registerNib:[UINib nibWithNibName:@"RQHomeSubPageToolBarView" bundle:nil] forSupplementaryViewOfKind:elementKind withReuseIdentifier:ID];
- RQHomeSubPageToolBarView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:ID forIndexPath:indexPath];
- if (!reusableView) reusableView = [self rq_viewFromXib];
- return reusableView;
- }
- - (void)bindViewModel:(RQHomeSubPageToolBarGroupViewModel *)viewModel {
- @weakify(self)
- self.viewModel = viewModel;
- [self.drivingTestRegulationsBtn setQmui_tapBlock:^(__kindof UIControl *sender) {
- @strongify(self)
- // TRListVC* vc = [[TRListVC alloc] init];
- // NSArray* arr = @[@"2016《机动车驾驶证申领和使用规定》",
- // @"中华人民共和国道路交通安全法",
- // @"道路交通安全违法行为处理程序规定",
- // @"道路交通事故处理程序规定",
- // @"酒驾新规"];
- //
- // [vc setModels:arr];
- // [vc setTitle:@"驾考法规"];
- // [self navPushHideTabbarToVC:vc];
- [self gotoMyGradeVC];
- }];
-
- [self.examinationSkillsBtn setQmui_tapBlock:^(__kindof UIControl *sender) {
- @strongify(self)
- if (RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN) {
- [myDelegate setType:@"6"];
- [self gotoExerVC];
- } else {
- [self gotoScoreRank];
- }
-
- // TRListVC* vc = [[TRListVC alloc] init];
- // NSArray* arr = @[@"科目一考试技巧记忆口诀",
- // @"科目一考试应试必备技巧",
- // @"科目一到科目四,超牛的驾考经验技巧,科科必过!",
- // @"理论考试知识汇总",
- // @"【科目一】交规巧记十三条!",
- // @"3分钟,快速掌握考试车内提示灯如何操作",
- // @"日期类题目最头痛,来看看我们总结的快速学习方法!",
- // @"帮您快速巧记交规秘诀,看完想不过都难!",
- // @"交规理论考试十大“给力”攻略"];
- //
- // [vc setModels:arr];
- // [vc setTitle:@"考试技巧"];
- // [self navPushHideTabbarToVC:vc];
- }];
-
- [self.noQuestionsBtn setQmui_tapBlock:^(__kindof UIControl *sender) {
- @strongify(self)
- [myDelegate setType:@"10"];
- [self gotoExerVC];
- }];
-
- [self.myMistakeBtn setQmui_tapBlock:^(__kindof UIControl *sender) {
- @strongify(self)
- [myDelegate setType:@"4"];
- [self gotoExerVC];
- }];
-
- [self.myCollectionBtn setQmui_tapBlock:^(__kindof UIControl *sender) {
- @strongify(self)
- [myDelegate setType:@"7"];
- [self gotoExerVC];
- }];
-
- [[RACObserve(RQ_SHARE_FUNCTION, myErorNum) takeUntil:self.rac_prepareForReuseSignal] subscribeNext:^(id _Nullable x) {
- @strongify(self)
- self.myMistakeBtn.imageView.clipsToBounds = NO;
- if (RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN) {
- [self.myMistakeBtn.imageView showBadgeWithStyle:WBadgeStyleNumber value:[RQ_YDTQuestion_Module getQuestionWithExerciseType:RQExerciseType_Wrong].count animationType:WBadgeAnimTypeNone];
- } else {
- if ([defUser.car_type isEqualToString:@"2"]) {
- [self.myMistakeBtn.imageView showBadgeWithStyle:WBadgeStyleNumber value:[DB_Que_Helper queryGZPZ_EXAM_CYRYMarkQuestionWithMarkType:@"1"] animationType:WBadgeAnimTypeNone];
- } else {
- [self.myMistakeBtn.imageView showBadgeWithStyle:WBadgeStyleNumber value:[RQ_YDTQuestion_Module getQuestionWithExerciseType:RQExerciseType_Wrong].count animationType:WBadgeAnimTypeNone];
- }
- }
-
-
- }];
-
-
- }
- - (void)navPushHideTabbarToVC:(UIViewController *)vc {
- if (RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN) {
- [RQControllerHelper.topNavigationController qmui_pushViewController:vc animated:YES completion:nil];
- } else {
- vc.hidesBottomBarWhenPushed = YES;
- [RQControllerHelper.topNavigationController qmui_pushViewController:vc animated:YES completion:nil];
- vc.hidesBottomBarWhenPushed = NO;
- }
-
- }
- - (void)gotoExerVC {
- if (RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN) {
-
- } else {
- if ([[RQPreferenceSettingHelper objectForKey:@"exerciseState"] isEqualToString:@"0"] && ![defUser.car_type isEqualToString:@"2"]) {
- [NSObject rq_showAlertViewWithTitle:@"温馨提示" message:[RQPreferenceSettingHelper objectForKey:@"exerciseMsg"] confirmTitle:@"确定"];
- return;
- }
- }
- ExerciseVC *vc = [[ExerciseVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- }
- - (void)gotoScoreRank {
- ScoreRankVC* vc = [[ScoreRankVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- }
- - (void)gotoMyGradeVC {
- MyGradeVC* vc = [[MyGradeVC alloc] init];
- [self navPushHideTabbarToVC:vc];
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- self.drivingTestRegulationsBtn.imagePosition = QMUIButtonImagePositionTop;
- self.examinationSkillsBtn.imagePosition = QMUIButtonImagePositionTop;
- self.noQuestionsBtn.imagePosition = QMUIButtonImagePositionTop;
- self.myMistakeBtn.imagePosition = QMUIButtonImagePositionTop;
- self.myCollectionBtn.imagePosition = QMUIButtonImagePositionTop;
-
- if (RQ_COMMON_MANAGER.YYXC_SERVICE_OPEN) {
- self.drivingTestRegulationsBtn.hidden = YES;
- [self.examinationSkillsBtn setImage:[UIImage imageNamed:@"question_submit_exam_press_icon"] forState:UIControlStateNormal];
- [self.examinationSkillsBtn setTitleNormal:@"排除的题"];
- } else {
- [self.examinationSkillsBtn setImage:[UIImage imageNamed:@"subject1_rating_board_icon"] forState:UIControlStateNormal];
- [self.examinationSkillsBtn setTitleNormal:@"排行榜"];
- }
- }
- @end
|