|
@@ -38,8 +38,6 @@
|
|
|
#import "HomeAlbumModel.h"
|
|
|
#import "HomeHotAlbumCell.h"
|
|
|
|
|
|
-#import "HomeQualityMusic.h"
|
|
|
-#import "HomeQualityMusicCollectionCell.h"
|
|
|
|
|
|
#import "HomeHotMusicView.h"
|
|
|
#import "HomeHotMusicCollectionCell.h"
|
|
@@ -113,11 +111,6 @@
|
|
|
@property (nonatomic, strong) UICollectionView *albumCollectionView; // 专辑容器
|
|
|
@property (nonatomic, assign) CGFloat albumViewHeight; // album 高度
|
|
|
|
|
|
-// 精品曲谱
|
|
|
-@property (nonatomic, strong) HomeQualityMusic *qualityMusicView;
|
|
|
-@property (nonatomic, strong) UICollectionView *qualityMusicCollectionView; // 精品曲谱容器
|
|
|
-@property (nonatomic, strong) NSMutableArray *qualityMusicArray; // 精品曲谱数据
|
|
|
-@property (nonatomic, assign) CGFloat qualityMusicViewHeight; // 精品music高度
|
|
|
|
|
|
// 热门曲谱
|
|
|
@property (nonatomic, strong) HomeHotMusicView *hotMusicView;
|
|
@@ -246,21 +239,12 @@
|
|
|
make.height.mas_equalTo(self.albumViewHeight);
|
|
|
}];
|
|
|
|
|
|
- // 精品曲谱
|
|
|
- [self.headView addSubview:self.qualityMusicView];
|
|
|
- self.qualityMusicViewHeight = [HomeQualityMusic getViewHeight];
|
|
|
- [self.qualityMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.headView);
|
|
|
- make.top.mas_equalTo(self.albumView.mas_bottom);
|
|
|
- make.height.mas_equalTo(self.self.qualityMusicViewHeight);
|
|
|
- }];
|
|
|
-
|
|
|
// 热门曲目
|
|
|
[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.qualityMusicView.mas_bottom);
|
|
|
+ make.top.mas_equalTo(self.albumView.mas_bottom);
|
|
|
make.height.mas_equalTo(self.musicViewHeight);
|
|
|
}];
|
|
|
|
|
@@ -308,7 +292,7 @@
|
|
|
|
|
|
- (void)refreshHeadHeight {
|
|
|
CGFloat bottomSpace = 20.0f;
|
|
|
- self.headViewHeight = self.bannerViewHeight + self.buttonViewHeight + self.noticeViewHeight + self.courseViewHeight + self.albumViewHeight + self.qualityMusicViewHeight + self.musicViewHeight + self.talentViewHeight + self.liveViewHeight + self.videoViewHeight + bottomSpace;
|
|
|
+ self.headViewHeight = self.bannerViewHeight + self.buttonViewHeight + self.noticeViewHeight + self.courseViewHeight + self.albumViewHeight + self.musicViewHeight + self.talentViewHeight + self.liveViewHeight + self.videoViewHeight + bottomSpace;
|
|
|
[self.pagerView reloadData];
|
|
|
}
|
|
|
|
|
@@ -576,31 +560,12 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)requestQualityMusic {
|
|
|
- [KSNetworkingManager homeQualityMusicListRequest:KS_POST version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
|
|
|
- dispatch_group_leave(self.requestGroup);
|
|
|
- if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
|
|
|
- NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
|
|
|
- NSMutableArray *musicArray = [NSMutableArray array];
|
|
|
- for (NSDictionary *parm in sourceArray) {
|
|
|
- HomeHotMusicModel *model = [[HomeHotMusicModel alloc] initWithDictionary:parm];
|
|
|
- [musicArray addObject:model];
|
|
|
- }
|
|
|
- self.qualityMusicArray = [NSMutableArray arrayWithArray:musicArray];
|
|
|
- }
|
|
|
- else {
|
|
|
- [self MBPShow:MESSAGEKEY];
|
|
|
- }
|
|
|
- } faliure:^(NSError * _Nonnull error) {
|
|
|
- dispatch_group_leave(self.requestGroup);
|
|
|
- }];
|
|
|
-}
|
|
|
|
|
|
|
|
|
- (void)requestHotMusic {
|
|
|
dispatch_group_enter(self.requestGroup);
|
|
|
[KSNetworkingManager homeMusicListRequest:KS_POST version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
|
|
|
-
|
|
|
+ dispatch_group_leave(self.requestGroup);
|
|
|
if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
|
|
|
NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
|
|
|
NSMutableArray *musicArray = [NSMutableArray array];
|
|
@@ -613,9 +578,8 @@
|
|
|
else {
|
|
|
[self MBPShow:MESSAGEKEY];
|
|
|
}
|
|
|
- [self requestQualityMusic];
|
|
|
} faliure:^(NSError * _Nonnull error) {
|
|
|
- [self requestQualityMusic];
|
|
|
+ dispatch_group_leave(self.requestGroup);
|
|
|
}];
|
|
|
}
|
|
|
|
|
@@ -733,9 +697,7 @@
|
|
|
[self refreshCourseView:self.recentCourseModel];
|
|
|
|
|
|
[self refreshAlbumView];
|
|
|
-
|
|
|
- [self refreshQualityView];
|
|
|
-
|
|
|
+
|
|
|
[self refreshMusicView];
|
|
|
// 达人
|
|
|
[self refreshTalentView];
|
|
@@ -998,20 +960,6 @@
|
|
|
[self.albumCollectionView reloadData];
|
|
|
}
|
|
|
|
|
|
-- (void)refreshQualityView {
|
|
|
- if (self.qualityMusicArray.count) {
|
|
|
- self.qualityMusicViewHeight = [HomeQualityMusic getViewHeight];
|
|
|
- self.qualityMusicView.hidden = NO;
|
|
|
- }
|
|
|
- else {
|
|
|
- self.qualityMusicViewHeight = CGFLOAT_MIN;
|
|
|
- self.qualityMusicView.hidden = YES;
|
|
|
- }
|
|
|
- [self.qualityMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(self.qualityMusicViewHeight);
|
|
|
- }];
|
|
|
- [self.qualityMusicCollectionView reloadData];
|
|
|
-}
|
|
|
|
|
|
|
|
|
- (void)refreshMusicView {
|
|
@@ -1196,11 +1144,6 @@
|
|
|
if (collectionView == self.albumCollectionView) { // 专辑
|
|
|
return self.albumArray.count;
|
|
|
}
|
|
|
- else if (collectionView == self.qualityMusicCollectionView) {
|
|
|
- NSInteger lastRowCount = (self.qualityMusicArray.count % 3) > 0 ? 1 : 0;
|
|
|
- NSInteger count = self.qualityMusicArray.count / 3 + lastRowCount;
|
|
|
- return count;
|
|
|
- }
|
|
|
else if (collectionView == self.musicCollectionView) { // 乐谱
|
|
|
NSInteger lastRowCount = (self.musicArray.count % 3) > 0 ? 1 : 0;
|
|
|
NSInteger count = self.musicArray.count / 3 + lastRowCount;
|
|
@@ -1225,19 +1168,6 @@
|
|
|
[cell configWithAlbumModel:model];
|
|
|
return cell;
|
|
|
}
|
|
|
- else if (collectionView == self.qualityMusicCollectionView) {
|
|
|
- NSMutableArray *songArray = [NSMutableArray array];
|
|
|
- NSInteger length = indexPath.item * 3 + 3 > self.qualityMusicArray.count ? self.qualityMusicArray.count - indexPath.item * 3: 3;
|
|
|
- NSRange range = NSMakeRange(indexPath.item * 3, length);
|
|
|
-
|
|
|
- songArray = [NSMutableArray arrayWithArray:[self.qualityMusicArray subarrayWithRange:range]];
|
|
|
- HomeQualityMusicCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeQualityMusicCollectionCell" 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 * 3 + 3 > self.musicArray.count ? self.musicArray.count - indexPath.item * 3: 3;
|
|
@@ -1373,9 +1303,6 @@
|
|
|
if (collectionView == self.albumCollectionView) {
|
|
|
return CGSizeMake(100, 134);
|
|
|
}
|
|
|
- else if (collectionView == self.qualityMusicCollectionView) {
|
|
|
- return CGSizeMake(KPortraitWidth * 0.83, 240);
|
|
|
- }
|
|
|
else if (collectionView == self.musicCollectionView) {
|
|
|
return CGSizeMake(KPortraitWidth * 0.83, 240);
|
|
|
}
|
|
@@ -1700,47 +1627,6 @@
|
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
|
}
|
|
|
|
|
|
-#pragma mark ---- 精品曲目
|
|
|
-- (HomeQualityMusic *)qualityMusicView {
|
|
|
- if (!_qualityMusicView) {
|
|
|
- _qualityMusicView = [HomeQualityMusic shareInstance];
|
|
|
- MJWeakSelf;
|
|
|
- [_qualityMusicView homeMusicMore:^{
|
|
|
- [weakSelf moreHotMusic:YES];
|
|
|
- }];
|
|
|
- [_qualityMusicView.musicContentView addSubview:self.qualityMusicCollectionView];
|
|
|
- [self.qualityMusicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.bottom.top.mas_equalTo(_qualityMusicView.musicContentView);
|
|
|
- }];
|
|
|
- }
|
|
|
- return _qualityMusicView;
|
|
|
-}
|
|
|
-
|
|
|
-- (UICollectionView *)qualityMusicCollectionView {
|
|
|
- if (!_qualityMusicCollectionView) {
|
|
|
- UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
|
|
- layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
|
|
|
- layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
|
|
- _qualityMusicCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
|
- _qualityMusicCollectionView.backgroundColor = [UIColor clearColor];
|
|
|
- _qualityMusicCollectionView.delegate = self;
|
|
|
- _qualityMusicCollectionView.dataSource = self;
|
|
|
- _qualityMusicCollectionView.showsVerticalScrollIndicator = NO;
|
|
|
- _qualityMusicCollectionView.showsHorizontalScrollIndicator = NO;
|
|
|
- if (@available(iOS 11.0, *)) {
|
|
|
- _qualityMusicCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- if (@available(iOS 13.0, *)) {
|
|
|
- _qualityMusicCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
|
|
|
- } else {
|
|
|
- // Fallback on earlier versions
|
|
|
- }
|
|
|
- }
|
|
|
- [_qualityMusicCollectionView registerNib:[UINib nibWithNibName:@"HomeQualityMusicCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeQualityMusicCollectionCell"];
|
|
|
- }
|
|
|
- return _qualityMusicCollectionView;
|
|
|
-}
|
|
|
|
|
|
#pragma mark ---- 热门曲目
|
|
|
- (HomeHotMusicView *)hotMusicView {
|
|
@@ -1748,7 +1634,7 @@
|
|
|
_hotMusicView = [HomeHotMusicView shareInstance];
|
|
|
MJWeakSelf;
|
|
|
[_hotMusicView homeMusicMore:^{
|
|
|
- [weakSelf moreHotMusic:NO];
|
|
|
+ [weakSelf moreHotMusic];
|
|
|
}];
|
|
|
[_hotMusicView.musicContentView addSubview:self.musicCollectionView];
|
|
|
[self.musicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
@@ -1759,10 +1645,9 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
-- (void)moreHotMusic:(BOOL)isQuality {
|
|
|
- NSString *type = isQuality ? @"?type=fine" : @"?type=list";
|
|
|
+- (void)moreHotMusic {
|
|
|
KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/music-list",type];
|
|
|
+ ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-list"];
|
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
|
}
|
|
|
|