|
@@ -6,12 +6,12 @@
|
|
//
|
|
//
|
|
|
|
|
|
#import "VideoListBodyView.h"
|
|
#import "VideoListBodyView.h"
|
|
-#import "VideoCourseCell.h"
|
|
|
|
|
|
+#import "MinePageVideoGroupCell.h"
|
|
#import "VideoCourseModel.h"
|
|
#import "VideoCourseModel.h"
|
|
#import "KSBaseWKWebViewController.h"
|
|
#import "KSBaseWKWebViewController.h"
|
|
#import "AuthDisplayView.h"
|
|
#import "AuthDisplayView.h"
|
|
|
|
|
|
-@interface VideoListBodyView ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
|
|
|
|
|
|
+@interface VideoListBodyView ()<UITableViewDelegate,UITableViewDataSource>
|
|
|
|
|
|
@property (nonatomic, strong) NSMutableArray *dataArray;
|
|
@property (nonatomic, strong) NSMutableArray *dataArray;
|
|
|
|
|
|
@@ -38,33 +38,34 @@
|
|
self = [super initWithFrame:frame];
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
if (self) {
|
|
self.backgroundColor = HexRGB(0xf8f9fc);
|
|
self.backgroundColor = HexRGB(0xf8f9fc);
|
|
- UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
|
|
|
- layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
|
|
|
|
-
|
|
|
|
- self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
|
|
- self.collectionView.backgroundColor = HexRGB(0xf8f9fc);
|
|
|
|
- self.collectionView.delegate = self;
|
|
|
|
- self.collectionView.dataSource = self;
|
|
|
|
- self.collectionView.showsVerticalScrollIndicator = NO;
|
|
|
|
- self.collectionView.showsHorizontalScrollIndicator = NO;
|
|
|
|
- [self.collectionView registerNib:[UINib nibWithNibName:@"VideoCourseCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"VideoCourseCell"];
|
|
|
|
- [self addSubview:self.collectionView];
|
|
|
|
- [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.bottom.top.mas_equalTo(self);
|
|
|
|
|
|
+ self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) style:UITableViewStylePlain];
|
|
|
|
+ self.tableView.backgroundColor = HexRGB(0xf8f9fc);
|
|
|
|
+ self.tableView.showsVerticalScrollIndicator = NO;
|
|
|
|
+ self.tableView.dataSource = self;
|
|
|
|
+ self.tableView.delegate = self;
|
|
|
|
+ self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
|
|
+ [self addSubview:self.tableView];
|
|
|
|
+ self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
|
+ [self.tableView registerNib:[UINib nibWithNibName:@"MinePageVideoGroupCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"MinePageVideoGroupCell"];
|
|
|
|
+ [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.right.top.bottom.mas_equalTo(self);
|
|
}];
|
|
}];
|
|
|
|
+ UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
|
|
|
|
+ bottomView.backgroundColor = HexRGB(0xf8f9fc);
|
|
|
|
+ self.tableView.tableFooterView = bottomView;
|
|
|
|
|
|
MJWeakSelf;
|
|
MJWeakSelf;
|
|
- self.collectionView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
|
|
|
|
|
|
+ self.tableView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
|
|
[weakSelf resetParamenter];
|
|
[weakSelf resetParamenter];
|
|
[weakSelf requestData];
|
|
[weakSelf requestData];
|
|
}];
|
|
}];
|
|
- self.collectionView.mj_footer = [KSGifRefreshFooter footerWithRefreshingBlock:^{
|
|
|
|
|
|
+ self.tableView.mj_footer = [KSGifRefreshFooter footerWithRefreshingBlock:^{
|
|
if (weakSelf.isLoadMore) {
|
|
if (weakSelf.isLoadMore) {
|
|
weakSelf.pages += 1;
|
|
weakSelf.pages += 1;
|
|
[weakSelf requestData];
|
|
[weakSelf requestData];
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- [weakSelf.collectionView.mj_footer endRefreshingWithNoMoreData];
|
|
|
|
|
|
+ [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
|
|
}
|
|
}
|
|
}];
|
|
}];
|
|
}
|
|
}
|
|
@@ -75,8 +76,8 @@
|
|
@weakObj(self);
|
|
@weakObj(self);
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
@strongObj(self);
|
|
@strongObj(self);
|
|
- [self.collectionView.mj_header endRefreshing];
|
|
|
|
- [self.collectionView.mj_footer endRefreshing];
|
|
|
|
|
|
+ [self.tableView.mj_header endRefreshing];
|
|
|
|
+ [self.tableView.mj_footer endRefreshing];
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -102,9 +103,9 @@
|
|
self.audioStatus = @"OUT_SALE";
|
|
self.audioStatus = @"OUT_SALE";
|
|
}
|
|
}
|
|
self.dataArray = [NSMutableArray array];
|
|
self.dataArray = [NSMutableArray array];
|
|
- [self.collectionView.mj_footer resetNoMoreData];
|
|
|
|
- [self setPromptString:[self getEmptyMessage] imageName:@"empty_videoCourse" buttonTitle:@"立即创建" inView:self.collectionView];
|
|
|
|
- [self.collectionView reloadData];
|
|
|
|
|
|
+ [self.tableView.mj_footer resetNoMoreData];
|
|
|
|
+ [self setPromptString:[self getEmptyMessage] imageName:@"empty_videoCourse" buttonTitle:@"立即创建" inView:self.tableView];
|
|
|
|
+ [self.tableView reloadData];
|
|
}
|
|
}
|
|
|
|
|
|
- (NSString *)getEmptyMessage {
|
|
- (NSString *)getEmptyMessage {
|
|
@@ -139,21 +140,21 @@
|
|
else {
|
|
else {
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
|
|
}
|
|
}
|
|
- [self.collectionView reloadData];
|
|
|
|
|
|
+ [self.tableView reloadData];
|
|
[self changePromptLabelStateWithArray:self.dataArray];
|
|
[self changePromptLabelStateWithArray:self.dataArray];
|
|
} faliure:^(NSError * _Nonnull error) {
|
|
} faliure:^(NSError * _Nonnull error) {
|
|
[self endRefresh];
|
|
[self endRefresh];
|
|
if (self.networkAvaiable == NO) {
|
|
if (self.networkAvaiable == NO) {
|
|
- [self setPromptString:@"暂无网络" imageName:@"no_networking" buttonTitle:@"" inView:self.collectionView];
|
|
|
|
|
|
+ [self setPromptString:@"暂无网络" imageName:@"no_networking" buttonTitle:@"" inView:self.tableView];
|
|
}
|
|
}
|
|
[self.dataArray removeAllObjects];
|
|
[self.dataArray removeAllObjects];
|
|
- [self.collectionView reloadData];
|
|
|
|
|
|
+ [self.tableView reloadData];
|
|
[self changePromptLabelStateWithArray:self.dataArray];
|
|
[self changePromptLabelStateWithArray:self.dataArray];
|
|
}];
|
|
}];
|
|
}
|
|
}
|
|
|
|
|
|
- (void)beginRefreshImmediately {
|
|
- (void)beginRefreshImmediately {
|
|
- [self.collectionView.mj_header beginRefreshing];
|
|
|
|
|
|
+ [self.tableView.mj_header beginRefreshing];
|
|
}
|
|
}
|
|
|
|
|
|
- (void)selectCellAtIndexPath:(NSIndexPath *)indexPath {
|
|
- (void)selectCellAtIndexPath:(NSIndexPath *)indexPath {
|
|
@@ -162,11 +163,11 @@
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (self.lastSelectedIndexPath != nil) {
|
|
if (self.lastSelectedIndexPath != nil) {
|
|
- UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:self.lastSelectedIndexPath];
|
|
|
|
- [cell setSelected:NO];
|
|
|
|
|
|
+ UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:self.lastSelectedIndexPath];
|
|
|
|
+ [cell setSelected:NO animated:NO];
|
|
}
|
|
}
|
|
- UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
|
|
|
|
- [cell setSelected:YES];
|
|
|
|
|
|
+ UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
|
|
|
|
+ [cell setSelected:YES animated:NO];
|
|
self.lastSelectedIndexPath = indexPath;
|
|
self.lastSelectedIndexPath = indexPath;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -186,23 +187,24 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-#pragma mark ----- collection view
|
|
|
|
-- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
|
|
|
|
- return 1;
|
|
|
|
-}
|
|
|
|
-- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
|
|
|
|
|
+#pragma mark - UITableViewDataSource
|
|
|
|
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
return self.dataArray.count;
|
|
return self.dataArray.count;
|
|
}
|
|
}
|
|
|
|
|
|
-- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
- VideoCourseCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"VideoCourseCell" forIndexPath:indexPath];
|
|
|
|
-
|
|
|
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
+ return 115.0f;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
+ MinePageVideoGroupCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MinePageVideoGroupCell"];
|
|
VideoCourseModel *model = [self.dataArray objectAtIndex:indexPath.row];
|
|
VideoCourseModel *model = [self.dataArray objectAtIndex:indexPath.row];
|
|
VIDEOGRROUP_STATUS status = [self getCourseStatus:self.selectIndex];
|
|
VIDEOGRROUP_STATUS status = [self getCourseStatus:self.selectIndex];
|
|
[cell configSourceModel:model groupStatus:status hideBottomView:NO];
|
|
[cell configSourceModel:model groupStatus:status hideBottomView:NO];
|
|
return cell;
|
|
return cell;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
- (VIDEOGRROUP_STATUS)getCourseStatus:(NSInteger)cellIndex {
|
|
- (VIDEOGRROUP_STATUS)getCourseStatus:(NSInteger)cellIndex {
|
|
VIDEOGRROUP_STATUS status;
|
|
VIDEOGRROUP_STATUS status;
|
|
if (cellIndex == 0) {
|
|
if (cellIndex == 0) {
|
|
@@ -220,7 +222,7 @@
|
|
return status;
|
|
return status;
|
|
}
|
|
}
|
|
|
|
|
|
-- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
VideoCourseModel *model = [self.dataArray objectAtIndex:indexPath.row];
|
|
VideoCourseModel *model = [self.dataArray objectAtIndex:indexPath.row];
|
|
NSString *url = @"";
|
|
NSString *url = @"";
|
|
if (self.selectIndex == 2 || self.selectIndex == 3) {
|
|
if (self.selectIndex == 2 || self.selectIndex == 3) {
|
|
@@ -234,10 +236,6 @@
|
|
[self.naviController pushViewController:ctrl animated:YES];
|
|
[self.naviController pushViewController:ctrl animated:YES];
|
|
}
|
|
}
|
|
|
|
|
|
-- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
- CGFloat height = self.selectIndex == 1 ? 200 : 210;
|
|
|
|
- return CGSizeMake((kScreenWidth - 28 - 11) / 2.0f, height);
|
|
|
|
-}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
设置没有数据时的显示
|
|
设置没有数据时的显示
|
|
@@ -266,7 +264,7 @@
|
|
[view addSubview:self.promptView];
|
|
[view addSubview:self.promptView];
|
|
[self.promptView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
[self.promptView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self);
|
|
make.left.right.mas_equalTo(self);
|
|
- make.top.mas_equalTo(self.collectionView);
|
|
|
|
|
|
+ make.top.mas_equalTo(self.tableView);
|
|
make.height.mas_equalTo(self);
|
|
make.height.mas_equalTo(self);
|
|
}];
|
|
}];
|
|
}
|
|
}
|