|
@@ -23,6 +23,7 @@
|
|
|
|
|
|
#import "HomeHotAlbumView.h"
|
|
|
#import "HomeHotAlbumCell.h"
|
|
|
+#import "HomeAlbumModel.h"
|
|
|
|
|
|
#import "HomeHotCourseView.h"
|
|
|
#import "HomeIntroduceView.h"
|
|
@@ -43,10 +44,19 @@
|
|
|
#import "HomeVideoCourseCell.h"
|
|
|
#import "HomeVideoGroupModel.h"
|
|
|
|
|
|
+#import "WMPlayer.h" // 播放相关
|
|
|
+
|
|
|
#define BUTTONWIDTH (80)
|
|
|
#define BUTTONHEIGHT (80)
|
|
|
|
|
|
-@interface HomeViewController ()<TYCyclePagerViewDataSource,TYCyclePagerViewDelegate,UITableViewDelegate,UITableViewDataSource,UIScrollViewDelegate,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout,UICollectionViewDataSource>
|
|
|
+@interface HomeViewController ()<TYCyclePagerViewDataSource,TYCyclePagerViewDelegate,UITableViewDelegate,UITableViewDataSource,UIScrollViewDelegate,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,WMPlayerDelegate>
|
|
|
+{
|
|
|
+ WMPlayer *_wmPlayer;
|
|
|
+ CGRect _playerFrame;
|
|
|
+}
|
|
|
+@property (nonatomic, strong) UIView *bgView;
|
|
|
+
|
|
|
+@property (nonatomic, assign) BOOL isRatation;
|
|
|
|
|
|
@property (nonatomic, strong) UITableView *tableView;
|
|
|
|
|
@@ -58,15 +68,18 @@
|
|
|
@property (nonatomic, strong) HomeBannerView *bannerView; // banner container
|
|
|
@property (nonatomic, strong) TYCyclePagerView *bannerScroll; // 活动
|
|
|
@property (nonatomic, strong) NSMutableArray *bannerArray; // banner 数据
|
|
|
+@property (nonatomic, assign) CGFloat bannerViewHeight; // banner 高度
|
|
|
|
|
|
@property (nonatomic, strong) HomeButtonView *buttonContainer; // button container
|
|
|
@property (nonatomic, strong) UIScrollView *buttonScrollView;
|
|
|
@property (nonatomic, strong) NSMutableArray *buttonArray; // button 内容
|
|
|
@property (nonatomic, assign) NSInteger buttonDotWidth;
|
|
|
+@property (nonatomic, assign) CGFloat buttonViewHeight; // button view 高度
|
|
|
|
|
|
@property (nonatomic, strong) HomeHotAlbumView *albumView; // albumView container
|
|
|
@property (nonatomic, strong) NSMutableArray *albumArray; // 热门专辑
|
|
|
@property (nonatomic, strong) UICollectionView *albumCollectionView; // 专辑容器
|
|
|
+@property (nonatomic, assign) CGFloat albumViewHeight; // album 高度
|
|
|
|
|
|
@property (nonatomic, strong) HomeHotCourseView *courseView; // course container
|
|
|
@property (nonatomic, strong) UIScrollView *courseScroll; // 课程scroll
|
|
@@ -74,20 +87,22 @@
|
|
|
@property (nonatomic, strong) UITableView *videoCourseTable; // 视频课table
|
|
|
@property (nonatomic, strong) NSMutableArray *videoCourseArray;
|
|
|
@property (nonatomic, strong) NSMutableArray *liveCourseArray;
|
|
|
+@property (nonatomic, assign) CGFloat courseViewHeight;
|
|
|
|
|
|
@property (nonatomic, strong) HomeIntroduceView *teacherView; // teacher container
|
|
|
@property (nonatomic, strong) UICollectionView *infoCollectionView; // 老师风采简介
|
|
|
@property (nonatomic, strong) NSMutableArray *teacherArray;
|
|
|
-
|
|
|
+@property (nonatomic, assign) CGFloat teachViewHeight;
|
|
|
|
|
|
@property (nonatomic, strong) HotInformationHeadView *informationHeadView; // information Header
|
|
|
+@property (nonatomic, assign) CGFloat informationHeight;
|
|
|
|
|
|
@property (nonatomic, strong) StudentInfoModel *mineInfo;
|
|
|
|
|
|
@property (nonatomic, assign) BOOL hasCourseTips;
|
|
|
|
|
|
@property (nonatomic, strong) HomeCourseTipsView *tipsCourseView;
|
|
|
-
|
|
|
+@property (nonatomic, assign) CGFloat tipsViewHeight;
|
|
|
@property (nonatomic, assign) BOOL isChooseLive; // 是否选择直播课
|
|
|
|
|
|
@property (nonatomic, assign) NSInteger courseCount;
|
|
@@ -102,13 +117,12 @@
|
|
|
self.ks_prefersNavigationBarHidden = YES;
|
|
|
self.isChooseLive = YES;
|
|
|
[self configNavView];
|
|
|
-// [self requestUserInfo];
|
|
|
[self configUI];
|
|
|
+ [self requestData];
|
|
|
}
|
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
|
[super viewWillAppear:animated];
|
|
|
- [self requestData];
|
|
|
}
|
|
|
|
|
|
- (void)configNavView {
|
|
@@ -139,6 +153,101 @@
|
|
|
self.tableView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
|
|
|
[weakSelf requestData];
|
|
|
}];
|
|
|
+
|
|
|
+ // 配置 首页显示
|
|
|
+ [self addDisplayView];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)addDisplayView {
|
|
|
+ CGFloat tableHeaderHeight = 0.0f;
|
|
|
+ [self.tableHeaderView addSubview:self.bannerView];
|
|
|
+ // banner
|
|
|
+ self.bannerViewHeight = [HomeBannerView getViewHeight];
|
|
|
+ tableHeaderHeight += self.bannerViewHeight;
|
|
|
+ [self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
+ make.top.mas_equalTo(self.tableHeaderView.mas_top);
|
|
|
+ make.height.mas_equalTo(self.bannerViewHeight);
|
|
|
+ }];
|
|
|
+ // button
|
|
|
+ [self.tableHeaderView addSubview:self.buttonContainer];
|
|
|
+ self.buttonViewHeight = [HomeButtonView getViewHeight];
|
|
|
+ [self.buttonContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
+ make.top.mas_equalTo(self.bannerView.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.buttonViewHeight);
|
|
|
+ }];
|
|
|
+ tableHeaderHeight += self.buttonViewHeight;
|
|
|
+
|
|
|
+ // 课程提醒
|
|
|
+ [self.tableHeaderView addSubview:self.tipsCourseView];
|
|
|
+ self.tipsViewHeight = CGFLOAT_MIN;
|
|
|
+ self.tipsCourseView.hidden = YES;
|
|
|
+ [self.tipsCourseView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
+ make.top.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.tipsViewHeight);
|
|
|
+ }];
|
|
|
+ tableHeaderHeight += self.tipsViewHeight;
|
|
|
+ // 专辑
|
|
|
+ [self.tableHeaderView addSubview:self.albumView];
|
|
|
+ self.albumViewHeight = [HomeHotAlbumView getViewHeight];
|
|
|
+ [self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
+ make.top.mas_equalTo(self.tipsCourseView.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.albumViewHeight);
|
|
|
+ }];
|
|
|
+ tableHeaderHeight += self.albumViewHeight;
|
|
|
+
|
|
|
+ // 课程
|
|
|
+ [self.tableHeaderView addSubview:self.courseView];
|
|
|
+ self.courseViewHeight = [self.courseView getViewHeightWithCount:10];
|
|
|
+ [self.courseView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
+ make.top.mas_equalTo(self.albumView.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.courseViewHeight);
|
|
|
+ }];
|
|
|
+ self.courseScroll.contentSize = CGSizeMake(KPortraitWidth * 2, self.courseViewHeight - 59);
|
|
|
+ [self.courseScroll addSubview:self.liveCourseTable];
|
|
|
+ [self.liveCourseTable mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(self.courseScroll);
|
|
|
+ make.top.bottom.mas_equalTo(self.courseView.courseContainer);
|
|
|
+ make.width.mas_equalTo(KPortraitWidth);
|
|
|
+ }];
|
|
|
+ [self.courseScroll addSubview:self.videoCourseTable];
|
|
|
+ [self.videoCourseTable mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(_courseScroll.mas_left).offset(KPortraitWidth);
|
|
|
+ make.top.bottom.mas_equalTo(self.courseView.courseContainer);
|
|
|
+ make.width.mas_equalTo(KPortraitWidth);
|
|
|
+ }];
|
|
|
+ tableHeaderHeight += self.courseViewHeight;
|
|
|
+
|
|
|
+ // 老师风采
|
|
|
+ [self.tableHeaderView addSubview:self.teacherView];
|
|
|
+ self.teachViewHeight = [self.teacherView getViewHeightWithSourceCount:10];
|
|
|
+
|
|
|
+ [self.teacherView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
+ make.top.mas_equalTo(self.courseView.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.teachViewHeight);
|
|
|
+ }];
|
|
|
+ tableHeaderHeight += self.teachViewHeight;
|
|
|
+
|
|
|
+ [self.tableHeaderView addSubview:self.informationHeadView];
|
|
|
+ self.informationHeight = [HotInformationHeadView getViewHeight];
|
|
|
+ [self.informationHeadView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
+ make.top.mas_equalTo(self.teacherView.mas_bottom);
|
|
|
+ make.height.mas_equalTo(self.informationHeight);
|
|
|
+ }];
|
|
|
+ tableHeaderHeight += self.informationHeight;
|
|
|
+ self.tableHeaderView.frame = CGRectMake(0, 0, KPortraitWidth, tableHeaderHeight);
|
|
|
+}
|
|
|
+
|
|
|
+- (void)refreshTableHeadHeight {
|
|
|
+ CGFloat tableHeaderHeight = self.bannerViewHeight + self.buttonViewHeight + self.tipsViewHeight + self.albumViewHeight + self.courseViewHeight + self.teachViewHeight + self.informationHeight;
|
|
|
+ self.tableHeaderView.frame = CGRectMake(0, 0, KPortraitWidth, tableHeaderHeight);
|
|
|
+ [self.tableView reloadData];
|
|
|
}
|
|
|
|
|
|
- (void)requestData {
|
|
@@ -146,10 +255,49 @@
|
|
|
// 栅栏函数
|
|
|
[self requestCourseInfo];
|
|
|
[self requestTeacherStyle];
|
|
|
+ [self requestHotAlbum];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)requestHotAlbum {
|
|
|
+ [KSNetworkingManager HomeHotAlbumRequest:KS_POST page:1 rows:10 success:^(NSDictionary * _Nonnull dic) {
|
|
|
+ if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
|
|
|
+ NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] 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 {
|
|
|
+ [self MBPShow:MESSAGEKEY];
|
|
|
+ }
|
|
|
+ [self refreshAlbumView];
|
|
|
+
|
|
|
+ } faliure:^(NSError * _Nonnull error) {
|
|
|
+
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+- (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];
|
|
|
+ [self refreshTableHeadHeight];
|
|
|
}
|
|
|
|
|
|
- (void)requestCourseInfo {
|
|
|
[KSNetworkingManager homeQueryLiveAndVideo:KS_GET success:^(NSDictionary * _Nonnull dic) {
|
|
|
+ [self.tableView.mj_header endRefreshing];
|
|
|
if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
|
|
|
NSDictionary *sourceDic = [dic dictionaryValueForKey:@"data"];
|
|
|
NSArray *liveList = [sourceDic arrayValueForKey:@"liveList"];
|
|
@@ -171,11 +319,30 @@
|
|
|
else {
|
|
|
[self MBPShow:MESSAGEKEY];
|
|
|
}
|
|
|
+ [self refreshCourseView];
|
|
|
} faliure:^(NSError * _Nonnull error) {
|
|
|
-
|
|
|
+ [self.tableView.mj_header endRefreshing];
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+- (void)refreshCourseView {
|
|
|
+ // 课程
|
|
|
+ if (self.liveCourseArray.count && self.videoCourseArray.count) {
|
|
|
+ self.courseCount = self.liveCourseArray.count >= self.videoCourseArray.count ? self.videoCourseArray.count : self.liveCourseArray.count;
|
|
|
+ // 根据课程返回数据显示高度
|
|
|
+ self.courseViewHeight = [self.courseView getViewHeightWithCount:self.courseCount];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ self.courseViewHeight = CGFLOAT_MIN;
|
|
|
+ }
|
|
|
+ [self.courseView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(self.courseViewHeight);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.liveCourseTable reloadData];
|
|
|
+ [self.videoCourseTable reloadData];
|
|
|
+ [self refreshTableHeadHeight];
|
|
|
+}
|
|
|
|
|
|
- (void)requestUserInfo {
|
|
|
[KSNetworkingManager queryStudentInfoRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
|
|
@@ -198,7 +365,7 @@
|
|
|
- (void)requestTeacherStyle {
|
|
|
|
|
|
[KSNetworkingManager homeQueryTeacherStyle:KS_POST page:1 rows:10 success:^(NSDictionary * _Nonnull dic) {
|
|
|
- [self.tableView.mj_header endRefreshing];
|
|
|
+
|
|
|
if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
|
|
|
NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
|
|
|
NSMutableArray *styleArray = [NSMutableArray array];
|
|
@@ -212,10 +379,26 @@
|
|
|
[self MBPShow:MESSAGEKEY];
|
|
|
}
|
|
|
// 回调
|
|
|
- [self refreshUIDisplay];
|
|
|
+ [self refreshTeachView];
|
|
|
} faliure:^(NSError * _Nonnull error) {
|
|
|
- [self.tableView.mj_header endRefreshing];
|
|
|
+
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)refreshTeachView {
|
|
|
+ if (self.teacherArray.count) {
|
|
|
+ self.teachViewHeight = [self.teacherView getViewHeightWithSourceCount:self.teacherArray.count];
|
|
|
+ self.teacherView.hidden = NO;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ self.teachViewHeight = CGFLOAT_MIN;
|
|
|
+ self.teacherView.hidden = YES;
|
|
|
+ }
|
|
|
+ [self.teacherView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(self.teachViewHeight);
|
|
|
}];
|
|
|
+ [self.infoCollectionView reloadData];
|
|
|
+ [self refreshTableHeadHeight];
|
|
|
}
|
|
|
|
|
|
- (void)refreshNavView {
|
|
@@ -229,146 +412,6 @@
|
|
|
self.navView.subjectName.text = subjectName;
|
|
|
}
|
|
|
|
|
|
-- (void)refreshUIDisplay {
|
|
|
- [self.tableHeaderView removeAllSubViews];
|
|
|
-
|
|
|
- CGFloat tableHeaderHeight = 0.0f;
|
|
|
-
|
|
|
- NSMutableArray *banner = [NSMutableArray array];
|
|
|
-
|
|
|
- for (NSInteger i = 0; i < 4; i++) {
|
|
|
- HomeMessageModel *model = [[HomeMessageModel alloc] init];
|
|
|
- [banner addObject:model];
|
|
|
- }
|
|
|
- self.bannerArray = [NSMutableArray arrayWithArray:banner];
|
|
|
-
|
|
|
- if (self.bannerArray.count) {
|
|
|
- [self.tableHeaderView addSubview:self.bannerView];
|
|
|
- CGFloat bannerHeight = [HomeBannerView getViewHeight];
|
|
|
- tableHeaderHeight += bannerHeight;
|
|
|
- [self.bannerView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
- make.top.mas_equalTo(self.tableHeaderView.mas_top);
|
|
|
- make.height.mas_equalTo(bannerHeight);
|
|
|
- }];
|
|
|
- [self refreshBannaerView];
|
|
|
- }
|
|
|
-
|
|
|
- NSMutableArray *buttonArr = [NSMutableArray array];
|
|
|
-
|
|
|
- for (NSInteger i = 0; i < 4; i++) {
|
|
|
- HomeMessageModel *model = [[HomeMessageModel alloc] init];
|
|
|
- [buttonArr addObject:model];
|
|
|
- }
|
|
|
- self.buttonArray = [NSMutableArray arrayWithArray:buttonArr];
|
|
|
-
|
|
|
- if (self.buttonArray.count) {
|
|
|
- [self.tableHeaderView addSubview:self.buttonContainer];
|
|
|
- CGFloat buttonViewHeight = [HomeButtonView getViewHeight];
|
|
|
- [self.buttonContainer mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
- make.top.mas_equalTo(self.tableHeaderView.mas_top).offset(tableHeaderHeight);
|
|
|
- make.height.mas_equalTo(buttonViewHeight);
|
|
|
- }];
|
|
|
- tableHeaderHeight += buttonViewHeight;
|
|
|
- [self showButtonMessage];
|
|
|
- }
|
|
|
-
|
|
|
- // 如果有最近课程
|
|
|
- self.hasCourseTips = YES;
|
|
|
- if (self.hasCourseTips) { // 课程提醒
|
|
|
- [self.tableHeaderView addSubview:self.tipsCourseView];
|
|
|
- CGFloat tipsViewHeight = [HomeCourseTipsView getViewHeight];
|
|
|
- [self.tipsCourseView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
- make.top.mas_equalTo(self.tableHeaderView.mas_top).offset(tableHeaderHeight);
|
|
|
- make.height.mas_equalTo(tipsViewHeight);
|
|
|
- }];
|
|
|
- tableHeaderHeight += tipsViewHeight;
|
|
|
- // 渲染页面
|
|
|
- }
|
|
|
-
|
|
|
- NSMutableArray *albumArr = [NSMutableArray array];
|
|
|
- for (NSInteger i = 0; i < 10; i++) {
|
|
|
- HomeMessageModel *model = [[HomeMessageModel alloc] init];
|
|
|
- [albumArr addObject:model];
|
|
|
- }
|
|
|
- self.albumArray = [NSMutableArray arrayWithArray:albumArr];
|
|
|
-
|
|
|
- if (self.albumArray.count) { // 热门专辑
|
|
|
- [self.tableHeaderView addSubview:self.albumView];
|
|
|
- CGFloat albumHeight = [HomeHotAlbumView getViewHeight];
|
|
|
- [self.albumView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
- make.top.mas_equalTo(self.tableHeaderView.mas_top).offset(tableHeaderHeight);
|
|
|
- make.height.mas_equalTo(albumHeight);
|
|
|
- }];
|
|
|
- tableHeaderHeight += albumHeight;
|
|
|
- }
|
|
|
-
|
|
|
- // 课程
|
|
|
- if (self.liveCourseArray.count && self.videoCourseArray.count) {
|
|
|
- self.courseCount = self.liveCourseArray.count >= self.videoCourseArray.count ? self.videoCourseArray.count : self.liveCourseArray.count;
|
|
|
- [self.tableHeaderView addSubview:self.courseView];
|
|
|
- // 根据课程返回数据显示高度
|
|
|
- CGFloat courseViewHeight = [self.courseView getViewHeightWithCount:self.courseCount];
|
|
|
- [self.courseView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
- make.top.mas_equalTo(self.tableHeaderView.mas_top).offset(tableHeaderHeight);
|
|
|
- make.height.mas_equalTo(courseViewHeight);
|
|
|
- }];
|
|
|
- [self.courseScroll removeAllSubViews];
|
|
|
- self.courseScroll.contentSize = CGSizeMake(KPortraitWidth * 2, courseViewHeight - 59);
|
|
|
- [self.courseScroll addSubview:self.liveCourseTable];
|
|
|
- [self.liveCourseTable mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.mas_equalTo(self.courseScroll);
|
|
|
- make.top.bottom.mas_equalTo(self.courseView.courseContainer);
|
|
|
- make.width.mas_equalTo(KPortraitWidth);
|
|
|
- }];
|
|
|
- [self.courseScroll addSubview:self.videoCourseTable];
|
|
|
- [self.videoCourseTable mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.mas_equalTo(_courseScroll.mas_left).offset(KPortraitWidth);
|
|
|
- make.top.bottom.mas_equalTo(self.courseView.courseContainer);
|
|
|
- make.width.mas_equalTo(KPortraitWidth);
|
|
|
- }];
|
|
|
- tableHeaderHeight += courseViewHeight;
|
|
|
- [self.liveCourseTable reloadData];
|
|
|
- [self.videoCourseTable reloadData];
|
|
|
- }
|
|
|
- if (self.teacherArray.count) {
|
|
|
- [self.tableHeaderView addSubview:self.teacherView];
|
|
|
- CGFloat teacherContentHeight = [self.teacherView getViewHeightWithSourceCount:self.teacherArray.count];
|
|
|
-
|
|
|
- [self.teacherView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
- make.top.mas_equalTo(self.tableHeaderView.mas_top).offset(tableHeaderHeight);
|
|
|
- make.height.mas_equalTo(teacherContentHeight);
|
|
|
- }];
|
|
|
- tableHeaderHeight += teacherContentHeight;
|
|
|
- }
|
|
|
-
|
|
|
- [self.tableHeaderView addSubview:self.informationHeadView];
|
|
|
- CGFloat informationHeadHeight = [HotInformationHeadView getViewHeight];
|
|
|
- [self.informationHeadView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.mas_equalTo(self.tableHeaderView);
|
|
|
- make.top.mas_equalTo(self.tableHeaderView.mas_top).offset(tableHeaderHeight);
|
|
|
- make.height.mas_equalTo(informationHeadHeight);
|
|
|
- }];
|
|
|
- tableHeaderHeight += informationHeadHeight;
|
|
|
-
|
|
|
- // test
|
|
|
- NSMutableArray *sourceArray = [NSMutableArray array];
|
|
|
-
|
|
|
- for (NSInteger i = 0; i < 4; i++) {
|
|
|
- HomeMessageModel *model = [[HomeMessageModel alloc] init];
|
|
|
- [sourceArray addObject:model];
|
|
|
- }
|
|
|
- self.dataArray = [NSMutableArray arrayWithArray:sourceArray];
|
|
|
-
|
|
|
- self.tableHeaderView.frame = CGRectMake(0, 0, KPortraitWidth, tableHeaderHeight);
|
|
|
- [self.tableView reloadData];
|
|
|
-}
|
|
|
-
|
|
|
- (void)refreshBannaerView {
|
|
|
if (self.bannerArray.count > 1) {
|
|
|
self.bannerScroll.autoScrollInterval = 3.0f;
|
|
@@ -545,7 +588,9 @@
|
|
|
|
|
|
- (__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 {
|
|
@@ -564,6 +609,8 @@
|
|
|
return;
|
|
|
}
|
|
|
// 播放视频
|
|
|
+ [self playVideoWithUrl:videoUrl];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
@@ -578,7 +625,7 @@
|
|
|
|
|
|
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
if (collectionView == self.albumCollectionView) {
|
|
|
- return CGSizeMake(120, 140);
|
|
|
+ return CGSizeMake(110, 140);
|
|
|
}
|
|
|
else {
|
|
|
return CGSizeMake((KPortraitWidth - 28 - 11) / 2.0f, 164);
|
|
@@ -602,7 +649,7 @@
|
|
|
}];
|
|
|
}
|
|
|
else if (scrollView == self.courseScroll) {
|
|
|
- NSLog(@"------");
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -706,6 +753,7 @@
|
|
|
}
|
|
|
|
|
|
- (void)moreAlbumDetail {
|
|
|
+ return;
|
|
|
KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @""];
|
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
@@ -979,6 +1027,58 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
+#pragma mark ------ WMPlayer
|
|
|
+- (void)playVideoWithUrl:(NSString *)fileUrl {
|
|
|
+ fileUrl = [fileUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+ _playerFrame = CGRectMake(0, iPhoneXSafeTopMargin, kScreenWidth, kScreenHeight - iPhoneXSafeTopMargin - iPhoneXSafeBottomMargin);
|
|
|
+ _wmPlayer = [[WMPlayer alloc] initWithFrame:_playerFrame];
|
|
|
+ WMPlayerModel *playModel = [[WMPlayerModel alloc] init];
|
|
|
+ playModel.videoURL = [NSURL URLWithString:fileUrl];
|
|
|
+ _wmPlayer.playerModel = playModel;
|
|
|
+ _wmPlayer.delegate = self;
|
|
|
+ _bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
|
|
|
+ _bgView.backgroundColor = [UIColor blackColor];
|
|
|
+ [[UIApplication sharedApplication].keyWindow addSubview:_bgView];
|
|
|
+ [[UIApplication sharedApplication].keyWindow addSubview:_wmPlayer];
|
|
|
+ [[UIApplication sharedApplication].keyWindow bringSubviewToFront:_wmPlayer];
|
|
|
+
|
|
|
+ [_wmPlayer play];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)wmplayer:(WMPlayer *)wmplayer clickedCloseButton:(UIButton *)backBtn {
|
|
|
+ [wmplayer removePlayer];
|
|
|
+ [_bgView removeFromSuperview];
|
|
|
+ [self setNeedsStatusBarAppearanceUpdate];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)wmplayer:(WMPlayer *)wmplayer clickedFullScreenButton:(UIButton *)fullScreenBtn {
|
|
|
+ self.isRatation = !self.isRatation;
|
|
|
+
|
|
|
+ if (self.isRatation) {
|
|
|
+ [wmplayer removeFromSuperview];
|
|
|
+ [UIView animateWithDuration:1.0f animations:^{
|
|
|
+ wmplayer.transform = CGAffineTransformMakeRotation(M_PI_2);
|
|
|
+
|
|
|
+ } completion:^(BOOL finished) {
|
|
|
+ wmplayer.frame = CGRectMake(0, iPhoneXSafeTopMargin, kScreenWidth, kScreenHeight - iPhoneXSafeTopMargin - iPhoneXSafeBottomMargin);
|
|
|
+ [[UIApplication sharedApplication].keyWindow addSubview:wmplayer];
|
|
|
+ [[UIApplication sharedApplication].keyWindow bringSubviewToFront:wmplayer];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ [wmplayer removeFromSuperview];
|
|
|
+
|
|
|
+ [UIView animateWithDuration:1.0f animations:^{
|
|
|
+ // 复原
|
|
|
+ wmplayer.transform = CGAffineTransformIdentity;
|
|
|
+
|
|
|
+ } completion:^(BOOL finished) {
|
|
|
+ wmplayer.frame = CGRectMake(0, iPhoneXSafeTopMargin, kScreenWidth, kScreenHeight - iPhoneXSafeTopMargin - iPhoneXSafeBottomMargin);
|
|
|
+ [[UIApplication sharedApplication].keyWindow addSubview:wmplayer];
|
|
|
+ [[UIApplication sharedApplication].keyWindow bringSubviewToFront:wmplayer];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
- (void)dealloc {
|