|
@@ -75,13 +75,11 @@
|
|
|
#import "HomeMusicSheetLayout.h"
|
|
|
#import "HomeArrangeCourseController.h"
|
|
|
|
|
|
+#import "HomeCountView.h"
|
|
|
+#import "KSTabBarViewController.h"
|
|
|
+
|
|
|
#define COLLECTION_WIDTH ((NSInteger)(IS_IPAD ? KPortraitWidth * 0.7 : KPortraitWidth * 0.83))
|
|
|
#define COLLECTION_HEIGHT (320)
|
|
|
-#define BUTTONWIDTH (65)
|
|
|
-#define BUTTONHEIGHT (80)
|
|
|
-
|
|
|
-#define BUTTON_ROWCOUNT (IS_IPAD ? 7 : 5)
|
|
|
-
|
|
|
|
|
|
@interface HomeViewController ()<JXPagerViewDelegate, JXPagerMainTableViewGestureDelegate,JXCategoryViewDelegate,SDCycleScrollViewDelegate,UIScrollViewDelegate,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,TYCyclePagerViewDataSource,TYCyclePagerViewDelegate>
|
|
|
|
|
@@ -99,11 +97,13 @@
|
|
|
@property (nonatomic, strong) NSMutableArray *bannerArray; // banner 数据
|
|
|
@property (nonatomic, assign) CGFloat bannerViewHeight; // banner 高度
|
|
|
|
|
|
+// 统计
|
|
|
+@property (nonatomic, strong) HomeCountView *countView;
|
|
|
+@property (nonatomic, assign) CGFloat countViewHeight;
|
|
|
+
|
|
|
// 按钮
|
|
|
@property (nonatomic, strong) HomeButtonView *buttonContainer; // button container
|
|
|
-@property (nonatomic, strong) UIScrollView *buttonScrollView;
|
|
|
@property (nonatomic, strong) NSMutableArray *buttonArray; // button 内容
|
|
|
-@property (nonatomic, assign) NSInteger buttonDotWidth;
|
|
|
@property (nonatomic, assign) CGFloat buttonViewHeight; // button view 高度
|
|
|
|
|
|
// 公告
|
|
@@ -131,12 +131,6 @@
|
|
|
@property (nonatomic, strong) NSMutableArray *videoCourseArray; // 视频课数据
|
|
|
@property (nonatomic, assign) CGFloat videoViewHeight; // video 高度
|
|
|
|
|
|
-// 直播课
|
|
|
-@property (nonatomic, strong) HomeHotLiveCourseView *liveCourseView;
|
|
|
-@property (nonatomic, strong) UICollectionView *liveCollectionView; // 直播课容器
|
|
|
-@property (nonatomic, strong) NSMutableArray *liveCourseArray; // 直播课数据
|
|
|
-@property (nonatomic, assign) CGFloat liveViewHeight; // live 高度
|
|
|
-
|
|
|
@property (nonatomic, strong) dispatch_group_t requestGroup;
|
|
|
|
|
|
// 顶部数据容器
|
|
@@ -165,6 +159,7 @@
|
|
|
@property (nonatomic, strong) HomeDragButton *suspendButton;
|
|
|
|
|
|
@property (nonatomic, assign) CGFloat headheight;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation HomeViewController
|
|
@@ -202,27 +197,37 @@
|
|
|
[self.headView addSubview:self.bannerView];
|
|
|
self.bannerViewHeight = CGFLOAT_MIN;
|
|
|
[self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.top.mas_equalTo(self.headView);
|
|
|
+ make.top.mas_equalTo(self.headView.mas_top).offset(12);
|
|
|
+ make.left.right.mas_equalTo(self.headView);
|
|
|
make.height.mas_equalTo(self.bannerViewHeight);
|
|
|
}];
|
|
|
self.bannerView.hidden = YES;
|
|
|
|
|
|
- // 按钮
|
|
|
- [self.headView addSubview:self.buttonContainer];
|
|
|
- self.buttonViewHeight = CGFLOAT_MIN;
|
|
|
- [self.buttonContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ // 统计
|
|
|
+ [self.headView addSubview:self.countView];
|
|
|
+ self.countViewHeight = [HomeCountView getViewHeight];
|
|
|
+ [self.countView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.headView);
|
|
|
make.top.mas_equalTo(self.bannerView.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.countViewHeight);
|
|
|
+ }];
|
|
|
+
|
|
|
+ // 最近课程
|
|
|
+ [self.headView addSubview:self.courseView];
|
|
|
+ self.courseViewHeight = CGFLOAT_MIN;
|
|
|
+ [self.courseView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.headView);
|
|
|
+ make.top.mas_equalTo(self.countView.mas_bottom);
|
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
|
}];
|
|
|
- self.buttonContainer.hidden = YES;
|
|
|
+ self.courseView.hidden = YES;
|
|
|
|
|
|
// 公告
|
|
|
[self.headView addSubview:self.noticeView];
|
|
|
self.noticeViewHeight = CGFLOAT_MIN;
|
|
|
[self.noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
+ make.top.mas_equalTo(self.courseView.mas_bottom);
|
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
|
}];
|
|
|
[self.noticeView.adView addSubview:self.noticeScrollView];
|
|
@@ -230,23 +235,23 @@
|
|
|
make.top.left.right.bottom.mas_equalTo(self.noticeView.adView);
|
|
|
}];
|
|
|
self.noticeView.hidden = YES;
|
|
|
-
|
|
|
- // 最近课程
|
|
|
- [self.headView addSubview:self.courseView];
|
|
|
- self.courseViewHeight = CGFLOAT_MIN;
|
|
|
- [self.courseView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ // 按钮
|
|
|
+ [self.headView addSubview:self.buttonContainer];
|
|
|
+ self.buttonViewHeight = CGFLOAT_MIN;
|
|
|
+ [self.buttonContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.headView);
|
|
|
make.top.mas_equalTo(self.noticeView.mas_bottom);
|
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
|
}];
|
|
|
- self.courseView.hidden = YES;
|
|
|
+ self.buttonContainer.hidden = YES;
|
|
|
|
|
|
- // 推荐老师
|
|
|
+ // 找老师
|
|
|
[self.headView addSubview:self.talentView];
|
|
|
self.talentViewHeight = CGFLOAT_MIN;
|
|
|
[self.talentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.courseView.mas_bottom);
|
|
|
+ make.top.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
make.height.mas_equalTo(self.talentViewHeight);
|
|
|
}];
|
|
|
self.talentView.hidden = YES;
|
|
@@ -260,19 +265,10 @@
|
|
|
make.height.mas_equalTo(self.videoViewHeight);
|
|
|
}];
|
|
|
self.videoCourseView.hidden = YES;
|
|
|
- // 直播
|
|
|
- [self.headView addSubview:self.liveCourseView];
|
|
|
- self.liveViewHeight = CGFLOAT_MIN;
|
|
|
- [self.liveCourseView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.videoCourseView.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.liveViewHeight);
|
|
|
- }];
|
|
|
- self.liveCourseView.hidden = YES;
|
|
|
|
|
|
[self.headBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.bannerView.mas_top);
|
|
|
+ make.top.mas_equalTo(self.headView.mas_top);
|
|
|
make.bottom.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
}];
|
|
|
|
|
@@ -284,9 +280,9 @@
|
|
|
}
|
|
|
|
|
|
- (void)refreshHeadHeight {
|
|
|
-// CGFloat bottomSpace = 20.0f;
|
|
|
+ CGFloat headSpace = 12.0f;
|
|
|
CGFloat bottomSpace = 0.0f;
|
|
|
- self.headViewHeight = self.bannerViewHeight + self.buttonViewHeight + self.noticeViewHeight + self.courseViewHeight + self.talentViewHeight + self.liveViewHeight + self.videoViewHeight + bottomSpace;
|
|
|
+ self.headViewHeight = headSpace + self.bannerViewHeight + self.countViewHeight + self.courseViewHeight + self.noticeViewHeight + self.buttonViewHeight + self.talentViewHeight + self.videoViewHeight + bottomSpace;
|
|
|
[self.pagerView resizeTableHeaderViewHeightWithAnimatable:NO duration:0.3f curve:UIViewAnimationCurveEaseInOut];
|
|
|
}
|
|
|
|
|
@@ -529,6 +525,9 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+- (void)requestStatistics {
|
|
|
+// dispatch_group_enter(self.requestGroup);
|
|
|
+}
|
|
|
|
|
|
- (void)requestCourseInfo {
|
|
|
|
|
@@ -537,13 +536,6 @@
|
|
|
dispatch_group_leave(self.requestGroup);
|
|
|
if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
|
|
|
NSDictionary *sourceDic = [dic ks_dictionaryValueForKey:@"data"];
|
|
|
- NSArray *liveList = [sourceDic ks_arrayValueForKey:@"liveList"];
|
|
|
- NSMutableArray *liveCourse = [NSMutableArray array];
|
|
|
- for (NSDictionary *parm in liveList) {
|
|
|
- HomeLiveGroupModel *model = [[HomeLiveGroupModel alloc] initWithDictionary:parm];
|
|
|
- [liveCourse addObject:model];
|
|
|
- }
|
|
|
- self.liveCourseArray = [NSMutableArray arrayWithArray:liveCourse];
|
|
|
|
|
|
NSArray *videoList = [sourceDic ks_arrayValueForKey:@"videoList"];
|
|
|
NSMutableArray *videoCourse = [NSMutableArray array];
|
|
@@ -714,9 +706,7 @@
|
|
|
[self refreshTalentView];
|
|
|
// 课程
|
|
|
[self refreshCourseView];
|
|
|
-
|
|
|
- // 刷新排序
|
|
|
- [self refreshViewLocation];
|
|
|
+
|
|
|
[self refreshHeadHeight];
|
|
|
|
|
|
[self refreshPageView];
|
|
@@ -824,71 +814,7 @@
|
|
|
[self.talentCollectionView reloadData];
|
|
|
}
|
|
|
|
|
|
-- (void)refreshViewLocation {
|
|
|
- // 如果有课程和公告 且有按钮
|
|
|
- CGFloat buttonViewDefaultHeight = self.buttonArray.count > BUTTON_ROWCOUNT ? [HomeButtonView getViewHeight] : [HomeButtonView getViewHeight] - 20;
|
|
|
-
|
|
|
- if (self.noticeTitleArray.count && self.recentCourseModel && self.buttonArray.count) {
|
|
|
- self.noticeViewHeight = [PublicNoticeView getViewHeight];
|
|
|
- [self.noticeView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.bannerView.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.noticeViewHeight);
|
|
|
- }];
|
|
|
- self.buttonViewHeight = buttonViewDefaultHeight;
|
|
|
- [self.buttonContainer mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.noticeView.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.buttonViewHeight);
|
|
|
- }];
|
|
|
- self.courseViewHeight = 91.0f;
|
|
|
- [self.courseView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.courseViewHeight);
|
|
|
- }];
|
|
|
-
|
|
|
- [self.headBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.bannerView.mas_top);
|
|
|
- make.bottom.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
- }];
|
|
|
- }
|
|
|
- else {
|
|
|
- CGFloat spaceCutDown = 0.0f;
|
|
|
- if (self.noticeArray.count) {
|
|
|
- spaceCutDown = 20.0f;
|
|
|
- }
|
|
|
-
|
|
|
- self.buttonViewHeight = self.buttonArray.count ? buttonViewDefaultHeight - spaceCutDown : CGFLOAT_MIN;
|
|
|
- [self.buttonContainer mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.bannerView.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.buttonViewHeight);
|
|
|
- }];
|
|
|
- self.noticeViewHeight = self.noticeTitleArray.count ? [PublicNoticeView getViewHeight] : CGFLOAT_MIN;
|
|
|
- [self.noticeView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.noticeViewHeight);
|
|
|
- }];
|
|
|
-
|
|
|
- [self.headBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.bannerView.mas_top);
|
|
|
- make.bottom.mas_equalTo(self.noticeView.mas_bottom);
|
|
|
- }];
|
|
|
-
|
|
|
- CGFloat courseViewHeight = self.recentCourseModel ? 90.0f : CGFLOAT_MIN;
|
|
|
- self.courseViewHeight = courseViewHeight;
|
|
|
- [self.courseView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.noticeView.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.courseViewHeight);
|
|
|
- }];
|
|
|
-
|
|
|
- }
|
|
|
-}
|
|
|
+
|
|
|
|
|
|
- (void)refreshBannaerView {
|
|
|
|
|
@@ -916,45 +842,38 @@
|
|
|
}
|
|
|
|
|
|
- (void)showButtonMessage {
|
|
|
-
|
|
|
+ [self.buttonContainer.buttonContentView removeAllSubViews];
|
|
|
+ CGFloat buttonSpace = (KPortraitWidth - BUTTON_ROWCOUNT * HOME_BUTTONWIDTH) / (BUTTON_ROWCOUNT + 1);
|
|
|
// 添加按钮
|
|
|
if (self.buttonArray.count) {
|
|
|
self.buttonContainer.hidden = NO;
|
|
|
- if (self.buttonArray.count > BUTTON_ROWCOUNT) { // 大于4个显示底部滚动视图
|
|
|
- self.buttonContainer.buttonPageCtrl.hidden = NO;
|
|
|
- self.buttonContainer.buttonDotLeft.constant = 0;
|
|
|
- NSInteger addPage = (self.buttonArray.count % BUTTON_ROWCOUNT) > 0 ? 1 : 0;
|
|
|
- NSInteger pageCount = self.buttonArray.count / BUTTON_ROWCOUNT + addPage;
|
|
|
- self.buttonDotWidth = 36 / pageCount;
|
|
|
- self.buttonContainer.buttonDotWidth.constant = self.buttonDotWidth;
|
|
|
- self.buttonScrollView.contentSize = CGSizeMake(KPortraitWidth * pageCount, BUTTONHEIGHT);
|
|
|
- }
|
|
|
- else {
|
|
|
- self.buttonContainer.buttonPageCtrl.hidden = YES;
|
|
|
- self.buttonScrollView.contentSize = CGSizeMake(KPortraitWidth, BUTTONHEIGHT);
|
|
|
+ CGFloat xSpace = 0.0f;
|
|
|
+ CGFloat ySpace = 0.0f;
|
|
|
+ for (NSInteger i = 0; i < self.buttonArray.count; i++) {
|
|
|
+ xSpace = buttonSpace / 2 + (i % BUTTON_ROWCOUNT) * (HOME_BUTTONWIDTH + buttonSpace);
|
|
|
+ ySpace = (i / BUTTON_ROWCOUNT) * HOME_BUTTONHEIGHT;
|
|
|
+ HomeMessageModel *model = self.buttonArray[i];
|
|
|
+ KSHomeButton *buttonView = [KSHomeButton shareInstance];
|
|
|
+
|
|
|
+ [buttonView.buttonImage sd_setImageWithURL:[NSURL URLWithString:[model.coverImage getUrlEndcodeString]]];
|
|
|
+ buttonView.buttonTitle.text = model.title;
|
|
|
+ buttonView.frame = CGRectMake(xSpace, ySpace, HOME_BUTTONWIDTH, HOME_BUTTONHEIGHT);
|
|
|
+
|
|
|
+ buttonView.actionButton.tag = 3000 + i;
|
|
|
+ [buttonView.actionButton addTarget:self action:@selector(HomeTopButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.buttonContainer.buttonContentView addSubview:buttonView];
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
self.buttonContainer.hidden = YES;
|
|
|
- self.buttonContainer.buttonPageCtrl.hidden = YES;
|
|
|
- self.buttonScrollView.contentSize = CGSizeMake(KPortraitWidth, CGFLOAT_MIN);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- self.buttonScrollView.contentOffset = CGPointMake(0, 0);
|
|
|
- [self.buttonScrollView removeAllSubViews];
|
|
|
- CGFloat buttonSpace = (KPortraitWidth - BUTTON_ROWCOUNT * BUTTONWIDTH) / (BUTTON_ROWCOUNT + 1);
|
|
|
- for (NSInteger i = 0; i < self.buttonArray.count; i++) {
|
|
|
- HomeMessageModel *model = self.buttonArray[i];
|
|
|
- KSHomeButton *buttonView = [KSHomeButton shareInstance];
|
|
|
-
|
|
|
- [buttonView.buttonImage sd_setImageWithURL:[NSURL URLWithString:[model.coverImage getUrlEndcodeString]]];
|
|
|
- buttonView.buttonTitle.text = model.title;
|
|
|
- buttonView.frame = CGRectMake(buttonSpace + (i % BUTTON_ROWCOUNT) * (BUTTONWIDTH + buttonSpace) + (i / BUTTON_ROWCOUNT) * KPortraitWidth, 0, BUTTONWIDTH, BUTTONHEIGHT);
|
|
|
- buttonView.actionButton.tag = 3000 + i;
|
|
|
- [buttonView.actionButton addTarget:self action:@selector(HomeTopButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [self.buttonScrollView addSubview:buttonView];
|
|
|
- }
|
|
|
+ // 高度
|
|
|
+ CGFloat buttonViewDefaultHeight = [HomeButtonView getViewHeight:self.buttonArray.count];
|
|
|
+ self.buttonViewHeight = buttonViewDefaultHeight;
|
|
|
+ [self.buttonContainer mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(buttonViewDefaultHeight);
|
|
|
+ }];
|
|
|
}
|
|
|
|
|
|
- (void)HomeTopButtonAction:(UIButton *)sender {
|
|
@@ -999,18 +918,7 @@
|
|
|
}
|
|
|
|
|
|
- (void)refreshCourseView {
|
|
|
- // 课程
|
|
|
- if (self.liveCourseArray.count) {
|
|
|
- self.liveViewHeight = [HomeHotLiveCourseView getViewHeight];
|
|
|
- self.liveCourseView.hidden = NO;
|
|
|
- }
|
|
|
- else {
|
|
|
- self.liveViewHeight = CGFLOAT_MIN;
|
|
|
- self.liveCourseView.hidden = YES;
|
|
|
- }
|
|
|
- [self.liveCourseView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(self.liveViewHeight);
|
|
|
- }];
|
|
|
+
|
|
|
if (self.videoCourseArray.count) {
|
|
|
self.videoViewHeight = [HomeHotVideoCourseView getViewHeight];
|
|
|
self.videoCourseView.hidden = NO;
|
|
@@ -1024,7 +932,6 @@
|
|
|
}];
|
|
|
|
|
|
[self.videoCollectionView reloadData];
|
|
|
- [self.liveCollectionView reloadData];
|
|
|
}
|
|
|
|
|
|
#pragma mark - JXPagerViewDelegate
|
|
@@ -1121,7 +1028,7 @@
|
|
|
|
|
|
- (TYCyclePagerViewLayout *)layoutForPagerView:(TYCyclePagerView *)pageView {
|
|
|
TYCyclePagerViewLayout *layout = [[TYCyclePagerViewLayout alloc]init];
|
|
|
- layout.itemSize = CGSizeMake(KPortraitWidth - 28, (KPortraitWidth - 28) / 347 * 132);
|
|
|
+ layout.itemSize = CGSizeMake(KPortraitWidth, (KPortraitWidth - 28) / 347 * 132);
|
|
|
layout.itemSpacing = 0;
|
|
|
return layout;
|
|
|
|
|
@@ -1158,12 +1065,9 @@
|
|
|
if (collectionView == self.talentCollectionView) { // 推荐老师
|
|
|
return self.talentArray.count;
|
|
|
}
|
|
|
- else if (collectionView == self.videoCollectionView) { // 视频课
|
|
|
+ else/* if (collectionView == self.videoCollectionView)*/ { // 视频课
|
|
|
return self.videoCourseArray.count;
|
|
|
}
|
|
|
- else { // 直播课
|
|
|
- return self.liveCourseArray.count;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1177,18 +1081,12 @@
|
|
|
}];
|
|
|
return cell;
|
|
|
}
|
|
|
- else if (collectionView == self.videoCollectionView) {
|
|
|
+ else /*if (collectionView == self.videoCollectionView)*/ { // 视频课
|
|
|
HomeVideoGroupModel *model = self.videoCourseArray[indexPath.item];
|
|
|
HomeHotVideoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotVideoCell" forIndexPath:indexPath];
|
|
|
[cell configWithSource:model];
|
|
|
return cell;
|
|
|
}
|
|
|
- else {
|
|
|
- HomeLiveGroupModel *model = self.liveCourseArray[indexPath.item];
|
|
|
- HomeHotLiveCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotLiveCell" forIndexPath:indexPath];
|
|
|
- [cell configWithSource:model];
|
|
|
- return cell;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
- (void)followTalentTeacher:(NSString *)teacherId {
|
|
@@ -1234,20 +1132,13 @@
|
|
|
TalentTeacherModel *model = self.talentArray[indexPath.item];
|
|
|
[self displayTeacherDetail:[NSString stringWithFormat:@"%.0f",model.userId]];
|
|
|
}
|
|
|
- else if (collectionView == self.videoCollectionView) { // 视频课
|
|
|
+ else /*if (collectionView == self.videoCollectionView)*/ { // 视频课
|
|
|
HomeVideoGroupModel *model = self.videoCourseArray[indexPath.row];
|
|
|
NSString *url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/videoDetail?groupId=",model.videoGroupId];
|
|
|
KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
ctrl.url = url;
|
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
|
}
|
|
|
- else if (collectionView == self.liveCollectionView) { // 直播课详情
|
|
|
- HomeLiveGroupModel *model = self.liveCourseArray[indexPath.row];
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- NSString *url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/liveDetail?groupId=",model.courseGroupId];
|
|
|
- ctrl.url = url;
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
// 老师风采
|
|
@@ -1259,10 +1150,7 @@
|
|
|
|
|
|
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
if (collectionView == self.talentCollectionView) {
|
|
|
- if (IS_IPAD) {
|
|
|
- return CGSizeMake(134, 178);
|
|
|
- }
|
|
|
- return CGSizeMake(110, 178);
|
|
|
+ return CGSizeMake(104, 146);
|
|
|
}
|
|
|
else if (collectionView == self.videoCollectionView) {
|
|
|
if (IS_IPAD) {
|
|
@@ -1309,16 +1197,6 @@
|
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
|
}
|
|
|
break;
|
|
|
- case HOMENAV_TAG_SEARCH: // 搜索
|
|
|
- {
|
|
|
- HomeArrangeCourseController *ctrl = [[HomeArrangeCourseController alloc] init];
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
- return;
|
|
|
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- webCtrl.url = [NSString stringWithFormat:@"%@/#/music-songbook/search", WEBHOST];
|
|
|
- [self.navigationController pushViewController:webCtrl animated:YES];
|
|
|
- }
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -1374,7 +1252,7 @@
|
|
|
if (!_bannerScroll) {
|
|
|
_bannerScroll = [[TYCyclePagerView alloc] init];
|
|
|
_bannerScroll.backgroundColor = [UIColor clearColor];
|
|
|
- _bannerScroll.frame = CGRectMake(0, 0, KPortraitWidth - 28, (KPortraitWidth - 28) / 347 * 132);
|
|
|
+ _bannerScroll.frame = CGRectMake(0, 0, KPortraitWidth, (KPortraitWidth - 28) / 347 * 132);
|
|
|
_bannerScroll.isInfiniteLoop = YES;
|
|
|
_bannerScroll.autoScrollInterval = 3.0f;
|
|
|
_bannerScroll.reloadDataNeedResetIndex = YES;
|
|
@@ -1418,35 +1296,40 @@
|
|
|
|
|
|
#pragma mark ---- scroll view delegate
|
|
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|
|
- if (scrollView == self.buttonScrollView) {
|
|
|
- NSInteger index = (NSInteger)(scrollView.contentOffset.x / (KPortraitWidth - 28));
|
|
|
-
|
|
|
- [UIView animateWithDuration:0.3f animations:^{
|
|
|
- self.buttonContainer.buttonDotLeft.constant = index * self.buttonDotWidth;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark ---- countView
|
|
|
+- (HomeCountView *)countView {
|
|
|
+ if (!_countView) {
|
|
|
+ _countView = [HomeCountView sharedInstance];
|
|
|
+ MJWeakSelf;
|
|
|
+ [_countView countActionCallback:^(BOOL showCourseTable) {
|
|
|
+ [weakSelf homeStatisticsAction:showCourseTable];
|
|
|
}];
|
|
|
}
|
|
|
+ return _countView;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)homeStatisticsAction:(BOOL)showCourseTable {
|
|
|
+ if (showCourseTable) {
|
|
|
+ [(KSTabBarViewController *)self.tabBarController tabBarSelectedWithIndex:2];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
+ ctrl.url = [NSString stringWithFormat:@"%@%@",WEBHOST,@"/#/memberRecord"];
|
|
|
+ [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#pragma mark ---- button container
|
|
|
- (HomeButtonView *)buttonContainer {
|
|
|
if (!_buttonContainer) {
|
|
|
_buttonContainer = [HomeButtonView shareInstance];
|
|
|
- [_buttonContainer.buttonContentView addSubview:self.buttonScrollView];
|
|
|
}
|
|
|
return _buttonContainer;
|
|
|
}
|
|
|
|
|
|
-- (UIScrollView *)buttonScrollView {
|
|
|
- if (!_buttonScrollView) {
|
|
|
- _buttonScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, KPortraitWidth, BUTTONHEIGHT)];
|
|
|
- _buttonScrollView.backgroundColor = [UIColor clearColor];
|
|
|
- _buttonScrollView.pagingEnabled = YES;
|
|
|
- _buttonScrollView.showsHorizontalScrollIndicator = NO;
|
|
|
- _buttonScrollView.showsVerticalScrollIndicator = NO;
|
|
|
- _buttonScrollView.delegate = self;
|
|
|
- }
|
|
|
- return _buttonScrollView;
|
|
|
-}
|
|
|
|
|
|
#pragma mark ---- notice view
|
|
|
- (UIView *)headBgView {
|
|
@@ -1559,16 +1442,15 @@
|
|
|
return _talentView;
|
|
|
}
|
|
|
|
|
|
-- (void)teacherMoreIntorduce {
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherElegant"];
|
|
|
+- (void)teacherMoreIntorduce { // 约课-VIP定制
|
|
|
+ HomeArrangeCourseController *ctrl = [[HomeArrangeCourseController alloc] init];
|
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
|
}
|
|
|
|
|
|
- (UICollectionView *)talentCollectionView {
|
|
|
if (!_talentCollectionView) {
|
|
|
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
|
|
- layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
|
|
|
+ layout.sectionInset = UIEdgeInsetsMake(0, 14, 0, 14);
|
|
|
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
|
|
_talentCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
|
_talentCollectionView.backgroundColor = [UIColor clearColor];
|
|
@@ -1635,59 +1517,9 @@
|
|
|
return _videoCollectionView;
|
|
|
}
|
|
|
|
|
|
-- (void)toVideoMorePage {
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/videoClass"];
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark ----- live course
|
|
|
-
|
|
|
-- (HomeHotLiveCourseView *)liveCourseView {
|
|
|
- if (!_liveCourseView) {
|
|
|
- _liveCourseView = [HomeHotLiveCourseView shareInstance];
|
|
|
- MJWeakSelf;
|
|
|
- [_liveCourseView homeLiveMore:^{
|
|
|
- [weakSelf toLiveMorePage];
|
|
|
- }];
|
|
|
- [_liveCourseView.liveContentView addSubview:self.liveCollectionView];
|
|
|
- [self.liveCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.bottom.top.mas_equalTo(_liveCourseView.liveContentView);
|
|
|
- }];
|
|
|
- }
|
|
|
- return _liveCourseView;
|
|
|
-}
|
|
|
-
|
|
|
-- (UICollectionView *)liveCollectionView {
|
|
|
- if (!_liveCollectionView) {
|
|
|
- UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
|
|
- layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
|
|
|
- layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
|
|
- _liveCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
|
- _liveCollectionView.backgroundColor = [UIColor clearColor];
|
|
|
- _liveCollectionView.delegate = self;
|
|
|
- _liveCollectionView.dataSource = self;
|
|
|
- _liveCollectionView.showsVerticalScrollIndicator = NO;
|
|
|
- _liveCollectionView.showsHorizontalScrollIndicator = NO;
|
|
|
- if (@available(iOS 11.0, *)) {
|
|
|
- _liveCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- if (@available(iOS 13.0, *)) {
|
|
|
- _liveCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- }
|
|
|
- }
|
|
|
- [_liveCollectionView registerNib:[UINib nibWithNibName:@"HomeHotLiveCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotLiveCell"];
|
|
|
- }
|
|
|
- return _liveCollectionView;
|
|
|
-}
|
|
|
-
|
|
|
-// 更多直播课
|
|
|
-- (void)toLiveMorePage {
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/liveClass"];
|
|
|
+- (void)toVideoMorePage { // 约课-视频
|
|
|
+ HomeArrangeCourseController *ctrl = [[HomeArrangeCourseController alloc] init];
|
|
|
+ [ctrl displayWithIndex:DISPLAY_INDEX_VIEO];
|
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
|
}
|
|
|
|