|
@@ -42,9 +42,6 @@
|
|
#import "HomeHotAlbumCell.h"
|
|
#import "HomeHotAlbumCell.h"
|
|
#import "HomeHotMusicModel.h"
|
|
#import "HomeHotMusicModel.h"
|
|
|
|
|
|
-#import "HomeQualityMusic.h"
|
|
|
|
-#import "HomeQualityMusicCollectionCell.h"
|
|
|
|
-
|
|
|
|
#import "KSPremissionAlert.h"
|
|
#import "KSPremissionAlert.h"
|
|
#import "RecordCheckManager.h"
|
|
#import "RecordCheckManager.h"
|
|
#import "KSAccompanyWebViewController.h"
|
|
#import "KSAccompanyWebViewController.h"
|
|
@@ -99,12 +96,6 @@
|
|
@property (nonatomic, strong) UICollectionView *albumCollectionView; // 专辑容器
|
|
@property (nonatomic, strong) UICollectionView *albumCollectionView; // 专辑容器
|
|
@property (nonatomic, assign) CGFloat albumViewHeight; // album 高度
|
|
@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) dispatch_group_t requestGroup;
|
|
@property (nonatomic, strong) dispatch_group_t requestGroup;
|
|
|
|
|
|
@property (nonatomic, strong) RecentCourseModel *recentCourseModel;
|
|
@property (nonatomic, strong) RecentCourseModel *recentCourseModel;
|
|
@@ -223,7 +214,6 @@
|
|
[self refreshNotice];
|
|
[self refreshNotice];
|
|
[self refreshCourseView:self.recentCourseModel];
|
|
[self refreshCourseView:self.recentCourseModel];
|
|
[self refreshAlbumView];
|
|
[self refreshAlbumView];
|
|
- [self refreshQualityView];
|
|
|
|
[self refreshMusicView];
|
|
[self refreshMusicView];
|
|
// 刷新排序
|
|
// 刷新排序
|
|
[self refreshViewLocation];
|
|
[self refreshViewLocation];
|
|
@@ -430,30 +420,11 @@
|
|
[self.albumCollectionView reloadData];
|
|
[self.albumCollectionView reloadData];
|
|
}
|
|
}
|
|
|
|
|
|
-- (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)requestHotMusicList {
|
|
- (void)requestHotMusicList {
|
|
dispatch_group_enter(self.requestGroup);
|
|
dispatch_group_enter(self.requestGroup);
|
|
[KSNetworkingManager homeMusicListRequest:KS_POST version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
|
|
[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"]) {
|
|
if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
|
|
NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
|
|
NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
|
|
NSMutableArray *musicArray = [NSMutableArray array];
|
|
NSMutableArray *musicArray = [NSMutableArray array];
|
|
@@ -466,26 +437,12 @@
|
|
else {
|
|
else {
|
|
[self MBPShow:MESSAGEKEY];
|
|
[self MBPShow:MESSAGEKEY];
|
|
}
|
|
}
|
|
- [self requestQualityMusic];
|
|
|
|
|
|
+
|
|
} faliure:^(NSError * _Nonnull error) {
|
|
} faliure:^(NSError * _Nonnull error) {
|
|
- [self requestQualityMusic];
|
|
|
|
|
|
+ dispatch_group_leave(self.requestGroup);
|
|
}];
|
|
}];
|
|
}
|
|
}
|
|
|
|
|
|
-- (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 {
|
|
- (void)refreshMusicView {
|
|
if (self.dataArray.count) {
|
|
if (self.dataArray.count) {
|
|
@@ -579,19 +536,11 @@
|
|
make.height.mas_equalTo(self.albumViewHeight);
|
|
make.height.mas_equalTo(self.albumViewHeight);
|
|
}];
|
|
}];
|
|
|
|
|
|
- [self.scrollView addSubview:self.qualityMusicView];
|
|
|
|
- self.qualityMusicViewHeight = [HomeQualityMusic getViewHeight];
|
|
|
|
- [self.qualityMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
|
- make.top.mas_equalTo(self.albumView.mas_bottom);
|
|
|
|
- make.height.mas_equalTo(self.qualityMusicViewHeight);
|
|
|
|
- }];
|
|
|
|
-
|
|
|
|
[self.scrollView addSubview:self.hotMusicView];
|
|
[self.scrollView addSubview:self.hotMusicView];
|
|
CGFloat musicHeadHeight = [HomeHotMusicView getViewHeight];
|
|
CGFloat musicHeadHeight = [HomeHotMusicView getViewHeight];
|
|
[self.hotMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
[self.hotMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.left.right.mas_equalTo(self.view);
|
|
- make.top.mas_equalTo(self.qualityMusicView.mas_bottom);
|
|
|
|
|
|
+ make.top.mas_equalTo(self.albumView.mas_bottom);
|
|
make.height.mas_equalTo(musicHeadHeight);
|
|
make.height.mas_equalTo(musicHeadHeight);
|
|
make.bottom.mas_equalTo(self.scrollView.mas_bottom).offset(-10);
|
|
make.bottom.mas_equalTo(self.scrollView.mas_bottom).offset(-10);
|
|
}];
|
|
}];
|
|
@@ -1068,11 +1017,6 @@
|
|
if (collectionView == self.albumCollectionView) {
|
|
if (collectionView == self.albumCollectionView) {
|
|
return self.albumArray.count;
|
|
return self.albumArray.count;
|
|
}
|
|
}
|
|
- else if (collectionView == self.qualityMusicCollectionView) { // 精品曲目
|
|
|
|
- NSInteger lastRowCount = (self.qualityMusicArray.count % 4) > 0 ? 1 : 0;
|
|
|
|
- NSInteger count = self.qualityMusicArray.count / 4 + lastRowCount;
|
|
|
|
- return count;
|
|
|
|
- }
|
|
|
|
else {
|
|
else {
|
|
NSInteger lastRowCount = (self.dataArray.count % 4) > 0 ? 1 : 0;
|
|
NSInteger lastRowCount = (self.dataArray.count % 4) > 0 ? 1 : 0;
|
|
NSInteger count = self.dataArray.count / 4 + lastRowCount;
|
|
NSInteger count = self.dataArray.count / 4 + lastRowCount;
|
|
@@ -1087,19 +1031,6 @@
|
|
[cell configWithAlbumModel:model];
|
|
[cell configWithAlbumModel:model];
|
|
return cell;
|
|
return cell;
|
|
}
|
|
}
|
|
- else if (collectionView == self.qualityMusicCollectionView) {
|
|
|
|
- NSMutableArray *songArray = [NSMutableArray array];
|
|
|
|
- NSInteger length = indexPath.item * 4 + 4 > self.qualityMusicArray.count ? self.qualityMusicArray.count - indexPath.item * 4: 4;
|
|
|
|
- NSRange range = NSMakeRange(indexPath.item * 4, 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 {
|
|
else {
|
|
NSMutableArray *songArray = [NSMutableArray array];
|
|
NSMutableArray *songArray = [NSMutableArray array];
|
|
NSInteger length = indexPath.item * 4 + 4 > self.dataArray.count ? self.dataArray.count - indexPath.item * 4: 4;
|
|
NSInteger length = indexPath.item * 4 + 4 > self.dataArray.count ? self.dataArray.count - indexPath.item * 4: 4;
|
|
@@ -1131,9 +1062,6 @@
|
|
return CGSizeMake(100, 140);
|
|
return CGSizeMake(100, 140);
|
|
|
|
|
|
}
|
|
}
|
|
- else if (collectionView == self.qualityMusicCollectionView) {
|
|
|
|
- return CGSizeMake(KPortraitWidth * 0.83, 320);
|
|
|
|
- }
|
|
|
|
else {
|
|
else {
|
|
return CGSizeMake(KPortraitWidth * 0.83, 320);
|
|
return CGSizeMake(KPortraitWidth * 0.83, 320);
|
|
}
|
|
}
|
|
@@ -1194,47 +1122,6 @@
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
[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 ---- 更多曲目
|
|
#pragma mark ---- 更多曲目
|
|
- (HomeHotMusicView *)hotMusicView {
|
|
- (HomeHotMusicView *)hotMusicView {
|
|
@@ -1242,7 +1129,7 @@
|
|
_hotMusicView = [HomeHotMusicView shareInstance];
|
|
_hotMusicView = [HomeHotMusicView shareInstance];
|
|
MJWeakSelf;
|
|
MJWeakSelf;
|
|
[_hotMusicView homeMusicMore:^{
|
|
[_hotMusicView homeMusicMore:^{
|
|
- [weakSelf moreHotMusic:NO];
|
|
|
|
|
|
+ [weakSelf moreHotMusic];
|
|
}];
|
|
}];
|
|
[_hotMusicView.musicContentView addSubview:self.musicCollectionView];
|
|
[_hotMusicView.musicContentView addSubview:self.musicCollectionView];
|
|
[self.musicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
[self.musicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
@@ -1253,10 +1140,9 @@
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-- (void)moreHotMusic:(BOOL)isQuality {
|
|
|
|
- NSString *type = isQuality ? @"?type=fine" : @"?type=list";
|
|
|
|
|
|
+- (void)moreHotMusic {
|
|
KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
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];
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
}
|
|
}
|
|
|
|
|