浏览代码

v2.0.5 读题,技巧,总结 完成基本测试

openlockPPP 1 年之前
父节点
当前提交
530cc9216b
共有 20 个文件被更改,包括 383 次插入34 次删除
  1. 4 4
      jiaPei.xcodeproj/project.pbxproj
  2. 二进制
      jiaPei.xcworkspace/xcuserdata/mimasigeling.xcuserdatad/UserInterfaceState.xcuserstate
  3. 0 1
      jiaPei/AppDelegate.m
  4. 21 0
      jiaPei/Images.xcassets/Modules/HomePageModule/播放_pay.imageset/Contents.json
  5. 二进制
      jiaPei/Images.xcassets/Modules/HomePageModule/播放_pay.imageset/播放_pay.png
  6. 21 0
      jiaPei/Images.xcassets/Modules/HomePageModule/播放_suspend.imageset/Contents.json
  7. 二进制
      jiaPei/Images.xcassets/Modules/HomePageModule/播放_suspend.imageset/播放_suspend.png
  8. 8 6
      jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseSubViewController.m
  9. 1 0
      jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseViewController.m
  10. 1 1
      jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/RQExerciseAnswerCell.m
  11. 1 1
      jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/RQExerciseAnswerCell.xib
  12. 96 5
      jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseAnswerItemViewModel.m
  13. 34 9
      jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseQuestionItemViewModel.m
  14. 9 0
      jiaPei/Modules/OtherModules/YDTQuestionModule/Model/RQYDTQuestionModel.h
  15. 2 2
      jiaPei/Modules/OtherModules/YDTQuestionModule/Model/RQYDTQuestionModel.m
  16. 3 1
      jiaPei/NewTheory/NYBasetjTimeVC.m
  17. 1 2
      jiaPei/OLD/Util/RQRemoteTheoryManager/RQRemoteTheoryManager.m
  18. 12 1
      jiaPei/OLD/Util/SingletonManger/VoiceManager/NYVoiceManager.h
  19. 168 0
      jiaPei/OLD/Util/SingletonManger/VoiceManager/NYVoiceManager.m
  20. 1 1
      jiaPei/Utils/Manager/UserManager/RQUserManager.m

+ 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 = 2042023082002;
+				CURRENT_PROJECT_VERSION = 2052023082501;
 				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.4;
+				MARKETING_VERSION = 2.0.5;
 				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 = 2042023082002;
+				CURRENT_PROJECT_VERSION = 2052023082501;
 				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.4;
+				MARKETING_VERSION = 2.0.5;
 				ONLY_ACTIVE_ARCH = NO;
 				OTHER_CFLAGS = (
 					"$(inherited)",

二进制
jiaPei.xcworkspace/xcuserdata/mimasigeling.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 1
jiaPei/AppDelegate.m

@@ -34,7 +34,6 @@
     [self configureSDKs];
     /// 初始化UI之前配置
     [self rq_configureApplication:application initialParamsBeforeInitUI:launchOptions];
-    RQ_USER_MANAGER.tryLookCount = 4;
     // Config Service
     self.services = [[RQViewModelServicesImpl alloc] init];
     // Config Nav Stack

+ 21 - 0
jiaPei/Images.xcassets/Modules/HomePageModule/播放_pay.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "播放_pay.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

二进制
jiaPei/Images.xcassets/Modules/HomePageModule/播放_pay.imageset/播放_pay.png


+ 21 - 0
jiaPei/Images.xcassets/Modules/HomePageModule/播放_suspend.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "播放_suspend.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

二进制
jiaPei/Images.xcassets/Modules/HomePageModule/播放_suspend.imageset/播放_suspend.png


+ 8 - 6
jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseSubViewController.m

@@ -416,12 +416,14 @@
     [self saveNumWithIndex:index];
     NSLog(@"JXCategoryViewDelegate=====didSelectedItemAtIndex=%zd",index);
     //控制-语音停止-切换
-    RQExerciseModel *exerciseModel = self.viewModel.questionArr[index];
-    if(![exerciseModel.ydtQuestionModel.Question isEqual:NY_VOICE_MANAGER.paytext]&&
-       //NY_VOICE_MANAGER.state==NYVoiceType_Start&&
-       NY_VOICE_MANAGER.paytext!=nil){
-        [NY_VOICE_MANAGER stopPayVoiceAction];
-    }
+//    RQExerciseModel *exerciseModel = self.viewModel.questionArr[index];
+//    if(![exerciseModel.ydtQuestionModel.Question isEqual:NY_VOICE_MANAGER.paytext]&&
+//       //NY_VOICE_MANAGER.state==NYVoiceType_Start&&
+//       NY_VOICE_MANAGER.paytext!=nil){
+//        
+//    }
+    [NY_VOICE_MANAGER stopPayVoiceAction];
+    [NY_VOICE_MANAGER stopPayVoiceActionUrl];
 }
 
 - (void)saveNumWithIndex:(NSInteger)index {

+ 1 - 0
jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseViewController.m

@@ -146,6 +146,7 @@
         [self.viewModel.services popViewModelAnimated:YES];
     }
     [NY_VOICE_MANAGER stopPayVoiceAction];//停止读题
+    [NY_VOICE_MANAGER stopPayVoiceActionUrl];
 }
 
 - (void)setAction {

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

@@ -38,7 +38,7 @@
 - (void)bindViewModel:(RQExerciseAnswerItemViewModel *)viewModel {
     _viewModel = viewModel;
     @weakify(self)
-    
+    self.skillLabel.userInteractionEnabled = YES;
     RAC(self.answerLabel, text) = [[RACObserve(viewModel, answerString) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
 
     

+ 1 - 1
jiaPei/Modules/OtherModules/ExerciseModule/View/ExercisePage/RQExerciseAnswerCell.xib

@@ -25,7 +25,7 @@
                                 <color key="textColor" red="0.039215686274509803" green="0.10196078431372549" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
-                            <view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qLO-kQ-QsU" customClass="YYLabel">
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qLO-kQ-QsU" customClass="YYLabel">
                                 <rect key="frame" x="8" y="45" width="272" height="28"/>
                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <userDefinedRuntimeAttributes>

+ 96 - 5
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseAnswerItemViewModel.m

@@ -17,6 +17,8 @@
 @property (nonatomic, readwrite, strong) YYLabel *yyLabel;
 @property (nonatomic, readwrite, strong) NSMutableAttributedString *skillString;
 
+@property (nonatomic, readwrite, strong) QMUIButton *readBtn;
+
 @end
 
 @implementation RQExerciseAnswerItemViewModel
@@ -46,7 +48,29 @@
                 space = 0.f;
             } else {
                 NSArray *knameList = [self getKeyRangeList:self.ydtJSModel.qb_analyse readText:self.ydtJSModel.qb_read_analyse];//获取关键字
-                NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",self.ydtJSModel.qb_read_analyse]];
+                NSMutableAttributedString *text = [[NSMutableAttributedString alloc] init];
+                //播放-答案
+                if (RQ_COMMON_MANAGER.JSJP_APP_VOICE) {//读题-是否开启
+                    CGSize btnSize = CGSizeMake(30, 30);
+                    //读题
+                    QMUIButton *readBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
+                    CGFloat ebtnH = 30.f;
+                    CGFloat ebtnW = 30.f;
+                    CGSize ebtnSize = CGSizeMake(ebtnW, ebtnH);
+                    readBtn.size = btnSize;
+                    [readBtn setImage:RQImageNamed(@"播放_pay") forState:UIControlStateNormal];
+                    [readBtn setImage:RQImageNamed(@"播放_suspend") forState:UIControlStateSelected];
+                    [readBtn addTarget:self action:@selector(buttonActionPayVoicedo:) forControlEvents:UIControlEventTouchUpInside];
+                    NSMutableAttributedString *readAttachment = [NSMutableAttributedString yy_attachmentStringWithContent:readBtn
+                                                                               contentMode:UIViewContentModeCenter
+                                                                            attachmentSize:ebtnSize
+                                                                               alignToFont:[UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize]
+                                                                                 alignment:YYTextVerticalAlignmentCenter];
+                    self.readBtn = readBtn;
+                    [text appendAttributedString:readAttachment];
+                }
+                NSMutableAttributedString *analyseString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",self.ydtJSModel.qb_read_analyse]];
+                [text appendAttributedString:analyseString];
                 text.yy_font = [UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize];
                 text.yy_lineSpacing = 8;
                 text.yy_color = RQ_MAIN_TEXT_COLOR_1;
@@ -73,19 +97,30 @@
                 self.skillHeight = height;
                 space = 6.f;
             }
-            _exRowHeight = [_answerString heightForFont:[UIFont systemFontOfSize:19] width:RQ_SCREEN_WIDTH - (16 * 2) - (8 * 2)] + (8 * 2) + (16 * 2) + space + self.skillHeight;
+            _exRowHeight = [_answerString heightForFont:[UIFont systemFontOfSize:19] width:RQ_SCREEN_WIDTH - (16 * 2) - (8 * 2)] + (8 * 2) + (16 * 2) + space;
         });
         
         
     }
     return self;
 }
+//重写 skillHeight get 方法
+- (CGFloat)skillHeight{
+    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));
+    if (RQ_USER_MANAGER.tryLookCount>0 && line==1){//试看
+        line = 0;
+    }
+    if(line==1) skillH = RQ_FIT_HORIZONTAL(34.f);
+    return skillH;
+}
+
 //重写 rowHeight get 方法
 - (CGFloat)rowHeight{
-    CGFloat rowH = _exRowHeight;
+    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));
     if (RQ_USER_MANAGER.tryLookCount>0 && line==1){//试看
-        rowH = _exRowHeight + 40.f;
+        rowH = rowH + 40.f;
     }
     return rowH;
 }
@@ -103,7 +138,7 @@
             NSRange matchedRange = [match rangeAtIndex:1];
             NSString *extractedText = [originalText substringWithRange:matchedRange];
             NSRange range = [readText rangeOfString:extractedText];
-            dict[extractedText] = @[@(range.location),@(range.length)];
+            dict[extractedText] = @[@(range.location+1),@(range.length)];
             [array addObject:dict];
             NSLog(@"Extracted Text: %@", extractedText);
             NSLog(@"Matched Range: %@", NSStringFromRange(matchedRange));
@@ -126,6 +161,7 @@
 - (YYLabel *)yyLabel {
     if (!_yyLabel) {
         _yyLabel = [[YYLabel alloc] init];
+        _yyLabel.userInteractionEnabled = YES;
     }
     return _yyLabel;
 }
@@ -134,4 +170,59 @@
     return @"RQExerciseAnswerCell";
 }
 
+#pragma mark -事件
+- (void)buttonActionPayVoicedo:(UIButton *)btn
+{
+    if (RQ_COMMON_MANAGER.JSJP_APP_VOICE) {//读题-是否开启
+        //是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));
+        if (RQ_USER_MANAGER.tryLookCount>0 && line==1){//试看
+            line = 0;
+        }
+        if (line==1) {
+            ShowMsg(@"请购买会员,才能读解题技巧。");
+            return;
+        }
+    }
+    btn.userInteractionEnabled = NO;
+    btn.selected = !btn.isSelected;
+    if(btn.selected){//播放
+        if (NY_VOICE_MANAGER.state == NYVoiceType_Pause){
+            [NY_VOICE_MANAGER resumePayVoiceActionUrl];//恢复
+        }else {
+            [NY_VOICE_MANAGER stopPayVoiceActionUrl];
+            NSString *url = self.ydtJSModel.qb_skill_audio_link;
+            WeakSelf(weakSelf)
+            [NY_VOICE_MANAGER startPayVoiceActionUrl:url completedBlock:^(NYVoiceType voiceType) {
+                switch (voiceType) {
+                    case NYVoiceType_Start:{
+                        weakSelf.readBtn.selected = YES;
+                    }break;
+                    case NYVoiceType_Wait:{//完成-等待
+                        weakSelf.readBtn.selected = NO;
+                    }break;
+                    case NYVoiceType_Resume:{//恢复
+                        weakSelf.readBtn.selected = YES;
+                    }break;
+                    case NYVoiceType_Pause:{//暂停
+                        weakSelf.readBtn.selected = NO;
+                    }break;
+                    case NYVoiceType_Stop:{//停止
+                        weakSelf.readBtn.selected = NO;
+                    }break;
+                    default:
+                        break;
+                }
+            }];
+        }
+    }else {//暂停
+        [NY_VOICE_MANAGER pausePayVoiceActionUrl];
+    }
+    //防止频繁点击 1 秒点一次
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        self.readBtn.userInteractionEnabled = YES;
+    });
+    
+}
 @end
+

+ 34 - 9
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseQuestionItemViewModel.m

@@ -22,12 +22,15 @@
 
 @property (nonatomic, readwrite, strong) QMUIButton *readBtn;
 
+@property (nonatomic,assign) int readCount;
+
 @end
 
 @implementation RQExerciseQuestionItemViewModel
 - (instancetype)initWithRQExerciseModel:(RQExerciseModel *)exerciseModel {
     if (self = [super init]) {
         @weakify(self)
+        self.readCount = 0;
         self.exerciseModel = exerciseModel;
         dispatch_async(dispatch_get_main_queue(), ^{
             @strongify(self)
@@ -316,26 +319,48 @@
     btn.selected = !btn.isSelected;
     if(btn.selected){//播放
         if (NY_VOICE_MANAGER.state == NYVoiceType_Pause){
-            [NY_VOICE_MANAGER resumePayVoiceAction];//恢复
+            [NY_VOICE_MANAGER resumePayVoiceActionUrl];//恢复
         }else {
+//            self.exerciseModel.ydtQuestionModel.Question
             NSString *Question = self.exerciseModel.ydtQuestionModel.Question;
-            @weakify(self)
-            [NY_VOICE_MANAGER startPayVoiceActionText:Question completedBlock:^(NYVoiceType voiceType) {
+            WeakSelf(weakSelf)
+            NY_VOICE_MANAGER.paytext = Question;
+            [NY_VOICE_MANAGER stopPayVoiceActionUrl];
+            NSString *url = self.exerciseModel.ydtQuestionModel.question_audio;
+            [NY_VOICE_MANAGER startPayVoiceActionUrl:url completedBlock:^(NYVoiceType voiceType) {
                 switch (voiceType) {
                     case NYVoiceType_Start:{
-                        self.readBtn.selected = YES;
+                        if (![weakSelf.exerciseModel.userAnswer containsObject:@"预选Option"]&&
+                            weakSelf.exerciseModel.userAnswer.count) {//未答题
+                            weakSelf.readCount++;
+                        }
+                        weakSelf.readBtn.selected = YES;
                     }break;
                     case NYVoiceType_Wait:{//完成-等待
-                        self.readBtn.selected = NO;
+                        if ([weakSelf.exerciseModel.userAnswer containsObject:@"预选Option"]||
+                            weakSelf.exerciseModel.userAnswer.count==0) {//未答题
+                            weakSelf.readBtn.selected = NO;
+                        }else{//已答题
+                            if(weakSelf.readCount==2){
+                                weakSelf.readBtn.selected = NO;
+                            }else if(weakSelf.readCount==1){
+                                if(RQStringIsNotEmpty(weakSelf.exerciseModel.ydtQuestionModel.answer_audio)){
+                                    //播放选项
+                                    [NY_VOICE_MANAGER startPayVoiceActionUrl:weakSelf.exerciseModel.ydtQuestionModel.answer_audio];
+                                }else{
+                                    weakSelf.readBtn.selected = NO;
+                                }
+                            }
+                        }
                     }break;
                     case NYVoiceType_Resume:{//恢复
-                        self.readBtn.selected = YES;
+                        weakSelf.readBtn.selected = YES;
                     }break;
                     case NYVoiceType_Pause:{//暂停
-                        self.readBtn.selected = NO;
+                        weakSelf.readBtn.selected = NO;
                     }break;
                     case NYVoiceType_Stop:{//停止
-                        self.readBtn.selected = NO;
+                        weakSelf.readBtn.selected = NO;
                     }break;
                     default:
                         break;
@@ -343,7 +368,7 @@
             }];
         }
     }else {//暂停
-        [NY_VOICE_MANAGER pausePayVoiceAction];
+        [NY_VOICE_MANAGER pausePayVoiceActionUrl];
     }
     //防止频繁点击 1 秒点一次
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

+ 9 - 0
jiaPei/Modules/OtherModules/YDTQuestionModule/Model/RQYDTQuestionModel.h

@@ -92,6 +92,15 @@ NS_ASSUME_NONNULL_BEGIN
  *  正确选项
  */
 @property (nonatomic, readwrite, copy) NSString *AnswerTrue;
+/**
+ *  题目语音
+ */
+@property (nonatomic, readwrite, copy) NSString *question_audio;
+/**
+ *  选项语音
+ */
+@property (nonatomic, readwrite, copy) NSString *answer_audio;
+
 /**
  *  题目解析
  */

+ 2 - 2
jiaPei/Modules/OtherModules/YDTQuestionModule/Model/RQYDTQuestionModel.m

@@ -59,8 +59,8 @@
     ydtQuestionModel.show_option_type = [resultSet intForColumn:@"show_option_type"];
     ydtQuestionModel.question_source = [resultSet intForColumn:@"question_source"];
     ydtQuestionModel.best_explain_new = [resultSet stringForColumn:@"best_explain_new"];
-
-    
+    ydtQuestionModel.question_audio = [resultSet stringForColumn:@"question_audio"];
+    ydtQuestionModel.answer_audio = [resultSet stringForColumn:@"answer_audio"];
 
     ydtQuestionModel.num = 0;
 //    ydtQuestionModel.allNum = 0;

+ 3 - 1
jiaPei/NewTheory/NYBasetjTimeVC.m

@@ -877,10 +877,12 @@ typedef enum {
     ShowMsgSuc();
     
     [RQ_COMMON_MANAGER keepIdleTimerDisabledisOpen:YES];
-    
+    [MBProgressHUD hideHUDForView:[RQ_SHARE_FUNCTION topViewController].view animated:YES];
     if ([RQ_USER_MANAGER.currentUser.city isEqualToString:@"3501"]) {
+        WeakSelf(weakSelf)
         [RQ_ALERTVIEW_MANAGER showAlertWithTitle:@"温馨提示" message: @"福州培训时间 \n 课堂时间:07:00---22:00 \n 模拟时间:05:00---23:00 \n 实操:05:00---23:00 \n 远程:05:00--23:59:59 \n 请学员注意!避免非培训时间导致学时无效。" confirmTitle:@"确认" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
             RemoveHUD();
+            [MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
         }];
     }
 }

+ 1 - 2
jiaPei/OLD/Util/RQRemoteTheoryManager/RQRemoteTheoryManager.m

@@ -89,7 +89,6 @@ static dispatch_once_t onceToken;
     
     [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
         [MBProgressHUD rq_hideHUD];
-
         if (!dict) {
             ShowMsg(@"上传照片接口异常!");
             [Bugly reportException:[NSException exceptionWithName:@"uploadEduPic" reason:[reportDic jsonStringEncoded] userInfo:reportDic]];
@@ -111,7 +110,6 @@ static dispatch_once_t onceToken;
 
 #pragma mark - 远程理论签退
 - (void)uploadEduSignOutWithArray:(NSArray *)trainArray resultBlock:(void (^)(BOOL isSuccess, NSDictionary *signOutDict))resultBlock {
-    [self showHud];
     
     __block NSString *str = @"";
     __block NSInteger trainTime = 0;
@@ -150,6 +148,7 @@ static dispatch_once_t onceToken;
                 !resultBlock? : resultBlock(NO, nil);
             }
         }];
+        [self hideHud];
     }];
 }
 

+ 12 - 1
jiaPei/OLD/Util/SingletonManger/VoiceManager/NYVoiceManager.h

@@ -7,6 +7,7 @@
 //
 
 #import <Foundation/Foundation.h>
+#import <AVFoundation/AVFoundation.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -30,7 +31,7 @@ typedef void(^NYVoicePayCompletedBlock)(NYVoiceType voiceType);
 @interface NYVoiceManager : NSObject
 
 //当前播放的string
-@property(nonatomic,copy,readonly) NSString *paytext;
+@property(nonatomic,copy) NSString *paytext;
 //当前状态
 @property (nonatomic,assign) NYVoiceType state;
 //回调
@@ -48,6 +49,16 @@ typedef void(^NYVoicePayCompletedBlock)(NYVoiceType voiceType);
 //恢复合成播放
 - (void)resumePayVoiceAction;
 
+//播放在线 url 音频
+- (void)startPayVoiceActionUrl:(NSString *)url;
+- (void)startPayVoiceActionUrl:(NSString *)url completedBlock:(NYVoicePayCompletedBlock)block;
+//暂停合成播放
+- (void)pausePayVoiceActionUrl;
+//停止合成播放
+- (void)stopPayVoiceActionUrl;
+//恢复合成播放
+- (void)resumePayVoiceActionUrl;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 168 - 0
jiaPei/OLD/Util/SingletonManger/VoiceManager/NYVoiceManager.m

@@ -9,6 +9,8 @@
 #import "NYVoiceManager.h"
 #import "payRequsestHandler.h"
 
+#import <MediaPlayer/MediaPlayer.h>
+
 static NYVoiceManager *vomanger = nil;
 static dispatch_once_t onceToken;
 
@@ -39,6 +41,19 @@ static dispatch_once_t onceToken;
 
 @property (nonatomic,assign)int cout; //统计合成句子数,当作utteranceId用于标记句子用
 
+
+
+#pragma mark - 播放器
+/*
+ * 播放器
+ */
+@property (nonatomic, strong) AVPlayer * avplayer;
+
+/*
+ * 播放器播放状态
+ */
+@property (nonatomic, assign) BOOL isPlaying;
+
 @end
 
 
@@ -379,6 +394,159 @@ static dispatch_once_t onceToken;
     
 }
 
+//播放在线 url 音频
+- (void)startPayVoiceActionUrl:(NSString *)url {
+    //重置播放器
+    AVPlayerItem * songItem = [[AVPlayerItem alloc]initWithURL:[NSURL URLWithString:url]];
+    if (self.avplayer == nil) {
+        self.avplayer = [[AVPlayer alloc]initWithPlayerItem:songItem];
+    }else {
+        [self.avplayer replaceCurrentItemWithPlayerItem:songItem];
+    }
+    //开始播放
+    [self.avplayer play];
+    //添加KVO
+    [self addObserver];
+    self.state = NYVoiceType_Start;
+    if(self.payCompletedBlock){
+        self.payCompletedBlock(NYVoiceType_Start);
+    }
+}
+- (void)startPayVoiceActionUrl:(NSString *)url completedBlock:(nonnull NYVoicePayCompletedBlock)block{
+    self.payCompletedBlock = block;
+    [self startPayVoiceActionUrl:url];
+}
+//暂停合成播放
+- (void)pausePayVoiceActionUrl {
+    if(self.avplayer){
+        [self.avplayer pause];
+        self.state = NYVoiceType_Pause;
+        if(self.payCompletedBlock){
+            self.payCompletedBlock(NYVoiceType_Pause);
+        }
+    }
+}
+//停止合成播放
+- (void)stopPayVoiceActionUrl {
+    if(self.avplayer){
+        [self.avplayer pause];
+        self.avplayer = nil;
+        self.state = NYVoiceType_Stop;
+        if(self.payCompletedBlock){
+            self.payCompletedBlock(NYVoiceType_Stop);
+        }
+    }
+}
+//恢复合成播放
+- (void)resumePayVoiceActionUrl {
+    if(self.avplayer){
+        [self.avplayer play];
+        self.state = NYVoiceType_Resume;
+        if(self.payCompletedBlock){
+            self.payCompletedBlock(NYVoiceType_Resume);
+        }
+    }
+}
+
+#pragma mark AVpalyer url
+/*
+ * 播放器播放状态
+ */
+- (BOOL)isPlaying {
+    return self.avplayer.rate == 1;
+}
+#pragma mark - KVO
+- (void)addObserver {
+    
+    AVPlayerItem * songItem = self.avplayer.currentItem;
+    
+    //给AVPlayerItem添加播放完成通知
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:AVPlayerItemDidPlayToEndTimeNotification object:songItem];
+    
+//    //更新播放器进度
+//    WeakSelf(weakSelf)
+//    _timeObserve = [self.avplayer addPeriodicTimeObserverForInterval:CMTimeMake(1.0, 1.0) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {
+//        float current = CMTimeGetSeconds(time);
+//        float total = CMTimeGetSeconds(songItem.duration);
+////        SuLog(@"%f, %f",current, total);
+//        if (current) {
+//            weakSelf.progress = current / total;
+//            weakSelf.playTime = [NSString stringWithFormat:@"%.f",current];
+//            weakSelf.playDuration = [NSString stringWithFormat:@"%.2f",total];
+//        }
+//    }];
+    
+    //监控状态属性,注意AVPlayer也有一个status属性,通过监控它的status也可以获得播放状态
+    [songItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
+    //监控网络加载情况属性
+    [songItem addObserver:self forKeyPath:@"loadedTimeRanges" options:NSKeyValueObservingOptionNew context:nil];
+}
+
+- (void)removeObserver {
+    
+    AVPlayerItem * songItem = self.avplayer.currentItem;
+    
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    
+//    if (_timeObserve) {
+//        [self.avplayer removeTimeObserver:_timeObserve];
+//        _timeObserve = nil;
+//    }
+    
+    [songItem removeObserver:self forKeyPath:@"status"];
+    [songItem removeObserver:self forKeyPath:@"loadedTimeRanges"];
+    
+    [self.avplayer replaceCurrentItemWithPlayerItem:nil];
+}
+
+
+- (void)playbackFinished:(NSNotification *)notice {
+    NSLog(@"播放完成");
+    if(self.payCompletedBlock){
+        self.payCompletedBlock(NYVoiceType_Wait);
+    }
+//    [self playNext];
+}
+
+/**
+ *  通过KVO监控播放器状态
+ *
+ *  @param keyPath 监控属性
+ *  @param object  监视器
+ *  @param change  状态改变
+ *  @param context 上下文
+ */
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
+    
+    AVPlayerItem * songItem = object;
+    
+    if ([keyPath isEqualToString:@"status"]) {
+        
+        switch (self.avplayer.status) {
+            case AVPlayerStatusUnknown:
+                NSLog(@"KVO:未知状态");
+                break;
+            case AVPlayerStatusReadyToPlay:
+                self.state = NYVoiceType_Start;
+                NSLog(@"KVO:准备完毕");
+                break;
+            case AVPlayerStatusFailed:
+                NSLog(@"KVO:加载失败");
+                break;
+            default:
+                break;
+        }
+//        SendNotify(SONGPLAYSTATUSCHANGE, nil)
+    }
+    if ([keyPath isEqualToString:@"loadedTimeRanges"]) {
+        
+        NSArray * array = songItem.loadedTimeRanges;
+        CMTimeRange timeRange = [array.firstObject CMTimeRangeValue]; //本次缓冲的时间范围
+        NSTimeInterval totalBuffer = CMTimeGetSeconds(timeRange.start) + CMTimeGetSeconds(timeRange.duration); //缓冲总长度
+//        SuLog(@"共缓冲%.2f",totalBuffer);
+    }
+}
+
 /*===============================使用自定义分割逻辑,以下为句子分割示例=====================*/
 #define Sentence_Count_Max 50   //单次最大请求字数,建议首句不要设置太长
 /*

+ 1 - 1
jiaPei/Utils/Manager/UserManager/RQUserManager.m

@@ -147,7 +147,7 @@ static id rq_userManager = nil;
     NSString *key = [NSString stringWithFormat:@"RQTryLookCountKey-%@",RQ_USER_MANAGER.currentUser._id];
     id object = [RQ_COMMON_MANAGER getObjectWithKey:key];
     if (RQObjectIsNil(object)) {
-        return 3;
+        return 4;
     } else {
         NSInteger tryLookCount = [object integerValue];
         return tryLookCount;