|  | @@ -13,9 +13,16 @@
 | 
											
												
													
														|  |  #import "AccompanyDetailViewController.h"
 |  |  #import "AccompanyDetailViewController.h"
 | 
											
												
													
														|  |  #import "VipCouseDetailViewController.h"
 |  |  #import "VipCouseDetailViewController.h"
 | 
											
												
													
														|  |  #import "GroupCourseListModel.h"
 |  |  #import "GroupCourseListModel.h"
 | 
											
												
													
														|  | 
 |  | +#import "OnlineClassManager.h"
 | 
											
												
													
														|  | 
 |  | +#import "KSPremissionAlert.h"
 | 
											
												
													
														|  | 
 |  | +#import "RecordCheckManager.h"
 | 
											
												
													
														|  | 
 |  | +#import <KSChoosePicker.h>
 | 
											
												
													
														|  | 
 |  | +#import <KSFullDatePicker.h>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  @interface ProgramCourseGroupBodyView ()<UITableViewDelegate,UITableViewDataSource>
 |  |  @interface ProgramCourseGroupBodyView ()<UITableViewDelegate,UITableViewDataSource>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +@property (nonatomic, strong) NSDateFormatter *dateFormatter;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  @property (nonatomic, strong) NSMutableArray *dataArray;
 |  |  @property (nonatomic, strong) NSMutableArray *dataArray;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  @property (nonatomic, strong) StateView *promptView;
 |  |  @property (nonatomic, strong) StateView *promptView;
 | 
											
										
											
												
													
														|  | @@ -31,6 +38,20 @@
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  @property (nonatomic, strong) NSString *courseStatus;
 |  |  @property (nonatomic, strong) NSString *courseStatus;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +@property (nonatomic, strong) OnlineClassManager *classManager;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +@property (nonatomic, assign) NSInteger secondChooseIndex;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +@property (nonatomic, assign) NSInteger thirdChooseIndex;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +@property (nonatomic, strong) NSMutableArray *statusArray;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +@property (nonatomic, strong) NSMutableArray *attendenceStatusArray;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +@property (nonatomic, assign) NSInteger joinRoomBeforeTime; // 上课开始时间
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +@property (nonatomic, assign) NSInteger quitRomeEndTime;    // 下课截止时间
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  @end
 |  |  @end
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  @implementation ProgramCourseGroupBodyView
 |  |  @implementation ProgramCourseGroupBodyView
 | 
											
										
											
												
													
														|  | @@ -53,6 +74,7 @@
 | 
											
												
													
														|  |          UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KPortraitWidth, iPhoneXSafeBottomMargin)];
 |  |          UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KPortraitWidth, iPhoneXSafeBottomMargin)];
 | 
											
												
													
														|  |          bottomView.backgroundColor = [UIColor clearColor];
 |  |          bottomView.backgroundColor = [UIColor clearColor];
 | 
											
												
													
														|  |          self.tableView.tableFooterView = bottomView;
 |  |          self.tableView.tableFooterView = bottomView;
 | 
											
												
													
														|  | 
 |  | +        [self configDefault];
 | 
											
												
													
														|  |          
 |  |          
 | 
											
												
													
														|  |          MJWeakSelf;
 |  |          MJWeakSelf;
 | 
											
												
													
														|  |          self.tableView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
 |  |          self.tableView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
 | 
											
										
											
												
													
														|  | @@ -65,6 +87,12 @@
 | 
											
												
													
														|  |      return self;
 |  |      return self;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +- (void)configDefault {
 | 
											
												
													
														|  | 
 |  | +    [self.dateFormatter setDateFormat:@"yyyy-MM"];
 | 
											
												
													
														|  | 
 |  | +    NSDate *currentDate = [NSDate date];
 | 
											
												
													
														|  | 
 |  | +    self.classDate = [self.dateFormatter stringFromDate:currentDate];
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  - (void)forceScroll {
 |  |  - (void)forceScroll {
 | 
											
												
													
														|  |      self.tableView.scrollEnabled = NO;
 |  |      self.tableView.scrollEnabled = NO;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
										
											
												
													
														|  | @@ -94,6 +122,21 @@
 | 
											
												
													
														|  |      });
 |  |      });
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +- (void)requestRoomConfig {
 | 
											
												
													
														|  | 
 |  | +    [KSNetworkingManager selectRoomConfigRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
 | 
											
												
													
														|  | 
 |  | +        if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
 | 
											
												
													
														|  | 
 |  | +            NSDictionary *result = [dic ks_dictionaryValueForKey:@"data"];
 | 
											
												
													
														|  | 
 |  | +            self.joinRoomBeforeTime = [result ks_integerValueForKey:@"practiceStartTime"];
 | 
											
												
													
														|  | 
 |  | +            self.quitRomeEndTime = [result ks_integerValueForKey:@"practiceEndTime"];
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        else {
 | 
											
												
													
														|  | 
 |  | +            [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +    } faliure:^(NSError * _Nonnull error) {
 | 
											
												
													
														|  | 
 |  | +        
 | 
											
												
													
														|  | 
 |  | +    }];
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  - (void)requestData {
 |  |  - (void)requestData {
 | 
											
												
													
														|  |      [KSNetworkingManager courseScheduleListRequest:KS_POST courseGroupId:self.courseGroupId classMonth:self.classDate attendanceStatus:self.attendanceStatus courseStatus:self.courseStatus success:^(NSDictionary * _Nonnull dic) {
 |  |      [KSNetworkingManager courseScheduleListRequest:KS_POST courseGroupId:self.courseGroupId classMonth:self.classDate attendanceStatus:self.attendanceStatus courseStatus:self.courseStatus success:^(NSDictionary * _Nonnull dic) {
 | 
											
												
													
														|  |          [self endRefresh];
 |  |          [self endRefresh];
 | 
											
										
											
												
													
														|  | @@ -129,6 +172,7 @@
 | 
											
												
													
														|  |          [self beginRefreshImmediately];
 |  |          [self beginRefreshImmediately];
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  - (void)selectCellAtIndexPath:(NSIndexPath *)indexPath {
 |  |  - (void)selectCellAtIndexPath:(NSIndexPath *)indexPath {
 | 
											
												
													
														|  |      
 |  |      
 | 
											
												
													
														|  |      if (self.lastSelectedIndexPath == indexPath) {
 |  |      if (self.lastSelectedIndexPath == indexPath) {
 | 
											
										
											
												
													
														|  | @@ -153,6 +197,9 @@
 | 
											
												
													
														|  |              make.left.right.top.mas_equalTo(self);
 |  |              make.left.right.top.mas_equalTo(self);
 | 
											
												
													
														|  |              make.height.mas_equalTo(sortViewHeight);
 |  |              make.height.mas_equalTo(sortViewHeight);
 | 
											
												
													
														|  |          }];
 |  |          }];
 | 
											
												
													
														|  | 
 |  | +        [self.dateFormatter setDateFormat:@"yyyy年MM月"];
 | 
											
												
													
														|  | 
 |  | +        NSDate *currentDate = [NSDate date];
 | 
											
												
													
														|  | 
 |  | +        [self.sortView.firstLabel setText:[self.dateFormatter stringFromDate:currentDate]];
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
 |  |      [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
 | 
											
										
											
												
													
														|  | @@ -174,7 +221,7 @@
 | 
											
												
													
														|  |      GroupCourseListModel *model = self.dataArray[indexPath.row];
 |  |      GroupCourseListModel *model = self.dataArray[indexPath.row];
 | 
											
												
													
														|  |      ProgramCourseListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ProgramCourseListCell"];
 |  |      ProgramCourseListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ProgramCourseListCell"];
 | 
											
												
													
														|  |      MJWeakSelf;
 |  |      MJWeakSelf;
 | 
											
												
													
														|  | -    [cell configWithSource:model callback:^(GroupCourseListModel * _Nonnull model) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    [cell configWithSource:model beforeTime:self.enterStartTime callback:^(GroupCourseListModel * _Nonnull model) {
 | 
											
												
													
														|  |          [weakSelf enterClassRoom:model];
 |  |          [weakSelf enterClassRoom:model];
 | 
											
												
													
														|  |      }];
 |  |      }];
 | 
											
												
													
														|  |      return cell;
 |  |      return cell;
 | 
											
										
											
												
													
														|  | @@ -182,6 +229,25 @@
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  - (void)enterClassRoom:(GroupCourseListModel *)model {
 |  |  - (void)enterClassRoom:(GroupCourseListModel *)model {
 | 
											
												
													
														|  |      
 |  |      
 | 
											
												
													
														|  | 
 |  | +    NSDateFormatter *dateFormatter = [NSObject getDateformatter];
 | 
											
												
													
														|  | 
 |  | +    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
 | 
											
												
													
														|  | 
 |  | +    NSDate *beginDate = [dateFormatter dateFromString:model.startTime];
 | 
											
												
													
														|  | 
 |  | +    NSDate *endDate = [dateFormatter dateFromString:model.endTime];
 | 
											
												
													
														|  | 
 |  | +    NSDate *currentDate = [NSDate date];
 | 
											
												
													
														|  | 
 |  | +    NSTimeInterval beginTimeInterval = [beginDate timeIntervalSinceDate:currentDate];
 | 
											
												
													
														|  | 
 |  | +    NSTimeInterval endTimeInterval = [currentDate timeIntervalSinceDate:endDate];
 | 
											
												
													
														|  | 
 |  | +    if (beginTimeInterval <= self.joinRoomBeforeTime * 60 && endTimeInterval < 0) {
 | 
											
												
													
														|  | 
 |  | +        [self joinClassRoom:model];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    else if (endTimeInterval > 0) {
 | 
											
												
													
														|  | 
 |  | +        [LOADING_MANAGER MBShowAUTOHidingInWindow:@"该课程已结束"];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    else {
 | 
											
												
													
														|  | 
 |  | +        NSString *tipsString = [NSString stringWithFormat:@"课程还未开始,请在上课前%zd分钟进入", self.joinRoomBeforeTime];
 | 
											
												
													
														|  | 
 |  | +        [LOADING_MANAGER MBShowAUTOHidingInWindow:tipsString];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    [self joinClassRoom:model];
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 |  |  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 | 
											
										
											
												
													
														|  | @@ -208,11 +274,77 @@
 | 
											
												
													
														|  |  - (GroupCourseSortView *)sortView {
 |  |  - (GroupCourseSortView *)sortView {
 | 
											
												
													
														|  |      if (!_sortView) {
 |  |      if (!_sortView) {
 | 
											
												
													
														|  |          _sortView = [GroupCourseSortView sharedInstance];
 |  |          _sortView = [GroupCourseSortView sharedInstance];
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | 
 |  | +        MJWeakSelf;
 | 
											
												
													
														|  | 
 |  | +        [_sortView sortAction:^(SORT_TYPE type) {
 | 
											
												
													
														|  | 
 |  | +            [weakSelf sortWithType:type];
 | 
											
												
													
														|  | 
 |  | +        }];
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      return _sortView;
 |  |      return _sortView;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +- (NSMutableArray *)statusArray {
 | 
											
												
													
														|  | 
 |  | +    if (!_statusArray) {
 | 
											
												
													
														|  | 
 |  | +        _statusArray = [NSMutableArray arrayWithObject:@[]];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    return _statusArray;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (OnlineClassManager *)classManager {
 | 
											
												
													
														|  | 
 |  | +    if (!_classManager) {
 | 
											
												
													
														|  | 
 |  | +        _classManager = [[OnlineClassManager alloc] init];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    return _classManager;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +// 加入房间
 | 
											
												
													
														|  | 
 |  | +- (void)joinClassRoom:(GroupCourseListModel *)model {
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    // 加入房间前判断摄像头和麦克风逻辑
 | 
											
												
													
														|  | 
 |  | +    [RecordCheckManager checkCameraPremissionAvaiableCallback:^(PREMISSIONTYPE type) {
 | 
											
												
													
														|  | 
 |  | +        [self afterCheckCameraCheckMic:type source:model];
 | 
											
												
													
														|  | 
 |  | +    }];
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (void)afterCheckCameraCheckMic:(PREMISSIONTYPE)cameraType source:(GroupCourseListModel *)model {
 | 
											
												
													
														|  | 
 |  | +    [RecordCheckManager checkMicPermissionAvaiableCallback:^(PREMISSIONTYPE type) {
 | 
											
												
													
														|  | 
 |  | +        if (type == PREMISSIONTYPE_YES && cameraType == PREMISSIONTYPE_YES) {
 | 
											
												
													
														|  | 
 |  | +            // 判断是否进行课前检测
 | 
											
												
													
														|  | 
 |  | +            [self.classManager joinRoomWithId:model.courseId subjectName:model.subjectName classEndTime:model.endTime inViewController:(KSBaseViewController *)self.naviController.visibleViewController];
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        else {
 | 
											
												
													
														|  | 
 |  | +            NSString *content = @"";
 | 
											
												
													
														|  | 
 |  | +            CHECKDEVICETYPE checkType = CHECKDEVICETYPE_BOTH;
 | 
											
												
													
														|  | 
 |  | +            if (cameraType == PREMISSIONTYPE_NO && type == PREMISSIONTYPE_NO) {
 | 
											
												
													
														|  | 
 |  | +                content = @"请开启相机和麦克风访问权限";
 | 
											
												
													
														|  | 
 |  | +                checkType = CHECKDEVICETYPE_BOTH;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            else if (cameraType == PREMISSIONTYPE_NO && type == PREMISSIONTYPE_YES) {
 | 
											
												
													
														|  | 
 |  | +                content =  @"请开启相机访问权限";
 | 
											
												
													
														|  | 
 |  | +                checkType = CHECKDEVICETYPE_CAMREA;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            else if (cameraType == PREMISSIONTYPE_YES && type == PREMISSIONTYPE_NO) {
 | 
											
												
													
														|  | 
 |  | +                content = @"请开启麦克风访问权限";
 | 
											
												
													
														|  | 
 |  | +                checkType = CHECKDEVICETYPE_MIC;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            [self showAlertWithMessage:content type:checkType];
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +    }];
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (void)showAlertWithMessage:(NSString *)message type:(CHECKDEVICETYPE)deviceType {
 | 
											
												
													
														|  | 
 |  | +    [KSPremissionAlert shareInstanceDisplayImage:deviceType message:message showInView:[NSObject getKeyWindow] cancel:^{
 | 
											
												
													
														|  | 
 |  | +        
 | 
											
												
													
														|  | 
 |  | +    } confirm:^{
 | 
											
												
													
														|  | 
 |  | +        [self openSettingView];
 | 
											
												
													
														|  | 
 |  | +    }];
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (void)openSettingView {
 | 
											
												
													
														|  | 
 |  | +    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
												
													
														|  |   设置没有数据时的显示
 |  |   设置没有数据时的显示
 | 
											
												
													
														|  |   
 |  |   
 | 
											
										
											
												
													
														|  | @@ -277,6 +409,150 @@
 | 
											
												
													
														|  |  - (void)dealloc {
 |  |  - (void)dealloc {
 | 
											
												
													
														|  |      [[NSNotificationCenter defaultCenter] removeObserver:self];
 |  |      [[NSNotificationCenter defaultCenter] removeObserver:self];
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (NSDateFormatter *)dateFormatter {
 | 
											
												
													
														|  | 
 |  | +    if (!_dateFormatter) {
 | 
											
												
													
														|  | 
 |  | +        _dateFormatter = [NSObject getDateformatter];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    return _dateFormatter;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +- (void)sortWithType:(SORT_TYPE)type {
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    if (type == SORT_TYPE_TIME) { // time
 | 
											
												
													
														|  | 
 |  | +        [self showPickerView];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    else if (type == SORT_TYPE_STATUS) { // 状态
 | 
											
												
													
														|  | 
 |  | +        MJWeakSelf;
 | 
											
												
													
														|  | 
 |  | +        KSChoosePicker *picker = [[KSChoosePicker alloc] initWithTitle:@"课程状态" sourceData:@[@"全部",@"未开始",@"进行中",@"已结束"]  lastChooseIndex:self.secondChooseIndex sureButtonColor:THEMECOLOR chooseReturnWithBlock:^(NSString * _Nonnull returnValue, NSInteger chooseIndex) {
 | 
											
												
													
														|  | 
 |  | +            weakSelf.secondChooseIndex = chooseIndex;
 | 
											
												
													
														|  | 
 |  | +            if (chooseIndex == 0) {
 | 
											
												
													
														|  | 
 |  | +                [weakSelf.sortView.secondLabel setText:@"全部状态"];
 | 
											
												
													
														|  | 
 |  | +                weakSelf.courseStatus = nil;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            else {
 | 
											
												
													
														|  | 
 |  | +                [weakSelf.sortView.secondLabel setText:returnValue];
 | 
											
												
													
														|  | 
 |  | +                [weakSelf evaluateStatusWithIndex:chooseIndex isCourseStatus:YES];
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            self.sortView.secondArrowUp = NO;
 | 
											
												
													
														|  | 
 |  | +            [weakSelf refreshAndRequestData];
 | 
											
												
													
														|  | 
 |  | +        } cancel:^{
 | 
											
												
													
														|  | 
 |  | +            self.sortView.secondArrowUp = NO;
 | 
											
												
													
														|  | 
 |  | +        }];
 | 
											
												
													
														|  | 
 |  | +        [picker showPicker];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    else if (type == SORT_TYPE_ATTENDENCE) {
 | 
											
												
													
														|  | 
 |  | +        
 | 
											
												
													
														|  | 
 |  | +        MJWeakSelf;
 | 
											
												
													
														|  | 
 |  | +        KSChoosePicker *picker = [[KSChoosePicker alloc] initWithTitle:@"考勤" sourceData:@[@"全部",@"到课",@"旷课"]  lastChooseIndex:self.secondChooseIndex sureButtonColor:THEMECOLOR chooseReturnWithBlock:^(NSString * _Nonnull returnValue, NSInteger chooseIndex) {
 | 
											
												
													
														|  | 
 |  | +            weakSelf.thirdChooseIndex = chooseIndex;
 | 
											
												
													
														|  | 
 |  | +            if (chooseIndex == 0) {
 | 
											
												
													
														|  | 
 |  | +                [weakSelf.sortView.thirdLabel setText:@"全部考勤"];
 | 
											
												
													
														|  | 
 |  | +                weakSelf.attendanceStatus = nil;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            else {
 | 
											
												
													
														|  | 
 |  | +                [weakSelf.sortView.thirdLabel setText:returnValue];
 | 
											
												
													
														|  | 
 |  | +                [weakSelf evaluateStatusWithIndex:chooseIndex isCourseStatus:NO];
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            self.sortView.thirdArrowUp = NO;
 | 
											
												
													
														|  | 
 |  | +            [weakSelf refreshAndRequestData];
 | 
											
												
													
														|  | 
 |  | +        } cancel:^{
 | 
											
												
													
														|  | 
 |  | +            self.sortView.thirdArrowUp = NO;
 | 
											
												
													
														|  | 
 |  | +        }];
 | 
											
												
													
														|  | 
 |  | +        [picker showPicker];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    else {
 | 
											
												
													
														|  | 
 |  | +        [self hiddenPopView];
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (void)evaluateStatusWithIndex:(NSInteger)chooseIndex isCourseStatus:(BOOL)isCourseStatus {
 | 
											
												
													
														|  | 
 |  | +    if (isCourseStatus) {
 | 
											
												
													
														|  | 
 |  | +        switch (chooseIndex) {
 | 
											
												
													
														|  | 
 |  | +            case 0:
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                self.courseStatus = nil;
 | 
											
												
													
														|  | 
 |  | +                [self.sortView.secondLabel setText:@"全部状态"];
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 1:
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                self.courseStatus = @"NOT_START";
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 2:
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                self.courseStatus = @"ING";
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 3:
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                self.courseStatus = @"COMPLETE";
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +                
 | 
											
												
													
														|  | 
 |  | +            default:
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    else {
 | 
											
												
													
														|  | 
 |  | +        switch (chooseIndex) {
 | 
											
												
													
														|  | 
 |  | +            case 0:
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                self.attendanceStatus = nil;
 | 
											
												
													
														|  | 
 |  | +                [self.sortView.thirdLabel setText:@"全部考勤"];
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 1:
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                self.attendanceStatus = @"1";
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            case 2:
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                self.attendanceStatus = @"0";
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +            default:
 | 
											
												
													
														|  | 
 |  | +                break;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (void)showPickerView {
 | 
											
												
													
														|  | 
 |  | +    KSFullDatePicker *picker = [[KSFullDatePicker alloc] initWithTitle:@"" date:[NSDate date] pickMode:KSDATEPICKER_MODE_YEAR_MONTH sureButtonColor:THEMECOLOR selectDateBlock:^(NSString *date) {
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        self.classDate = date;
 | 
											
												
													
														|  | 
 |  | +        NSString *displayTime = [self getTimeDisplay:date];
 | 
											
												
													
														|  | 
 |  | +        [self.sortView.firstLabel setText:displayTime];
 | 
											
												
													
														|  | 
 |  | +        [self resetPickerStatus];
 | 
											
												
													
														|  | 
 |  | +        // 请求数据
 | 
											
												
													
														|  | 
 |  | +        [self refreshAndRequestData];
 | 
											
												
													
														|  | 
 |  | +    } cancleBlock:^{
 | 
											
												
													
														|  | 
 |  | +        [self resetPickerStatus];
 | 
											
												
													
														|  | 
 |  | +    }];
 | 
											
												
													
														|  | 
 |  | +    [picker show];
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (void)hiddenPopView {
 | 
											
												
													
														|  | 
 |  | +    self.sortView.firstArrowUp = NO;
 | 
											
												
													
														|  | 
 |  | +    self.sortView.secondArrowUp = NO;
 | 
											
												
													
														|  | 
 |  | +    self.sortView.thirdArrowUp = NO;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (NSString *)getTimeDisplay:(NSString *)chooseMonth {
 | 
											
												
													
														|  | 
 |  | +    [self.dateFormatter setDateFormat:@"yyyy-MM"];
 | 
											
												
													
														|  | 
 |  | +    NSDate *chooseDate = [self.dateFormatter dateFromString:chooseMonth];
 | 
											
												
													
														|  | 
 |  | +    [self.dateFormatter setDateFormat:@"yyyy年MM月"];
 | 
											
												
													
														|  | 
 |  | +    NSString *displayTime = [self.dateFormatter stringFromDate:chooseDate];
 | 
											
												
													
														|  | 
 |  | +    return displayTime;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +- (void)resetPickerStatus {
 | 
											
												
													
														|  | 
 |  | +    self.sortView.firstArrowUp = NO;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  /*
 |  |  /*
 | 
											
												
													
														|  |  // Only override drawRect: if you perform custom drawing.
 |  |  // Only override drawRect: if you perform custom drawing.
 | 
											
												
													
														|  |  // An empty implementation adversely affects performance during animation.
 |  |  // An empty implementation adversely affects performance during animation.
 |