Browse Source

排队显示修改

Steven 4 years ago
parent
commit
d45ab24ef4

+ 1 - 0
MusicGradeExam/MusicGradeExam.xcodeproj/project.pbxproj

@@ -3477,6 +3477,7 @@
 				CODE_SIGN_ENTITLEMENTS = "MusicGradeExam/酷乐秀.entitlements";
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1.0.0;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = P664H7S5LL;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (

+ 22 - 0
MusicGradeExam/MusicGradeExam/Assets.xcassets/buttonStatus/button_wait.imageset/Contents.json

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

BIN
MusicGradeExam/MusicGradeExam/Assets.xcassets/buttonStatus/button_wait.imageset/button_wait@2x.png


BIN
MusicGradeExam/MusicGradeExam/Assets.xcassets/buttonStatus/button_wait.imageset/button_wait@3x.png


+ 1 - 1
MusicGradeExam/MusicGradeExam/Base/KSBaseViewController.m

@@ -140,7 +140,7 @@
     rightBt.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, -40);
     [rightBt setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
     rightBt.titleLabel.font = [UIFont systemFontOfSize:16];
-    [rightBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+    [rightBt setTitleColor:HexRGB(0x333333) forState:UIControlStateNormal];
     [rightBt setTitle:title forState:UIControlStateNormal];
     [rightBt addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside];
     UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightBt];

+ 0 - 16
MusicGradeExam/MusicGradeExam/UI/Classroom/View/MainContainer/ClassroomMainContainer.m

@@ -15,7 +15,6 @@
 @property (nonatomic, strong) UIView *tapGestureView;
 @property (nonatomic) CGRect currentVideoFrame;
 @property (nonatomic) CGRect originVideoFrame;
-@property (nonatomic, strong) UILabel *nameLabel;
 
 @end
 
@@ -30,7 +29,6 @@
         [self.videoBackView addSubview:self.videoView];
         self.originVideoFrame = self.videoBackView.frame;
         self.currentVideoFrame = self.originVideoFrame;
-        [self.videoView addSubview:self.nameLabel];
     }
     return self;
 }
@@ -54,12 +52,6 @@
         }];
     }
     self.member = member;
-    if ([member.userId isEqualToString:[ClassroomService sharedService].currentRoom.currentMember.userId]) {
-        self.nameLabel.text = @"我";
-    }
-    else {
-        self.nameLabel.text = [NSString returnNoNullStringWithString:member.name];
-    }
 }
 
 - (void)cancelRenderView {
@@ -144,14 +136,6 @@
     return _emptyView;
 }
 
-- (UILabel *)nameLabel {
-    if (!_nameLabel) {
-        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 100, 20)];
-        _nameLabel.textColor = [UIColor whiteColor];
-        _nameLabel.font = [UIFont systemFontOfSize:16.0f];
-    }
-    return _nameLabel;
-}
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

+ 2 - 2
MusicGradeExam/MusicGradeExam/UI/Classroom/View/VideoList/ClassVideoListCell.m

@@ -111,11 +111,11 @@
                 self.roleLable.hidden = NO;
                 if (member.role == RoleMainTeacher) {
                     self.roleLable.text = @"主考";
-                    self.roleLable.backgroundColor = HexRGB(0xF5A623);
+                    self.roleLable.backgroundColor = HexRGB(0xFF5500);
                 }
                 else {
                     self.roleLable.text = @"助考";
-                    self.roleLable.backgroundColor = HexRGB(0xFF5500);
+                    self.roleLable.backgroundColor = HexRGB(0xF5A623);
                 }
             }
             else {

+ 26 - 9
MusicGradeExam/MusicGradeExam/UI/Exam/Controller/WaitExamViewController.m

@@ -50,8 +50,6 @@
 // 去录播
 - (void)toRecordExam {
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        
-        //
         RecordExamViewController *ctrl = [[RecordExamViewController alloc] init];
         ctrl.examRegistrationId = self.examRegistrationId;
         [self.navigationController pushViewController:ctrl animated:YES];
@@ -97,6 +95,11 @@
     _cancleRequest = YES;
 }
 
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+}
+
 - (void)viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
     [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
@@ -109,12 +112,7 @@
         return;
     }
     [self requestDataWithHub:YES];
-    
-    // 进入页面建立连接
-    if (USER_MANAGER.needConnect == NO) {
-        [USER_MANAGER connectRongCloud];
-        USER_MANAGER.needConnect = YES;
-    }
+    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
 }
 
 - (void)viewDidAppear:(BOOL)animated {
@@ -157,7 +155,6 @@
         }];
     }
     [guideView showMaskViewInView:nil];
-    
 }
 
 
@@ -208,6 +205,25 @@
     [self.bottomView configMessageSource:self.sourceModel];
     [self configViewHeight];
     [self configExamRoomMessage];
+    
+    if (USER_MANAGER.needConnect == NO) {
+        if (![NSString isEmptyString:self.sourceModel.examStartTime]) {
+            NSString *examDay = [[self.sourceModel.examStartTime componentsSeparatedByString:@" "] firstObject];
+            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+            [formatter setDateFormat:@"yyyy-MM-dd"];
+            formatter.timeZone = [NSTimeZone systemTimeZone];
+            NSDate *currentDate = [NSDate date];
+            NSString *currentDay = [formatter stringFromDate:currentDate];
+            if ([examDay isEqualToString:currentDay]) { // 如果今天有考试,IM建立连接
+                [self configIMConnection];
+            }
+        }
+    }
+}
+
+- (void)configIMConnection {
+    [USER_MANAGER connectRongCloud];
+    USER_MANAGER.needConnect = YES;
 }
 
 - (void)configViewHeight {
@@ -297,6 +313,7 @@
             [self MBPShow:@"签到成功"];
             // 滑动到底部
             [self scrollToBottom];
+            [self requestDataWithHub:NO];
         }
         else {
             [self MBPShow:MESSAGEKEY];

+ 0 - 2
MusicGradeExam/MusicGradeExam/UI/Exam/View/WaitExamBottomView.h

@@ -13,8 +13,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface WaitExamBottomView : UIView
 
-@property (nonatomic, assign) BOOL canJoinRoom;
-
 @property (weak, nonatomic) IBOutlet UIButton *joinButton;
 
 

+ 56 - 22
MusicGradeExam/MusicGradeExam/UI/Exam/View/WaitExamBottomView.m

@@ -13,8 +13,19 @@ typedef NS_ENUM(NSInteger,EXAMSTATUS) {
     EXAMSTATUS_SINGED,   // 已签到
 };
 
+typedef NS_ENUM(NSInteger, JOINBUTTONSTATUS) {
+    JOINBUTTONSTATUS_NOTSTART,  // 未开始
+    JOINBUTTONSTATUS_WAIT,      // 排队中
+    JOINBUTTONSTATUS_IN,        // 进行中
+    JOINBUTTONSTATUS_FINISH,    // 已结束
+
+};
+
 @interface WaitExamBottomView ()
 
+@property (nonatomic, assign) JOINBUTTONSTATUS buttonStatus;
+
+
 @property (nonatomic, copy) JoinRoomAction callback;
 
 @property (weak, nonatomic) IBOutlet UIButton *guideButton;
@@ -60,20 +71,20 @@ typedef NS_ENUM(NSInteger,EXAMSTATUS) {
     
     if (self.status == EXAMSTATUS_SINGED) { // 已签到显示
         if (self.sourceModel.recordFlag == 1 && self.sourceModel.finishedExam == 4) { // 录播考试开启中
-            self.canJoinRoom = YES;
+            self.buttonStatus = JOINBUTTONSTATUS_IN;
             [self.joinButton setTitle:@"录播考试" forState:UIControlStateNormal];
         }
         else if (self.sourceModel.recordFlag == 0 && self.sourceModel.finishedExam == 4) { // 录播考试结束
-            self.canJoinRoom = NO;
+            self.buttonStatus = JOINBUTTONSTATUS_FINISH;
             [self.joinButton setTitle:@"录播考试已结束" forState:UIControlStateNormal];
         }
         else if (self.sourceModel.finishedExam == 5) { // 考试已完成
-            self.canJoinRoom = NO;
+            self.buttonStatus = JOINBUTTONSTATUS_FINISH;
             [self.joinButton setTitle:@"考试已完成" forState:UIControlStateNormal];
         }
         else {
-            self.canJoinRoom = self.sourceModel.classroomSwitch;
             if (self.sourceModel.classroomSwitch == 0) {
+                self.buttonStatus = JOINBUTTONSTATUS_WAIT;
                 NSString *title = [NSString stringWithFormat:@"当前需要等待%.0f位考生",self.sourceModel.waitNum];
                 if (self.sourceModel.waitNum == 0) {
                     title = @"即将开始考试,请准备";
@@ -81,37 +92,60 @@ typedef NS_ENUM(NSInteger,EXAMSTATUS) {
                [self.joinButton setTitle:title forState:UIControlStateNormal];
             }
             else {
+                self.buttonStatus = JOINBUTTONSTATUS_IN;
                 [self.joinButton setTitle:@"到你了,进入考场" forState:UIControlStateNormal];
             }
         }
     }
     else { // 未签到显示
-        self.canJoinRoom = NO;
+        self.buttonStatus = JOINBUTTONSTATUS_NOTSTART;
         [self.joinButton setTitle:@"进入考场" forState:UIControlStateNormal];
     }
 }
 
-- (void)setCanJoinRoom:(BOOL)canJoinRoom {
-    _canJoinRoom = canJoinRoom;
-    if (canJoinRoom) {
-        self.joinButton.userInteractionEnabled = YES;
-        [self.joinButton setBackgroundImage:[UIImage imageNamed:@"button_nomal"] forState:UIControlStateNormal];
-        [self.joinButton setBackgroundImage:[UIImage imageNamed:@"button_highlight"] forState:UIControlStateHighlighted];
-        
-        [self.joinButton.layer addAnimation:[self alphaChange:2.0f] forKey:@"aAlpha"];
-        
-        self.hasAnimation = YES;
-    }
-    else {
-        self.joinButton.userInteractionEnabled = NO;
-        [self.joinButton setBackgroundImage:[UIImage imageNamed:@"button_unable"] forState:UIControlStateNormal];
-        if (self.hasAnimation) {
-            self.hasAnimation = NO;
-            [self.joinButton.layer removeAnimationForKey:@"aAlpha"];
+- (void)setButtonStatus:(JOINBUTTONSTATUS)buttonStatus {
+    _buttonStatus = buttonStatus;
+    switch (buttonStatus) {
+        case JOINBUTTONSTATUS_NOTSTART: // 未开始
+        case JOINBUTTONSTATUS_FINISH:   // 已结束
+        {
+            self.joinButton.userInteractionEnabled = NO;
+            [self.joinButton setBackgroundImage:[UIImage imageNamed:@"button_unable"] forState:UIControlStateNormal];
+            if (self.hasAnimation) {
+                self.hasAnimation = NO;
+                [self.joinButton.layer removeAnimationForKey:@"aAlpha"];
+            }
         }
+            break;
+        case JOINBUTTONSTATUS_WAIT:
+        {
+            self.joinButton.userInteractionEnabled = NO;
+            [self.joinButton setBackgroundImage:[UIImage imageNamed:@"button_wait"] forState:UIControlStateNormal];
+            if (self.hasAnimation == NO) {
+                self.hasAnimation = YES;
+                [self.joinButton.layer addAnimation:[self alphaChange:2.0f] forKey:@"aAlpha"];
+            }
+        }
+            break;
+        case JOINBUTTONSTATUS_IN:
+        {
+            self.joinButton.userInteractionEnabled = YES;
+            [self.joinButton setBackgroundImage:[UIImage imageNamed:@"button_nomal"] forState:UIControlStateNormal];
+            [self.joinButton setBackgroundImage:[UIImage imageNamed:@"button_highlight"] forState:UIControlStateHighlighted];
+            if (self.hasAnimation == NO) {
+                self.hasAnimation = YES;
+                [self.joinButton.layer addAnimation:[self alphaChange:2.0f] forKey:@"aAlpha"];
+            }
+        }
+            break;
+        default:
+            break;
     }
 }
 
+
+
+
 - (void)operationCallback:(JoinRoomAction)callback {
     if (callback) {
         self.callback = callback;

+ 13 - 1
MusicGradeExam/MusicGradeExam/UI/ExamLibrary/Controller/OpenFileViewController.m

@@ -16,6 +16,7 @@
 
 @property (nonatomic, strong) NSMutableArray *fileArray;
 
+
 @end
 
 @implementation OpenFileViewController
@@ -23,7 +24,7 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    [self allocTitle:@"曲目详情"];
+    [self allocTitle:[NSString returnNoNullStringWithString:self.fileName]];
     [self addChildViewController:self.previewCtrl];
 }
 
@@ -31,6 +32,7 @@
 - (void)viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
     [self requestFileSource];
+    [self.previewCtrl addObserver:self forKeyPath:@"currentPreviewItemIndex" options:NSKeyValueObservingOptionNew context:nil];
 }
 
 - (void)requestFileSource { // 如果缓存中有,不会再次下载
@@ -73,6 +75,16 @@
     return _previewCtrl;
 }
 
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
+    NSInteger currentIndex = [[change objectForKey:@"new"] integerValue];
+    self.navigationController.interactivePopGestureRecognizer.enabled = (currentIndex == 0);
+    [self rightButtonTitle:[NSString stringWithFormat:@"%zd/%zd", (currentIndex+1),self.fileArray.count]];
+}
+
+
+- (void)dealloc {
+    [self.previewCtrl removeObserver:self forKeyPath:@"currentPreviewItemIndex"];
+}
 /*
 #pragma mark - Navigation
 

+ 25 - 0
MusicGradeExam/MusicGradeExam/UI/Home/Controller/HomeViewController.m

@@ -17,6 +17,7 @@
 #import "WaitExamViewController.h"
 #import "ExamViewController.h"
 #import "ExamDisplayViewController.h"
+#import "UserInfoManager.h"
 
 @interface HomeViewController ()<TYCyclePagerViewDataSource,TYCyclePagerViewDelegate>
 
@@ -95,9 +96,33 @@
         }
         self.bodyView.hasExam = YES;
         [self.pagerView reloadData];
+        if (USER_MANAGER.needConnect == NO) { // 如果没有建立IM连接
+            
+            for (TicketListModel *model in self.dataArray) {
+                if (![NSString isEmptyString:model.examTime]) {
+                    NSString *examDay = [[model.examTime componentsSeparatedByString:@" "] firstObject];
+                    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+                    [formatter setDateFormat:@"yyyy-MM-dd"];
+                    formatter.timeZone = [NSTimeZone systemTimeZone];
+                    NSDate *currentDate = [NSDate date];
+                    NSString *currentDay = [formatter stringFromDate:currentDate];
+                    if ([examDay isEqualToString:currentDay]) { // 如果今天有考试,IM建立连接
+                        [self configIMConnection];
+                        break;
+                    }
+                }
+            }
+        }
     }
 }
 
+- (void)configIMConnection {
+    // IM建立连接
+    [USER_MANAGER connectRongCloud];
+    USER_MANAGER.needConnect = YES;
+}
+
+
 - (void)queryUnReadMessageCount {
     [KSRequestManager queryCountOfUnreadRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
         [self.scrollView.mj_header endRefreshing];

+ 3 - 2
MusicGradeExam/MusicGradeExam/UI/Login/Model/UserInfoManager.m

@@ -86,10 +86,11 @@
             
             if (connectJPush) {
                 [JPUSHService setAlias:UserDefault(UIDKey) completion:nil seq:0];
-            }
-            if (connectRM) {
                 // 设置推送别名
                 [Bugly setUserIdentifier:UserDefault(UIDKey)];
+            }
+            if (connectRM) {
+                
                 [self connectRongCloud];
             }
             else if (self.callback) {