|
@@ -34,12 +34,10 @@
|
|
|
#import "KSHomeButton.h"
|
|
|
#import "HomeNewHeadView.h"
|
|
|
|
|
|
-#import "HomeAlbumView.h"
|
|
|
+#import "HomeNewAlbumView.h"
|
|
|
#import "HomeAlbumModel.h"
|
|
|
#import "HomeHotAlbumCell.h"
|
|
|
|
|
|
-#import "HomeHotMusicView.h"
|
|
|
-#import "HomeHotMusicCollectionCell.h"
|
|
|
|
|
|
#import "HomeBannerView.h"
|
|
|
#import <UIButton+WebCache.h>
|
|
@@ -49,9 +47,6 @@
|
|
|
#import "HomeAuthAlertView.h"
|
|
|
#import "KSAwardAlertView.h"
|
|
|
|
|
|
-#import "HomeNewMusicView.h"
|
|
|
-#import "HomeRecommendMusicView.h"
|
|
|
-#import "HomeMusicModel.h"
|
|
|
|
|
|
#import "HomeDragButton.h"
|
|
|
#import "ToneTuningViewController.h"
|
|
@@ -63,6 +58,9 @@
|
|
|
#import "HomeMusicSheetLayout.h"
|
|
|
#import "MinePageViewController.h"
|
|
|
|
|
|
+#import "HomeMusicPageView.h"
|
|
|
+#import "HomeStatisticsView.h"
|
|
|
+
|
|
|
#define COLLECTION_WIDTH ((NSInteger)(IS_IPAD ? KPortraitWidth * 0.7 : KPortraitWidth * 0.83))
|
|
|
#define COLLECTION_HEIGHT (320)
|
|
|
|
|
@@ -97,7 +95,7 @@
|
|
|
|
|
|
@property (nonatomic, assign) BOOL isFirstLoad;
|
|
|
|
|
|
-@property (nonatomic, strong) HomeAlbumView *albumView;
|
|
|
+@property (nonatomic, strong) HomeNewAlbumView *albumView;
|
|
|
@property (nonatomic, strong) NSMutableArray *albumArray; // 热门专辑
|
|
|
@property (nonatomic, strong) UICollectionView *albumCollectionView; // 专辑容器
|
|
|
@property (nonatomic, assign) CGFloat albumViewHeight; // album 高度
|
|
@@ -106,22 +104,6 @@
|
|
|
|
|
|
@property (nonatomic, strong) RecentCourseModel *recentCourseModel;
|
|
|
|
|
|
-// 热门曲目
|
|
|
-@property (nonatomic, strong) HomeHotMusicView *hotMusicView;
|
|
|
-@property (nonatomic, strong) UICollectionView *musicCollectionView; // 曲谱容器
|
|
|
-@property (nonatomic, assign) CGFloat hotMusicHeight; // music 高度
|
|
|
-
|
|
|
-// 推荐曲目
|
|
|
-@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) HomeAuthAlertView *authAlertView;
|
|
|
|
|
@@ -136,6 +118,14 @@
|
|
|
// 机构名称
|
|
|
@property (nonatomic, strong) HomeTenantView *tenantNameView;
|
|
|
|
|
|
+@property (nonatomic, strong) HomeMusicPageView *musicPageView;
|
|
|
+
|
|
|
+@property (nonatomic, assign) CGFloat musicPageViewHeight;
|
|
|
+
|
|
|
+@property (nonatomic, strong) HomeStatisticsView *statisticsView;
|
|
|
+
|
|
|
+@property (nonatomic, assign) CGFloat statisticsViewHeight;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation HomeViewController
|
|
@@ -259,7 +249,6 @@
|
|
|
[self refreshButtonView];
|
|
|
[self refreshCourseView:self.recentCourseModel];
|
|
|
[self refreshAlbumView];
|
|
|
- [self refreshMusicView];
|
|
|
|
|
|
// 刷新排序
|
|
|
if (self.isCheck) {
|
|
@@ -532,7 +521,7 @@
|
|
|
|
|
|
- (void)refreshAlbumView {
|
|
|
if (self.albumArray.count) {
|
|
|
- self.albumViewHeight = [HomeAlbumView getViewHeight];
|
|
|
+ self.albumViewHeight = [HomeNewAlbumView getViewHeight];
|
|
|
self.albumView.hidden = NO;
|
|
|
}
|
|
|
else {
|
|
@@ -545,91 +534,6 @@
|
|
|
[self.albumCollectionView reloadData];
|
|
|
}
|
|
|
|
|
|
-- (void)requestHomeMusicMessage {
|
|
|
- dispatch_group_enter(self.requestGroup);
|
|
|
- [KSNetworkingManager homeAppMusicSheetRequest:KS_POST version:[USER_MANAGER getCurrentVersion] subjectIds:[NSString stringWithFormat:@"%.0f",self.mineInfo.defaultSubject] 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.dataArray = [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)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.dataArray.count) {
|
|
|
- self.hotMusicHeight = [HomeHotMusicView getViewHeight];
|
|
|
- self.hotMusicView.hidden = NO;
|
|
|
- }
|
|
|
- else {
|
|
|
- self.hotMusicHeight = CGFLOAT_MIN;
|
|
|
- self.hotMusicView.hidden = YES;
|
|
|
- }
|
|
|
- [self.hotMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(self.hotMusicHeight);
|
|
|
- }];
|
|
|
- [self.musicCollectionView reloadData];
|
|
|
-}
|
|
|
-
|
|
|
- (void)configUI {
|
|
|
CGFloat navHeight = [HomeNavView getViewHeight];
|
|
|
[self.view addSubview:self.navView];
|
|
@@ -722,38 +626,33 @@
|
|
|
self.headBgView.layer.cornerRadius = 18.0f;
|
|
|
self.headBgView.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner;
|
|
|
|
|
|
- [self.scrollView addSubview:self.albumView];
|
|
|
- self.albumViewHeight = [HomeAlbumView getViewHeight];
|
|
|
- [self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ // 统计
|
|
|
+ [self.scrollView addSubview:self.statisticsView];
|
|
|
+ self.statisticsViewHeight = CGFLOAT_MIN;
|
|
|
+ [self.statisticsView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.view);
|
|
|
make.top.mas_equalTo(self.headBgView.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.albumViewHeight);
|
|
|
+ make.height.mas_equalTo(self.statisticsViewHeight);
|
|
|
}];
|
|
|
+ self.statisticsView.hidden = YES;
|
|
|
|
|
|
- [self.scrollView addSubview:self.recommendMusicView];
|
|
|
- CGFloat recommendMusicHeadHeight = [HomeRecommendMusicView getViewHeight];
|
|
|
- [self.recommendMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ [self.scrollView addSubview:self.albumView];
|
|
|
+ self.albumViewHeight = [HomeNewAlbumView getViewHeight];
|
|
|
+ [self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.view);
|
|
|
- make.top.mas_equalTo(self.albumView.mas_bottom);
|
|
|
- make.height.mas_equalTo(recommendMusicHeadHeight);
|
|
|
+ make.top.mas_equalTo(self.statisticsView.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.albumViewHeight);
|
|
|
}];
|
|
|
|
|
|
- [self.scrollView addSubview:self.newestMusicView];
|
|
|
- CGFloat newMusicHeight = [HomeNewMusicView getViewHeight];
|
|
|
- [self.newestMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ [self.scrollView addSubview:self.musicPageView];
|
|
|
+ self.musicPageViewHeight = [HomeMusicPageView getViewHeight];
|
|
|
+ [self.musicPageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.view);
|
|
|
- make.top.mas_equalTo(self.recommendMusicView.mas_bottom);
|
|
|
- make.height.mas_equalTo(newMusicHeight);
|
|
|
+ make.top.mas_equalTo(self.albumView.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.musicPageViewHeight);
|
|
|
+ make.bottom.mas_equalTo(self.scrollView.mas_bottom);
|
|
|
}];
|
|
|
|
|
|
- [self.scrollView addSubview:self.hotMusicView];
|
|
|
- CGFloat musicHeadHeight = [HomeHotMusicView getViewHeight];
|
|
|
- [self.hotMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
- make.top.mas_equalTo(self.newestMusicView.mas_bottom);
|
|
|
- make.height.mas_equalTo(musicHeadHeight);
|
|
|
- make.bottom.mas_equalTo(self.scrollView.mas_bottom).offset(-10);
|
|
|
- }];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -769,7 +668,6 @@
|
|
|
[self requestRecentCourse];
|
|
|
[self requestNotice];
|
|
|
[self requestAlbumSource];
|
|
|
- [self requestHomeMusicMessage];
|
|
|
[self requestAwardMessage];
|
|
|
|
|
|
dispatch_group_notify(self.requestGroup, dispatch_get_main_queue(), ^{
|
|
@@ -1161,72 +1059,14 @@
|
|
|
}
|
|
|
|
|
|
- (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 {
|
|
|
- NSInteger lastRowCount = (self.dataArray.count % 4) > 0 ? 1 : 0;
|
|
|
- NSInteger count = self.dataArray.count / 4 + lastRowCount;
|
|
|
- return count;
|
|
|
- }
|
|
|
+ return self.albumArray.count;
|
|
|
}
|
|
|
|
|
|
- (__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 {
|
|
|
- NSMutableArray *songArray = [NSMutableArray array];
|
|
|
- NSInteger length = indexPath.item * 4 + 4 > self.dataArray.count ? self.dataArray.count - indexPath.item * 4: 4;
|
|
|
- NSRange range = NSMakeRange(indexPath.item * 4, length);
|
|
|
-
|
|
|
- songArray = [NSMutableArray arrayWithArray:[self.dataArray subarrayWithRange:range]];
|
|
|
- HomeHotMusicCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotMusicCollectionCell" forIndexPath:indexPath];
|
|
|
- MJWeakSelf;
|
|
|
- [cell configWithSourceArray:songArray callback:^(NSString * _Nonnull songId) {
|
|
|
- [weakSelf displaySongDetail:songId];
|
|
|
- }];
|
|
|
- return cell;
|
|
|
- }
|
|
|
+ HomeAlbumModel *model = self.albumArray[indexPath.item];
|
|
|
+ HomeHotAlbumCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotAlbumCell" forIndexPath:indexPath];
|
|
|
+ [cell configWithAlbumModel:model];
|
|
|
+ return cell;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1251,9 +1091,9 @@
|
|
|
}
|
|
|
|
|
|
#pragma mark ----- 专辑
|
|
|
-- (HomeAlbumView *)albumView {
|
|
|
+- (HomeNewAlbumView *)albumView {
|
|
|
if (!_albumView) {
|
|
|
- _albumView = [HomeAlbumView shareInstance];
|
|
|
+ _albumView = [HomeNewAlbumView sharedInstance];
|
|
|
MJWeakSelf;
|
|
|
[_albumView homeAlbumMore:^{
|
|
|
[weakSelf moreAlbumDetail];
|
|
@@ -1305,169 +1145,6 @@
|
|
|
[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, 14, 0, 14) 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;
|
|
|
- _recommendMusicCollectionView.bounces = 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, 14, 0, 14) 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;
|
|
|
- _newestMusicCollectionView.bounces = 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, 14, 0, 14) 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;
|
|
|
- _musicCollectionView.bounces = 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;
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
- (HomeBannerView *)bannerView {
|
|
|
if (!_bannerView) {
|
|
@@ -1599,6 +1276,71 @@
|
|
|
}
|
|
|
return _tenantNameView;
|
|
|
}
|
|
|
+
|
|
|
+- (HomeMusicPageView *)musicPageView {
|
|
|
+ if (!_musicPageView) {
|
|
|
+ _musicPageView = [HomeMusicPageView sharedInstance];
|
|
|
+ MJWeakSelf;
|
|
|
+ [_musicPageView pageActionCallback:^(HOME_MUSIC_TAG action) {
|
|
|
+ [weakSelf musicPageAction:action];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ return _musicPageView;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)musicPageAction:(HOME_MUSIC_TAG)action {
|
|
|
+ NSString *pageType = @"";
|
|
|
+ switch (action) {
|
|
|
+ case HOME_MUSIC_TAG_RECOMMEND:
|
|
|
+ {
|
|
|
+ pageType = @"?type=TOP";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case HOME_MUSIC_TAG_HOT:
|
|
|
+ {
|
|
|
+ pageType = @"?type=HOT";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case HOME_MUSIC_TAG_NEW:
|
|
|
+ {
|
|
|
+ pageType = @"?type=NEW";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case HOME_MUSIC_TAG_MORE:
|
|
|
+ {
|
|
|
+ pageType = @""; // 全部
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ pageType = @"";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
+ ctrl.url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/music-list", pageType];
|
|
|
+ [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
+}
|
|
|
+
|
|
|
+- (HomeStatisticsView *)statisticsView {
|
|
|
+ if (!_statisticsView) {
|
|
|
+ _statisticsView = [HomeStatisticsView sharedInstance];
|
|
|
+ _statisticsView.naviController = self.navigationController;
|
|
|
+ MJWeakSelf;
|
|
|
+ [_statisticsView configWebViewRefreshCallback:^(CGFloat viewHeight) {
|
|
|
+ [weakSelf refreshStatisticView:viewHeight];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ return _statisticsView;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)refreshStatisticView:(CGFloat)viewHeight {
|
|
|
+ self.statisticsView.hidden = NO;
|
|
|
+ self.statisticsViewHeight = viewHeight;
|
|
|
+ [self.statisticsView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.view);
|
|
|
+ make.top.mas_equalTo(self.headBgView.mas_bottom).offset(12);
|
|
|
+ make.height.mas_equalTo(self.statisticsViewHeight);
|
|
|
+ }];
|
|
|
+}
|
|
|
/*
|
|
|
#pragma mark - Navigation
|
|
|
|