// // RQHoursBeforeExamHomeViewModel.m // jiaPei // // Created by 张嵘 on 2022/6/21. // Copyright © 2022 JCZ. All rights reserved. // #import "RQHoursBeforeExamHomeViewModel.h" @interface RQHoursBeforeExamHomeViewModel () /// 秘卷一 @property (nonatomic, readwrite, copy) NSArray *itemsOne; /// 秘卷二 @property (nonatomic, readwrite, copy) NSArray *itemsTwo; @property (nonatomic, readwrite, assign) NSInteger hudDisMissCount; @end @implementation RQHoursBeforeExamHomeViewModel #pragma mark - Public Method - (instancetype)initWithServices:(id)services params:(NSDictionary *)params { if (self = [super initWithServices:services params:params]) { } return self; } - (void)initialize { [super initialize]; self.title = @"考前秘卷"; /// 隐藏导航栏的细线 self.prefersNavigationBarBottomLineHidden = YES; self.prefersNavigationBarHidden = YES; self.hudDisMissCount = 0; ///配置数据 // [self rq_configureData]; } #pragma mark - PrivateMethod - (void)rq_configureData { @weakify(self); NSString *gs = [RQ_COMMON_MANAGER getCarTypeSimpleCNStrWithCarType:RQ_COMMON_MANAGER.carType]; NSString *km = [RQ_COMMON_MANAGER getSubjectTypeNumStrWithSubjectType:RQ_COMMON_MANAGER.subject]; [MBProgressHUD rq_showProgressHUD:@"获取秘卷..."]; [[[RQ_HTTP_Service getSelectMiQuestionInfoListWithCategory:RQMiQuestionType_One gs:gs kemu:km] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSArray *itemArr) { @strongify(self) self.itemsOne = itemArr; self.hudDisMissCount ++; } error:^(NSError * _Nullable error) { @strongify(self) self.hudDisMissCount ++; }]; [[[RQ_HTTP_Service getSelectMiQuestionInfoListWithCategory:RQMiQuestionType_Two gs:gs kemu:km] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSArray *itemArr) { @strongify(self) self.itemsTwo = itemArr; self.hudDisMissCount ++; } error:^(NSError * _Nullable error) { @strongify(self) self.hudDisMissCount ++; }]; [RACObserve(self, hudDisMissCount) subscribeNext:^(id _Nullable x) { if (self.hudDisMissCount >= 2) { [MBProgressHUD rq_hideHUD]; } }]; } @end