Browse Source

本地练习基本完成

openlockPPP 1 year ago
parent
commit
da081a0997

+ 4 - 4
jiaPei.xcodeproj/project.pbxproj

@@ -11726,7 +11726,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				"CODE_SIGN_RESOURCE_RULES_PATH[sdk=*]" = "";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2072023092702;
+				CURRENT_PROJECT_VERSION = 2092023100701;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				ENABLE_BITCODE = NO;
@@ -11763,7 +11763,7 @@
 					"$(PROJECT_DIR)/jiaPei/Vendor/BaiDuFaceSDK/BDFaceSDK/lib",
 					"$(PROJECT_DIR)/jiaPei/Vendor/QiNiu_IMSDK/Vendors/Voice",
 				);
-				MARKETING_VERSION = 2.0.7;
+				MARKETING_VERSION = 2.0.9;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"$(inherited)",
@@ -11808,7 +11808,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2072023092702;
+				CURRENT_PROJECT_VERSION = 2092023100701;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				ENABLE_BITCODE = NO;
@@ -11845,7 +11845,7 @@
 					"$(PROJECT_DIR)/jiaPei/Vendor/BaiDuFaceSDK/BDFaceSDK/lib",
 					"$(PROJECT_DIR)/jiaPei/Vendor/QiNiu_IMSDK/Vendors/Voice",
 				);
-				MARKETING_VERSION = 2.0.7;
+				MARKETING_VERSION = 2.0.9;
 				ONLY_ACTIVE_ARCH = NO;
 				OTHER_CFLAGS = (
 					"$(inherited)",

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


+ 2 - 0
jiaPei/Macros/RQConstEnum.h

@@ -98,6 +98,8 @@ typedef NS_ENUM(NSUInteger, RQHomeSubPageType) {
     RQHomeSubPageType_SelectedTestQuestions,
     /// 模拟考试
     RQHomeSubPageType_MockExamination,
+    /// 本地练习
+    RQHomeSubPageType_LocalityQuestions,
 };
 /// EditListType
 typedef NS_ENUM(NSUInteger, RQHomeSubEditListType) {

+ 1 - 0
jiaPei/Modules/BaseModule/Common/ViewModel/RQCommonItemViewModel.m

@@ -37,6 +37,7 @@
 
 //获取字典
 - (NSArray *)getKeyRangeList:(NSString *)originalText readText:(NSString*)readText {
+    if(originalText==nil||readText==nil)return @[];
     NSError *error = nil;
     NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"【(.*?)】" options:0 error:&error];
     NSMutableArray *array = nil;

+ 11 - 2
jiaPei/Modules/HomePageModule/ViewModel/HomeSubPage/专项练习/RQSpecialPractiseViewModel.m

@@ -128,9 +128,18 @@
 
 
 - (NSArray *)zeroArr {
+    //福州市-江苏-目前写死
+    if ([RQ_USER_MANAGER.currentUser.city isEqualToString:@"3501"]) {
+        NSInteger allCount = [RQ_YDTQuestion_Module getQuestionNumWithWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_Locality];
+        return @[
+            [[RQSpecialPracticeItemViewModel alloc] initWithTitleStr:@"本地练习" subTitleStr:[NSString qmui_stringWithNSInteger:allCount] iconImgStr:@"章节练习背景" itemCount:3.f],
+            [[RQSpecialPracticeItemViewModel alloc] initWithTitleStr:@"章节练习" subTitleStr:[NSString qmui_stringWithNSInteger:self.chapterArr.count] iconImgStr:@"章节练习背景" itemCount:3.f],
+            [[RQSpecialPracticeItemViewModel alloc] initWithTitleStr:@"考点练习" subTitleStr:[NSString qmui_stringWithNSInteger:self.pointArr.count] iconImgStr:@"考点练习背景" itemCount:3.f]
+        ];
+    }
     return @[
-        [[RQSpecialPracticeItemViewModel alloc] initWithTitleStr:@"章节练习" subTitleStr:[NSString qmui_stringWithNSInteger:self.chapterArr.count] iconImgStr:@"章节练习背景"],
-        [[RQSpecialPracticeItemViewModel alloc] initWithTitleStr:@"考点练习" subTitleStr:[NSString qmui_stringWithNSInteger:self.pointArr.count] iconImgStr:@"考点练习背景"]
+        [[RQSpecialPracticeItemViewModel alloc] initWithTitleStr:@"章节练习" subTitleStr:[NSString qmui_stringWithNSInteger:self.chapterArr.count] iconImgStr:@"章节练习背景" itemCount:2.f],
+        [[RQSpecialPracticeItemViewModel alloc] initWithTitleStr:@"考点练习" subTitleStr:[NSString qmui_stringWithNSInteger:self.pointArr.count] iconImgStr:@"考点练习背景" itemCount:2.f]
     ];
 }
 

+ 1 - 1
jiaPei/Modules/HomePageModule/ViewModel/HomeSubPage/专项练习/itemViewModel/RQSpecialPracticeItemViewModel.h

@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface RQSpecialPracticeItemViewModel : RQCommonCollectionItemViewModel
 @property (nonatomic, readonly, copy) NSString *subTitleStr;
-- (instancetype)initWithTitleStr:(NSString *)titleStr subTitleStr:(NSString *)subTitleStr iconImgStr:(NSString *)iconImgStr;
+- (instancetype)initWithTitleStr:(NSString *)titleStr subTitleStr:(NSString *)subTitleStr iconImgStr:(NSString *)iconImgStr itemCount:(CGFloat)itemCount;
 @end
 
 NS_ASSUME_NONNULL_END

+ 21 - 3
jiaPei/Modules/HomePageModule/ViewModel/HomeSubPage/专项练习/itemViewModel/RQSpecialPracticeItemViewModel.m

@@ -13,14 +13,32 @@
 @end
 
 @implementation RQSpecialPracticeItemViewModel
-- (instancetype)initWithTitleStr:(NSString *)titleStr subTitleStr:(NSString *)subTitleStr iconImgStr:(NSString *)iconImgStr {
+- (instancetype)initWithTitleStr:(NSString *)titleStr subTitleStr:(NSString *)subTitleStr iconImgStr:(NSString *)iconImgStr itemCount:(CGFloat)itemCount {
     if (self = [super init]) {
         self.title = titleStr;
         self.icon = iconImgStr;
-        CGFloat width = (RQ_SCREEN_WIDTH - 8 - 32) / 2.f;
+        CGFloat width = (RQ_SCREEN_WIDTH - 8 - 32-(itemCount==3.f?32:0)) / itemCount;
         CGFloat height = width * (100.f / 168.f);
         self.itemSize = CGSizeMake(width, height);
-        if ([titleStr isEqualToString:@"章节练习"]) {
+        if ([titleStr isEqualToString:@"本地练习"]) {
+            self.subTitleStr = [NSString stringWithFormat:@"共%@题",subTitleStr];
+            self.operation = ^{
+                NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_Locality ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel  *ydtQuestionModel) {
+                    RQExerciseModel *exerciseModel = [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
+                    exerciseModel.isLocalityLX = true;
+                    return exerciseModel;
+                }].toArray;
+                RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
+                    RQHomePageCarTypeKey        : @(RQ_YDTQuestion_Module.carType),
+                    RQHomePageSubjectTypeKey    : @(RQ_YDTQuestion_Module.subject),
+                    RQHomeSubPageTypeKey        : @(RQHomeSubPageType_LocalityQuestions),
+                    RQViewModelIDKey            : @"本地练习",
+                    RQExerciseTypeKey           : @(RQExerciseType_Locality),
+                    RQViewModelUtilKey          : arr,
+                }];
+                [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
+            };
+        }else if ([titleStr isEqualToString:@"章节练习"]) {
             self.subTitleStr = [NSString stringWithFormat:@"共%@章",subTitleStr];
             self.operation = ^{
                 RQChapterAndPointListViewModel *chapterListViewModel = [[RQChapterAndPointListViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelTitleKey : titleStr}];

+ 4 - 2
jiaPei/Modules/OtherModules/ExerciseModule/Model/RQExerciseModel.h

@@ -48,8 +48,10 @@ NS_ASSUME_NONNULL_BEGIN
  *  是否显示过技巧讲解
  */
 @property (nonatomic, readwrite, assign) BOOL isShowSkillExplanation;
-
-
+/**
+ *  是否是本地练习
+ */
+@property (nonatomic, readwrite, assign) BOOL isLocalityLX;
 /**
  *  Cell样式
  */

+ 2 - 0
jiaPei/Modules/OtherModules/ExerciseModule/RQExerciseModule.h

@@ -85,6 +85,8 @@ typedef NS_ENUM(NSUInteger, RQExerciseType) {
     RQExerciseType_Point,
     /// 章节题
     RQExerciseType_Chapter,
+    /// 本地考题
+    RQExerciseType_Locality,
 };
 
 

+ 0 - 1
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExercisExplainItemViewModel.m

@@ -21,7 +21,6 @@
         @weakify(self)
         dispatch_async(dispatch_get_main_queue(), ^{
             @strongify(self)
-//            getKeyRangeList
             self.exerciseModel = exerciseModel;
             CGFloat headerHeight = 16.f + 26.f + 16.f;
             CGFloat textHeight = 0;

+ 3 - 0
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseAnswerItemViewModel.m

@@ -49,6 +49,9 @@
                 space = 0.f;
             } else {
                 NSString *readText = [[self.ydtJSModel.qb_analyse stringByReplacingOccurrencesOfString:@"【" withString:@""] stringByReplacingOccurrencesOfString:@"】" withString:@""];
+                if(readText==nil&&exerciseModel.ydtQuestionModel.Type==RQQuestionType_Judgment){//判断题
+                    readText = [NSString stringWithFormat:@"看题目答题:%@",[answerOptionArr.mutableCopy componentsJoinedByString:@" "]];
+                }
                 NSArray *knameList = [self getKeyRangeList:self.ydtJSModel.qb_analyse readText:readText];//获取关键字
                 NSMutableAttributedString *text = [[NSMutableAttributedString alloc] init];
                 //播放-答案

+ 15 - 1
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseQuestionItemViewModel.m

@@ -199,7 +199,21 @@
     [testText appendAttributedString:typeAttachment];
     [testText appendAttributedString:self.spaceAttachment];
 
-    
+    if(exerciseModel.isLocalityLX){//是本地练习
+        NSMutableAttributedString *newAttachment = nil;
+        QMUIButton *newBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
+        newBtn.size = btnSize;
+        [newBtn setTitle:@"本市考题" textColor:RQ_MAIN_TEXT_COLOR_WHITE Font:RQ_Exercise_Module.exerciseFontSize - 6 fotState:UIControlStateNormal];
+        
+        [newBtn setBackgroundImage:[UIImage qmui_imageWithColor:RQColor(30, 222, 91) size:btnSize cornerRadiusArray:@[@(btnCornerRadius), @(btnCornerRadius), @(btnCornerRadius), @(btnCornerRadius)]] forState:UIControlStateNormal];
+        newAttachment = [NSMutableAttributedString yy_attachmentStringWithContent:newBtn
+                                                                   contentMode:UIViewContentModeCenter
+                                                                attachmentSize:btnSize
+                                                                   alignToFont:[UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize]
+                                                                     alignment:YYTextVerticalAlignmentCenter];
+        [testText appendAttributedString:newAttachment];
+        [testText appendAttributedString:self.spaceAttachment];
+    }
     
     if ([RQ_YDTQuestion_Module isNewRuleQuestionWithQuestionId:exerciseModel.ydtQuestionModel.ID]) {
         NSMutableAttributedString *newAttachment = nil;

+ 8 - 2
jiaPei/Modules/OtherModules/YDTQuestionModule/Modules/RQYDTXCQuestionModule.m

@@ -444,7 +444,10 @@ static id rq_ydtXcQuestionModule = nil;
         case RQExerciseType_Video:
             conditionStr = @"AND media_url <> '' AND video_url <> ''";
             break;
-        
+        case RQExerciseType_Locality:
+            conditionStr = @"";
+            break;
+            
         default:
             break;
     }
@@ -453,7 +456,10 @@ static id rq_ydtXcQuestionModule = nil;
     NSString *selectQueryStr = @"*";
     NSString *whereQueryStr = [NSString stringWithFormat:@"%@ AND %@ AND cityid = 0", queryCarTypeStr, querySubjectTypeStr];
     NSString *categoryWhereQueryStr = [NSString stringWithFormat:@"%@ AND %@ AND city_id = 0", queryCarTypeStr, querySubjectTypeStr];
-
+    if(exerciseType==RQExerciseType_Locality){
+        whereQueryStr = [NSString stringWithFormat:@"%@ AND %@ AND cityid = %@", queryCarTypeStr, querySubjectTypeStr,RQ_USER_MANAGER.city_dbId];
+        categoryWhereQueryStr = [NSString stringWithFormat:@"%@ AND %@ AND city_id = %@", queryCarTypeStr, querySubjectTypeStr,RQ_USER_MANAGER.city_dbId];
+    }
     
     NSString *categoryQueryStr = RQStringIsNotEmpty(categoryStr)? [NSString stringWithFormat:@"INNER JOIN ( SELECT MIN(question_id) AS question_id FROM t_app_question_category WHERE %@ AND %@ GROUP BY question_id ) AS t1 ON web_note.ID = t1.question_id ", categoryWhereQueryStr, categoryStr] : @"";