Browse Source

录播提示修改

Steven 5 years ago
parent
commit
28e79a1a98

+ 25 - 14
MusicGradeExam/MusicGradeExam/Tools/Custom/KSMediaManager.m

@@ -44,18 +44,6 @@
 }
 
 
-- (void)setMediaType:(MEDIATYPE)mediaType {
-    _mediaType = mediaType;
-    if (mediaType == MEDIATYPE_PHOTO) {
-        self.maxPhotoNumber = 9;
-    }
-    else if (mediaType == MEDIATYPE_VIDEO) {
-        self.maxPhotoNumber = 1;
-    }
-    else if (mediaType == MEDIATYPE_ALL) {
-        self.maxPhotoNumber = 2;
-    }
-}
 
 - (void)showAlertCallbackWithBlock:(MediaCallback)callback {
     
@@ -152,9 +140,11 @@
     [self extracted:imagePickerVc];
     
     [imagePickerVc setDidFinishPickingVideoHandle:^(UIImage *coverImage, PHAsset *asset) {
-        if (asset.duration >= 481) {
+        if (asset.duration >= self.maxDuration +1) {
+            NSInteger minites =  self.maxDuration / 60;
+            NSString *tipsString = [NSString stringWithFormat:@"视频长度不能超过%zd分钟",minites];
             dispatch_main_async_safe(^{
-                [MBProgressHUD ksShowMessage:@"视频长度不能超过8分钟"];
+                [MBProgressHUD ksShowMessage:tipsString];
             });
             return;
         }
@@ -244,6 +234,8 @@
                 [mediaTypes addObject:(NSString *)kUTTypeImage];
             }
             self.imagePickerVc.mediaTypes = mediaTypes;
+            self.imagePickerVc.videoMaximumDuration = self.maxDuration;
+
             if(kiOS8Later) {
                 _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
             }
@@ -413,4 +405,23 @@
 }
 #define push clang diagnostic pop
 
+
+#pragma mark ---- setting
+
+- (void)setMaxDuration:(NSInteger)maxDuration {
+    _maxDuration = maxDuration;
+}
+
+- (void)setMediaType:(MEDIATYPE)mediaType {
+    _mediaType = mediaType;
+    if (mediaType == MEDIATYPE_PHOTO) {
+        self.maxPhotoNumber = 9;
+    }
+    else if (mediaType == MEDIATYPE_VIDEO) {
+        self.maxPhotoNumber = 1;
+    }
+    else if (mediaType == MEDIATYPE_ALL) {
+        self.maxPhotoNumber = 2;
+    }
+}
 @end

+ 7 - 3
MusicGradeExam/MusicGradeExam/UI/Classroom/View/TitleView/ClassTitleView.m

@@ -25,7 +25,7 @@
 @interface ClassTitleView ()
 
 //@property (nonatomic, strong) UILabel *timeLable;
-@property (nonatomic, strong) NSTimer *timeTimer;
+//@property (nonatomic, strong) NSTimer *timeTimer;
 @property (nonatomic, strong) NSMutableArray *buttonArray;
 @property (nonatomic, strong) NSArray *buttonImageArray;
 @property (nonatomic, strong) NSArray *buttonHighlightedImageArray;
@@ -51,7 +51,7 @@
         self.isCountDown = NO;
         self.duration = [ClassroomService sharedService].currentRoom.surplusTime;
         [self refreshTitleView];
-        [self.timeTimer setFireDate:[NSDate distantPast]];
+//        [self.timeTimer setFireDate:[NSDate distantPast]];
     }
     return self;
 }
@@ -188,12 +188,15 @@
     }
 }
 
+
 - (void)stopDurationTimer {
+    /*
     [self.timeTimer setFireDate:[NSDate distantFuture]];
     if (self.timeTimer.valid) {
         [self.timeTimer invalidate];
         self.timeTimer = nil;
     }
+     */
 }
 
 
@@ -359,6 +362,7 @@
     return _buttonArray;
 }
 
+/*
 - (NSTimer *)timeTimer {
     if (_timeTimer == nil) {
         
@@ -372,7 +376,7 @@
     
     return _timeTimer;
 }
-
+*/
 - (void)setNetStatus:(NetWorkingStatus)netStatus {
     _netStatus = netStatus;
     NSString *displayImg = @"network_status1";

+ 16 - 3
MusicGradeExam/MusicGradeExam/UI/Exam/Controller/WaitExamViewController.m

@@ -218,9 +218,22 @@
                 [self joinRoomAction:roomId];
             }
             else if (self.sourceModel.recordFlag == 1 && self.sourceModel.finishedExam == 4) { // 去录播
-                RecordExamViewController *ctrl = [[RecordExamViewController alloc] init];
-                ctrl.examRegistrationId = self.examRegistrationId;
-                [self.navigationController pushViewController:ctrl animated:YES];
+                // 查询录播详情
+                [KSRequestManager stuRecordDetailRequest:KS_GET examRegistrationId:self.examRegistrationId success:^(NSDictionary * _Nonnull dic) {
+                    if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
+                        RecordExamModel *sourceModel = [[RecordExamModel alloc] initWithDictionary:[dic dictionaryValueForKey:@"data"]];
+                        RecordExamViewController *ctrl = [[RecordExamViewController alloc] init];
+                        ctrl.examRegistrationId = self.examRegistrationId;
+                        ctrl.sourceModel = sourceModel;
+                        [self.navigationController pushViewController:ctrl animated:YES];
+                    }
+                    else {
+                        [self MBPShow:MESSAGEKEY];
+                        [self requestDataWithHub:NO];
+                    }
+                } faliure:^(NSError * _Nonnull error) {
+                    
+                }];
             }
         }
             break;

+ 4 - 0
MusicGradeExam/MusicGradeExam/UI/Exam/View/WaitExamBottomView.m

@@ -61,6 +61,10 @@ typedef NS_ENUM(NSInteger,EXAMSTATUS) {
             self.canJoinRoom = YES;
             [self.joinButton setTitle:@"录播考试" forState:UIControlStateNormal];
         }
+        else if (self.sourceModel.recordFlag == 0 && self.sourceModel.finishedExam == 4) { // 录播考试结束
+            self.canJoinRoom = NO;
+            [self.joinButton setTitle:@"录播考试已结束" forState:UIControlStateNormal];
+        }
         else if (self.sourceModel.finishedExam == 5) { // 考试已完成
             self.canJoinRoom = NO;
             [self.joinButton setTitle:@"考试已完成" forState:UIControlStateNormal];

+ 3 - 0
MusicGradeExam/MusicGradeExam/UI/RecordExam/Controller/RecordExamViewController.h

@@ -7,6 +7,7 @@
 //
 
 #import "KSBaseViewController.h"
+#import "RecordExamModel.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -14,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) NSString *examRegistrationId;
 
+@property (nonatomic, strong) RecordExamModel *sourceModel;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 16 - 8
MusicGradeExam/MusicGradeExam/UI/RecordExam/Controller/RecordExamViewController.m

@@ -11,7 +11,6 @@
 #import "RecordListCell.h"
 #import "RecordBottomView.h"
 #import "RecordTipsView.h"
-#import "RecordExamModel.h"
 #import "KSMediaManager.h"
 #import "WMPlayer.h"
 #import "SongModel.h"
@@ -35,8 +34,6 @@
 
 @property (nonatomic, strong) RecordBottomView *bottomView;
 
-@property (nonatomic, strong) RecordExamModel *sourceModel;
-
 @property (nonatomic, strong) NSMutableArray *songArray;
 
 @property (nonatomic, strong) KSMediaManager *mediaManager;
@@ -56,7 +53,7 @@
     // Do any additional setup after loading the view.
     self.ks_prefersNavigationBarHidden = YES;
     [self configUI];
-    [self requestData];
+    [self evaluateSource];
 }
 
 - (void)viewWillAppear:(BOOL)animated {
@@ -257,9 +254,20 @@
         [self.navigationController popViewControllerAnimated:YES];
     }
     else { // 时间结束
-        self.bottomView.finishButton.userInteractionEnabled = NO;
-        [self.bottomView.finishButton setTitle:@"考试已结束" forState:UIControlStateNormal];
-        [self.bottomView.finishButton setBackgroundColor:HexRGB(0xcccccc)];
+        MJWeakSelf;
+        if (self.fileUrlArray.count == 0) {
+            [self KSShowMsg:@"考试结束" promptCompletion:^{
+                [weakSelf.navigationController popViewControllerAnimated:YES];
+            }];
+        }
+        else {
+            [KSNormalAlertView ks_showAlertWithTitle:@"考试时间已结束,是否提交?" leftTitle:@"取消" rightTitle:@"确定" cancel:^{
+                [weakSelf removeAllFile];
+                [weakSelf.navigationController popViewControllerAnimated:YES];
+            } confirm:^{
+                [weakSelf submitService];
+            }];
+        }
     }
 }
 
@@ -304,7 +312,7 @@
     
     // 是否确认提交
     MJWeakSelf;
-    [KSNormalAlertView ks_showAlertWithTitle:@"确认已提交所有曲目\n提交之后无法修改" leftTitle:@"取消" rightTitle:@"确定" cancel:^{
+    [KSNormalAlertView ks_showAlertWithTitle:@"请确认已上传所有录播曲目" leftTitle:@"取消" rightTitle:@"确认" cancel:^{
         
     } confirm:^{
         [weakSelf submitService];