|
@@ -47,7 +47,6 @@
|
|
#import "TYCyclePagerView.h"
|
|
#import "TYCyclePagerView.h"
|
|
#import "TYPageControl.h"
|
|
#import "TYPageControl.h"
|
|
#import "HomeBannerCell.h"
|
|
#import "HomeBannerCell.h"
|
|
-#import "BadgeIntroduceView.h"
|
|
|
|
#import "HomeAuthAlertView.h"
|
|
#import "HomeAuthAlertView.h"
|
|
#import "KSAwardAlertView.h"
|
|
#import "KSAwardAlertView.h"
|
|
|
|
|
|
@@ -63,12 +62,11 @@
|
|
|
|
|
|
#import "HomeTenantPageView.h"
|
|
#import "HomeTenantPageView.h"
|
|
#import "HomeMusicSheetLayout.h"
|
|
#import "HomeMusicSheetLayout.h"
|
|
|
|
+#import "MinePageViewController.h"
|
|
|
|
|
|
#define COLLECTION_WIDTH ((NSInteger)(IS_IPAD ? KPortraitWidth * 0.7 : KPortraitWidth * 0.83))
|
|
#define COLLECTION_WIDTH ((NSInteger)(IS_IPAD ? KPortraitWidth * 0.7 : KPortraitWidth * 0.83))
|
|
#define COLLECTION_HEIGHT (320)
|
|
#define COLLECTION_HEIGHT (320)
|
|
|
|
|
|
-#define BUTTONWIDTH (65)
|
|
|
|
-#define BUTTONHEIGHT (70)
|
|
|
|
|
|
|
|
@interface HomeViewController ()<SDCycleScrollViewDelegate,UIScrollViewDelegate,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,TYCyclePagerViewDataSource,TYCyclePagerViewDelegate>
|
|
@interface HomeViewController ()<SDCycleScrollViewDelegate,UIScrollViewDelegate,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,TYCyclePagerViewDataSource,TYCyclePagerViewDelegate>
|
|
|
|
|
|
@@ -76,6 +74,8 @@
|
|
|
|
|
|
@property (nonatomic, strong) HomeNewHeadView *headView;
|
|
@property (nonatomic, strong) HomeNewHeadView *headView;
|
|
|
|
|
|
|
|
+@property (nonatomic, strong) UIView *headBgView;
|
|
|
|
+
|
|
@property (nonatomic, strong) UserInfo *mineInfo;
|
|
@property (nonatomic, strong) UserInfo *mineInfo;
|
|
|
|
|
|
@property (nonatomic, strong) PublicNoticeView *noticeView;
|
|
@property (nonatomic, strong) PublicNoticeView *noticeView;
|
|
@@ -93,9 +93,7 @@
|
|
@property (nonatomic, strong) HomeRecentCourseView *courseView;
|
|
@property (nonatomic, strong) HomeRecentCourseView *courseView;
|
|
|
|
|
|
@property (nonatomic, strong) HomeButtonView *buttonContainer; // button container
|
|
@property (nonatomic, strong) HomeButtonView *buttonContainer; // button container
|
|
-@property (nonatomic, strong) UIScrollView *buttonScrollView;
|
|
|
|
@property (nonatomic, strong) NSMutableArray *buttonArray; // button 内容
|
|
@property (nonatomic, strong) NSMutableArray *buttonArray; // button 内容
|
|
-@property (nonatomic, assign) NSInteger buttonDotWidth;
|
|
|
|
@property (nonatomic, assign) CGFloat buttonViewHeight; // button view 高度
|
|
@property (nonatomic, assign) CGFloat buttonViewHeight; // button view 高度
|
|
|
|
|
|
@property (nonatomic, assign) BOOL isFirstLoad;
|
|
@property (nonatomic, assign) BOOL isFirstLoad;
|
|
@@ -126,8 +124,6 @@
|
|
@property (nonatomic, strong) NSMutableArray *newestMusicArray; // 曲谱数据
|
|
@property (nonatomic, strong) NSMutableArray *newestMusicArray; // 曲谱数据
|
|
@property (nonatomic, assign) CGFloat newestMusicViewHeight; // music 高度
|
|
@property (nonatomic, assign) CGFloat newestMusicViewHeight; // music 高度
|
|
|
|
|
|
-@property (nonatomic, strong) BadgeIntroduceView *intruduceAlert;
|
|
|
|
-
|
|
|
|
@property (nonatomic, strong) HomeAuthAlertView *authAlertView;
|
|
@property (nonatomic, strong) HomeAuthAlertView *authAlertView;
|
|
|
|
|
|
@property (nonatomic, assign) BOOL isCheck;
|
|
@property (nonatomic, assign) BOOL isCheck;
|
|
@@ -138,11 +134,6 @@
|
|
|
|
|
|
@property (nonatomic, assign) BOOL isSettingSubject;
|
|
@property (nonatomic, assign) BOOL isSettingSubject;
|
|
|
|
|
|
-// 机构专辑
|
|
|
|
-@property (nonatomic, strong) HomeTenantPageView *tenantAlbumView;
|
|
|
|
-
|
|
|
|
-@property (nonatomic, assign) CGFloat tenantAlbumHeight;
|
|
|
|
-
|
|
|
|
// 机构名称
|
|
// 机构名称
|
|
@property (nonatomic, strong) HomeTenantView *tenantNameView;
|
|
@property (nonatomic, strong) HomeTenantView *tenantNameView;
|
|
|
|
|
|
@@ -239,9 +230,16 @@
|
|
- (void)refreshNotice {
|
|
- (void)refreshNotice {
|
|
if (self.titleArray.count) {
|
|
if (self.titleArray.count) {
|
|
self.noticeView.hidden = NO;
|
|
self.noticeView.hidden = NO;
|
|
|
|
+ CGFloat height = [PublicNoticeView getViewHeight];
|
|
|
|
+ [self.noticeView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.height.mas_equalTo(height);
|
|
|
|
+ }];
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
self.noticeView.hidden = YES;
|
|
self.noticeView.hidden = YES;
|
|
|
|
+ [self.noticeView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.height.mas_equalTo(CGFLOAT_MIN);
|
|
|
|
+ }];
|
|
}
|
|
}
|
|
self.noticeScrollView.titlesGroup = self.titleArray;
|
|
self.noticeScrollView.titlesGroup = self.titleArray;
|
|
}
|
|
}
|
|
@@ -251,16 +249,13 @@
|
|
[self.headView configMessage:self.mineInfo];
|
|
[self.headView configMessage:self.mineInfo];
|
|
[self refreshTenantNameView];
|
|
[self refreshTenantNameView];
|
|
[self refreshBannerView];
|
|
[self refreshBannerView];
|
|
- [self refreshButtonView];
|
|
|
|
[self refreshNotice];
|
|
[self refreshNotice];
|
|
|
|
+ [self refreshButtonView];
|
|
[self refreshCourseView:self.recentCourseModel];
|
|
[self refreshCourseView:self.recentCourseModel];
|
|
[self refreshAlbumView];
|
|
[self refreshAlbumView];
|
|
[self refreshMusicView];
|
|
[self refreshMusicView];
|
|
-
|
|
|
|
- // 刷新专辑显示
|
|
|
|
- [self refreshTenantBanner];
|
|
|
|
|
|
+
|
|
// 刷新排序
|
|
// 刷新排序
|
|
- [self refreshViewLocation];
|
|
|
|
if (self.isCheck) {
|
|
if (self.isCheck) {
|
|
[self checkShowAwardAlert];
|
|
[self checkShowAwardAlert];
|
|
}
|
|
}
|
|
@@ -290,21 +285,6 @@
|
|
[self.tenantNameView configTenantName:self.mineInfo.tenantName];
|
|
[self.tenantNameView configTenantName:self.mineInfo.tenantName];
|
|
}
|
|
}
|
|
|
|
|
|
-- (void)refreshTenantBanner {
|
|
|
|
- if (self.mineInfo.tenantAlbumStatus != 0 && [UserDefault(TENANT_ID) integerValue] > 0) {
|
|
|
|
- self.tenantAlbumHeight = [HomeTenantPageView getViewHeight];
|
|
|
|
- self.tenantAlbumView.hidden = NO;
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- self.tenantAlbumHeight = CGFLOAT_MIN;
|
|
|
|
- self.tenantAlbumView.hidden = YES;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [self.tenantAlbumView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.height.mas_equalTo(self.tenantAlbumHeight);
|
|
|
|
- }];
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
- (void)removeFloatWindow {
|
|
- (void)removeFloatWindow {
|
|
if ([self.view.subviews containsObject:self.suspendButton]) {
|
|
if ([self.view.subviews containsObject:self.suspendButton]) {
|
|
[self.suspendButton removeFromSuperview];
|
|
[self.suspendButton removeFromSuperview];
|
|
@@ -391,50 +371,7 @@
|
|
[self.bannerScroll reloadData];
|
|
[self.bannerScroll reloadData];
|
|
}
|
|
}
|
|
|
|
|
|
-- (void)refreshViewLocation {
|
|
|
|
- // 如果有课程和公告 且有按钮
|
|
|
|
-
|
|
|
|
- CGFloat buttonViewDefaultHeight = self.buttonArray.count > 4 ? [HomeButtonView getViewHeight] : [HomeButtonView getViewHeight] - 20;
|
|
|
|
-
|
|
|
|
- if (self.titleArray.count && self.recentCourseModel && self.buttonArray.count) {
|
|
|
|
- [self.noticeView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
|
- make.top.mas_equalTo(self.bannerView.mas_bottom);
|
|
|
|
- make.height.mas_equalTo(56.0f);
|
|
|
|
- }];
|
|
|
|
-
|
|
|
|
- [self.buttonContainer mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
|
- make.top.mas_equalTo(self.noticeView.mas_bottom);
|
|
|
|
- make.height.mas_equalTo(buttonViewDefaultHeight);
|
|
|
|
- }];
|
|
|
|
- [self.courseView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
|
- make.top.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
|
- make.height.mas_equalTo(91.0f);
|
|
|
|
- }];
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- CGFloat buttonViewHeight = self.buttonArray.count ? buttonViewDefaultHeight : CGFLOAT_MIN;
|
|
|
|
- [self.buttonContainer mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
|
- make.top.mas_equalTo(self.bannerView.mas_bottom);
|
|
|
|
- make.height.mas_equalTo(buttonViewHeight);
|
|
|
|
- }];
|
|
|
|
- CGFloat noticeHeight = self.titleArray.count ? [self.noticeView getViewHeight] : CGFLOAT_MIN;
|
|
|
|
- [self.noticeView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
|
- make.top.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
|
- make.height.mas_equalTo(noticeHeight);
|
|
|
|
- }];
|
|
|
|
- CGFloat courseViewHeight = self.recentCourseModel ? 90.0f : CGFLOAT_MIN;
|
|
|
|
- [self.courseView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
|
- make.top.mas_equalTo(self.noticeView.mas_bottom);
|
|
|
|
- make.height.mas_equalTo(courseViewHeight);
|
|
|
|
- }];
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- (void)requestHomeButton {
|
|
- (void)requestHomeButton {
|
|
@@ -480,49 +417,52 @@
|
|
}
|
|
}
|
|
|
|
|
|
- (void)refreshButtonView {
|
|
- (void)refreshButtonView {
|
|
- CGFloat containerWidth = (KPortraitWidth - 28);
|
|
|
|
-
|
|
|
|
|
|
+ [self.buttonContainer.buttonContentView removeAllSubViews];
|
|
|
|
+ // 添加机构专辑
|
|
|
|
+ if (self.mineInfo.tenantAlbumStatus != 0 && [UserDefault(TENANT_ID) integerValue] > 0) {
|
|
|
|
+ HomeMessageModel *buttonModel = [[HomeMessageModel alloc] init];
|
|
|
|
+ buttonModel.title = @"机构教程";
|
|
|
|
+ buttonModel.linkUrl = [NSString stringWithFormat:@"%@%@",WEBHOST,@"/#/train-tool"];
|
|
|
|
+ buttonModel.coverImage = @"tenantAlbum_button";
|
|
|
|
+ buttonModel.isLocalButton = YES;
|
|
|
|
+ [self.buttonArray addObject:buttonModel];
|
|
|
|
+ }
|
|
|
|
+ CGFloat buttonSpace = (KPortraitWidth - BUTTON_ROWCOUNT * HOME_BUTTONWIDTH) / (BUTTON_ROWCOUNT + 1);
|
|
|
|
+ // 添加按钮
|
|
if (self.buttonArray.count) {
|
|
if (self.buttonArray.count) {
|
|
-
|
|
|
|
self.buttonContainer.hidden = NO;
|
|
self.buttonContainer.hidden = NO;
|
|
- // 添加按钮
|
|
|
|
- if (self.buttonArray.count > 4) { // 大于4个显示底部滚动视图
|
|
|
|
- self.buttonContainer.buttonPageCtrl.hidden = NO;
|
|
|
|
- self.buttonContainer.buttonDotLeft.constant = 0;
|
|
|
|
- NSInteger addPage = (self.buttonArray.count % 4) > 0 ? 1 : 0;
|
|
|
|
- NSInteger pageCount = self.buttonArray.count / 4 + addPage;
|
|
|
|
- self.buttonDotWidth = 36 / pageCount;
|
|
|
|
- self.buttonContainer.buttonDotWidth.constant = self.buttonDotWidth;
|
|
|
|
- self.buttonScrollView.contentSize = CGSizeMake(containerWidth * pageCount, BUTTONHEIGHT);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- self.buttonContainer.buttonPageCtrl.hidden = YES;
|
|
|
|
- self.buttonScrollView.contentSize = CGSizeMake(containerWidth, BUTTONHEIGHT);
|
|
|
|
|
|
+ CGFloat xSpace = 0.0f;
|
|
|
|
+ CGFloat ySpace = 0.0f;
|
|
|
|
+ for (NSInteger i = 0; i < self.buttonArray.count; i++) {
|
|
|
|
+ xSpace = buttonSpace / 2 + (i % BUTTON_ROWCOUNT) * (HOME_BUTTONWIDTH + buttonSpace);
|
|
|
|
+ ySpace = (i / BUTTON_ROWCOUNT) * (HOME_BUTTONHEIGHT + HOME_BUTTON_VERTICAL_SPACE);
|
|
|
|
+ HomeMessageModel *model = self.buttonArray[i];
|
|
|
|
+ KSHomeButton *buttonView = [KSHomeButton shareInstance];
|
|
|
|
+ if (model.isLocalButton) {
|
|
|
|
+ [buttonView.buttonImage setImage:[UIImage imageNamed:model.coverImage]];
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ [buttonView.buttonImage sd_setImageWithURL:[NSURL URLWithString:[model.coverImage getUrlEndcodeString]]];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ buttonView.buttonTitle.text = model.title;
|
|
|
|
+ buttonView.frame = CGRectMake(xSpace, ySpace, HOME_BUTTONWIDTH, HOME_BUTTONHEIGHT);
|
|
|
|
+
|
|
|
|
+ buttonView.actionButton.tag = 3000 + i;
|
|
|
|
+ [buttonView.actionButton addTarget:self action:@selector(HomeTopButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
+ [self.buttonContainer.buttonContentView addSubview:buttonView];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
self.buttonContainer.hidden = YES;
|
|
self.buttonContainer.hidden = YES;
|
|
- self.buttonContainer.buttonPageCtrl.hidden = YES;
|
|
|
|
- self.buttonScrollView.contentSize = CGSizeMake(containerWidth, CGFLOAT_MIN);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- self.buttonScrollView.contentOffset = CGPointMake(0, 0);
|
|
|
|
- [self.buttonScrollView removeAllSubViews];
|
|
|
|
- CGFloat leftSpace = 10.0f;
|
|
|
|
- CGFloat buttonSpace = (containerWidth - 4 * BUTTONWIDTH - leftSpace * 2) / 3;
|
|
|
|
-
|
|
|
|
- for (NSInteger i = 0; i < self.buttonArray.count; i++) {
|
|
|
|
- HomeMessageModel *model = self.buttonArray[i];
|
|
|
|
- KSHomeButton *buttonView = [KSHomeButton shareInstance];
|
|
|
|
-
|
|
|
|
- [buttonView.buttonImage sd_setImageWithURL:[NSURL URLWithString:[model.coverImage getUrlEndcodeString]]];
|
|
|
|
- buttonView.buttonTitle.text = model.title;
|
|
|
|
- buttonView.frame = CGRectMake(leftSpace + (i % 4) * (BUTTONWIDTH + buttonSpace) + (i / 4) * containerWidth, 0, BUTTONWIDTH, BUTTONHEIGHT);
|
|
|
|
- buttonView.actionButton.tag = 3000 + i;
|
|
|
|
- [buttonView.actionButton addTarget:self action:@selector(HomeTopButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
- [self.buttonScrollView addSubview:buttonView];
|
|
|
|
- }
|
|
|
|
|
|
+ // 高度
|
|
|
|
+ CGFloat buttonViewDefaultHeight = [HomeButtonView getViewHeight:self.buttonArray.count];
|
|
|
|
+ self.buttonViewHeight = buttonViewDefaultHeight;
|
|
|
|
+ [self.buttonContainer mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.height.mas_equalTo(buttonViewDefaultHeight);
|
|
|
|
+ }];
|
|
}
|
|
}
|
|
|
|
|
|
- (void)HomeTopButtonAction:(UIButton *)sender {
|
|
- (void)HomeTopButtonAction:(UIButton *)sender {
|
|
@@ -534,6 +474,14 @@
|
|
ToneTuningViewController *ctrl = [[ToneTuningViewController alloc] init];
|
|
ToneTuningViewController *ctrl = [[ToneTuningViewController alloc] init];
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
}
|
|
}
|
|
|
|
+ else if ([model.linkUrl isEqualToString:@"native-homepage"]) {
|
|
|
|
+ MinePageViewController *pageCtrl = [[MinePageViewController alloc] init];
|
|
|
|
+ [self.navigationController pushViewController:pageCtrl animated:YES];
|
|
|
|
+ }
|
|
|
|
+ else if ([model.linkUrl isEqualToString:@"native-homework"]) {
|
|
|
|
+ HomeworkListViewController *ctrl = [[HomeworkListViewController alloc] init];
|
|
|
|
+ [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
|
+ }
|
|
else {
|
|
else {
|
|
KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
|
|
KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
|
|
webCtrl.url = [model.linkUrl getUrlEndcodeString];
|
|
webCtrl.url = [model.linkUrl getUrlEndcodeString];
|
|
@@ -667,11 +615,10 @@
|
|
}
|
|
}
|
|
|
|
|
|
- (void)configUI {
|
|
- (void)configUI {
|
|
- CGFloat navHeight = IS_iPhoneX ? 100 : 70;
|
|
|
|
|
|
+ CGFloat navHeight = [HomeNavView getViewHeight];
|
|
[self.view addSubview:self.navView];
|
|
[self.view addSubview:self.navView];
|
|
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
- make.width.mas_equalTo(kScreenWidth);
|
|
|
|
- make.right.top.mas_equalTo(self.view);
|
|
|
|
|
|
+ make.left.right.top.mas_equalTo(self.view);
|
|
make.height.mas_equalTo(navHeight);
|
|
make.height.mas_equalTo(navHeight);
|
|
}];
|
|
}];
|
|
[self.view bringSubviewToFront:self.navView];
|
|
[self.view bringSubviewToFront:self.navView];
|
|
@@ -697,6 +644,10 @@
|
|
[weakSelf requestHomeMessage];
|
|
[weakSelf requestHomeMessage];
|
|
}];
|
|
}];
|
|
|
|
|
|
|
|
+ // 背景
|
|
|
|
+ [self.scrollView addSubview:self.headBgView];
|
|
|
|
+
|
|
|
|
+
|
|
// header
|
|
// header
|
|
[self.scrollView addSubview:self.headView];
|
|
[self.scrollView addSubview:self.headView];
|
|
CGFloat headHeight = [self.headView getViewHeight];
|
|
CGFloat headHeight = [self.headView getViewHeight];
|
|
@@ -706,58 +657,60 @@
|
|
make.height.mas_equalTo(headHeight);
|
|
make.height.mas_equalTo(headHeight);
|
|
}];
|
|
}];
|
|
|
|
|
|
- [self.scrollView addSubview:self.bannerView];
|
|
|
|
-
|
|
|
|
- [self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
|
+ // 最近课程
|
|
|
|
+ [self.scrollView addSubview:self.courseView];
|
|
|
|
+ [self.courseView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.top.mas_equalTo(self.headView.mas_bottom);
|
|
make.top.mas_equalTo(self.headView.mas_bottom);
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
}];
|
|
}];
|
|
-
|
|
|
|
- // 按钮
|
|
|
|
- [self.scrollView addSubview:self.buttonContainer];
|
|
|
|
- [self.buttonContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
|
+ self.courseView.hidden = YES;
|
|
|
|
+ // banner
|
|
|
|
+ [self.scrollView addSubview:self.bannerView];
|
|
|
|
+ [self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.left.right.mas_equalTo(self.view);
|
|
- make.top.mas_equalTo(self.bannerView.mas_bottom);
|
|
|
|
|
|
+ make.top.mas_equalTo(self.courseView.mas_bottom);
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
}];
|
|
}];
|
|
- self.buttonContainer.hidden = YES;
|
|
|
|
|
|
+ self.bannerView.hidden = YES;
|
|
|
|
|
|
// 公告
|
|
// 公告
|
|
[self.scrollView addSubview:self.noticeView];
|
|
[self.scrollView addSubview:self.noticeView];
|
|
[self.noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
[self.noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.left.right.mas_equalTo(self.view);
|
|
- make.top.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
|
|
|
|
+ make.top.mas_equalTo(self.bannerView.mas_bottom);
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
}];
|
|
}];
|
|
-
|
|
|
|
[self.noticeView.adView addSubview:self.noticeScrollView];
|
|
[self.noticeView.adView addSubview:self.noticeScrollView];
|
|
[self.noticeScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
[self.noticeScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.left.right.bottom.mas_equalTo(self.noticeView.adView);
|
|
make.top.left.right.bottom.mas_equalTo(self.noticeView.adView);
|
|
}];
|
|
}];
|
|
self.noticeView.hidden = YES;
|
|
self.noticeView.hidden = YES;
|
|
- // 最近课程
|
|
|
|
- [self.scrollView addSubview:self.courseView];
|
|
|
|
- [self.courseView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
|
+
|
|
|
|
+ // 按钮
|
|
|
|
+ [self.scrollView addSubview:self.buttonContainer];
|
|
|
|
+ [self.buttonContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.top.mas_equalTo(self.noticeView.mas_bottom);
|
|
make.top.mas_equalTo(self.noticeView.mas_bottom);
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
make.height.mas_equalTo(CGFLOAT_MIN);
|
|
}];
|
|
}];
|
|
- self.courseView.hidden = YES;
|
|
|
|
|
|
+ self.buttonContainer.hidden = YES;
|
|
|
|
|
|
- [self.scrollView addSubview:self.tenantAlbumView];
|
|
|
|
- self.tenantAlbumHeight = CGFLOAT_MIN;
|
|
|
|
- [self.tenantAlbumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
- make.left.right.mas_equalTo(self.view);
|
|
|
|
- make.top.mas_equalTo(self.courseView.mas_bottom);
|
|
|
|
- make.height.mas_equalTo(self.tenantAlbumHeight);
|
|
|
|
|
|
+ [self.headBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.right.mas_equalTo(self.headView);
|
|
|
|
+ make.top.mas_equalTo(self.headView.mas_top);
|
|
|
|
+ make.bottom.mas_equalTo(self.buttonContainer.mas_bottom);
|
|
}];
|
|
}];
|
|
- self.tenantAlbumView.hidden = YES;
|
|
|
|
|
|
+
|
|
|
|
+ self.headBgView.layer.masksToBounds = YES;
|
|
|
|
+ self.headBgView.layer.cornerRadius = 18.0f;
|
|
|
|
+ self.headBgView.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner;
|
|
|
|
+
|
|
[self.scrollView addSubview:self.albumView];
|
|
[self.scrollView addSubview:self.albumView];
|
|
self.albumViewHeight = [HomeAlbumView getViewHeight];
|
|
self.albumViewHeight = [HomeAlbumView getViewHeight];
|
|
[self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
[self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.left.right.mas_equalTo(self.view);
|
|
- make.top.mas_equalTo(self.tenantAlbumView.mas_bottom);
|
|
|
|
|
|
+ make.top.mas_equalTo(self.headBgView.mas_bottom);
|
|
make.height.mas_equalTo(self.albumViewHeight);
|
|
make.height.mas_equalTo(self.albumViewHeight);
|
|
}];
|
|
}];
|
|
|
|
|
|
@@ -875,6 +828,14 @@
|
|
|
|
|
|
#pragma mark ----- lazying
|
|
#pragma mark ----- lazying
|
|
|
|
|
|
|
|
+- (UIView *)headBgView {
|
|
|
|
+ if (!_headBgView) {
|
|
|
|
+ _headBgView = [[UIView alloc] init];
|
|
|
|
+ _headBgView.backgroundColor = [UIColor whiteColor];
|
|
|
|
+ }
|
|
|
|
+ return _headBgView;
|
|
|
|
+}
|
|
|
|
+
|
|
- (HomeNavView *)navView {
|
|
- (HomeNavView *)navView {
|
|
if (!_navView) {
|
|
if (!_navView) {
|
|
_navView = [HomeNavView shareInstance];
|
|
_navView = [HomeNavView shareInstance];
|
|
@@ -913,12 +874,9 @@
|
|
}
|
|
}
|
|
|
|
|
|
- (void)openSettingView {
|
|
- (void)openSettingView {
|
|
- if (@available(iOS 10, *)) {
|
|
|
|
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
|
|
|
|
- } else {
|
|
|
|
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
|
|
|
|
- }
|
|
|
|
|
|
+ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
|
|
}
|
|
}
|
|
|
|
+
|
|
- (void)toMessageCenter {
|
|
- (void)toMessageCenter {
|
|
NotiferMessageViewController *messageCenter = [[NotiferMessageViewController alloc] init];
|
|
NotiferMessageViewController *messageCenter = [[NotiferMessageViewController alloc] init];
|
|
[self.navigationController pushViewController:messageCenter animated:YES];
|
|
[self.navigationController pushViewController:messageCenter animated:YES];
|
|
@@ -938,11 +896,6 @@
|
|
|
|
|
|
- (void)headAction:(HOMEHEADACTION)type {
|
|
- (void)headAction:(HOMEHEADACTION)type {
|
|
switch (type) {
|
|
switch (type) {
|
|
- case HOMEHEADACTION_DESC:
|
|
|
|
- {
|
|
|
|
- [self showDescAlert];
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
case HOMEHEADACTION_AUTH:
|
|
case HOMEHEADACTION_AUTH:
|
|
{
|
|
{
|
|
[self toAuthDetail];
|
|
[self toAuthDetail];
|
|
@@ -1049,18 +1002,6 @@
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-- (BadgeIntroduceView *)intruduceAlert {
|
|
|
|
- if (!_intruduceAlert) {
|
|
|
|
- _intruduceAlert = [BadgeIntroduceView shareInstance];
|
|
|
|
- _intruduceAlert.frame = CGRectMake(0, 0, KPortraitWidth, KPortraitHeight);
|
|
|
|
- }
|
|
|
|
- return _intruduceAlert;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-- (void)showDescAlert {
|
|
|
|
- [self.intruduceAlert showAlertInView:[NSObject getKeyWindow]];
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
- (void)toUserCenter {
|
|
- (void)toUserCenter {
|
|
UserSettingViewController *ctrl = [[UserSettingViewController alloc] init];
|
|
UserSettingViewController *ctrl = [[UserSettingViewController alloc] init];
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
[self.navigationController pushViewController:ctrl animated:YES];
|
|
@@ -1098,7 +1039,7 @@
|
|
_noticeScrollView.scrollEnabled = NO;
|
|
_noticeScrollView.scrollEnabled = NO;
|
|
_noticeScrollView.scrollDirection = UICollectionViewScrollDirectionVertical;
|
|
_noticeScrollView.scrollDirection = UICollectionViewScrollDirectionVertical;
|
|
_noticeScrollView.titleLabelTextColor = HexRGB(0x1a1a1a);
|
|
_noticeScrollView.titleLabelTextColor = HexRGB(0x1a1a1a);
|
|
- _noticeScrollView.titleLabelBackgroundColor = [UIColor whiteColor];
|
|
|
|
|
|
+ _noticeScrollView.titleLabelBackgroundColor = [UIColor clearColor];
|
|
_noticeScrollView.titleLabelTextFont = [UIFont systemFontOfSize:14];
|
|
_noticeScrollView.titleLabelTextFont = [UIFont systemFontOfSize:14];
|
|
_noticeScrollView.titlesGroup = self.titleArray;
|
|
_noticeScrollView.titlesGroup = self.titleArray;
|
|
}
|
|
}
|
|
@@ -1177,36 +1118,18 @@
|
|
|
|
|
|
#pragma mark ---- scroll view delegate
|
|
#pragma mark ---- scroll view delegate
|
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|
- if (scrollView == self.buttonScrollView) {
|
|
|
|
- NSInteger index = (NSInteger)(scrollView.contentOffset.x / (KPortraitWidth - 28));
|
|
|
|
-
|
|
|
|
- [UIView animateWithDuration:0.3f animations:^{
|
|
|
|
- self.buttonContainer.buttonDotLeft.constant = index * self.buttonDotWidth;
|
|
|
|
- }];
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
#pragma mark ---- button container
|
|
#pragma mark ---- button container
|
|
|
|
+
|
|
- (HomeButtonView *)buttonContainer {
|
|
- (HomeButtonView *)buttonContainer {
|
|
if (!_buttonContainer) {
|
|
if (!_buttonContainer) {
|
|
_buttonContainer = [HomeButtonView shareInstance];
|
|
_buttonContainer = [HomeButtonView shareInstance];
|
|
- [_buttonContainer.buttonContentView addSubview:self.buttonScrollView];
|
|
|
|
}
|
|
}
|
|
return _buttonContainer;
|
|
return _buttonContainer;
|
|
}
|
|
}
|
|
|
|
|
|
-- (UIScrollView *)buttonScrollView {
|
|
|
|
- if (!_buttonScrollView) {
|
|
|
|
- _buttonScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, (KPortraitWidth - 28), BUTTONHEIGHT)];
|
|
|
|
- _buttonScrollView.backgroundColor = [UIColor clearColor];
|
|
|
|
- _buttonScrollView.pagingEnabled = YES;
|
|
|
|
- _buttonScrollView.showsHorizontalScrollIndicator = NO;
|
|
|
|
- _buttonScrollView.showsVerticalScrollIndicator = NO;
|
|
|
|
- _buttonScrollView.delegate = self;
|
|
|
|
- }
|
|
|
|
- return _buttonScrollView;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
#pragma mark ---- collection data source
|
|
#pragma mark ---- collection data source
|
|
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
|
|
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
|
|
return 1;
|
|
return 1;
|
|
@@ -1294,7 +1217,7 @@
|
|
|
|
|
|
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
if (collectionView == self.albumCollectionView) {
|
|
if (collectionView == self.albumCollectionView) {
|
|
- return CGSizeMake(100, 140);
|
|
|
|
|
|
+ return CGSizeMake(100, 134);
|
|
|
|
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -1530,7 +1453,7 @@
|
|
if (!_bannerScroll) {
|
|
if (!_bannerScroll) {
|
|
_bannerScroll = [[TYCyclePagerView alloc] init];
|
|
_bannerScroll = [[TYCyclePagerView alloc] init];
|
|
_bannerScroll.backgroundColor = [UIColor clearColor];
|
|
_bannerScroll.backgroundColor = [UIColor clearColor];
|
|
- _bannerScroll.frame = CGRectMake(0, 0, kScreenWidth - 28, (kScreenWidth - 28) / 347 * 132);
|
|
|
|
|
|
+ _bannerScroll.frame = CGRectMake(0, 0, KPortraitWidth, (kScreenWidth - 28) / 347 * 132);
|
|
_bannerScroll.isInfiniteLoop = YES;
|
|
_bannerScroll.isInfiniteLoop = YES;
|
|
_bannerScroll.autoScrollInterval = 3.0f;
|
|
_bannerScroll.autoScrollInterval = 3.0f;
|
|
_bannerScroll.reloadDataNeedResetIndex = YES;
|
|
_bannerScroll.reloadDataNeedResetIndex = YES;
|
|
@@ -1586,7 +1509,7 @@
|
|
|
|
|
|
- (TYCyclePagerViewLayout *)layoutForPagerView:(TYCyclePagerView *)pageView {
|
|
- (TYCyclePagerViewLayout *)layoutForPagerView:(TYCyclePagerView *)pageView {
|
|
TYCyclePagerViewLayout *layout = [[TYCyclePagerViewLayout alloc]init];
|
|
TYCyclePagerViewLayout *layout = [[TYCyclePagerViewLayout alloc]init];
|
|
- layout.itemSize = CGSizeMake(kScreenWidth - 28, (kScreenWidth - 28) / 347 * 132);
|
|
|
|
|
|
+ layout.itemSize = CGSizeMake(kScreenWidth, (kScreenWidth - 28) / 347 * 132);
|
|
layout.itemSpacing = 0;
|
|
layout.itemSpacing = 0;
|
|
return layout;
|
|
return layout;
|
|
|
|
|
|
@@ -1641,22 +1564,6 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-- (HomeTenantPageView *)tenantAlbumView {
|
|
|
|
- if (!_tenantAlbumView) {
|
|
|
|
- _tenantAlbumView = [HomeTenantPageView shareInstance];
|
|
|
|
- MJWeakSelf;
|
|
|
|
- [_tenantAlbumView displayTenatantPage:^{
|
|
|
|
- [weakSelf showTenantAlbumPageView];
|
|
|
|
- }];
|
|
|
|
- }
|
|
|
|
- return _tenantAlbumView;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-- (void)showTenantAlbumPageView {
|
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
|
- ctrl.url = [NSString stringWithFormat:@"%@%@",WEBHOST,@"/#/train-tool"];
|
|
|
|
- [self.navigationController pushViewController:ctrl animated:YES];
|
|
|
|
-}
|
|
|
|
|
|
|
|
- (HomeTenantView *)tenantNameView {
|
|
- (HomeTenantView *)tenantNameView {
|
|
if (!_tenantNameView) {
|
|
if (!_tenantNameView) {
|