|
@@ -38,6 +38,7 @@
|
|
|
[answerOptionArr addObject:[allOptionsArr objectAtIndex:indexStr.integerValue - 1]];
|
|
|
}
|
|
|
self.ydtJSModel = [RQ_YDT_JS_Question_Module getQuestionJSWithQuestionId:exerciseModel.ydtQuestionModel.ID];
|
|
|
+ exerciseModel.ydtQuestionModel.explain = self.ydtJSModel.best_explain_new;//2023.9.25
|
|
|
// //ning 2023-5-24 一点通db 解题答案数据有异常-新整jq库进行修正。
|
|
|
// self.ydtJSModel.qb_read_analyse = [YN_YDT_JQ_Question_Module getQuestionKTJQWithQuestionId:exerciseModel.ydtQuestionModel.ID];
|
|
|
//于2023-08-18 年更新db完成-解决此问题
|
|
@@ -47,7 +48,8 @@
|
|
|
self.skillHeight = 0.f;
|
|
|
space = 0.f;
|
|
|
} else {
|
|
|
- NSArray *knameList = [self getKeyRangeList:self.ydtJSModel.qb_analyse readText:self.ydtJSModel.qb_read_analyse];//获取关键字
|
|
|
+ NSString *readText = [[self.ydtJSModel.qb_analyse stringByReplacingOccurrencesOfString:@"【" withString:@""] stringByReplacingOccurrencesOfString:@"】" withString:@""];
|
|
|
+ NSArray *knameList = [self getKeyRangeList:self.ydtJSModel.qb_analyse readText:readText];//获取关键字
|
|
|
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] init];
|
|
|
//播放-答案
|
|
|
if (RQ_COMMON_MANAGER.JSJP_APP_VOICE) {//读题-是否开启
|
|
@@ -69,7 +71,7 @@
|
|
|
self.readBtn = readBtn;
|
|
|
[text appendAttributedString:readAttachment];
|
|
|
}
|
|
|
- NSMutableAttributedString *analyseString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",self.ydtJSModel.qb_read_analyse]];
|
|
|
+ NSMutableAttributedString *analyseString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",readText]];
|
|
|
[text appendAttributedString:analyseString];
|
|
|
text.yy_font = [UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize];
|
|
|
text.yy_lineSpacing = 8;
|
|
@@ -79,7 +81,7 @@
|
|
|
for (NSDictionary *item in knameList) {
|
|
|
NSArray *values = item.allValues.firstObject;
|
|
|
NSString *replacementString = item.allKeys.firstObject;
|
|
|
- NSRange range = NSMakeRange([values[0] intValue], [values[1] intValue]);
|
|
|
+ NSRange range = NSMakeRange([values[0] intValue]+1, [values[1] intValue]);
|
|
|
NSDictionary *attributes = @{ NSForegroundColorAttributeName: RGB_COLOR(244, 0, 47),NSFontAttributeName: [UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize]};
|
|
|
[text replaceCharactersInRange:range withString:replacementString];
|
|
|
[text setAttributes:attributes range:NSMakeRange(range.location, range.length)];
|
|
@@ -125,30 +127,6 @@
|
|
|
return rowH;
|
|
|
}
|
|
|
|
|
|
-//获取字典
|
|
|
-- (NSArray *)getKeyRangeList:(NSString *)originalText readText:(NSString*)readText {
|
|
|
- NSError *error = nil;
|
|
|
- NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"【(.*?)】" options:0 error:&error];
|
|
|
- NSMutableArray *array = nil;
|
|
|
- if (!error) {
|
|
|
- array = @[].mutableCopy;
|
|
|
- NSArray<NSTextCheckingResult *> *matches = [regex matchesInString:originalText options:0 range:NSMakeRange(0, originalText.length)];
|
|
|
- for (NSTextCheckingResult *match in matches) {
|
|
|
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
|
|
- NSRange matchedRange = [match rangeAtIndex:1];
|
|
|
- NSString *extractedText = [originalText substringWithRange:matchedRange];
|
|
|
- NSRange range = [readText rangeOfString:extractedText];
|
|
|
- dict[extractedText] = @[@(range.location+1),@(range.length)];
|
|
|
- [array addObject:dict];
|
|
|
- NSLog(@"Extracted Text: %@", extractedText);
|
|
|
- NSLog(@"Matched Range: %@", NSStringFromRange(matchedRange));
|
|
|
- }
|
|
|
- } else {
|
|
|
- NSLog(@"Regex Error: %@", error.localizedDescription);
|
|
|
- }
|
|
|
- return array;
|
|
|
-}
|
|
|
-
|
|
|
- (CGFloat)getMessageHeightWithAttributedStr:(NSMutableAttributedString *)attributedStr andLabel:(YYLabel *)lb {
|
|
|
lb.attributedText = attributedStr;
|
|
|
CGSize introSize = CGSizeMake(RQ_SCREEN_WIDTH - (16 * 2) - (8 * 2), CGFLOAT_MAX);
|