// // RQSpecialPracticeItemViewModel.m // jiaPei // // Created by 张嵘 on 2022/6/22. // Copyright © 2022 JCZ. All rights reserved. // #import "RQSpecialPracticeItemViewModel.h" @interface RQSpecialPracticeItemViewModel () @property (nonatomic, readwrite, copy) NSString *subTitleStr; @end @implementation RQSpecialPracticeItemViewModel - (instancetype)initWithTitleStr:(NSString *)titleStr subTitleStr:(NSString *)subTitleStr iconImgStr:(NSString *)iconImgStr { if (self = [super init]) { self.title = titleStr; self.icon = iconImgStr; CGFloat width = (RQ_SCREEN_WIDTH - 8 - 32) / 2.f; CGFloat height = width * (100.f / 168.f); self.itemSize = CGSizeMake(width, height); if ([titleStr isEqualToString:@"章节练习"]) { self.subTitleStr = [NSString stringWithFormat:@"共%@章",subTitleStr]; self.operation = ^{ RQChapterAndPointListViewModel *chapterListViewModel = [[RQChapterAndPointListViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelTitleKey : titleStr}]; [RQ_APPDELEGATE.services pushViewModel:chapterListViewModel animated:YES]; }; } else if ([titleStr isEqualToString:@"考点练习"]) { self.subTitleStr = [NSString stringWithFormat:@"共%@考点",subTitleStr]; self.operation = ^{ RQChapterAndPointListViewModel *pointListViewModel = [[RQChapterAndPointListViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelTitleKey : titleStr}]; [RQ_APPDELEGATE.services pushViewModel:pointListViewModel animated:YES]; }; } } return self; } @end