// // RQSpecialPointItemViewModel.m // jiaPei // // Created by 张嵘 on 2022/6/22. // Copyright © 2022 JCZ. All rights reserved. // #import "RQSpecialPointItemViewModel.h" @interface RQSpecialPointItemViewModel () @property (nonatomic, readwrite, copy) NSString *numStr; @end @implementation RQSpecialPointItemViewModel - (instancetype)initWithPointArr:(NSArray *)pointArr currentPoint:(RQYDTPointModel *)currentPoint { if (self = [super init]) { @weakify(self) self.title = currentPoint.name; self.numStr = [NSString qmui_stringWithNSInteger:[pointArr indexOfObject:currentPoint] + 1]; CGFloat width = RQ_SCREEN_WIDTH / 2.f; CGFloat height = RQ_FIT_HORIZONTAL(50.f); self.itemSize = CGSizeMake(width, height); [[RACScheduler scheduler] schedule:^{ @strongify(self) NSArray *pointArr = [RQ_YDTQuestion_Module getPointQuestionWithPointID:currentPoint.id]; self.subtitle = [NSString qmui_stringWithNSInteger:pointArr.count]; self.operation = ^{ if (!RQObjectIsNil(pointArr) && pointArr.count > 0) { NSArray *arr = [pointArr.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 : currentPoint.name, RQExerciseTypeKey : @(RQExerciseType_Point), RQViewModelUtilKey : arr, }]; RQ_Exercise_Module.otherStr = currentPoint.name; [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES]; } else { [MBProgressHUD rq_showTips:@"正在获取题目..."]; } }; }]; } return self; } @end