|
@@ -117,29 +117,7 @@
|
|
|
@property (nonatomic, assign) CGFloat courseViewHeight;
|
|
|
@property (nonatomic, strong) RecentCourseModel *recentCourseModel;
|
|
|
|
|
|
-// 热门专辑
|
|
|
-@property (nonatomic, strong) HomeHotAlbumView *albumView;
|
|
|
-@property (nonatomic, strong) NSMutableArray *albumArray;
|
|
|
-@property (nonatomic, strong) UICollectionView *albumCollectionView; // 专辑容器
|
|
|
-@property (nonatomic, assign) CGFloat albumViewHeight; // album 高度
|
|
|
-
|
|
|
-// 推荐曲目
|
|
|
-@property (nonatomic, strong) HomeRecommendMusicView *recommendMusicView;
|
|
|
-@property (nonatomic, strong) UICollectionView *recommendMusicCollectionView; // 曲谱容器
|
|
|
-@property (nonatomic, strong) NSMutableArray *recommendMusicArray; // 曲谱数据
|
|
|
-@property (nonatomic, assign) CGFloat recommendMusicViewHeight; // music 高度
|
|
|
-
|
|
|
-// 最新曲目
|
|
|
-@property (nonatomic, strong) HomeNewMusicView *newestMusicView;
|
|
|
-@property (nonatomic, strong) UICollectionView *newestMusicCollectionView; // 曲谱容器
|
|
|
-@property (nonatomic, strong) NSMutableArray *newestMusicArray; // 曲谱数据
|
|
|
-@property (nonatomic, assign) CGFloat newestMusicViewHeight; // music 高度
|
|
|
-
|
|
|
-// 热门曲谱
|
|
|
-@property (nonatomic, strong) HomeHotMusicView *hotMusicView;
|
|
|
-@property (nonatomic, strong) UICollectionView *musicCollectionView; // 曲谱容器
|
|
|
-@property (nonatomic, strong) NSMutableArray *musicArray; // 曲谱数据
|
|
|
-@property (nonatomic, assign) CGFloat musicViewHeight; // music 高度
|
|
|
+
|
|
|
// 推荐老师
|
|
|
@property (nonatomic, strong) HomeHotTalentView *talentView;
|
|
|
@property (nonatomic, strong) UICollectionView *talentCollectionView; // 推荐老师容器
|
|
@@ -185,6 +163,7 @@
|
|
|
|
|
|
@property (nonatomic, strong) HomeDragButton *suspendButton;
|
|
|
|
|
|
+@property (nonatomic, assign) CGFloat headheight;
|
|
|
@end
|
|
|
|
|
|
@implementation HomeViewController
|
|
@@ -193,7 +172,7 @@
|
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view.
|
|
|
self.ks_prefersNavigationBarHidden = YES;
|
|
|
- _titles = @[@"老师风采",@"热门资讯"];
|
|
|
+ _titles = @[@""];
|
|
|
self.isFirstLoad = YES;
|
|
|
[self configNavView];
|
|
|
[self configUI];
|
|
@@ -261,48 +240,12 @@
|
|
|
}];
|
|
|
self.courseView.hidden = YES;
|
|
|
|
|
|
- // 热门专辑
|
|
|
- [self.headView addSubview:self.albumView];
|
|
|
- self.albumViewHeight = [HomeHotAlbumView getViewHeight];
|
|
|
- [self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.courseView.mas_bottom).offset(20);
|
|
|
- make.height.mas_equalTo(self.albumViewHeight);
|
|
|
- }];
|
|
|
-
|
|
|
- // 推荐曲目
|
|
|
- [self.headView addSubview:self.recommendMusicView];
|
|
|
- self.recommendMusicViewHeight = [HomeRecommendMusicView getViewHeight];
|
|
|
- [self.recommendMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.albumView.mas_bottom).offset(20);
|
|
|
- make.height.mas_equalTo(self.recommendMusicViewHeight);
|
|
|
- }];
|
|
|
-
|
|
|
- // 最新曲目
|
|
|
- [self.headView addSubview:self.newestMusicView];
|
|
|
- self.newestMusicViewHeight = [HomeNewMusicView getViewHeight];
|
|
|
- [self.newestMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.recommendMusicView.mas_bottom).offset(20);
|
|
|
- make.height.mas_equalTo(self.newestMusicViewHeight);
|
|
|
- }];
|
|
|
-
|
|
|
- // 热门曲目
|
|
|
- [self.headView addSubview:self.hotMusicView];
|
|
|
- self.musicViewHeight = [HomeHotMusicView getViewHeight];
|
|
|
- [self.hotMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.newestMusicView.mas_bottom).offset(20);
|
|
|
- make.height.mas_equalTo(self.musicViewHeight);
|
|
|
- }];
|
|
|
-
|
|
|
// 推荐老师
|
|
|
[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.hotMusicView.mas_bottom);
|
|
|
+ make.top.mas_equalTo(self.courseView.mas_bottom);
|
|
|
make.height.mas_equalTo(self.talentViewHeight);
|
|
|
}];
|
|
|
self.talentView.hidden = YES;
|
|
@@ -340,15 +283,16 @@
|
|
|
}
|
|
|
|
|
|
- (void)refreshHeadHeight {
|
|
|
- CGFloat bottomSpace = 20.0f;
|
|
|
- self.headViewHeight = self.bannerViewHeight + self.buttonViewHeight + self.noticeViewHeight + self.courseViewHeight + self.albumViewHeight + self.recommendMusicViewHeight + self.newestMusicViewHeight + self.musicViewHeight + self.talentViewHeight + self.liveViewHeight + self.videoViewHeight + bottomSpace;
|
|
|
+// CGFloat bottomSpace = 20.0f;
|
|
|
+ CGFloat bottomSpace = 0.0f;
|
|
|
+ self.headViewHeight = self.bannerViewHeight + self.buttonViewHeight + self.noticeViewHeight + self.courseViewHeight + self.talentViewHeight + self.liveViewHeight + self.videoViewHeight + bottomSpace;
|
|
|
[self.pagerView reloadData];
|
|
|
}
|
|
|
|
|
|
- (void)configUI {
|
|
|
[self configHeadView];
|
|
|
-
|
|
|
- _categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, kNaviBarHeight, KPortraitWidth, 44)];
|
|
|
+ self.headheight = CGFLOAT_MIN;
|
|
|
+ _categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, kNaviBarHeight, KPortraitWidth, self.headheight)];
|
|
|
self.categoryView.backgroundColor = [UIColor clearColor];
|
|
|
self.categoryView.titles = self.titles;
|
|
|
self.categoryView.delegate = self;
|
|
@@ -360,12 +304,6 @@
|
|
|
self.categoryView.cellWidth = 90.0f;
|
|
|
self.categoryView.cellSpacing = 16.0f;
|
|
|
self.categoryView.averageCellSpacingEnabled = NO;
|
|
|
- JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
|
|
|
- lineView.verticalMargin = 10;
|
|
|
- lineView.indicatorColor = THEMECOLOR;
|
|
|
- lineView.indicatorWidth = 63.0f;
|
|
|
- lineView.indicatorHeight = 12.0f;
|
|
|
- self.categoryView.indicators = @[lineView];
|
|
|
|
|
|
_pagerView = [self preferredPagingView];
|
|
|
self.pagerView.frame = CGRectMake(0, kNaviBarHeight, KPortraitWidth, KPortraitHeight - kNaviBarHeight - kTabBarHeight);
|
|
@@ -590,27 +528,6 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)requestHotAlbum {
|
|
|
- dispatch_group_enter(self.requestGroup);
|
|
|
- [KSNetworkingManager HomeHotAlbumRequest:KS_POST page:1 rows:10 version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
|
|
|
- dispatch_group_leave(self.requestGroup);
|
|
|
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
|
|
|
- NSArray *sourceArray = [[dic ks_dictionaryValueForKey:@"data"] ks_arrayValueForKey:@"rows"];
|
|
|
- NSMutableArray *albumArray = [NSMutableArray array];
|
|
|
- for (NSDictionary *parm in sourceArray) {
|
|
|
- HomeAlbumModel *model = [[HomeAlbumModel alloc] initWithDictionary:parm];
|
|
|
- [albumArray addObject:model];
|
|
|
- }
|
|
|
- self.albumArray = [NSMutableArray arrayWithArray:albumArray];
|
|
|
- }
|
|
|
- else {
|
|
|
- [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
|
|
|
- }
|
|
|
-
|
|
|
- } faliure:^(NSError * _Nonnull error) {
|
|
|
- dispatch_group_leave(self.requestGroup);
|
|
|
- }];
|
|
|
-}
|
|
|
|
|
|
- (void)requestCourseInfo {
|
|
|
|
|
@@ -679,44 +596,6 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
-- (void)requestHomeMusicMessage {
|
|
|
- dispatch_group_enter(self.requestGroup);
|
|
|
- [KSNetworkingManager homeAppMusicSheetRequest:KS_POST version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
|
|
|
- dispatch_group_leave(self.requestGroup);
|
|
|
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
|
|
|
- NSDictionary *result = [dic ks_dictionaryValueForKey:@"data"];
|
|
|
- NSArray *hotMusicSheet = [result ks_arrayValueForKey:@"hotMusicSheet"]; // 最热曲目
|
|
|
- NSMutableArray *hotArray = [NSMutableArray array];
|
|
|
- for (NSDictionary *parm in hotMusicSheet) {
|
|
|
- HomeMusicModel *model = [[HomeMusicModel alloc] initWithDictionary:parm];
|
|
|
- [hotArray addObject:model];
|
|
|
- }
|
|
|
- self.musicArray = [NSMutableArray arrayWithArray:hotArray];
|
|
|
-
|
|
|
- NSArray *newMusicSheet = [result ks_arrayValueForKey:@"newMusicSheet"]; // 最新曲目
|
|
|
- NSMutableArray *newMusicArray = [NSMutableArray array];
|
|
|
- for (NSDictionary *parm in newMusicSheet) {
|
|
|
- HomeMusicModel *model = [[HomeMusicModel alloc] initWithDictionary:parm];
|
|
|
- [newMusicArray addObject:model];
|
|
|
- }
|
|
|
- self.newestMusicArray = [NSMutableArray arrayWithArray:newMusicArray];
|
|
|
-
|
|
|
- NSArray *topMusicSheet = [result ks_arrayValueForKey:@"topMusicSheet"]; // 推荐曲目
|
|
|
- NSMutableArray *topMusicArray = [NSMutableArray array];
|
|
|
- for (NSDictionary *parm in topMusicSheet) {
|
|
|
- HomeMusicModel *model = [[HomeMusicModel alloc] initWithDictionary:parm];
|
|
|
- [topMusicArray addObject:model];
|
|
|
- }
|
|
|
- self.recommendMusicArray = [NSMutableArray arrayWithArray:topMusicArray];
|
|
|
- }
|
|
|
- else {
|
|
|
- [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
|
|
|
- }
|
|
|
- } faliure:^(NSError * _Nonnull error) {
|
|
|
- dispatch_group_leave(self.requestGroup);
|
|
|
- }];
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
- (void)requestTalentSource {
|
|
|
dispatch_group_enter(self.requestGroup);
|
|
@@ -811,8 +690,6 @@
|
|
|
[self requestCourseInfo];
|
|
|
// 老师
|
|
|
[self requestTalentSource];
|
|
|
- [self requestHotAlbum];
|
|
|
- [self requestHomeMusicMessage];
|
|
|
[self requestTeacherStyle];
|
|
|
[self requestLiveList];
|
|
|
[self requestInformationList];
|
|
@@ -832,10 +709,6 @@
|
|
|
[self showButtonMessage];
|
|
|
[self refreshNotice];
|
|
|
[self refreshCourseView:self.recentCourseModel];
|
|
|
-
|
|
|
- [self refreshAlbumView];
|
|
|
-
|
|
|
- [self refreshMusicView];
|
|
|
// 老师
|
|
|
[self refreshTalentView];
|
|
|
// 课程
|
|
@@ -1124,64 +997,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-- (void)refreshAlbumView {
|
|
|
- if (self.albumArray.count) {
|
|
|
- self.albumViewHeight = [HomeHotAlbumView getViewHeight];
|
|
|
- self.albumView.hidden = NO;
|
|
|
- }
|
|
|
- else {
|
|
|
- self.albumViewHeight = CGFLOAT_MIN;
|
|
|
- self.albumView.hidden = YES;
|
|
|
- }
|
|
|
- [self.albumView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(self.albumViewHeight);
|
|
|
- }];
|
|
|
- [self.albumCollectionView reloadData];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)refreshMusicView {
|
|
|
- if (self.recommendMusicArray.count) {
|
|
|
- self.recommendMusicViewHeight = [HomeHotMusicView getViewHeight];
|
|
|
- self.recommendMusicView.hidden = NO;
|
|
|
- }
|
|
|
- else {
|
|
|
- self.recommendMusicViewHeight = CGFLOAT_MIN;
|
|
|
- self.recommendMusicView.hidden = YES;
|
|
|
- }
|
|
|
-
|
|
|
- [self.recommendMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(self.recommendMusicViewHeight);
|
|
|
- }];
|
|
|
- [self.recommendMusicCollectionView reloadData];
|
|
|
-
|
|
|
- if (self.newestMusicArray.count) {
|
|
|
- self.newestMusicViewHeight = [HomeHotMusicView getViewHeight];
|
|
|
- self.newestMusicView.hidden = NO;
|
|
|
- }
|
|
|
- else {
|
|
|
- self.newestMusicViewHeight = CGFLOAT_MIN;
|
|
|
- self.newestMusicView.hidden = YES;
|
|
|
- }
|
|
|
-
|
|
|
- [self.newestMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(self.newestMusicViewHeight);
|
|
|
- }];
|
|
|
- [self.newestMusicCollectionView reloadData];
|
|
|
-
|
|
|
- if (self.musicArray.count) {
|
|
|
- self.musicViewHeight = [HomeHotMusicView getViewHeight];
|
|
|
- self.hotMusicView.hidden = NO;
|
|
|
- }
|
|
|
- else {
|
|
|
- self.musicViewHeight = CGFLOAT_MIN;
|
|
|
- self.hotMusicView.hidden = YES;
|
|
|
- }
|
|
|
- [self.hotMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(self.musicViewHeight);
|
|
|
- }];
|
|
|
- [self.musicCollectionView reloadData];
|
|
|
-}
|
|
|
-
|
|
|
- (void)refreshCourseView {
|
|
|
// 课程
|
|
|
if (self.liveCourseArray.count) {
|
|
@@ -1226,7 +1041,7 @@
|
|
|
}
|
|
|
|
|
|
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
|
|
- return 44;
|
|
|
+ return self.headheight;
|
|
|
}
|
|
|
|
|
|
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
|
@@ -1235,27 +1050,15 @@
|
|
|
}
|
|
|
|
|
|
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
|
|
|
- if (index == 0) {
|
|
|
- HomePageBodyView *listView = [[HomePageBodyView alloc] init];
|
|
|
- listView.naviController = self.navigationController;
|
|
|
- [self.listViewArray replaceObjectAtIndex:index withObject:listView];
|
|
|
- self.listViewArray[index] = listView;
|
|
|
- listView.selectIndex = index;
|
|
|
- listView.styleArray = [self.teacherArray mutableCopy];
|
|
|
- listView.liveArray = [self.liveListArray mutableCopy];
|
|
|
- [listView beginFirstRefresh];
|
|
|
- return listView;
|
|
|
- }
|
|
|
- else {
|
|
|
- HomeInformationBodyView *listView = [[HomeInformationBodyView alloc] init];
|
|
|
- listView.naviController = self.navigationController;
|
|
|
- [self.listViewArray replaceObjectAtIndex:index withObject:listView];
|
|
|
- self.listViewArray[index] = listView;
|
|
|
- listView.selectIndex = index;
|
|
|
- listView.informationArray = [self.informationArray mutableCopy];
|
|
|
- [listView beginFirstRefresh];
|
|
|
- return listView;
|
|
|
- }
|
|
|
+
|
|
|
+ HomeInformationBodyView *listView = [[HomeInformationBodyView alloc] init];
|
|
|
+ listView.naviController = self.navigationController;
|
|
|
+ [self.listViewArray replaceObjectAtIndex:index withObject:listView];
|
|
|
+ self.listViewArray[index] = listView;
|
|
|
+ listView.selectIndex = index;
|
|
|
+ listView.informationArray = [self.informationArray mutableCopy];
|
|
|
+ [listView beginFirstRefresh];
|
|
|
+ return listView;
|
|
|
}
|
|
|
|
|
|
#pragma mark - JXCategoryViewDelegate
|
|
@@ -1351,25 +1154,7 @@
|
|
|
}
|
|
|
|
|
|
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
|
|
- if (collectionView == self.albumCollectionView) { // 专辑
|
|
|
- return self.albumArray.count;
|
|
|
- }
|
|
|
- else if (collectionView == self.recommendMusicCollectionView) {
|
|
|
- NSInteger lastRowCount = (self.recommendMusicArray.count % 4) > 0 ? 1 : 0;
|
|
|
- NSInteger count = self.recommendMusicArray.count / 4 + lastRowCount;
|
|
|
- return count;
|
|
|
- }
|
|
|
- else if (collectionView == self.newestMusicCollectionView) {
|
|
|
- NSInteger lastRowCount = (self.newestMusicArray.count % 4) > 0 ? 1 : 0;
|
|
|
- NSInteger count = self.newestMusicArray.count / 4 + lastRowCount;
|
|
|
- return count;
|
|
|
- }
|
|
|
- else if (collectionView == self.musicCollectionView) { // 乐谱
|
|
|
- NSInteger lastRowCount = (self.musicArray.count % 4) > 0 ? 1 : 0;
|
|
|
- NSInteger count = self.musicArray.count / 4 + lastRowCount;
|
|
|
- return count;
|
|
|
- }
|
|
|
- else if (collectionView == self.talentCollectionView) { // 推荐老师
|
|
|
+ if (collectionView == self.talentCollectionView) { // 推荐老师
|
|
|
return self.talentArray.count;
|
|
|
}
|
|
|
else if (collectionView == self.videoCollectionView) { // 视频课
|
|
@@ -1382,52 +1167,7 @@
|
|
|
|
|
|
|
|
|
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
- if (collectionView == self.albumCollectionView) {
|
|
|
- HomeAlbumModel *model = self.albumArray[indexPath.item];
|
|
|
- HomeHotAlbumCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotAlbumCell" forIndexPath:indexPath];
|
|
|
- [cell configWithAlbumModel:model];
|
|
|
- return cell;
|
|
|
- }
|
|
|
- else if (collectionView == self.recommendMusicCollectionView) {
|
|
|
- NSMutableArray *songArray = [NSMutableArray array];
|
|
|
- NSInteger length = indexPath.item * 4 + 4 > self.recommendMusicArray.count ? self.recommendMusicArray.count - indexPath.item * 4: 4;
|
|
|
- NSRange range = NSMakeRange(indexPath.item * 4, length);
|
|
|
-
|
|
|
- songArray = [NSMutableArray arrayWithArray:[self.recommendMusicArray subarrayWithRange:range]];
|
|
|
- HomeHotMusicCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotMusicCollectionCell" forIndexPath:indexPath];
|
|
|
- MJWeakSelf;
|
|
|
- [cell configWithSourceArray:songArray callback:^(NSString * _Nonnull songId) {
|
|
|
- [weakSelf displaySongDetail:songId];
|
|
|
- }];
|
|
|
- return cell;
|
|
|
- }
|
|
|
- else if (collectionView == self.newestMusicCollectionView) {
|
|
|
- NSMutableArray *songArray = [NSMutableArray array];
|
|
|
- NSInteger length = indexPath.item * 4 + 4 > self.newestMusicArray.count ? self.newestMusicArray.count - indexPath.item * 4: 4;
|
|
|
- NSRange range = NSMakeRange(indexPath.item * 4, length);
|
|
|
-
|
|
|
- songArray = [NSMutableArray arrayWithArray:[self.newestMusicArray subarrayWithRange:range]];
|
|
|
- HomeHotMusicCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotMusicCollectionCell" forIndexPath:indexPath];
|
|
|
- MJWeakSelf;
|
|
|
- [cell configWithSourceArray:songArray callback:^(NSString * _Nonnull songId) {
|
|
|
- [weakSelf displaySongDetail:songId];
|
|
|
- }];
|
|
|
- return cell;
|
|
|
- }
|
|
|
- else if (collectionView == self.musicCollectionView) {
|
|
|
- NSMutableArray *songArray = [NSMutableArray array];
|
|
|
- NSInteger length = indexPath.item * 4 + 4 > self.musicArray.count ? self.musicArray.count - indexPath.item * 4: 4;
|
|
|
- NSRange range = NSMakeRange(indexPath.item * 4, length);
|
|
|
-
|
|
|
- songArray = [NSMutableArray arrayWithArray:[self.musicArray subarrayWithRange:range]];
|
|
|
- HomeHotMusicCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotMusicCollectionCell" forIndexPath:indexPath];
|
|
|
- MJWeakSelf;
|
|
|
- [cell configWithSourceArray:songArray callback:^(NSString * _Nonnull songId) {
|
|
|
- [weakSelf displaySongDetail:songId];
|
|
|
- }];
|
|
|
- return cell;
|
|
|
- }
|
|
|
- else if (collectionView == self.talentCollectionView) {
|
|
|
+ if (collectionView == self.talentCollectionView) {
|
|
|
TalentTeacherModel *talentModel = self.talentArray[indexPath.item];
|
|
|
HomeHotTalentCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotTalentCell" forIndexPath:indexPath];
|
|
|
MJWeakSelf;
|
|
@@ -1489,13 +1229,7 @@
|
|
|
}
|
|
|
|
|
|
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
- if (collectionView == self.albumCollectionView) { // 专辑详情
|
|
|
- HomeAlbumModel *model = self.albumArray[indexPath.item];
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/music-album-detail/",model.internalBaseClassIdentifier];
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
- }
|
|
|
- else if (collectionView == self.talentCollectionView) { // 老师风采
|
|
|
+ if (collectionView == self.talentCollectionView) { // 老师风采
|
|
|
TalentTeacherModel *model = self.talentArray[indexPath.item];
|
|
|
[self displayTeacherDetail:[NSString stringWithFormat:@"%.0f",model.userId]];
|
|
|
}
|
|
@@ -1523,19 +1257,7 @@
|
|
|
}
|
|
|
|
|
|
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
- if (collectionView == self.albumCollectionView) {
|
|
|
- return CGSizeMake(100, 134);
|
|
|
- }
|
|
|
- else if (collectionView == self.recommendMusicCollectionView) {
|
|
|
- return CGSizeMake(COLLECTION_WIDTH, COLLECTION_HEIGHT);
|
|
|
- }
|
|
|
- else if (collectionView == self.newestMusicCollectionView) {
|
|
|
- return CGSizeMake(COLLECTION_WIDTH, COLLECTION_HEIGHT);
|
|
|
- }
|
|
|
- else if (collectionView == self.musicCollectionView) {
|
|
|
- return CGSizeMake(COLLECTION_WIDTH, COLLECTION_HEIGHT);
|
|
|
- }
|
|
|
- else if (collectionView == self.talentCollectionView) {
|
|
|
+ if (collectionView == self.talentCollectionView) {
|
|
|
if (IS_IPAD) {
|
|
|
return CGSizeMake(134, 178);
|
|
|
}
|
|
@@ -1814,213 +1536,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#pragma mark ----- 专辑
|
|
|
-- (HomeHotAlbumView *)albumView {
|
|
|
- if (!_albumView) {
|
|
|
- _albumView = [HomeHotAlbumView shareInstance];
|
|
|
- MJWeakSelf;
|
|
|
- [_albumView homeAlbumMore:^{
|
|
|
- [weakSelf moreAlbumDetail];
|
|
|
- }];
|
|
|
- [_albumView.albumContentView addSubview:self.albumCollectionView];
|
|
|
- [self.albumCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.bottom.top.mas_equalTo(_albumView.albumContentView);
|
|
|
- }];
|
|
|
- }
|
|
|
- return _albumView;
|
|
|
-}
|
|
|
-
|
|
|
-- (UICollectionView *)albumCollectionView {
|
|
|
- if (!_albumCollectionView) {
|
|
|
- UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
|
|
- layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
|
|
|
- layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
|
|
- _albumCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
|
- _albumCollectionView.backgroundColor = [UIColor clearColor];
|
|
|
- _albumCollectionView.delegate = self;
|
|
|
- _albumCollectionView.dataSource = self;
|
|
|
- _albumCollectionView.showsVerticalScrollIndicator = NO;
|
|
|
- _albumCollectionView.showsHorizontalScrollIndicator = NO;
|
|
|
- if (@available(iOS 11.0, *)) {
|
|
|
- _albumCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- if (@available(iOS 13.0, *)) {
|
|
|
- _albumCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- }
|
|
|
- }
|
|
|
- [_albumCollectionView registerNib:[UINib nibWithNibName:@"HomeHotAlbumCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotAlbumCell"];
|
|
|
- }
|
|
|
- return _albumCollectionView;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)moreAlbumDetail {
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-album"];
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark --- 推荐曲目
|
|
|
-- (HomeRecommendMusicView *)recommendMusicView {
|
|
|
- if (!_recommendMusicView) {
|
|
|
- _recommendMusicView = [HomeRecommendMusicView shareInstance];
|
|
|
- MJWeakSelf;
|
|
|
- [_recommendMusicView homeMusicMore:^{
|
|
|
- [weakSelf moreRecommendMusic];
|
|
|
- }];
|
|
|
- [_recommendMusicView.musicContentView addSubview:self.recommendMusicCollectionView];
|
|
|
- [self.recommendMusicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.bottom.top.mas_equalTo(_recommendMusicView.musicContentView);
|
|
|
- }];
|
|
|
- }
|
|
|
- return _recommendMusicView;
|
|
|
-}
|
|
|
-
|
|
|
-- (UICollectionView *)recommendMusicCollectionView {
|
|
|
- if (!_recommendMusicCollectionView) {
|
|
|
- HomeMusicSheetLayout *layout = [[HomeMusicSheetLayout alloc] initWithSectionInset:UIEdgeInsetsMake(0, 11, 0, KPortraitWidth - COLLECTION_WIDTH) andMiniLineSapce:10 andMiniInterItemSpace:10 andItemSize:CGSizeMake(COLLECTION_WIDTH, COLLECTION_HEIGHT)];
|
|
|
-
|
|
|
- _recommendMusicCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
|
- _recommendMusicCollectionView.backgroundColor = [UIColor clearColor];
|
|
|
- _recommendMusicCollectionView.delegate = self;
|
|
|
- _recommendMusicCollectionView.dataSource = self;
|
|
|
- _recommendMusicCollectionView.showsVerticalScrollIndicator = NO;
|
|
|
- _recommendMusicCollectionView.showsHorizontalScrollIndicator = NO;
|
|
|
- if (@available(iOS 11.0, *)) {
|
|
|
- _recommendMusicCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- if (@available(iOS 13.0, *)) {
|
|
|
- _recommendMusicCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- }
|
|
|
- }
|
|
|
- [_recommendMusicCollectionView registerNib:[UINib nibWithNibName:@"HomeHotMusicCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotMusicCollectionCell"];
|
|
|
- }
|
|
|
- return _recommendMusicCollectionView;
|
|
|
-}
|
|
|
-
|
|
|
-- (NSMutableArray *)recommendMusicArray {
|
|
|
- if (!_recommendMusicArray) {
|
|
|
- _recommendMusicArray = [NSMutableArray array];
|
|
|
- }
|
|
|
- return _recommendMusicArray;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)moreRecommendMusic {
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-list"];
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark ---- 最新曲目
|
|
|
-- (HomeNewMusicView *)newestMusicView {
|
|
|
- if (!_newestMusicView) {
|
|
|
- if (!_newestMusicView) {
|
|
|
- _newestMusicView = [HomeNewMusicView shareInstance];
|
|
|
- MJWeakSelf;
|
|
|
- [_newestMusicView homeMusicMore:^{
|
|
|
- [weakSelf moreNewMusic];
|
|
|
- }];
|
|
|
- [_newestMusicView.musicContentView addSubview:self.newestMusicCollectionView];
|
|
|
- [self.newestMusicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.bottom.top.mas_equalTo(_newestMusicView.musicContentView);
|
|
|
- }];
|
|
|
- }
|
|
|
- return _newestMusicView;
|
|
|
- }
|
|
|
- return _newestMusicView;
|
|
|
-}
|
|
|
-
|
|
|
-- (UICollectionView *)newestMusicCollectionView {
|
|
|
- if (!_newestMusicCollectionView) {
|
|
|
- HomeMusicSheetLayout *layout = [[HomeMusicSheetLayout alloc] initWithSectionInset:UIEdgeInsetsMake(0, 11, 0, KPortraitWidth - COLLECTION_WIDTH) andMiniLineSapce:10 andMiniInterItemSpace:10 andItemSize:CGSizeMake(COLLECTION_WIDTH, COLLECTION_HEIGHT)];
|
|
|
-
|
|
|
- _newestMusicCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
|
- _newestMusicCollectionView.backgroundColor = [UIColor clearColor];
|
|
|
- _newestMusicCollectionView.delegate = self;
|
|
|
- _newestMusicCollectionView.dataSource = self;
|
|
|
- _newestMusicCollectionView.showsVerticalScrollIndicator = NO;
|
|
|
- _newestMusicCollectionView.showsHorizontalScrollIndicator = NO;
|
|
|
- if (@available(iOS 11.0, *)) {
|
|
|
- _newestMusicCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- if (@available(iOS 13.0, *)) {
|
|
|
- _newestMusicCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- }
|
|
|
- }
|
|
|
- [_newestMusicCollectionView registerNib:[UINib nibWithNibName:@"HomeHotMusicCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotMusicCollectionCell"];
|
|
|
- }
|
|
|
- return _newestMusicCollectionView;
|
|
|
-}
|
|
|
-
|
|
|
-- (NSMutableArray *)newestMusicArray {
|
|
|
- if (!_newestMusicArray) {
|
|
|
- _newestMusicArray = [NSMutableArray array];
|
|
|
- }
|
|
|
- return _newestMusicArray;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)moreNewMusic {
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-list"];
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark ---- 热门曲目
|
|
|
-- (HomeHotMusicView *)hotMusicView {
|
|
|
- if (!_hotMusicView) {
|
|
|
- _hotMusicView = [HomeHotMusicView shareInstance];
|
|
|
- MJWeakSelf;
|
|
|
- [_hotMusicView homeMusicMore:^{
|
|
|
- [weakSelf moreHotMusic];
|
|
|
- }];
|
|
|
- [_hotMusicView.musicContentView addSubview:self.musicCollectionView];
|
|
|
- [self.musicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.bottom.top.mas_equalTo(_hotMusicView.musicContentView);
|
|
|
- }];
|
|
|
- }
|
|
|
- return _hotMusicView;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-- (void)moreHotMusic {
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-list"];
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
-- (UICollectionView *)musicCollectionView {
|
|
|
- if (!_musicCollectionView) {
|
|
|
- HomeMusicSheetLayout *layout = [[HomeMusicSheetLayout alloc] initWithSectionInset:UIEdgeInsetsMake(0, 11, 0, KPortraitWidth - COLLECTION_WIDTH) andMiniLineSapce:10 andMiniInterItemSpace:10 andItemSize:CGSizeMake(COLLECTION_WIDTH, COLLECTION_HEIGHT)];
|
|
|
-
|
|
|
- _musicCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
|
- _musicCollectionView.backgroundColor = [UIColor clearColor];
|
|
|
- _musicCollectionView.delegate = self;
|
|
|
- _musicCollectionView.dataSource = self;
|
|
|
- _musicCollectionView.showsVerticalScrollIndicator = NO;
|
|
|
- _musicCollectionView.showsHorizontalScrollIndicator = NO;
|
|
|
- if (@available(iOS 11.0, *)) {
|
|
|
- _musicCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- if (@available(iOS 13.0, *)) {
|
|
|
- _musicCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- }
|
|
|
- }
|
|
|
- [_musicCollectionView registerNib:[UINib nibWithNibName:@"HomeHotMusicCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotMusicCollectionCell"];
|
|
|
- }
|
|
|
- return _musicCollectionView;
|
|
|
-}
|
|
|
-
|
|
|
#pragma mark ---- talent view
|
|
|
- (HomeHotTalentView *)talentView {
|
|
|
if (!_talentView) {
|