Просмотр исходного кода

重构做题基础页, 修护 做题 背题模式 崩溃问题, 切换做题 背题出错问题。

openlockPPP 1 год назад
Родитель
Сommit
ee03e97730
16 измененных файлов с 285 добавлено и 72 удалено
  1. 49 22
      Pods/YYText/YYText/Utility/YYTextAsyncLayer.m
  2. 4 4
      jiaPei.xcodeproj/project.pbxproj
  3. 1 1
      jiaPei.xcodeproj/xcshareddata/xcschemes/jiaPei.xcscheme
  4. BIN
      jiaPei.xcworkspace/xcuserdata/mimasigeling.xcuserdatad/UserInterfaceState.xcuserstate
  5. 1 0
      jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseSubViewController.h
  6. 42 15
      jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseViewController.m
  7. 5 0
      jiaPei/Modules/OtherModules/ExerciseModule/Model/RQExerciseModel.h
  8. 20 11
      jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/NYTestingCentreCell.m
  9. 12 3
      jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/RQExerciseAnswerCell.m
  10. 6 2
      jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/RQExerciseVideoExplainCell.m
  11. 0 1
      jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/RQExerciseSubViewModel.h
  12. 15 0
      jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/RQTestQuestionsViewModel.m
  13. 20 4
      jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseAnswerItemViewModel.m
  14. 98 4
      jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseOptionItemViewModel.m
  15. 11 4
      jiaPei/Modules/OtherModules/PTObjectMolule/RQPTObjectMolule.m
  16. 1 1
      jiaPei/Modules/OtherModules/YDTQuestionModule/Modules/RQYDTXCQuestionModule.m

+ 49 - 22
Pods/YYText/YYText/Utility/YYTextAsyncLayer.m

@@ -200,28 +200,55 @@ static dispatch_queue_t YYTextAsyncLayerGetReleaseQueue() {
     } else {
         [_sentinel increase];
         if (task.willDisplay) task.willDisplay(self);
-        UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, self.contentsScale);
-        CGContextRef context = UIGraphicsGetCurrentContext();
-        if (self.opaque) {
-            CGSize size = self.bounds.size;
-            size.width *= self.contentsScale;
-            size.height *= self.contentsScale;
-            CGContextSaveGState(context); {
-                if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor) < 1) {
-                    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
-                    CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
-                    CGContextFillPath(context);
-                }
-                if (self.backgroundColor) {
-                    CGContextSetFillColorWithColor(context, self.backgroundColor);
-                    CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
-                    CGContextFillPath(context);
-                }
-            } CGContextRestoreGState(context);
-        }
-        task.display(context, self.bounds.size, ^{return NO;});
-        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
-        UIGraphicsEndImageContext();
+//        UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, self.contentsScale);
+//        CGContextRef context = UIGraphicsGetCurrentContext();
+//        if (self.opaque) {
+//            CGSize size = self.bounds.size;
+//            size.width *= self.contentsScale;
+//            size.height *= self.contentsScale;
+//            CGContextSaveGState(context); {
+//                if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor) < 1) {
+//                    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
+//                    CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
+//                    CGContextFillPath(context);
+//                }
+//                if (self.backgroundColor) {
+//                    CGContextSetFillColorWithColor(context, self.backgroundColor);
+//                    CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
+//                    CGContextFillPath(context);
+//                }
+//            } CGContextRestoreGState(context);
+//        }
+//        task.display(context, self.bounds.size, ^{return NO;});
+//        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
+//        UIGraphicsEndImageContext();
+//        self.contents = (__bridge id)(image.CGImage);
+        UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init];
+        format.opaque = self.opaque;
+        format.scale = self.contentsScale;
+
+        UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:self.bounds.size format:format];
+        UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {
+            CGContextRef context = rendererContext.CGContext;
+            if (self.opaque) {
+                CGSize size = self.bounds.size;
+                size.width *= self.contentsScale;
+                size.height *= self.contentsScale;
+                CGContextSaveGState(context); {
+                    if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor) < 1) {
+                        CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
+                        CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
+                        CGContextFillPath(context);
+                    }
+                    if (self.backgroundColor) {
+                        CGContextSetFillColorWithColor(context, self.backgroundColor);
+                        CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
+                        CGContextFillPath(context);
+                    }
+                } CGContextRestoreGState(context);
+            }
+            task.display(context, self.bounds.size, ^{return NO;});
+        }];
         self.contents = (__bridge id)(image.CGImage);
         if (task.didDisplay) task.didDisplay(self, YES);
     }

+ 4 - 4
jiaPei.xcodeproj/project.pbxproj

@@ -11778,7 +11778,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				"CODE_SIGN_RESOURCE_RULES_PATH[sdk=*]" = "";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2162024030901;
+				CURRENT_PROJECT_VERSION = 2172024032501;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				ENABLE_BITCODE = NO;
@@ -11816,7 +11816,7 @@
 					"$(PROJECT_DIR)/jiaPei/Vendor/BaiDuFaceSDK/BDFaceSDK/lib",
 					"$(PROJECT_DIR)/jiaPei/Vendor/QiNiu_IMSDK/Vendors/Voice",
 				);
-				MARKETING_VERSION = 2.1.6;
+				MARKETING_VERSION = 2.1.7;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"$(inherited)",
@@ -11861,7 +11861,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2162024030901;
+				CURRENT_PROJECT_VERSION = 2172024032501;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				ENABLE_BITCODE = NO;
@@ -11899,7 +11899,7 @@
 					"$(PROJECT_DIR)/jiaPei/Vendor/BaiDuFaceSDK/BDFaceSDK/lib",
 					"$(PROJECT_DIR)/jiaPei/Vendor/QiNiu_IMSDK/Vendors/Voice",
 				);
-				MARKETING_VERSION = 2.1.6;
+				MARKETING_VERSION = 2.1.7;
 				ONLY_ACTIVE_ARCH = NO;
 				OTHER_CFLAGS = (
 					"$(inherited)",

+ 1 - 1
jiaPei.xcodeproj/xcshareddata/xcschemes/jiaPei.xcscheme

@@ -41,7 +41,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "Release"
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       disableMainThreadChecker = "YES"

BIN
jiaPei.xcworkspace/xcuserdata/mimasigeling.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 0
jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseSubViewController.h

@@ -10,6 +10,7 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface RQExerciseSubViewController : RQCommonViewController <JXCategoryViewDelegate, JXPagerViewListViewDelegate, JXPagerSmoothViewDataSource>
+
 @property (nonatomic, readwrite, assign) NSUInteger count;
 @property (nonatomic, readwrite, assign) NSInteger number;/// 记录数字
 @property (nonatomic, readwrite, strong) UIScrollView *contentScrollView;

+ 42 - 15
jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseViewController.m

@@ -20,6 +20,9 @@
 
 @property (nonatomic, readwrite, assign) RQExerciseType historyExerciseType;
 
+//保存 vc
+@property (nonatomic, readwrite, strong) RQExerciseSubViewController *exerciseSubViewController;
+
 @end
 
 @implementation RQExerciseViewController
@@ -62,11 +65,11 @@
 
 - (void)viewDidDisappear:(BOOL)animated {
     [super viewDidDisappear:animated];
-    self.categoryView.delegate = nil;
-//    [self.myTitleView removeAllSubviews];
-//    self.myTitleView = nil;
-    self.pagerView = nil;
     if(!RQ_Exercise_Module.isShow_CatalogueView){
+        self.categoryView.delegate = nil;
+    //    [self.myTitleView removeAllSubviews];
+    //    self.myTitleView = nil;
+        self.pagerView = nil;
         [RQ_Exercise_Module.timer invalidate];
         RQ_Exercise_Module.timer = nil;
         RQ_Exercise_Module.count = 0;
@@ -186,18 +189,21 @@
 }
 
 - (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
-    RQExerciseSubViewModel *exerciseSubViewModel = [[RQExerciseSubViewModel alloc] initWithServices:self.viewModel.services params:@{
-//        RQExerciseTypeKey           : (self.viewModel.exerciseType == RQExerciseType_Exam)? @(RQExerciseType_Exam) : @(index),
-        RQHomePageCarTypeKey        : @(self.viewModel.homePageCarType),
-        RQHomePageSubjectTypeKey    : @(self.viewModel.homePageSubjectType),
-        RQHomeSubPageTypeKey        : @(self.viewModel.homeSubPageType),
-        RQHomeSubEditListTypeKey    : @(self.viewModel.homeSubEditListType),
-        RQViewModelIDKey            : self.viewModel.titleStr?  : @"",
-        RQViewCommonValueKey        : @(self.viewModel.number),
-        RQViewModelUtilKey          : self.viewModel.questionArr? : @[],
-    }];
-    RQExerciseSubViewController *exerciseSubViewController = [[RQExerciseSubViewController alloc] initWithViewModel:exerciseSubViewModel];
+    NSLog(@"index=%zd",index);
+//    RQExerciseSubViewModel *exerciseSubViewModel = [[RQExerciseSubViewModel alloc] initWithServices:self.viewModel.services params:@{
+////        RQExerciseTypeKey           : (self.viewModel.exerciseType == RQExerciseType_Exam)? @(RQExerciseType_Exam) : @(index),
+//        RQHomePageCarTypeKey        : @(self.viewModel.homePageCarType),
+//        RQHomePageSubjectTypeKey    : @(self.viewModel.homePageSubjectType),
+//        RQHomeSubPageTypeKey        : @(self.viewModel.homeSubPageType),
+//        RQHomeSubEditListTypeKey    : @(self.viewModel.homeSubEditListType),
+//        RQViewModelIDKey            : self.viewModel.titleStr?  : @"",
+//        RQViewCommonValueKey        : @(self.viewModel.number),
+//        RQViewModelUtilKey          : self.viewModel.questionArr? : @[],
+//    }];
+//    RQExerciseSubViewController *exerciseSubViewController = [[RQExerciseSubViewController alloc] initWithViewModel:exerciseSubViewModel];
 //    RAC(exerciseSubViewController, count) = RACObserve(self, count);
+    
+    RQExerciseSubViewController *exerciseSubViewController = self.exerciseSubViewController;
     return exerciseSubViewController;
 }
 
@@ -307,7 +313,28 @@
     return (RQ_Exercise_Module.currentExerciseType == RQExerciseType_Exam)? @[@""] : @[@"答题模式", @"背题模式"];
 }
 
+- (RQExerciseSubViewController *)exerciseSubViewController{
+    
+    if(!_exerciseSubViewController){
+        _exerciseSubViewController = [self createSubVc:0];
+    }
+    return _exerciseSubViewController;
+}
 
+- (RQExerciseSubViewController*)createSubVc:(NSInteger)index {
+    RQExerciseSubViewModel *exerciseSubViewModel = [[RQExerciseSubViewModel alloc] initWithServices:self.viewModel.services params:@{
+//        RQExerciseTypeKey           : (self.viewModel.exerciseType == RQExerciseType_Exam)? @(RQExerciseType_Exam) : @(index),
+        RQHomePageCarTypeKey        : @(self.viewModel.homePageCarType),
+        RQHomePageSubjectTypeKey    : @(self.viewModel.homePageSubjectType),
+        RQHomeSubPageTypeKey        : @(self.viewModel.homeSubPageType),
+        RQHomeSubEditListTypeKey    : @(self.viewModel.homeSubEditListType),
+        RQViewModelIDKey            : self.viewModel.titleStr?  : @"",
+        RQViewCommonValueKey        : @(self.viewModel.number),
+        RQViewModelUtilKey          : self.viewModel.questionArr? : @[],
+    }];
+    RQExerciseSubViewController *exerciseSubViewController = [[RQExerciseSubViewController alloc] initWithViewModel:exerciseSubViewModel];
+    return exerciseSubViewController;
+}
 
 - (RQCountdownView *)countdownView {
     if (!_countdownView) {

+ 5 - 0
jiaPei/Modules/OtherModules/ExerciseModule/Model/RQExerciseModel.h

@@ -34,6 +34,11 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @property (nonatomic, readwrite, copy) NSArray *userAnswer;
 
+/**
+ *  用户(背题)-选项
+ */
+@property (nonatomic, readwrite, copy) NSArray *userAnswerRecitation;
+
 /**
  *  是否收藏0收藏1否
  */

+ 20 - 11
jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/NYTestingCentreCell.m

@@ -52,21 +52,30 @@
     
     [[[[RACObserve(viewModel, ydtJSModel) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread] distinctUntilChanged] subscribeNext:^(RQYDTJSModel *ydtJSModel) {
         @strongify(self)
-        if (RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne) {
-            if (RQ_VIP_Module.isSubject1Vip||RQ_USER_MANAGER.tryLookCount>0) {
-                self.bottom_view.hidden = YES;
+        int tryCount = RQ_USER_MANAGER.tryLookCount;
+        if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+            tryCount = 0;
+        }
+        if (RQ_Exercise_Module.currentExerciseType == RQExerciseType_Sequential||
+            RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation//背题模式
+            ){
+            if (RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne) {
+                if (RQ_VIP_Module.isSubject1Vip||tryCount>0) {
+                    self.bottom_view.hidden = YES;
+                } else {
+                    self.bottom_view.hidden = NO;
+                }
+            } else if (RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour) {
+                if (RQ_VIP_Module.isSubject4Vip||tryCount>0) {
+                    self.bottom_view.hidden = YES;
+                } else {
+                    self.bottom_view.hidden = NO;
+                }
             } else {
-                self.bottom_view.hidden = NO;
-            }
-        } else if (RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour) {
-            if (RQ_VIP_Module.isSubject4Vip||RQ_USER_MANAGER.tryLookCount>0) {
                 self.bottom_view.hidden = YES;
-            } else {
-                self.bottom_view.hidden = NO;
             }
-        } else {
-            self.bottom_view.hidden = YES;
         }
+        
 //        self.skillLabel.hidden = RQObjectIsNil(ydtJSModel);
     }];
     

+ 12 - 3
jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/RQExerciseAnswerCell.m

@@ -57,6 +57,11 @@
     if(RQ_USER_MANAGER.tryLookCount>0){
         count = RQ_USER_MANAGER.tryLookCount-1;
     }
+    int tryCount = RQ_USER_MANAGER.tryLookCount;
+    if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+        tryCount = 0;
+        count = 0;
+    }
     self.trycount_label.text = [NSString stringWithFormat:@"%d",count];//试看次数
 
     [[[[RACObserve(viewModel, ydtJSModel) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread] distinctUntilChanged] subscribeNext:^(RQYDTJSModel *ydtJSModel) {
@@ -67,7 +72,7 @@
                 self.lookSkillBtn.hidden = YES;
                 self.jqmd_label.hidden = YES;
                 self.tryseeView.hidden = YES;
-            } else if(RQ_USER_MANAGER.tryLookCount>0){//是否试看
+            } else if(tryCount>0){//是否试看
                 self.coverImageView.hidden = YES;
                 self.lookSkillBtn.hidden = YES;
                 self.jqmd_label.hidden = YES;
@@ -84,7 +89,7 @@
                 self.lookSkillBtn.hidden = YES;
                 self.jqmd_label.hidden = YES;
                 self.tryseeView.hidden = YES;
-            } else if(RQ_USER_MANAGER.tryLookCount>0){//是否试看
+            } else if(tryCount>0){//是否试看
                 self.coverImageView.hidden = YES;
                 self.lookSkillBtn.hidden = YES;
                 self.jqmd_label.hidden = YES;
@@ -135,7 +140,11 @@
 //        NSInteger line = RQ_COMMON_MANAGER.APP_SWITCH? 0 : ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
         NSInteger line = ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
         self.skill_bottom_layout.constant = 16.f;
-        if(RQ_USER_MANAGER.tryLookCount>0 && line == 1){//是否试看
+        int tryCount = RQ_USER_MANAGER.tryLookCount;
+        if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+            tryCount = 0;
+        }
+        if(tryCount>0 && line == 1){//是否试看
             line = 0;
             self.skill_bottom_layout.constant = 56.f;
         }

+ 6 - 2
jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/RQExerciseVideoExplainCell.m

@@ -38,6 +38,10 @@
     
     RAC(self.tryLookLabel, text) = [[RACObserve(RQ_USER_MANAGER, tryLookCount) takeUntil:self.rac_prepareForReuseSignal] map:^id _Nullable(id  _Nullable value) {
         @strongify(self)
+        int tryCount = RQ_USER_MANAGER.tryLookCount;
+        if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+            tryCount = 0;
+        }
 //        if ((RQ_VIP_Module.isSubject1Vip && [viewModel.ydtJSModel.kemu isEqualToString:@"1"]) || (RQ_VIP_Module.isSubject4Vip && [viewModel.ydtJSModel.kemu isEqualToString:@"4"])) {
         if ((RQ_VIP_Module.isSubject1Vip) || (RQ_VIP_Module.isSubject4Vip)) {
             self.tryLookView.hidden = YES;
@@ -47,7 +51,7 @@
         } else {
             self.tryLookBottomView.hidden = NO;
             self.tryLookBgImageView.hidden = NO;
-            if (RQ_USER_MANAGER.tryLookCount == 0) {
+            if (tryCount == 0) {
                 self.tryLookView.hidden = NO;
                 self.tryLookCoverImageView.hidden = NO;
             } else {
@@ -55,7 +59,7 @@
                 self.tryLookCoverImageView.hidden = YES;
             }
         }
-        return [NSString stringWithFormat:@"第%ld题",RQ_USER_MANAGER.tryLookCount];
+        return [NSString stringWithFormat:@"第%ld题",tryCount];
     }];
 }
 - (IBAction)playBtnAvtion:(id)sender {

+ 0 - 1
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/RQExerciseSubViewModel.h

@@ -25,7 +25,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 
 
-
 @end
 
 NS_ASSUME_NONNULL_END

+ 15 - 0
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/RQTestQuestionsViewModel.m

@@ -83,12 +83,27 @@
     ///
     RAC(self, dataSource) = [[RACSignal combineLatest:@[[RACObserve(self, exerciseModel) distinctUntilChanged], RACObserve(self.exerciseModel, userAnswer), [RACObserve(self.exerciseModel, answerResultsType) distinctUntilChanged],RACObserve(RQ_Exercise_Module, currentExerciseType)] reduce:^id (RQExerciseModel *exerciseModel, NSArray *userAnswer, NSNumber *answerResultsType, NSNumber *currentExerciseType) {
         @strongify(self)
+        NSLog(@"XXT=题目%zd:%@",exerciseModel.ydtQuestionModel.num,exerciseModel.ydtQuestionModel.Question);
+        NSLog(@"XXT=答案:%@",exerciseModel.ydtQuestionModel.AnswerTrue);
+        NSLog(@"XXT=AnswerItem:%@",exerciseAnswerItemViewModel.answerString);
+        NSLog(@"XXT=word:%@",ydtJSModel.word);
         if (RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation) {
+            for (RQExerciseOptionItemViewModel *itemModel in self.group1.itemViewModels) {
+                if(exerciseAnswerItemViewModel.answerString){
+                    itemModel.exerciseModel.userAnswerRecitation = @[exerciseAnswerItemViewModel.answerString.copy].copy;
+                }
+            }
             self.group2.itemViewModels = @[exerciseAnswerItemViewModel];
             self.group3.itemViewModels = @[];
             self.group4.itemViewModels = @[exerciseTestingCentreItemViewModel];
             self.group5.itemViewModels = RQObjectIsNil(exerciseVideoExplainItemViewModel)? @[exercisExplainItemViewModel] : @[exerciseVideoExplainItemViewModel,exercisExplainItemViewModel];
+            
         } else {
+            for (RQExerciseOptionItemViewModel *itemModel in self.group1.itemViewModels) {
+                if(exerciseAnswerItemViewModel.answerString){
+                    itemModel.exerciseModel.userAnswerRecitation = @[];
+                }
+            }
             BOOL isAnswered = (![userAnswer containsObject:@"预选Option"] && userAnswer.count > 0);
             if (isAnswered) {
                 if (exerciseModel.answerResultsType == RQAnswerResultsType_Correct) {

+ 20 - 4
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseAnswerItemViewModel.m

@@ -96,7 +96,11 @@
                 self.skillString = text;
 //                NSInteger line = RQ_COMMON_MANAGER.APP_SWITCH? 0 : ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
                 NSInteger line = ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
-                if (RQ_USER_MANAGER.tryLookCount>0 && line==1){//试看
+                int tryCount = RQ_USER_MANAGER.tryLookCount;
+                if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+                    tryCount = 0;
+                }
+                if (tryCount>0 && line==1){//试看
                     line = 0;
                 }
                 CGFloat height = (line == 0)? [self getMessageHeightWithAttributedStr:text andLabel:self.yyLabel] : RQ_FIT_HORIZONTAL(34.f);
@@ -115,7 +119,11 @@
     CGFloat skillH = _skillHeight;
 //    NSInteger line = RQ_COMMON_MANAGER.APP_SWITCH? 0 : ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
     NSInteger line = ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
-    if (RQ_USER_MANAGER.tryLookCount>0 && line==1){//试看
+    int tryCount = RQ_USER_MANAGER.tryLookCount;
+    if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+        tryCount = 0;
+    }
+    if (tryCount>0 && line==1){//试看
         line = 0;
     }
     if(line==1) skillH = RQ_FIT_HORIZONTAL(34.f);
@@ -127,7 +135,11 @@
     CGFloat rowH = _exRowHeight + self.skillHeight;
 //    NSInteger line = RQ_COMMON_MANAGER.APP_SWITCH? 0 : ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
     NSInteger line = ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
-    if (RQ_USER_MANAGER.tryLookCount>0 && line==1){//试看
+    int tryCount = RQ_USER_MANAGER.tryLookCount;
+    if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+        tryCount = 0;
+    }
+    if (tryCount>0 && line==1){//试看
         rowH = rowH + 40.f;
     }
     return rowH;
@@ -161,7 +173,11 @@
         //是vip
 //        NSInteger line = RQ_COMMON_MANAGER.APP_SWITCH? 0 : ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
         NSInteger line = ((RQ_VIP_Module.isSubject1Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne)? 0 : ((RQ_VIP_Module.isSubject4Vip && RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? 0 : 1));
-        if (RQ_USER_MANAGER.tryLookCount>0 && line==1){//试看
+        int tryCount = RQ_USER_MANAGER.tryLookCount;
+        if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+            tryCount = 0;
+        }
+        if (tryCount>0 && line==1){//试看
             line = 0;
         }
         if (line==1) {

+ 98 - 4
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseOptionItemViewModel.m

@@ -54,7 +54,97 @@
         } else if ([self.exerciseModel.ydtQuestionModel.An4 isEqualToString:optString]) {
             self.title = @"D";
         }
-        
+        [[RACObserve(self.exerciseModel, userAnswerRecitation) deliverOnMainThread] subscribeNext:^(id  _Nullable x) {
+            @strongify(self)
+            NSArray *userAnswerArr = self.exerciseModel.userAnswer;
+            if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
+                userAnswerArr = self.exerciseModel.userAnswerRecitation;
+            }
+            if ([self.exerciseModel.ydtQuestionModel.An1 isEqualToString:optString]) {
+                self.title = @"A";
+            } else if ([self.exerciseModel.ydtQuestionModel.An2 isEqualToString:optString]) {
+                self.title = @"B";
+            } else if ([self.exerciseModel.ydtQuestionModel.An3 isEqualToString:optString]) {
+                self.title = @"C";
+            } else if ([self.exerciseModel.ydtQuestionModel.An4 isEqualToString:optString]) {
+                self.title = @"D";
+            }
+            if (self.exerciseModel.ydtQuestionModel.Type == 3) {
+//                NSArray *userAnswerArr = self.exerciseModel.userAnswer;
+                if ([userAnswerArr containsObject:@"预选Option"]) {
+                    if ([userAnswerArr containsObject:optString]) {
+                        [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_COLOR range:NSMakeRange(0, optString.length)];
+                        self.btnBgColor = RQ_MAIN_COLOR;
+                    } else {
+                        [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_1 range:NSMakeRange(0, optString.length)];
+                        self.btnBgColor = RQ_MAIN_TEXT_COLOR_WHITE;
+                    }
+                } else {
+                    if ([userAnswerArr containsObject:optString] && [answerOptionArr containsObject:optString]) {
+                        [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_GREEN range:NSMakeRange(0, optString.length)];
+                        self.title = @"";
+                        self.btnBgColor = RQ_MAIN_TEXT_COLOR_GREEN;
+                        if (RQ_Exercise_Module.currentExerciseType != RQExerciseType_Recitation) {
+                            self.exerciseModel.answerResultsType = (self.exerciseModel.answerResultsType == RQAnswerResultsType_Error)? RQAnswerResultsType_Error : RQAnswerResultsType_Correct;
+                        }
+                    } else if ([userAnswerArr containsObject:optString] && ![answerOptionArr containsObject:optString]) {
+                        [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_RED range:NSMakeRange(0, optString.length)];
+                        self.title = @"";
+                        self.btnBgColor = RQ_MAIN_TEXT_COLOR_RED;
+                        if (RQ_Exercise_Module.currentExerciseType != RQExerciseType_Recitation) {
+                            self.exerciseModel.answerResultsType = RQAnswerResultsType_Error;
+                        }
+                    } else if (![userAnswerArr containsObject:optString] && [answerOptionArr containsObject:optString]) {
+                        [_optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_GREEN range:NSMakeRange(0, optString.length)];
+                        self.btnBgColor = RQ_MAIN_TEXT_COLOR_GREEN;
+                        if (RQ_Exercise_Module.currentExerciseType != RQExerciseType_Recitation) {
+                            self.exerciseModel.answerResultsType = RQAnswerResultsType_Error;
+                        }
+                    } else {
+                        [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_1 range:NSMakeRange(0, optString.length)];
+                        self.btnBgColor = RQ_MAIN_TEXT_COLOR_WHITE;
+                    }
+                }
+            } else {
+                
+                NSString *answerOptionStr = allOptionsArr[self.exerciseModel.ydtQuestionModel.AnswerTrue.integerValue - 1];
+                
+//                NSArray *userAnswerArr = self.exerciseModel.userAnswer;
+                if (userAnswerArr.count > 0) {
+                    if ([answerOptionStr isEqualToString:optString]) {
+                        /// 正确选项
+                        [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_GREEN range:NSMakeRange(0, optString.length)];
+                        if ([userAnswerArr.firstObject isEqualToString:optString]) {
+                            self.title = @"";
+                            if (RQ_Exercise_Module.currentExerciseType != RQExerciseType_Recitation) {
+                                self.exerciseModel.answerResultsType = RQAnswerResultsType_Correct;
+                            }
+                        }
+                        self.btnBgColor = RQ_MAIN_TEXT_COLOR_GREEN;
+                    } else {
+                        /// 错误选项
+                        if ([userAnswerArr containsObject:optString]) {
+                            if (RQ_Exercise_Module.currentExerciseType != RQExerciseType_Recitation) {
+                                self.exerciseModel.answerResultsType = RQAnswerResultsType_Error;
+                                [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_RED range:NSMakeRange(0, optString.length)];
+                                self.title = @"";
+                                self.btnBgColor = RQ_MAIN_TEXT_COLOR_RED;
+                            } else {
+                                [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_1 range:NSMakeRange(0, optString.length)];
+                                self.btnBgColor = RQ_MAIN_TEXT_COLOR_WHITE;
+                            }
+                        } else {
+                            [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_1 range:NSMakeRange(0, optString.length)];
+                            self.btnBgColor = RQ_MAIN_TEXT_COLOR_WHITE;
+                        }
+                    }
+                } else {
+                    [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_1 range:NSMakeRange(0, optString.length)];
+                    self.btnBgColor = RQ_MAIN_TEXT_COLOR_WHITE;
+                }
+            }
+
+        }];
         [[RACObserve(self.exerciseModel, userAnswer) deliverOnMainThread] subscribeNext:^(id  _Nullable x) {
             @strongify(self)
             if (self.exerciseModel.ydtQuestionModel.Type == 3) {
@@ -69,7 +159,7 @@
                         self.btnBgColor = RQ_MAIN_TEXT_COLOR_WHITE;
                     }
                 } else {
-                    self.operation = ^{};
+                    //self.operation = ^{};
                     if ([userAnswerArr containsObject:optString] && [answerOptionArr containsObject:optString]) {
                         [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_GREEN range:NSMakeRange(0, optString.length)];
                         self.title = @"";
@@ -101,7 +191,7 @@
                 NSArray *userAnswerArr = (RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation)? answerOptionArr.copy : self.exerciseModel.userAnswer;
 //                NSArray *userAnswerArr = self.exerciseModel.userAnswer;
                 if (userAnswerArr.count > 0) {
-                    self.operation = ^{};
+                    //self.operation = ^{};
                     if ([answerOptionStr isEqualToString:optString]) {
                         /// 正确选项
                         [self.optsString addAttribute:NSForegroundColorAttributeName value:RQ_MAIN_TEXT_COLOR_GREEN range:NSMakeRange(0, optString.length)];
@@ -148,8 +238,12 @@
             return @(10.f + ((labelHeight.floatValue < RQ_FIT_HORIZONTAL(30.f)? RQ_FIT_HORIZONTAL(30.f) : labelHeight.floatValue)) + 10.f);
         }] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal];
         //答题-block
-        self.operation = (RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation)? ^{} : ^{
+        //(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation)? ^{} :
+        self.operation = ^{
+            if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation)return;
             @strongify(self)
+            NSLog(@"RQExerciseType_xxxx----operation");
+            if(self.exerciseModel.answerResultsType != RQAnswerResultsType_Unanswered)return;//已答题 不可用
             if (RQ_USER_MANAGER.tryLookCount > 0) {//试看次数
                 RQ_USER_MANAGER.tryLookCount = RQ_USER_MANAGER.tryLookCount - 1;
             }

+ 11 - 4
jiaPei/Modules/OtherModules/PTObjectMolule/RQPTObjectMolule.m

@@ -23,6 +23,7 @@ typedef NS_ENUM(NSInteger, RQQRCodeType) {
 @interface RQPTObjectMolule ()
 @property (nonatomic, readwrite, assign) RQQRCodeType rqQRCodeType;
 @property (nonatomic, readwrite, assign) BOOL isShowChooseSubject;
+@property (nonatomic, readwrite, copy) NSString *PTSC6_str;
 @end
 
 @implementation RQPTObjectMolule
@@ -121,8 +122,10 @@ static id rq_ptObjectModule = nil;
         }
 
         __block NSString *ptSubjectStr;
+        self.PTSC6_str = @"";
         if (_rqQRCodeType == RQQRCodeType_PTSC && !RQObjectIsNil(array[5]) && !RQObjectIsNil(array[7])) {
             ptSubjectStr = array[5];
+            self.PTSC6_str = [ptSubjectStr copy];
             NSString *trainTypeStr = array[7];
             if ([trainTypeStr isEqualToString:@"17"]) {
                 if ([ptSubjectStr isEqualToString:@"5"] || RQStringIsEmpty(ptSubjectStr)) {
@@ -487,10 +490,14 @@ static id rq_ptObjectModule = nil;
                     } else {
                         if (self.rqQRCodeType == RQQRCodeType_PTSC) {
                             NSString *message = @"操作成功!";
-                            if ([rqCodeArr[7] integerValue] == 17) {
-                                message = @"扫码签到成功!等待设备响应!";
-                            } else if ([rqCodeArr[7] integerValue] == 19) {
-                                message = @"扫码签退成功!等待设备响应!";
+                            if([self.PTSC6_str isEqualToString:@"5"]){
+                                if ([rqCodeArr[7] integerValue] == 17) {
+                                    message = @"扫码签到验证成功,请等待设备响应";
+                                } else if ([rqCodeArr[7] integerValue] == 19) {
+                                    message = @"扫码签退验证成功,请等待设备响应";
+                                }
+                            }else{
+                                message = @"扫码成功, 请在设备进行下一步操作";
                             }
                             [RQ_SHARE_FUNCTION showAlertWithMessage:message completion:nil];
                             [Tools playAudioWithString:message];

+ 1 - 1
jiaPei/Modules/OtherModules/YDTQuestionModule/Modules/RQYDTXCQuestionModule.m

@@ -504,7 +504,7 @@ static id rq_ydtXcQuestionModule = nil;
         while ([resultSet next]) {
             RQYDTQuestionModel *ydtQuestionModel = [RQYDTQuestionModel ydtQuestionModelWithFMResultSet:resultSet];
             ydtQuestionModel.num = num;
-            NSLog(@"QT index = %zd ID=%zd qt=%@",num,ydtQuestionModel.ID,ydtQuestionModel.Question);
+            NSLog(@"QT index = %zd ID=%zd qt=%@  Type=%zd",num,ydtQuestionModel.ID,ydtQuestionModel.Question,ydtQuestionModel.Type);
             [arr addObject:ydtQuestionModel];
             num ++;
         }