12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //
- // NYHomePageOneBigItemViewModel.m
- // jiaPei
- //
- // Created by Ning.ge on 2024/11/22.
- // Copyright © 2024 JCZ. All rights reserved.
- //
- #import "NYHomePageOneBigItemViewModel.h"
- @interface NYHomePageOneBigItemViewModel ()
- @property (nonatomic, readwrite, assign) RQHomePageCarType homePageCarType;
- @property (nonatomic, readwrite, assign) RQHomePageSubjectType homePageSubjectType;
- @end
- @implementation NYHomePageOneBigItemViewModel
- - (instancetype)initWithNYHomePageCarType:(RQHomePageCarType)homePageCarType homePageSubjectType:(RQHomePageSubjectType)homePageSubjectType treeListModel:(nonnull RQTreeListModel *)treeListModel {
- if (self = [super init]) {
- @weakify(self)
- self.homePageCarType = homePageCarType;
- self.homePageSubjectType = homePageSubjectType;
- self.treeListModel = treeListModel;
- CGFloat width = RQ_SCREEN_WIDTH;
- CGFloat height = RQ_FIT_HORIZONTAL(363.f);
- self.itemSize = CGSizeMake(width, height);
-
- NSArray *readList = [NYTools readExerciseListUserKey:RQ_USER_MANAGER.currentUser.outId carType:RQ_YDTQuestion_Module.carType subject:RQ_YDTQuestion_Module.subject exerciseType:RQ_Exercise_Module.currentExerciseType];
- NSInteger allCount = [RQ_YDTQuestion_Module getQuestionNumWithWithSubject:self.homePageSubjectType exerciseType:RQExerciseType_Sequential];
- self.sxlxtStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld/%ld",readList.count,allCount]];
- RAC(self, sxlxtStr) = [[RACSignal combineLatest:@[RACObserve(RQ_YDTQuestion_Module, subjectOneArr), RACObserve(RQ_YDTQuestion_Module, subjectFourArr)] reduce:^id (NSArray *subjectOneArr, NSArray *subjectFourArr) {
- @strongify(self)
- NSArray *readList = [NYTools readExerciseListUserKey:RQ_USER_MANAGER.currentUser.outId carType:RQ_YDTQuestion_Module.carType subject:RQ_YDTQuestion_Module.subject exerciseType:RQ_Exercise_Module.currentExerciseType];
- NSInteger allCount = [RQ_YDTQuestion_Module getQuestionNumWithWithSubject:self.homePageSubjectType exerciseType:RQExerciseType_Sequential];
- return [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld/%ld",readList.count,allCount]];
- }] takeUntil:self.rac_willDeallocSignal];
-
-
-
- NSString *score = [NSString stringWithFormat:@"%@",@"0"];
- NSString *fen = [NSString stringWithFormat:@"分"];
- NSString *myScore = [NSString stringWithFormat:@"%@%@",score,fen];
- NSMutableAttributedString *myScoreAttrStr = [[NSMutableAttributedString alloc] initWithString:myScore];
- self.mnksStr = myScoreAttrStr;//模拟考试
-
- RAC(self, mnksStr) = [[RACSignal combineLatest:@[RACObserve(RQ_COMMON_MANAGER, examResultOneListArr), RACObserve(RQ_COMMON_MANAGER, examResultFourListArr)] reduce:^id (NSArray *examResultOneListArr, NSArray *examResultFourListArr) {
- @strongify(self)
- NSArray *arr;
- if (self.homePageSubjectType == RQHomePageSubjectType_SubjectOne) {
- arr = examResultOneListArr;
- }
-
- if (self.homePageSubjectType == RQHomePageSubjectType_SubjectFour) {
- arr = examResultFourListArr;
- }
-
- float max = [[[arr.rac_sequence.signal map:^id _Nullable(RQExamResultModel *examResultModel) {
- return examResultModel.score;
- }].toArray valueForKeyPath:@"@max.floatValue"] floatValue];
- NSString *score = [NSString qmui_stringWithCGFloat:max decimal:0];
- NSString *fen = [NSString stringWithFormat:@"分"];
- NSString *myScore = [NSString stringWithFormat:@"%@%@",score,fen];
- NSMutableAttributedString *myScoreAttrStr = [[NSMutableAttributedString alloc] initWithString:myScore];
-
- return myScoreAttrStr;
- }] takeUntil:self.rac_willDeallocSignal];
-
-
- }
- return self;
- }
- @end
|