|
@@ -13,14 +13,32 @@
|
|
|
@end
|
|
|
|
|
|
@implementation RQSpecialPracticeItemViewModel
|
|
|
-- (instancetype)initWithTitleStr:(NSString *)titleStr subTitleStr:(NSString *)subTitleStr iconImgStr:(NSString *)iconImgStr {
|
|
|
+- (instancetype)initWithTitleStr:(NSString *)titleStr subTitleStr:(NSString *)subTitleStr iconImgStr:(NSString *)iconImgStr itemCount:(CGFloat)itemCount {
|
|
|
if (self = [super init]) {
|
|
|
self.title = titleStr;
|
|
|
self.icon = iconImgStr;
|
|
|
- CGFloat width = (RQ_SCREEN_WIDTH - 8 - 32) / 2.f;
|
|
|
+ CGFloat width = (RQ_SCREEN_WIDTH - 8 - 32-(itemCount==3.f?32:0)) / itemCount;
|
|
|
CGFloat height = width * (100.f / 168.f);
|
|
|
self.itemSize = CGSizeMake(width, height);
|
|
|
- if ([titleStr isEqualToString:@"章节练习"]) {
|
|
|
+ if ([titleStr isEqualToString:@"本地练习"]) {
|
|
|
+ self.subTitleStr = [NSString stringWithFormat:@"共%@题",subTitleStr];
|
|
|
+ self.operation = ^{
|
|
|
+ NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_Locality ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) {
|
|
|
+ RQExerciseModel *exerciseModel = [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
|
|
|
+ exerciseModel.isLocalityLX = true;
|
|
|
+ return exerciseModel;
|
|
|
+ }].toArray;
|
|
|
+ RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
|
|
|
+ RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
|
|
|
+ RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
|
|
|
+ RQHomeSubPageTypeKey : @(RQHomeSubPageType_LocalityQuestions),
|
|
|
+ RQViewModelIDKey : @"本地练习",
|
|
|
+ RQExerciseTypeKey : @(RQExerciseType_Locality),
|
|
|
+ RQViewModelUtilKey : arr,
|
|
|
+ }];
|
|
|
+ [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
|
|
|
+ };
|
|
|
+ }else if ([titleStr isEqualToString:@"章节练习"]) {
|
|
|
self.subTitleStr = [NSString stringWithFormat:@"共%@章",subTitleStr];
|
|
|
self.operation = ^{
|
|
|
RQChapterAndPointListViewModel *chapterListViewModel = [[RQChapterAndPointListViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelTitleKey : titleStr}];
|