|
@@ -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;
|
|
|
}
|