Jelajahi Sumber

首页资讯和风采加载更多

Steven 2 tahun lalu
induk
melakukan
d5948d1716

+ 0 - 6
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj

@@ -866,7 +866,6 @@
 		BCFDA61828BC8FDE0022B497 /* HomeHotLiveCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCFDA61628BC8FDE0022B497 /* HomeHotLiveCell.xib */; };
 		BCFDA61B28BC90310022B497 /* HomePageHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFDA61A28BC90310022B497 /* HomePageHeaderView.m */; };
 		BCFDA61D28BC903C0022B497 /* HomePageHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCFDA61C28BC903C0022B497 /* HomePageHeaderView.xib */; };
-		BCFDA62028BC93C80022B497 /* NewHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFDA61F28BC93C80022B497 /* NewHomeViewController.m */; };
 		BCFDA62428BC94400022B497 /* HomeNavSearchView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFDA62328BC94400022B497 /* HomeNavSearchView.m */; };
 		BCFDA62628BC94480022B497 /* HomeNavSearchView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCFDA62528BC94480022B497 /* HomeNavSearchView.xib */; };
 		BCFDA62E28BC99410022B497 /* HomeBannerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFDA62828BC99410022B497 /* HomeBannerCell.m */; };
@@ -2402,8 +2401,6 @@
 		BCFDA61928BC90310022B497 /* HomePageHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomePageHeaderView.h; sourceTree = "<group>"; };
 		BCFDA61A28BC90310022B497 /* HomePageHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomePageHeaderView.m; sourceTree = "<group>"; };
 		BCFDA61C28BC903C0022B497 /* HomePageHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageHeaderView.xib; sourceTree = "<group>"; };
-		BCFDA61E28BC93C70022B497 /* NewHomeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NewHomeViewController.h; sourceTree = "<group>"; };
-		BCFDA61F28BC93C80022B497 /* NewHomeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NewHomeViewController.m; sourceTree = "<group>"; };
 		BCFDA62228BC94400022B497 /* HomeNavSearchView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeNavSearchView.h; sourceTree = "<group>"; };
 		BCFDA62328BC94400022B497 /* HomeNavSearchView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeNavSearchView.m; sourceTree = "<group>"; };
 		BCFDA62528BC94480022B497 /* HomeNavSearchView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeNavSearchView.xib; sourceTree = "<group>"; };
@@ -2800,8 +2797,6 @@
 			children = (
 				275FA1F427E7356A00CFEA2E /* HomeViewController.h */,
 				275FA1F327E7356A00CFEA2E /* HomeViewController.m */,
-				BCFDA61E28BC93C70022B497 /* NewHomeViewController.h */,
-				BCFDA61F28BC93C80022B497 /* NewHomeViewController.m */,
 			);
 			path = Controller;
 			sourceTree = "<group>";
@@ -6605,7 +6600,6 @@
 				2779353E27E324A60010E277 /* UIDevice+TFDevice.m in Sources */,
 				2723B5C027F157B100E0B90B /* ChatAddressHeaderView.m in Sources */,
 				2723B68127F15D3D00E0B90B /* ModifyNameViewController.m in Sources */,
-				BCFDA62028BC93C80022B497 /* NewHomeViewController.m in Sources */,
 				2779359927E324A80010E277 /* NSBundle+TZImagePicker.m in Sources */,
 				2779358E27E324A80010E277 /* WMPlayerModel.m in Sources */,
 				2779354E27E324A70010E277 /* KSAudioSessionManager.m in Sources */,

TEMPAT SAMPAH
KulexiuForStudent/KulexiuForStudent.xcworkspace/xcuserdata/wangzhi.xcuserdatad/UserInterfaceState.xcuserstate


+ 53 - 21
KulexiuForStudent/KulexiuForStudent.xcworkspace/xcuserdata/wangzhi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -519,22 +519,6 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "EB1CAF44-C1EE-42A4-8F62-76ED6C2F5924"
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KulexiuForStudent/Module/Home/Controller/NewHomeViewController.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1248"
-            endingLineNumber = "1248"
-            landmarkName = "-homeNavAction:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
             uuid = "8CC6F8FD-6841-4923-8FDB-B8F040B84FB5"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
@@ -647,16 +631,64 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "86DC858A-E760-4FAD-B72F-575EF97630F2"
+            uuid = "E4B6561E-126D-4140-B2B7-84FB5FF41267"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/Common/Base/KSAccompanyWebViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "647"
+            endingLineNumber = "647"
+            landmarkName = "-userContentController:didReceiveScriptMessage:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "FC352D59-3F71-4ABC-972B-D35C29F45704"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/Common/Base/KSAccompanyWebViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1107"
+            endingLineNumber = "1107"
+            landmarkName = "-showCustomLoading"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "9A08094F-35E5-4ADD-9EF1-C45E09861E3D"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/Common/Base/AccompanyLoadingView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "43"
+            endingLineNumber = "43"
+            landmarkName = "-showLoading"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "F407B7D6-93C9-469A-9BAD-A75B982ABBDE"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "KulexiuForStudent/Module/Home/Controller/NewHomeViewController.m"
+            filePath = "KulexiuForStudent/Module/Home/Controller/HomeViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1006"
-            endingLineNumber = "1006"
-            landmarkName = "-pagerView:mainTableViewDidScroll:"
+            startingLineNumber = "657"
+            endingLineNumber = "657"
+            landmarkName = "-requestInformationList"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>

+ 12 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h

@@ -639,6 +639,18 @@ NS_ASSUME_NONNULL_BEGIN
 /// @param faliure 失败
 + (void)queryTeacherLivingListRequest:(NSString *)get success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
+
+// /api-cms/news/page
+
+/// 资讯分页查询
+/// @param post post
+/// @param page 页数
+/// @param rows 条数
+/// @param version version
+/// @param success 成功
+/// @param faliure 失败
++ (void)informationListRequest:(NSString *)post page:(NSInteger)page rows:(NSInteger)rows version:(NSString *)version success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
+
 #pragma mark ---- 地址服务
 // /api-mall-portal/member/address/list
 

+ 21 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m

@@ -1319,6 +1319,27 @@
     [self request:get andWithUrl:url and:nil success:success faliure:faliure];
 }
 
+// /api-cms/news/page
+
+/// 资讯分页查询
+/// @param post post
+/// @param page 页数
+/// @param rows 条数
+/// @param version version
+/// @param success 成功
+/// @param faliure 失败
++ (void)informationListRequest:(NSString *)post page:(NSInteger)page rows:(NSInteger)rows version:(NSString *)version success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
+    NSString *url = [NSString stringWithFormat:@"%@%@", hostURL, @"/api-cms/news/page"];
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:@"STUDENT" forKey:@"platformType"];
+    [parm setValue:@"1" forKey:@"type"];
+    [parm setValue:@"1" forKey:@"status"];
+//    [parm setValue:version forKey:@"version"];
+    [parm setValue:@(page) forKey:@"page"];
+    [parm setValue:@(rows) forKey:@"rows"];
+    [self request:post andWithUrl:url and:parm success:success faliure:faliure];
+}
+
 #pragma mark ---- 地址服务
 // /api-mall-portal/member/address/list
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSTabBarViewController.m

@@ -25,7 +25,7 @@
 }
 
 - (void)configItems {
-    NSArray *controllerArray = @[@"NewHomeViewController",@"CourseViewController",@"ChatViewController",@"ShopMallViewController",@"MineViewController"];
+    NSArray *controllerArray = @[@"HomeViewController",@"CourseViewController",@"ChatViewController",@"ShopMallViewController",@"MineViewController"];
     NSArray *titleArray = @[@"首页",@"课表",@"聊天",@"商城",@"我的"];
     NSArray *imageArray = @[@"tab_home_unselected",@"tab_course_unselected",@"tab_chat_unselected",@"tab_mall_unselected",@"tab_mine_unselected"];
     NSArray *selectedImgArray = @[@"tab_home_selected",@"tab_course_selected",@"tab_chat_selected",@"tab_mall_selected",@"tab_mine_selected"];

+ 6 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/HomeViewController.h

@@ -6,11 +6,17 @@
 //
 
 #import "KSBaseViewController.h"
+#import "JXCategoryTitleView.h"
+#import "JXPagerView.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface HomeViewController : KSBaseViewController
 
+@property (nonatomic, strong) JXPagerView *pagerView;
+@property (nonatomic, strong, readonly) JXCategoryTitleView *categoryView;
+@property (nonatomic, strong) NSArray <NSString *> *titles;
+
 @end
 
 NS_ASSUME_NONNULL_END

File diff ditekan karena terlalu besar
+ 533 - 373
KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/HomeViewController.m


+ 0 - 22
KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/NewHomeViewController.h

@@ -1,22 +0,0 @@
-//
-//  NewHomeViewController.h
-//  KulexiuForStudent
-//
-//  Created by 王智 on 2022/8/29.
-//
-
-#import "KSBaseViewController.h"
-#import "JXCategoryTitleView.h"
-#import "JXPagerView.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface NewHomeViewController : KSBaseViewController
-
-@property (nonatomic, strong) JXPagerView *pagerView;
-@property (nonatomic, strong, readonly) JXCategoryTitleView *categoryView;
-@property (nonatomic, strong) NSArray <NSString *> *titles;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 1749
KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/NewHomeViewController.m

@@ -1,1749 +0,0 @@
-//
-//  NewHomeViewController.m
-//  KulexiuForStudent
-//
-//  Created by 王智 on 2022/8/29.
-//
-
-#import "NewHomeViewController.h"
-#import "KSBaseWKWebViewController.h"
-#import "InstrumentChooseViewController.h"
-#import "NotiferMessageViewController.h"
-#import "HomeNavSearchView.h"
-#import "KSScanViewController.h"
-#import "HomeBannerView.h"
-#import <UIButton+WebCache.h>
-#import "TYCyclePagerView.h"
-#import "TYPageControl.h"
-#import "HomeBannerCell.h"
-
-#import "HomeBannerCell.h"
-#import "HomeButtonView.h"
-#import "KSHomeButton.h"
-
-#import "PublicNoticeView.h"
-#import "SDCycleScrollView.h"
-#import "NoticeSourceModel.h"
-
-#import "AppDelegate.h"
-#import "StudentInfoModel.h"
-#import "UserInfoManager.h"
-
-#import "HomeRecentCourseView.h"
-#import "AccompanyDetailViewController.h"
-#import "MusicRoomDetailViewController.h"
-
-#import "HomeHotAlbumView.h"
-#import "HomeAlbumModel.h"
-#import "HomeHotAlbumCell.h"
-
-#import "HomeHotMusicView.h"
-#import "HomeHotMusicCollectionCell.h"
-#import "KSPremissionAlert.h"
-#import "RecordCheckManager.h"
-#import "KSAccompanyWebViewController.h"
-
-#import "HomeHotTalentView.h"
-#import "HomeHotTalentCell.h"
-#import "TalentTeacherModel.h"
-
-#import "HomeHotVideoCourseView.h"
-#import "HomeHotVideoCell.h"
-#import "HomeVideoGroupModel.h"
-
-#import "HomeHotLiveCourseView.h"
-#import "HomeHotLiveCell.h"
-#import "HomeLiveGroupModel.h"
-
-#import "JXCategoryView.h"
-#import "JXPagerListRefreshView.h"
-#import "HomePageBodyView.h"
-#import "HomeInformationBodyView.h"
-
-#import "TeacherStyleModel.h"
-#import "HomeTeacherLiveModel.h"
-
-#define BUTTONWIDTH (65)
-#define BUTTONHEIGHT (80)
-
-@interface NewHomeViewController ()<JXPagerViewDelegate, JXPagerMainTableViewGestureDelegate,JXCategoryViewDelegate,SDCycleScrollViewDelegate,UIScrollViewDelegate,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,TYCyclePagerViewDataSource,TYCyclePagerViewDelegate>
-
-@property (nonatomic, strong) StudentInfoModel *mineInfo;
-
-@property (nonatomic, strong) HomeNavSearchView *navView;
-
-@property (nonatomic, strong) HomeMessageModel *flashModel;
-@property (nonatomic, assign) BOOL isFirstLoad;
-
-// banner
-@property (nonatomic, strong) TYPageControl *pageControl;
-@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) PublicNoticeView *noticeView;
-@property (nonatomic, strong) SDCycleScrollView *noticeScrollView;
-@property (nonatomic, strong) NSMutableArray *noticeArray; // notice数据
-@property (nonatomic, strong) NSMutableArray *noticeTitleArray; // 标题数组
-@property (nonatomic, assign) CGFloat noticeViewHeight;
-
-// 最近课程
-@property (nonatomic, strong) HomeRecentCourseView *courseView;
-@property (nonatomic, assign) CGFloat courseViewHeight;
-@property (nonatomic, strong) RecentCourseModel *recentCourseModel;
-
-// 热门专辑
-@property (nonatomic, strong) HomeHotAlbumView *albumView;
-@property (nonatomic, strong) NSMutableArray *albumArray;
-@property (nonatomic, strong) UICollectionView *albumCollectionView; // 专辑容器
-@property (nonatomic, assign) CGFloat albumViewHeight; // album 高度
-
-// 热门曲谱
-@property (nonatomic, strong) HomeHotMusicView *hotMusicView;
-@property (nonatomic, strong) UICollectionView *musicCollectionView; // 曲谱容器
-@property (nonatomic, strong) NSMutableArray *musicArray; // 曲谱数据
-@property (nonatomic, assign) CGFloat musicViewHeight; // music 高度
-// 推荐达人
-@property (nonatomic, strong) HomeHotTalentView *talentView;
-@property (nonatomic, strong) UICollectionView *talentCollectionView; // 推荐达人容器
-@property (nonatomic, strong) NSMutableArray *talentArray; // 推荐达人数据
-@property (nonatomic, assign) CGFloat talentViewHeight; // talent 高度
-
-// 视频课
-@property (nonatomic, strong) HomeHotVideoCourseView *videoCourseView;
-@property (nonatomic, strong) UICollectionView *videoCollectionView; // 视频课容器
-@property (nonatomic, strong) NSMutableArray *videoCourseArray; // 视频课数据
-@property (nonatomic, assign) CGFloat videoViewHeight; // video 高度
-
-// 直播课
-@property (nonatomic, strong) HomeHotLiveCourseView *liveCourseView;
-@property (nonatomic, strong) UICollectionView *liveCollectionView; // 直播课容器
-@property (nonatomic, strong) NSMutableArray *liveCourseArray; // 直播课数据
-@property (nonatomic, assign) CGFloat liveViewHeight; // live 高度
-
-@property (nonatomic, strong) dispatch_group_t requestGroup;
-
-// 顶部数据容器
-@property (nonatomic, strong) UIView *headView;
-
-@property (nonatomic, strong) JXCategoryTitleView *myCategoryView;
-
-@property (nonatomic, assign) NSInteger currentIndex;
-
-@property (nonatomic, strong) NSMutableArray *listViewArray;
-
-@property (nonatomic, assign) NSInteger headViewHeight;
-
-
-@property (nonatomic, strong) NSMutableArray *teacherArray;
-@property (nonatomic, strong) NSMutableArray *liveListArray;
-@property (nonatomic, strong) NSMutableArray *informationArray;
-
-@property (nonatomic, strong) UIView *headBgView;
-
-@end
-
-@implementation NewHomeViewController
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
-    self.ks_prefersNavigationBarHidden = YES;
-    _titles = @[@"达人风采",@"热门资讯"];
-    self.isFirstLoad = YES;
-    [self configNavView];
-    [self configUI];
-}
-
-- (void)requestTrackAuth {
-    
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    [appDelegate appTrackActionAuth];
-}
-
-- (void)configNavView {
-    [self.scrollView removeFromSuperview];
-    [self.view addSubview:self.navView];
-    [self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.top.mas_equalTo(self.view);
-        make.height.mas_equalTo(kNaviBarHeight);
-    }];
-    [self.view bringSubviewToFront:self.navView];
-}
-
-- (void)configHeadView {
-    [self.headView addSubview:self.headBgView];
-    
-    // banner
-    [self.headView addSubview:self.bannerView];
-    self.bannerViewHeight = [HomeBannerView getViewHeight];
-    [self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.top.mas_equalTo(self.headView);
-        make.height.mas_equalTo(self.bannerViewHeight);
-    }];
-    
-    // 按钮
-    [self.headView addSubview:self.buttonContainer];
-    self.buttonViewHeight = CGFLOAT_MIN;
-    [self.buttonContainer mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.headView);
-        make.top.mas_equalTo(self.bannerView.mas_bottom);
-        make.height.mas_equalTo(CGFLOAT_MIN);
-    }];
-    self.buttonContainer.hidden = YES;
-    
-    // 公告
-    [self.headView addSubview:self.noticeView];
-    self.noticeViewHeight = CGFLOAT_MIN;
-    [self.noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.headView);
-        make.top.mas_equalTo(self.buttonContainer.mas_bottom);
-        make.height.mas_equalTo(CGFLOAT_MIN);
-    }];
-    [self.noticeView.adView addSubview:self.noticeScrollView];
-    [self.noticeScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.left.right.bottom.mas_equalTo(self.noticeView.adView);
-    }];
-    self.noticeView.hidden = YES;
-    
-    // 最近课程
-    [self.headView addSubview:self.courseView];
-    self.courseViewHeight = CGFLOAT_MIN;
-    [self.courseView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.headView);
-        make.top.mas_equalTo(self.noticeView.mas_bottom);
-        make.height.mas_equalTo(CGFLOAT_MIN);
-    }];
-    self.courseView.hidden = YES;
-    
-    // 热门专辑
-    [self.headView addSubview:self.albumView];
-    self.albumViewHeight = [HomeHotAlbumView getViewHeight];
-    [self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.headView);
-        make.top.mas_equalTo(self.courseView.mas_bottom);
-        make.height.mas_equalTo(self.albumViewHeight);
-    }];
-    
-    // 热门曲目
-    [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.albumView.mas_bottom);
-        make.height.mas_equalTo(self.musicViewHeight);
-    }];
-    
-    // 推荐达人
-    [self.headView addSubview:self.talentView];
-    self.talentViewHeight = CGFLOAT_MIN;
-    [self.talentView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.headView);
-        make.top.mas_equalTo(self.hotMusicView.mas_bottom);
-        make.height.mas_equalTo(self.talentViewHeight);
-    }];
-    self.talentView.hidden = YES;
-    
-    // 视频课
-    [self.headView addSubview:self.videoCourseView];
-    self.videoViewHeight = CGFLOAT_MIN;
-    [self.videoCourseView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.headView);
-        make.top.mas_equalTo(self.talentView.mas_bottom);
-        make.height.mas_equalTo(self.videoViewHeight);
-    }];
-    self.videoCourseView.hidden = YES;
-    // 直播
-    [self.headView addSubview:self.liveCourseView];
-    self.liveViewHeight = CGFLOAT_MIN;
-    [self.liveCourseView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.headView);
-        make.top.mas_equalTo(self.videoCourseView.mas_bottom);
-        make.height.mas_equalTo(self.liveViewHeight);
-    }];
-    self.liveCourseView.hidden = YES;
-    
-    [self.headBgView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.headView);
-        make.top.mas_equalTo(self.bannerView.mas_top);
-        make.bottom.mas_equalTo(self.buttonContainer.mas_bottom);
-    }];
-    
-    self.headBgView.layer.masksToBounds = YES;
-    self.headBgView.layer.cornerRadius = 18.0f;
-    self.headBgView.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner;
-    
-    [self refreshHeadHeight];
-}
-
-- (void)refreshHeadHeight {
-    CGFloat bottomSpace = 20.0f;
-    self.headViewHeight = self.bannerViewHeight + self.buttonViewHeight + self.noticeViewHeight + self.courseViewHeight + self.albumViewHeight + self.musicViewHeight + self.talentViewHeight + self.liveViewHeight + self.videoViewHeight + bottomSpace;
-    [self.pagerView reloadData];
-}
-
-- (void)configUI {
-    [self configHeadView];
-    
-    _categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, kNaviBarHeight, kScreenWidth, 44)];
-    self.categoryView.backgroundColor = [UIColor clearColor];
-    self.categoryView.titles = self.titles;
-    self.categoryView.delegate = self;
-    self.categoryView.titleFont = [UIFont systemFontOfSize:18.0f weight:UIFontWeightMedium];
-    self.categoryView.titleSelectedFont = [UIFont systemFontOfSize:18.0f weight:UIFontWeightMedium];
-    self.categoryView.titleSelectedColor = HexRGB(0x333333);
-    self.categoryView.titleColor = HexRGB(0x999999);
-    self.categoryView.titleColorGradientEnabled = YES;
-    self.categoryView.cellWidth = 90.0f;
-    self.categoryView.cellSpacing = 16.0f;
-    self.categoryView.averageCellSpacingEnabled = NO;
-    JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
-    lineView.verticalMargin = 10;
-    lineView.indicatorColor = THEMECOLOR;
-    lineView.indicatorWidth = 63.0f;
-    lineView.indicatorHeight = 12.0f;
-    self.categoryView.indicators = @[lineView];
-    
-    _pagerView = [self preferredPagingView];
-    self.pagerView.frame = CGRectMake(0, kNaviBarHeight, kScreenWidth, kScreenHeight - kNaviBarHeight - kTabBarHeight);
-    self.pagerView.mainTableView.gestureDelegate = self;
-    [self.view addSubview:self.pagerView];
-    self.pagerView.backgroundColor = [UIColor clearColor];
-    self.pagerView.mainTableView.backgroundColor = [UIColor clearColor];
-    self.categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagerView.listContainerView;
-
-    // 头部刷新
-    MJWeakSelf;
-    self.pagerView.mainTableView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
-        [weakSelf requestData];
-    }];
-}
-
-- (void)viewDidAppear:(BOOL)animated {
-    [super viewDidAppear:animated];
-    self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0);
-}
-
-- (JXPagerView *)preferredPagingView {
-    return [[JXPagerView alloc] initWithDelegate:self];
-}
-
-- (void)viewWillAppear:(BOOL)animated {
-    [super viewWillAppear:animated];
-    if (self.isFirstLoad == YES) {
-        [self requestUserInfo:YES]; // 获取声部
-        [self requestTrackAuth];
-        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-        [appDelegate handleNotiferSource];
-    }
-    else {
-        [self requestUserInfo:YES];
-    }
-    [self requestUnreadCount];
-    
-}
-
-- (void)requestUnreadCount {
-    [KSNetworkingManager queryCountOfUnreadRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
-        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
-            NSArray *countArray = [dic arrayValueForKey:@"data"];
-            NSInteger courseCount = 0;
-            NSInteger sysCount = 0;
-            for (NSDictionary *parm in countArray) {
-                if ([[parm stringValueForKey:@"key"] isEqualToString:@"COURSE"]) {
-                    courseCount = [parm integerValueForKey:@"value"];
-                }
-                if ([[parm stringValueForKey:@"key"] isEqualToString:@"SYSTEM"]) {
-                    sysCount = [parm integerValueForKey:@"value"];
-                }
-            }
-            if (courseCount != 0 || sysCount != 0) {
-                self.navView.dotView.hidden = NO;
-            }
-            else {
-                self.navView.dotView.hidden = YES;
-            }
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        
-    }];
-}
-
-- (void)requestUserInfo:(BOOL)checkSubject {
-    self.isFirstLoad = NO;
-    [KSNetworkingManager queryStudentInfoRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
-        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
-            self.mineInfo = [[StudentInfoModel alloc] initWithDictionary:[dic dictionaryValueForKey:@"data"]];
-            NSString *rongToken = UserDefault(RongTokenKey);
-            if ([NSString isEmptyString:rongToken]) {
-                [USER_MANAGER queryUserInfoConnectRongCloud:YES];
-            }
-            [self refreshSource:checkSubject];
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        
-    }];
-}
-
-- (void)refreshSource:(BOOL)checkSubject {
-    if (checkSubject) {
-        if ([NSString isEmptyString:self.mineInfo.subjectName]) {
-            [self showInstrumentView:YES];
-        }
-        else {
-            [self requestData];
-        }
-    }
-}
-
-- (void)showInstrumentView:(BOOL)hideBackButton {
-    InstrumentChooseViewController *ctrl = [[InstrumentChooseViewController alloc] init];
-    MJWeakSelf;
-    [ctrl chooseCallback:^{
-        [weakSelf requestUserInfo:NO];
-        [weakSelf requestData];
-    }];
-    if (hideBackButton) {
-        ctrl.isModalPresent = YES;
-        CustomNavViewController *navCrtl = [[CustomNavViewController alloc] initWithRootViewController:ctrl];
-        navCrtl.modalPresentationStyle = UIModalPresentationFullScreen;
-        [self.navigationController presentViewController:navCrtl animated:YES completion:nil];
-    }
-    else {
-        [self.navigationController pushViewController:ctrl animated:YES];
-    }
-}
-
-- (void)requestNewsList {
-    dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager homeNewsList:KS_POST version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
-        dispatch_group_leave(self.requestGroup);
-        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
-            NSDictionary *result = [dic dictionaryValueForKey:@"data"];
-            // banner
-            NSArray *bannerArray = [result arrayValueForKey:@"banner"];
-            NSMutableArray *bannerInfoArray = [NSMutableArray array];
-            for (NSDictionary *parm in bannerArray) {
-                HomeMessageModel *model = [[HomeMessageModel alloc] initWithDictionary:parm];
-                [bannerInfoArray addObject:model];
-            }
-            self.bannerArray = [NSMutableArray arrayWithArray:bannerInfoArray];
-            
-            // button
-            NSArray *buttonArray = [result arrayValueForKey:@"appMenu"];
-            NSMutableArray *buttonInfoArray = [NSMutableArray array];
-            for (NSDictionary *parm in buttonArray) {
-                HomeMessageModel *model = [[HomeMessageModel alloc] initWithDictionary:parm];
-                [buttonInfoArray addObject:model];
-            }
-            self.buttonArray = [NSMutableArray arrayWithArray:buttonInfoArray];
-            
-            // news
-            NSArray *flashArray = [result arrayValueForKey:@"flashPage"];
-            if (flashArray.count) {
-                self.flashModel = [[HomeMessageModel alloc] initWithDictionary:[flashArray firstObject]];
-            }
-            
-            // information
-            NSArray *information = [result arrayValueForKey:@"information"];
-            NSMutableArray *informationInfoArray = [NSMutableArray array];
-            for (NSDictionary *parm in information) {
-                HomeMessageModel *model = [[HomeMessageModel alloc] initWithDictionary:parm];
-                [informationInfoArray addObject:model];
-            }
-            self.informationArray = [NSMutableArray arrayWithArray:informationInfoArray];
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
-    }];
-}
-
-- (void)requestHotAlbum {
-    dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager HomeHotAlbumRequest:KS_POST page:1 rows:10 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 *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];
-        }
-        
-    } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
-    }];
-}
-
-- (void)requestCourseInfo {
-    
-    dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager homeQueryLiveAndVideo:KS_GET version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
-        dispatch_group_leave(self.requestGroup);
-        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
-            NSDictionary *sourceDic = [dic dictionaryValueForKey:@"data"];
-            NSArray *liveList = [sourceDic arrayValueForKey:@"liveList"];
-            NSMutableArray *liveCourse = [NSMutableArray array];
-            for (NSDictionary *parm in liveList) {
-                HomeLiveGroupModel *model = [[HomeLiveGroupModel alloc] initWithDictionary:parm];
-                [liveCourse addObject:model];
-            }
-            self.liveCourseArray = [NSMutableArray arrayWithArray:liveCourse];
-            
-            NSArray *videoList = [sourceDic arrayValueForKey:@"videoList"];
-            NSMutableArray *videoCourse = [NSMutableArray array];
-            for (NSDictionary *parm in videoList) {
-                HomeVideoGroupModel *model = [[HomeVideoGroupModel alloc] initWithDictionary:parm];
-                [videoCourse addObject:model];
-            }
-            self.videoCourseArray = [NSMutableArray arrayWithArray:videoCourse];
-            
-            // 最近课程
-            NSDictionary *parm = [sourceDic dictionaryValueForKey:@"recentCourses"];
-            if (parm == nil) {
-                self.recentCourseModel = nil;
-            }
-            else {
-                self.recentCourseModel = [[RecentCourseModel alloc] initWithDictionary:parm];
-            }
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-        
-    } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
-    }];
-}
-
-- (void)requestNotice {
-    dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager helpCenterContentListRequest:KS_POST success:^(NSDictionary * _Nonnull dic) {
-        dispatch_group_leave(self.requestGroup);
-        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
-            NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
-            if (sourceArray.count) {
-                NSDictionary *parm = [sourceArray firstObject];
-                NoticeSourceModel *bannerModel = [[NoticeSourceModel alloc] initWithDictionary:parm];
-                [self.noticeArray addObject:bannerModel];
-                [self.noticeTitleArray addObject:bannerModel.title];
-            }
-            else {
-                self.noticeArray = [NSMutableArray array];
-                self.noticeTitleArray = [NSMutableArray array];
-            }
-        }
-        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];
-            for (NSDictionary *parm in sourceArray) {
-                HomeHotMusicModel *model = [[HomeHotMusicModel alloc] initWithDictionary:parm];
-                [musicArray addObject:model];
-            }
-            self.musicArray = [NSMutableArray arrayWithArray:musicArray];
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
-    }];
-}
-
-- (void)requestTalentSource {
-    dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager queryHotTeacherListRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
-        dispatch_group_leave(self.requestGroup);
-        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
-            NSArray *sourceArray = [dic arrayValueForKey:@"data"];
-            NSMutableArray *talentArray = [NSMutableArray array];
-            for (NSDictionary *parm in sourceArray) {
-                TalentTeacherModel *model = [[TalentTeacherModel alloc] initWithDictionary:parm];
-                [talentArray addObject:model];
-            }
-            self.talentArray = [NSMutableArray arrayWithArray:talentArray];
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
-    }];
-}
-
-- (void)requestTeacherStyle {
-    dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager homeQueryTeacherStyle:KS_POST page:1 rows:10 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 *styleArray = [NSMutableArray array];
-            for (NSDictionary *parm in sourceArray) {
-                TeacherStyleModel *model = [[TeacherStyleModel alloc] initWithDictionary:parm];
-                [styleArray addObject:model];
-            }
-            self.teacherArray = [NSMutableArray arrayWithArray:styleArray];
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-        // 回调
-    } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
-    }];
-}
-
-- (void)requestLiveList {
-    dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager queryTeacherLivingListRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
-        dispatch_group_leave(self.requestGroup);
-        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
-            NSArray *sourceArray = [dic arrayValueForKey:@"data"];
-            NSMutableArray *liveListArray = [NSMutableArray array];
-            for (NSDictionary *parm in sourceArray) {
-                HomeTeacherLiveModel *model = [[HomeTeacherLiveModel alloc] initWithDictionary:parm];
-                [liveListArray addObject:model];
-            }
-            self.liveListArray = [NSMutableArray arrayWithArray:liveListArray];
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
-    }];
-}
-
-- (void)requestData {
-    [self showhud];
-    [self requestNewsList];
-    [self requestNotice];
-    [self requestCourseInfo];
-    // 达人
-    [self requestTalentSource];
-    [self requestHotAlbum];
-    [self requestHotMusic];
-    
-    [self requestTeacherStyle];
-    [self requestLiveList];
-    dispatch_group_notify(self.requestGroup, dispatch_get_main_queue(), ^{
-        [self removehub];
-        [self.pagerView.mainTableView.mj_header endRefreshing];
-        [self refreshView];
-    });
-}
-
-
-- (void)refreshView {
-    [self refreshBannaerView];
-    [self showButtonMessage];
-    [self refreshNotice];
-    [self refreshCourseView:self.recentCourseModel];
-    
-    [self refreshAlbumView];
-    [self refreshMusicView];
-    // 达人
-    [self refreshTalentView];
-    // 课程
-    [self refreshCourseView];
-    
-    // 刷新排序
-    [self refreshViewLocation];
-    [self refreshHeadHeight];
-    
-    [self refreshPageView];
-}
-
-- (void)refreshPageView {
-    for (NSInteger i = 0; i < self.listViewArray.count; i++) {
-        id view = self.listViewArray[i];
-        if ([view isKindOfClass:[HomePageBodyView class]]) {
-            HomePageBodyView *styleView = (HomePageBodyView *)view;
-            styleView.styleArray = [self.teacherArray mutableCopy];
-            styleView.liveArray = [self.liveListArray mutableCopy];
-            [styleView beginFirstRefresh];
-        }
-        else if ([view isKindOfClass:[HomeInformationBodyView class]]) {
-            HomeInformationBodyView *informationView = (HomeInformationBodyView *)view;
-            informationView.informationArray = [self.informationArray mutableCopy];
-            [informationView beginFirstRefresh];
-        }
-    }
-}
-
-- (void)refreshTalentView {
-    if (self.talentArray.count) {
-        self.talentViewHeight = [HomeHotTalentView getViewHeight];
-        self.talentView.hidden = NO;
-    }
-    else {
-        self.talentViewHeight = CGFLOAT_MIN;
-        self.talentView.hidden = YES;
-    }
-    [self.talentView mas_updateConstraints:^(MASConstraintMaker *make) {
-        make.height.mas_equalTo(self.talentViewHeight);
-    }];
-    [self.talentCollectionView reloadData];
-}
-
-- (void)refreshViewLocation {
-    // 如果有课程和公告 且有按钮
-    CGFloat buttonViewDefaultHeight = self.buttonArray.count > 5 ? [HomeButtonView getViewHeight] : [HomeButtonView getViewHeight] - 20;
-    
-    if (self.noticeTitleArray.count && self.recentCourseModel && self.buttonArray.count) {
-        self.noticeViewHeight = [PublicNoticeView getViewHeight];
-        [self.noticeView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.mas_equalTo(self.headView);
-            make.top.mas_equalTo(self.bannerView.mas_bottom);
-            make.height.mas_equalTo(self.noticeViewHeight);
-        }];
-        self.buttonViewHeight = buttonViewDefaultHeight;
-        [self.buttonContainer mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.mas_equalTo(self.headView);
-            make.top.mas_equalTo(self.noticeView.mas_bottom);
-            make.height.mas_equalTo(self.buttonViewHeight);
-        }];
-        self.courseViewHeight = 91.0f;
-        [self.courseView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.mas_equalTo(self.headView);
-            make.top.mas_equalTo(self.buttonContainer.mas_bottom);
-            make.height.mas_equalTo(self.courseViewHeight);
-        }];
-        
-        [self.headBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.mas_equalTo(self.headView);
-            make.top.mas_equalTo(self.bannerView.mas_top);
-            make.bottom.mas_equalTo(self.buttonContainer.mas_bottom);
-        }];
-    }
-    else {
-        self.buttonViewHeight = self.buttonArray.count ? buttonViewDefaultHeight : CGFLOAT_MIN;
-        [self.buttonContainer mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.mas_equalTo(self.headView);
-            make.top.mas_equalTo(self.bannerView.mas_bottom);
-            make.height.mas_equalTo(self.buttonViewHeight);
-        }];
-        self.noticeViewHeight = self.noticeTitleArray.count ? [PublicNoticeView getViewHeight] : CGFLOAT_MIN;
-        [self.noticeView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.mas_equalTo(self.headView);
-            make.top.mas_equalTo(self.buttonContainer.mas_bottom);
-            make.height.mas_equalTo(self.noticeViewHeight);
-        }];
-        
-        [self.headBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.mas_equalTo(self.headView);
-            make.top.mas_equalTo(self.bannerView.mas_top);
-            make.bottom.mas_equalTo(self.noticeView.mas_bottom);
-        }];
-        
-        CGFloat courseViewHeight = self.recentCourseModel ? 90.0f : CGFLOAT_MIN;
-        self.courseViewHeight = courseViewHeight;
-        [self.courseView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.mas_equalTo(self.headView);
-            make.top.mas_equalTo(self.noticeView.mas_bottom);
-            make.height.mas_equalTo(self.courseViewHeight);
-        }];
-        
-    }
-}
-
-- (void)refreshBannaerView {
-    if (self.bannerArray.count > 1) {
-        self.bannerScroll.autoScrollInterval = 3.0f;
-        [self.bannerScroll addSubview:self.pageControl];
-    }
-    else {
-        self.bannerScroll.autoScrollInterval = 0;
-        [self.pageControl removeFromSuperview];
-    }
-    _pageControl.numberOfPages = self.bannerArray.count;
-    [self.bannerScroll reloadData];
-}
-
-- (void)showButtonMessage {
-    
-    // 添加按钮
-    if (self.buttonArray.count) {
-        self.buttonContainer.hidden = NO;
-        if (self.buttonArray.count > 5) { // 大于4个显示底部滚动视图
-            self.buttonContainer.buttonPageCtrl.hidden = NO;
-            self.buttonContainer.buttonDotLeft.constant = 0;
-            NSInteger addPage = (self.buttonArray.count % 5) > 0 ? 1 : 0;
-            NSInteger pageCount = self.buttonArray.count / 5 + addPage;
-            self.buttonDotWidth = 36 / pageCount;
-            self.buttonContainer.buttonDotWidth.constant = self.buttonDotWidth;
-            self.buttonScrollView.contentSize = CGSizeMake(kScreenWidth * pageCount, BUTTONHEIGHT);
-        }
-        else {
-            self.buttonContainer.buttonPageCtrl.hidden = YES;
-            self.buttonScrollView.contentSize = CGSizeMake(kScreenWidth, BUTTONHEIGHT);
-        }
-    }
-    else {
-        self.buttonContainer.hidden = YES;
-        self.buttonContainer.buttonPageCtrl.hidden = YES;
-        self.buttonScrollView.contentSize = CGSizeMake(kScreenWidth, CGFLOAT_MIN);
-    }
-    
-        
-    self.buttonScrollView.contentOffset = CGPointMake(0, 0);
-    [self.buttonScrollView removeAllSubViews];
-    CGFloat buttonSpace = (kScreenWidth - 5 * BUTTONWIDTH) / 6;
-    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(buttonSpace + (i % 5) * (BUTTONWIDTH + buttonSpace) + (i / 5) * KPortraitWidth, 0, BUTTONWIDTH, BUTTONHEIGHT);
-        buttonView.actionButton.tag = 3000 + i;
-        [buttonView.actionButton addTarget:self action:@selector(HomeTopButtonAction:) forControlEvents:UIControlEventTouchUpInside];
-        [self.buttonScrollView addSubview:buttonView];
-    }
-}
-
-- (void)HomeTopButtonAction:(UIButton *)sender {
-    NSInteger index = sender.tag - 3000;
-    if ([self checkIsLoginToLoginView:YES]) {
-        HomeMessageModel *model = self.buttonArray[index];
-        if (![NSString isEmptyString:model.linkUrl]) {
-            KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
-            webCtrl.url = model.linkUrl;
-            [self.navigationController pushViewController:webCtrl animated:YES];
-        }
-    }
-}
-
-- (void)refreshNotice {
-    if (self.noticeTitleArray.count) {
-        self.noticeView.hidden = NO;
-    }
-    else {
-        self.noticeView.hidden = YES;
-    }
-    self.noticeScrollView.titlesGroup = self.noticeTitleArray;
-}
-
-
-- (void)refreshCourseView:(RecentCourseModel *)model {
-    if (model) {
-        [self.courseView configCourseMessage:model];
-        self.courseView.hidden = NO;
-    }
-    else {
-        self.courseView.hidden = YES;
-    }
-}
-
-- (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];
-}
-
-
-- (void)refreshMusicView {
-    [self.musicCollectionView reloadData];
-}
-
-- (void)refreshCourseView {
-    // 课程
-    if (self.liveCourseArray.count) {
-        self.liveViewHeight = [HomeHotLiveCourseView getViewHeight];
-        self.liveCourseView.hidden = NO;
-    }
-    else {
-        self.liveViewHeight = CGFLOAT_MIN;
-        self.liveCourseView.hidden = YES;
-    }
-    [self.liveCourseView mas_updateConstraints:^(MASConstraintMaker *make) {
-        make.height.mas_equalTo(self.liveViewHeight);
-    }];
-    if (self.videoCourseArray.count) {
-        self.videoViewHeight = [HomeHotVideoCourseView getViewHeight];
-        self.videoCourseView.hidden = NO;
-    }
-    else {
-        self.videoViewHeight = CGFLOAT_MIN;
-        self.videoCourseView.hidden = YES;
-    }
-    [self.videoCourseView mas_updateConstraints:^(MASConstraintMaker *make) {
-        make.height.mas_equalTo(self.videoViewHeight);
-    }];
-    
-    [self.videoCollectionView reloadData];
-    [self.liveCollectionView reloadData];
-}
-
-#pragma mark - JXPagerViewDelegate
-
-- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
-    return self.headView;
-}
-
-- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
-    return self.headViewHeight;
-}
-
-- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
-    return self.categoryView;
-}
-
-- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
-    return 44;
-}
-
-- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
-    //和categoryView的item数量一致
-    return self.titles.count;
-}
-
-- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
-    if (index == 0) {
-        HomePageBodyView *listView = [[HomePageBodyView alloc] init];
-        listView.naviController = self.navigationController;
-        [self.listViewArray replaceObjectAtIndex:index withObject:listView];
-        self.listViewArray[index] = listView;
-        listView.selectIndex = index;
-        listView.styleArray = [self.teacherArray mutableCopy];
-        listView.liveArray = [self.liveListArray mutableCopy];
-        [listView beginFirstRefresh];
-        return listView;
-    }
-    else {
-        HomeInformationBodyView *listView = [[HomeInformationBodyView alloc] init];
-        listView.naviController = self.navigationController;
-        [self.listViewArray replaceObjectAtIndex:index withObject:listView];
-        self.listViewArray[index] = listView;
-        listView.selectIndex = index;
-        listView.informationArray = [self.informationArray mutableCopy];
-        [listView beginFirstRefresh];
-        return listView;
-    }
-}
-
-#pragma mark - JXCategoryViewDelegate
-- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
-    self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
-    if (self.listViewArray.count > index) {
-        id value = self.listViewArray[index];
-        if ([value isKindOfClass:[KSJXBodyView class]]) {
-            KSJXBodyView *listView = (KSJXBodyView *)value;
-            [listView beginFirstRefresh];
-        }
-        else if ([value isKindOfClass:[kSJXCollectionView class]]) {
-            kSJXCollectionView *listView = (kSJXCollectionView *)value;
-            [listView beginFirstRefresh];
-        }
-    }
-}
-
-#pragma mark - JXPagerMainTableViewGestureDelegate
-- (BOOL)mainTableViewGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
-    //禁止categoryView左右滑动的时候,上下和左右都可以滚动
-    if (otherGestureRecognizer == self.categoryView.collectionView.panGestureRecognizer) {
-        return NO;
-    }
-    return [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
-}
-
-
-- (void)pagerView:(JXPagerView *)pagerView mainTableViewDidScroll:(UIScrollView *)scrollView {
-    NSLog(@"sscroll content offset y %f", scrollView.contentOffset.y);
-    NSInteger height = self.headViewHeight;
-    CGFloat space = scrollView.contentOffset.y;
-    if (space > 0) {
-        self.navView.lineView.hidden = NO;
-    }
-    else {
-        self.navView.lineView.hidden = YES;
-
-    }
-    if (space >= height) {
-        self.categoryView.backgroundColor = [UIColor whiteColor];
-    }
-    else {
-        self.categoryView.backgroundColor = [UIColor clearColor];
-    }
-}
-
-#pragma mark - TYCyclePagerViewDataSource代理
-- (NSInteger)numberOfItemsInPagerView:(TYCyclePagerView *)pageView {
-    return self.bannerArray.count;
-}
-
-- (UICollectionViewCell *)pagerView:(TYCyclePagerView *)pagerView cellForItemAtIndex:(NSInteger)index {
-    HomeMessageModel *model = self.bannerArray[index];
-    HomeBannerCell *cell = [pagerView dequeueReusableCellWithReuseIdentifier:@"HomeBannerCell" forIndex:index];
-    [cell configCellWithModel:model];
-    return cell;
-}
-
-- (TYCyclePagerViewLayout *)layoutForPagerView:(TYCyclePagerView *)pageView {
-    TYCyclePagerViewLayout *layout = [[TYCyclePagerViewLayout alloc]init];
-    layout.itemSize = CGSizeMake(kScreenWidth - 28, (kScreenWidth - 28) / 347 * 132);
-    layout.itemSpacing = 0;
-    return layout;
-    
-}
-
-- (void)pagerView:(TYCyclePagerView *)pageView didScrollFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex {
-    if (pageView == self.bannerScroll) {
-        [self.pageControl setCurrentPage:toIndex animate:YES];
-    }
-}
-
-- (void)pagerView:(TYCyclePagerView *)pageView didSelectedItemCell:(__kindof UICollectionViewCell *)cell atIndex:(NSInteger)index {
-    
-    HomeMessageModel *model = self.bannerArray[index];
-    if (![NSString isEmptyString:model.linkUrl]) {
-        KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
-        webCtrl.url = model.linkUrl;
-        [self.navigationController pushViewController:webCtrl animated:YES];
-    }
-}
-
-#pragma mark ---- collection data source
-- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
-    return 1;
-}
-
-- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
-    if (collectionView == self.albumCollectionView) { // 专辑
-        return self.albumArray.count;
-    }
-    else if (collectionView == self.musicCollectionView) { // 乐谱
-        NSInteger lastRowCount = (self.musicArray.count % 3) > 0 ? 1 : 0;
-        NSInteger count = self.musicArray.count / 3 + lastRowCount;
-        return count;
-    }
-    else if (collectionView == self.talentCollectionView) { // 推荐达人
-        return self.talentArray.count;
-    }
-    else if (collectionView == self.videoCollectionView) { // 视频课
-        return self.videoCourseArray.count;
-    }
-    else { // 直播课
-        return self.liveCourseArray.count;
-    }
-}
-
-
-- (__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 if (collectionView == self.musicCollectionView) {
-        NSMutableArray *songArray = [NSMutableArray array];
-        NSInteger length = indexPath.item * 3 + 3 > self.musicArray.count ? self.musicArray.count - indexPath.item * 3: 3;
-        NSRange range = NSMakeRange(indexPath.item * 3, length);
-        
-        songArray = [NSMutableArray arrayWithArray:[self.musicArray subarrayWithRange:range]];
-        HomeHotMusicCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotMusicCollectionCell" forIndexPath:indexPath];
-        MJWeakSelf;
-        [cell configWithSourceArray:songArray callback:^(NSString * _Nonnull songId) {
-            [weakSelf displaySongDetail:songId];
-        }];
-        return cell;
-    }
-    else if (collectionView == self.talentCollectionView) {
-        TalentTeacherModel *talentModel = self.talentArray[indexPath.item];
-        HomeHotTalentCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotTalentCell" forIndexPath:indexPath];
-        [cell configWithSource:talentModel];
-        return cell;
-    }
-    else if (collectionView == self.videoCollectionView) {
-        HomeVideoGroupModel *model = self.videoCourseArray[indexPath.item];
-        HomeHotVideoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotVideoCell" forIndexPath:indexPath];
-        [cell configWithSource:model];
-        return cell;
-    }
-    else {
-        HomeLiveGroupModel *model = self.liveCourseArray[indexPath.item];
-        HomeHotLiveCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotLiveCell" forIndexPath:indexPath];
-        [cell configWithSource:model];
-        return cell;
-    }
-}
-
-- (void)displaySongDetail:(NSString *)songId {
-    // 检测权限
-    PREMISSIONTYPE micEnable = [RecordCheckManager checkPermissionShowAlert:NO showInView:nil];
-    PREMISSIONTYPE cameraEnable = [RecordCheckManager checkCameraPremissionAvaiable:NO showInView:nil];
-    if (micEnable == PREMISSIONTYPE_YES && cameraEnable == PREMISSIONTYPE_YES) { // 如果麦克风和摄像头权限都有
-        // 跳转到播放页面
-        KSAccompanyWebViewController *detailCtrl = [[KSAccompanyWebViewController alloc] init];
-        detailCtrl.url = [NSString stringWithFormat:@"%@/accompany?id=%@",hostURL, songId];
-        detailCtrl.hiddenNavBar = YES;
-        detailCtrl.parmDic = @{@"isOpenLight" : @(YES), @"orientation" : @(0),@"isHideTitle" : @(YES)};
-        [self.navigationController pushViewController:detailCtrl animated:YES];
-    }
-    else {
-        if (micEnable == PREMISSIONTYPE_NO && cameraEnable == PREMISSIONTYPE_NO) { // 如果麦克风权限和摄像头权限都没有
-            [self showAlertWithMessage:@"请开启相机和麦克风访问权限" type:CHECKDEVICETYPE_BOTH];
-        }
-        else if (micEnable == PREMISSIONTYPE_NO) { // 如果没有麦克风权限
-            [self showAlertWithMessage:@"请开启麦克风访问权限" type:CHECKDEVICETYPE_MIC];
-        }
-        else if (cameraEnable == PREMISSIONTYPE_NO) { // 如果没有摄像头权限
-            [self showAlertWithMessage:@"请开启相机访问权限" type:CHECKDEVICETYPE_CAMREA];
-        }
-    }
-}
-
-- (void)showAlertWithMessage:(NSString *)message type:(CHECKDEVICETYPE)deviceType {
-    [KSPremissionAlert shareInstanceDisplayImage:deviceType message:message showInView:self.view cancel:^{
-        
-    } confirm:^{
-        [self openSettingView];
-    }];
-    
-}
-
-- (void)openSettingView {
-    if (@available(iOS 10, *)) {
-        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
-    } else {
-        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
-    }
-}
-
-- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
-    if (collectionView == self.albumCollectionView) { // 专辑详情
-        HomeAlbumModel *model = self.albumArray[indexPath.item];
-        KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-        ctrl.url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/music-album-detail/",model.internalBaseClassIdentifier];
-        [self.navigationController pushViewController:ctrl animated:YES];
-    }
-    else if (collectionView == self.talentCollectionView) { // 达人风采
-        TalentTeacherModel *model = self.talentArray[indexPath.item];
-        [self displayTeacherDetail:[NSString stringWithFormat:@"%.0f",model.userId]];
-    }
-    else if (collectionView == self.videoCollectionView) {  // 视频课
-        HomeVideoGroupModel *model = self.videoCourseArray[indexPath.row];
-        NSString *url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/videoDetail?groupId=",model.videoGroupId];
-        KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-        ctrl.url = url;
-        [self.navigationController pushViewController:ctrl animated:YES];
-    }
-    else if (collectionView == self.liveCollectionView) {   // 直播课详情
-        HomeLiveGroupModel *model = self.liveCourseArray[indexPath.row];
-        KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-        NSString *url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/liveDetail?groupId=",model.courseGroupId];
-        ctrl.url = url;
-        [self.navigationController pushViewController:ctrl animated:YES];
-    }
-}
-
-// 老师风采
-- (void)displayTeacherDetail:(NSString *)teacherId {
-    KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-    ctrl.url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/teacherHome?teacherId=",teacherId];
-    [self.navigationController pushViewController:ctrl animated:YES];
-}
-
-- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
-    if (collectionView == self.albumCollectionView) {
-        return CGSizeMake(100, 134);
-    }
-    else if (collectionView == self.musicCollectionView) {
-        return CGSizeMake(KPortraitWidth * 0.83, 240);
-    }
-    else if (collectionView == self.talentCollectionView) {
-        return CGSizeMake(110, 150);
-    }
-    else if (collectionView == self.videoCollectionView) {
-        return CGSizeMake((KPortraitWidth - 28 - 11) / 2.0f, 157);
-    }
-    else {
-        return CGSizeMake((KPortraitWidth - 28 - 11) / 2.0f, 157);
-    }
-}
-
-#pragma mark ----- SDCycleScrollViewDelegate
-- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
-    NoticeSourceModel *noticeModel = self.noticeArray[index];
-    KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
-    webCtrl.url = [NSString stringWithFormat:@"%@/#/helpCenterDetail?id=%@",WEBHOST, noticeModel.internalBaseClassIdentifier];
-    [self.navigationController pushViewController:webCtrl animated:YES];
-}
-
-
-#pragma mark ------- lazying
-- (HomeNavSearchView *)navView {
-    if (!_navView) {
-        _navView = [HomeNavSearchView shareInstance];
-        MJWeakSelf;
-        [_navView homeNavSearchAction:^(HOMENAV_TAG action) {
-            [weakSelf homeNavAction:action];
-        }];
-    }
-    return _navView;
-}
-
-- (void)homeNavAction:(HOMENAV_TAG)action {
-    switch (action) {
-        case HOMENAV_TAG_SCAN: // 扫一扫
-        {
-            [self showScanView];
-        }
-            break;
-        case HOMENAV_TAG_MESSAGE: // 消息
-        {
-            NotiferMessageViewController *ctrl = [[NotiferMessageViewController alloc] init];
-            [self.navigationController pushViewController:ctrl animated:YES];
-        }
-            break;
-        case HOMENAV_TAG_SEARCH: // 搜索
-        {
-            KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
-            webCtrl.url = [NSString stringWithFormat:@"%@/#/music-songbook/search", WEBHOST];
-            [self.navigationController pushViewController:webCtrl animated:YES];
-        }
-            break;
-        default:
-            break;
-    }
-}
-
-- (void)showScanView {
-    // 判断是否有权限
-    PREMISSIONTYPE albumEnable = [RecordCheckManager checkCameraPremissionAvaiable:NO showInView:nil];
-    if (albumEnable == PREMISSIONTYPE_YES) { // 如果有权限
-        KSScanViewController *ctrl = [[KSScanViewController alloc] init];
-        [self.navigationController pushViewController:ctrl animated:YES];
-    }
-    else {
-        if (albumEnable == PREMISSIONTYPE_NO) {
-            [self showAlertWithMessage:@"请开启相机访问权限" type:CHECKDEVICETYPE_CAMREA];
-        }
-    }
-}
-
-- (dispatch_group_t)requestGroup {
-    if (!_requestGroup) {
-        _requestGroup = dispatch_group_create();
-    }
-    return _requestGroup;
-}
-
-
-- (UIView *)headView {
-    if (!_headView) {
-        _headView = [[UIView alloc] init];
-        _headView.backgroundColor = [UIColor clearColor];
-    }
-    return _headView;
-}
-
-- (NSMutableArray *)listViewArray {
-    if (!_listViewArray) {
-        _listViewArray = [NSMutableArray arrayWithArray:@[@"",@""]];
-    }
-    return _listViewArray;
-}
-
-
-- (HomeBannerView *)bannerView {
-    if (!_bannerView) {
-        _bannerView = [HomeBannerView shareInstance];
-        [_bannerView.bannerContentView addSubview:self.bannerScroll];
-    }
-    return _bannerView;
-}
-
-#pragma mark --- banner
-- (TYCyclePagerView *)bannerScroll {
-    if (!_bannerScroll) {
-        _bannerScroll = [[TYCyclePagerView alloc] init];
-        _bannerScroll.backgroundColor = [UIColor clearColor];
-        _bannerScroll.frame = CGRectMake(0, 0, kScreenWidth - 28, (kScreenWidth - 28) / 347 * 132);
-        _bannerScroll.isInfiniteLoop = YES;
-        _bannerScroll.autoScrollInterval = 3.0f;
-        _bannerScroll.reloadDataNeedResetIndex = YES;
-        _bannerScroll.dataSource = self;
-        _bannerScroll.delegate = self;
-        [_bannerScroll registerNib:[UINib nibWithNibName:@"HomeBannerCell" bundle:nil] forCellWithReuseIdentifier:@"HomeBannerCell"];
-        if (@available(iOS 11.0, *)) {
-            _bannerScroll.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-        } else {
-            // Fallback on earlier versions
-            if (@available(iOS 13.0, *)) {
-                _bannerScroll.collectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
-            } else {
-                // Fallback on earlier versions
-            }
-        }
-    }
-    return _bannerScroll;
-}
-
-- (TYPageControl *)pageControl {
-    if (!_pageControl) {
-        _pageControl = [[TYPageControl alloc] init];
-        _pageControl.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
-        _pageControl.pageIndicatorSpaing = 4.0f;
-        _pageControl.frame = CGRectMake(0, (kScreenWidth - 28) * 132 / 347 - 20, kScreenWidth-28 - 12, 12);
-        _pageControl.currentPageIndicatorTintColor = HexRGB(0xffffff);
-        _pageControl.pageIndicatorTintColor = HexRGB(0xffffff);
-        _pageControl.pageIndicatorSize = CGSizeMake(5, 5);
-        _pageControl.currentPageIndicatorSize = CGSizeMake(12, 5);
-    }
-    return _pageControl;
-}
-
-- (NSMutableArray *)bannerArray {
-    if (!_bannerArray) {
-        _bannerArray = [NSMutableArray array];
-    }
-    return _bannerArray;
-}
-
-#pragma mark ---- scroll view delegate
-- (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
-- (HomeButtonView *)buttonContainer {
-    if (!_buttonContainer) {
-        _buttonContainer = [HomeButtonView shareInstance];
-        [_buttonContainer.buttonContentView addSubview:self.buttonScrollView];
-    }
-    return _buttonContainer;
-}
-
-- (UIScrollView *)buttonScrollView {
-    if (!_buttonScrollView) {
-        _buttonScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, KPortraitWidth, BUTTONHEIGHT)];
-        _buttonScrollView.backgroundColor = [UIColor clearColor];
-        _buttonScrollView.pagingEnabled = YES;
-        _buttonScrollView.showsHorizontalScrollIndicator = NO;
-        _buttonScrollView.showsVerticalScrollIndicator = NO;
-        _buttonScrollView.delegate = self;
-    }
-    return _buttonScrollView;
-}
-
-#pragma mark ---- notice view
-- (UIView *)headBgView {
-    if (!_headBgView) {
-        _headBgView = [[UIView alloc] init];
-        _headBgView.backgroundColor = [UIColor whiteColor];
-    }
-    return _headBgView;
-}
-- (PublicNoticeView *)noticeView {
-    if (!_noticeView) {
-        _noticeView = [PublicNoticeView shareInstance];
-        MJWeakSelf;
-        [_noticeView moreCallback:^{
-            [weakSelf moreNotice];
-        }];
-    }
-    return _noticeView;
-}
-
-- (NSMutableArray *)noticeArray {
-    if (!_noticeArray) {
-        _noticeArray = [NSMutableArray array];
-    }
-    return _noticeArray;
-}
-
-- (NSMutableArray *)noticeTitleArray {
-    if (!_noticeTitleArray) {
-        _noticeTitleArray = [NSMutableArray array];
-    }
-    return _noticeTitleArray;
-}
-
-- (void)moreNotice {
-    if (self.noticeArray.count) {
-        NoticeSourceModel *bannerModel = self.noticeArray[0];
-        KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
-        webCtrl.url = [NSString stringWithFormat:@"%@/#/helpCenterDetail?id=%@",WEBHOST, bannerModel.internalBaseClassIdentifier];
-        [self.navigationController pushViewController:webCtrl animated:YES];
-    }
-}
-
-- (SDCycleScrollView *)noticeScrollView {
-    if (!_noticeScrollView) {
-        _noticeScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:[UIImage new]];
-        _noticeScrollView.onlyDisplayText = YES;
-        _noticeScrollView.autoScroll = NO;
-        _noticeScrollView.scrollEnabled = NO;
-        _noticeScrollView.scrollDirection = UICollectionViewScrollDirectionVertical;
-        _noticeScrollView.titleLabelTextColor = HexRGB(0x1a1a1a);
-        _noticeScrollView.titleLabelBackgroundColor = [UIColor clearColor];
-        _noticeScrollView.titleLabelTextFont = [UIFont systemFontOfSize:14];
-        _noticeScrollView.titlesGroup = self.noticeTitleArray;
-    }
-    return _noticeScrollView;
-}
-
-- (HomeRecentCourseView *)courseView {
-    if (!_courseView) {
-        _courseView = [HomeRecentCourseView shareInstance];
-        MJWeakSelf;
-        [_courseView joinRoom:^(RECENTCOURSE_TYPE type, RecentCourseModel * _Nonnull courseModel) {
-            [weakSelf joinRoomAction:type courseMessage:courseModel];
-        }];
-    }
-    return _courseView;
-}
-
-- (void)joinRoomAction:(RECENTCOURSE_TYPE)type courseMessage:(RecentCourseModel *)courseModel {
-    if (type == RECENTCOURSE_TYPE_ACCOMPANY) {
-        AccompanyDetailViewController *detailVC = [[AccompanyDetailViewController alloc] init];
-        detailVC.courseId = courseModel.courseId;
-        detailVC.courseGroupId = courseModel.courseGroupId;
-        detailVC.teacherId = courseModel.teacherId;
-        [self.navigationController pushViewController:detailVC animated:YES];
-    }
-    else if (type == RECENTCOURSE_TYPE_MUSICCLASS) { // 琴房课
-        MusicRoomDetailViewController *detailVC = [[MusicRoomDetailViewController alloc] init];
-        detailVC.courseId = courseModel.courseId;
-        detailVC.courseGroupId = courseModel.courseGroupId;
-        detailVC.teacherId = courseModel.teacherId;
-        [self.navigationController pushViewController:detailVC animated:YES];
-    }
-    else {
-        KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-        NSString *url = [NSString stringWithFormat:@"%@/#/liveDetail?joinRoom=1&groupId=%@&classId=%@", WEBHOST,courseModel.courseGroupId,courseModel.courseId];
-        ctrl.url = url;
-        [self.navigationController pushViewController:ctrl animated:YES];
-    }
-}
-
-#pragma mark ----- 专辑
-- (HomeHotAlbumView *)albumView {
-    if (!_albumView) {
-        _albumView = [HomeHotAlbumView shareInstance];
-        MJWeakSelf;
-        [_albumView homeAlbumMore:^{
-            [weakSelf moreAlbumDetail];
-        }];
-        [_albumView.albumContentView addSubview:self.albumCollectionView];
-        [self.albumCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.bottom.top.mas_equalTo(_albumView.albumContentView);
-        }];
-    }
-    return _albumView;
-}
-
-- (UICollectionView *)albumCollectionView {
-    if (!_albumCollectionView) {
-        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
-        layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
-        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
-        _albumCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
-        _albumCollectionView.backgroundColor = [UIColor clearColor];
-        _albumCollectionView.delegate = self;
-        _albumCollectionView.dataSource = self;
-        _albumCollectionView.showsVerticalScrollIndicator = NO;
-        _albumCollectionView.showsHorizontalScrollIndicator = NO;
-        if (@available(iOS 11.0, *)) {
-            _albumCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-        } else {
-            // Fallback on earlier versions
-            if (@available(iOS 13.0, *)) {
-                _albumCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
-            } else {
-                // Fallback on earlier versions
-            }
-        }
-        [_albumCollectionView registerNib:[UINib nibWithNibName:@"HomeHotAlbumCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotAlbumCell"];
-    }
-    return _albumCollectionView;
-}
-
-- (void)moreAlbumDetail {
-    KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-    ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-album"];
-    [self.navigationController pushViewController:ctrl animated:YES];
-}
-
-
-#pragma mark ---- 热门曲目
-- (HomeHotMusicView *)hotMusicView {
-    if (!_hotMusicView) {
-        _hotMusicView = [HomeHotMusicView shareInstance];
-        MJWeakSelf;
-        [_hotMusicView homeMusicMore:^{
-            [weakSelf moreHotMusic];
-        }];
-        [_hotMusicView.musicContentView addSubview:self.musicCollectionView];
-        [self.musicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.bottom.top.mas_equalTo(_hotMusicView.musicContentView);
-        }];
-    }
-    return _hotMusicView;
-}
-
-
-- (void)moreHotMusic {
-    KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-    ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-list"];
-    [self.navigationController pushViewController:ctrl animated:YES];
-}
-
-- (UICollectionView *)musicCollectionView {
-    if (!_musicCollectionView) {
-        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
-        layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
-        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
-        _musicCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
-        _musicCollectionView.backgroundColor = [UIColor clearColor];
-        _musicCollectionView.delegate = self;
-        _musicCollectionView.dataSource = self;
-        _musicCollectionView.showsVerticalScrollIndicator = NO;
-        _musicCollectionView.showsHorizontalScrollIndicator = NO;
-        if (@available(iOS 11.0, *)) {
-            _musicCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-        } else {
-            // Fallback on earlier versions
-            if (@available(iOS 13.0, *)) {
-                _musicCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
-            } else {
-                // Fallback on earlier versions
-            }
-        }
-        [_musicCollectionView registerNib:[UINib nibWithNibName:@"HomeHotMusicCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotMusicCollectionCell"];
-    }
-    return _musicCollectionView;
-}
-
-#pragma mark ---- talent view
-- (HomeHotTalentView *)talentView {
-    if (!_talentView) {
-        _talentView = [HomeHotTalentView shareInstance];
-        [_talentView.talentContentView addSubview:self.talentCollectionView];
-        MJWeakSelf;
-        [_talentView homeTalentMore:^{
-            [weakSelf teacherMoreIntorduce];
-        }];
-        [self.talentCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.bottom.top.mas_equalTo(_talentView.talentContentView);
-        }];
-    }
-    return _talentView;
-}
-
-- (void)teacherMoreIntorduce {
-    KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-    ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherElegant"];
-    [self.navigationController pushViewController:ctrl animated:YES];
-}
-
-- (UICollectionView *)talentCollectionView {
-    if (!_talentCollectionView) {
-        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
-        layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
-        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
-        _talentCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
-        _talentCollectionView.backgroundColor = [UIColor clearColor];
-        _talentCollectionView.delegate = self;
-        _talentCollectionView.dataSource = self;
-        _talentCollectionView.showsVerticalScrollIndicator = NO;
-        _talentCollectionView.showsHorizontalScrollIndicator = NO;
-        if (@available(iOS 11.0, *)) {
-            _talentCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-        } else {
-            // Fallback on earlier versions
-            if (@available(iOS 13.0, *)) {
-                _talentCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
-            } else {
-                // Fallback on earlier versions
-            }
-        }
-        [_talentCollectionView registerNib:[UINib nibWithNibName:@"HomeHotTalentCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotTalentCell"];
-    }
-    return _talentCollectionView;
-}
-
-
-#pragma mark ----- video course
-- (HomeHotVideoCourseView *)videoCourseView {
-    if (!_videoCourseView) {
-        _videoCourseView = [HomeHotVideoCourseView shareInstance];
-        MJWeakSelf;
-        [_videoCourseView homeVideoMore:^{
-            [weakSelf toVideoMorePage];
-        }];
-        [_videoCourseView.videoContentView addSubview:self.videoCollectionView];
-        [self.videoCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.bottom.top.mas_equalTo(_videoCourseView.videoContentView);
-        }];
-    }
-    return _videoCourseView;
-}
-
-- (UICollectionView *)videoCollectionView {
-    if (!_videoCollectionView) {
-        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
-        layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
-        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
-        _videoCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
-        _videoCollectionView.backgroundColor = [UIColor clearColor];
-        _videoCollectionView.delegate = self;
-        _videoCollectionView.dataSource = self;
-        _videoCollectionView.showsVerticalScrollIndicator = NO;
-        _videoCollectionView.showsHorizontalScrollIndicator = NO;
-        if (@available(iOS 11.0, *)) {
-            _videoCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-        } else {
-            // Fallback on earlier versions
-            if (@available(iOS 13.0, *)) {
-                _videoCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
-            } else {
-                // Fallback on earlier versions
-            }
-        }
-        
-        [_videoCollectionView registerNib:[UINib nibWithNibName:@"HomeHotVideoCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotVideoCell"];
-    }
-    return _videoCollectionView;
-}
-
-- (void)toVideoMorePage {
-    KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-    ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/videoClass"];
-    [self.navigationController pushViewController:ctrl animated:YES];
-}
-
-#pragma mark ----- live course
-
-- (HomeHotLiveCourseView *)liveCourseView {
-    if (!_liveCourseView) {
-        _liveCourseView = [HomeHotLiveCourseView shareInstance];
-        MJWeakSelf;
-        [_liveCourseView homeLiveMore:^{
-            [weakSelf toLiveMorePage];
-        }];
-        [_liveCourseView.liveContentView addSubview:self.liveCollectionView];
-        [self.liveCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
-            make.left.right.bottom.top.mas_equalTo(_liveCourseView.liveContentView);
-        }];
-    }
-    return _liveCourseView;
-}
-
-- (UICollectionView *)liveCollectionView {
-    if (!_liveCollectionView) {
-        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
-        layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
-        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
-        _liveCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
-        _liveCollectionView.backgroundColor = [UIColor clearColor];
-        _liveCollectionView.delegate = self;
-        _liveCollectionView.dataSource = self;
-        _liveCollectionView.showsVerticalScrollIndicator = NO;
-        _liveCollectionView.showsHorizontalScrollIndicator = NO;
-        if (@available(iOS 11.0, *)) {
-            _liveCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-        } else {
-            // Fallback on earlier versions
-            if (@available(iOS 13.0, *)) {
-                _liveCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
-            } else {
-                // Fallback on earlier versions
-            }
-        }
-        [_liveCollectionView registerNib:[UINib nibWithNibName:@"HomeHotLiveCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotLiveCell"];
-    }
-    return _liveCollectionView;
-}
-
-// 更多直播课
-- (void)toLiveMorePage {
-    KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
-    ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/liveClass"];
-    [self.navigationController pushViewController:ctrl animated:YES];
-}
-
-- (NSMutableArray *)informationArray {
-    if (!_informationArray) {
-        _informationArray = [NSMutableArray array];
-    }
-    return _informationArray;
-}
-
-- (NSMutableArray *)teacherArray {
-    if (!_teacherArray) {
-        _teacherArray = [NSMutableArray array];
-    }
-    return _teacherArray;
-}
-
-- (NSMutableArray *)liveListArray {
-    if (!_liveListArray) {
-        _liveListArray = [NSMutableArray array];
-    }
-    return _liveListArray;
-}
-
-/*
-#pragma mark - Navigation
-
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
-}
-*/
-
-@end

+ 8 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/View/HomePageView/HomeInformationBodyView.h

@@ -13,6 +13,14 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) NSMutableArray *informationArray;
 
+@property (nonatomic, assign) BOOL isLoadMore;
+
+@property (nonatomic, assign) NSInteger rows;
+
+@property (nonatomic, assign) NSInteger pages;
+
+- (void)resetAndRefresh;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 65 - 1
KulexiuForStudent/KulexiuForStudent/Module/Home/View/HomePageView/HomeInformationBodyView.m

@@ -9,9 +9,11 @@
 #import "HomeInformationCell.h"
 #import "HomeMessageModel.h"
 #import "KSBaseWKWebViewController.h"
-
+#import "UserInfoManager.h"
 @interface HomeInformationBodyView ()<UITableViewDelegate,UITableViewDataSource>
 
+@property (nonatomic, assign) BOOL isFirstLoad;
+
 
 @end
 
@@ -20,6 +22,7 @@
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
     if (self) {
+        self.isFirstLoad = YES;
         self.backgroundColor = [UIColor clearColor];
         self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) style:UITableViewStylePlain];
         self.tableView.backgroundColor = HexRGB(0xf6f8f9);
@@ -34,13 +37,74 @@
         headView.backgroundColor = HexRGB(0xf6f8f9);
         self.tableView.tableHeaderView = headView;
         
+        UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
+        bottomView.backgroundColor = HexRGB(0xf6f8f9);
+        self.tableView.tableFooterView = bottomView;
+        
         [self addSubview:self.tableView];
         [self.tableView registerNib:[UINib nibWithNibName:@"HomeInformationCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"HomeInformationCell"];
+        MJWeakSelf;
+        self.tableView.mj_footer = [KSGifRefreshFooter footerWithRefreshingBlock:^{
+            if (weakSelf.isLoadMore) {
+                weakSelf.pages += 1;
+                [weakSelf requestData];
+            }
+            else {
+                [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
+            }
+        }];
     }
     return self;
 }
 
+- (void)endRefresh {
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [self.tableView.mj_footer endRefreshing];
+    });
+}
+- (void)resetAndRefresh {
+    [self configDefaultRefresh];
+    [self.tableView reloadData];
+}
+
+- (void)configDefaultRefresh {
+    self.isLoadMore = YES;
+    self.pages = 1;
+    self.rows = 10;
+    [self.tableView.mj_footer resetNoMoreData];
+}
+
+- (void)requestData {
+    [KSNetworkingManager informationListRequest:KS_POST page:self.pages rows:self.rows version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
+        [self endRefresh];
+        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
+            NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
+            NSMutableArray *informationArray = [NSMutableArray array];
+            for (NSDictionary *parm in sourceArray) {
+                HomeMessageModel *model = [[HomeMessageModel alloc] initWithDictionary:parm];
+                [informationArray addObject:model];
+            }
+            if (informationArray.count < self.rows) {
+                self.isLoadMore = NO;
+            }
+            [self.informationArray addObjectsFromArray:informationArray];
+        }
+        else {
+            [self MBPShow:MESSAGEKEY];
+        }
+        [self.tableView reloadData];
+        // 回调
+    } faliure:^(NSError * _Nonnull error) {
+        [self endRefresh];
+    }];
+}
+
+
 - (void)beginFirstRefresh {
+    if (self.isFirstLoad) {
+        self.isFirstLoad = NO;
+        [self configDefaultRefresh];
+    }
     [self.tableView reloadData];
 }
 

+ 8 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/View/HomePageView/HomePageBodyView.h

@@ -15,6 +15,14 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) NSMutableArray *styleArray;
 
+@property (nonatomic, assign) BOOL isLoadMore;
+
+@property (nonatomic, assign) NSInteger rows;
+
+@property (nonatomic, assign) NSInteger pages;
+
+- (void)resetAndRefresh;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 75 - 2
KulexiuForStudent/KulexiuForStudent/Module/Home/View/HomePageView/HomePageBodyView.m

@@ -13,13 +13,15 @@
 #import "KSEnterLiveroomManager.h"
 #import "MBProgressHUD+KSShow.h"
 #import "HomeTempLiveCell.h"
-
+#import "UserInfoManager.h"
 #import "TeacherStyleFlowLayout.h"
 
 @interface HomePageBodyView ()<UICollectionViewDelegate,UICollectionViewDataSource,WaterFlowLayoutDelegate>
 
 @property (nonatomic, strong) NSMutableArray *sourceArray;
 
+@property (nonatomic, assign) BOOL isFirstLoad;
+
 @end
 
 @implementation HomePageBodyView
@@ -27,6 +29,7 @@
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
     if (self) {
+        self.isFirstLoad = YES;
         self.backgroundColor = HexRGB(0xf6f8f9);
         TeacherStyleFlowLayout *layout = [[TeacherStyleFlowLayout alloc] init];
         layout.sectionInset = UIEdgeInsetsMake(0, 14, 12, 14);
@@ -41,16 +44,84 @@
         [self.collectionView registerNib:[UINib nibWithNibName:@"HomeHotStyleCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotStyleCell"];
         [self.collectionView registerNib:[UINib nibWithNibName:@"HomeTempLiveCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeTempLiveCell"];
         [self addSubview:self.collectionView];
+        
+        MJWeakSelf;
+        self.collectionView.mj_footer = [KSGifRefreshFooter footerWithRefreshingBlock:^{
+            if (weakSelf.isLoadMore) {
+                weakSelf.pages += 1;
+                [weakSelf requestData];
+            }
+            else {
+                [weakSelf.collectionView.mj_footer endRefreshingWithNoMoreData];
+            }
+        }];
     }
     return self;
 }
 
-- (void)beginFirstRefresh {
+- (void)configDefaultRefresh {
+    self.isLoadMore = YES;
+    self.pages = 1;
+    self.rows = 10;
+    [self.collectionView.mj_footer resetNoMoreData];
+}
+
+- (void)resetParamenter {
+    [self configDefaultRefresh];
+    self.styleArray = [NSMutableArray array];
+    self.sourceArray = [NSMutableArray arrayWithArray:self.liveArray];
+    [self.collectionView reloadData];
+}
+
+- (void)endRefresh {
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [self.collectionView.mj_footer endRefreshing];
+    });
+}
+
+- (void)requestData {
+    [KSNetworkingManager homeQueryTeacherStyle:KS_POST page:self.pages rows:self.rows version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
+        [self endRefresh];
+        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
+            NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
+            NSMutableArray *styleArray = [NSMutableArray array];
+            for (NSDictionary *parm in sourceArray) {
+                TeacherStyleModel *model = [[TeacherStyleModel alloc] initWithDictionary:parm];
+                [styleArray addObject:model];
+            }
+            if (styleArray.count < self.rows) {
+                self.isLoadMore = NO;
+            }
+            [self.sourceArray addObjectsFromArray:styleArray];
+        }
+        else {
+            [self MBPShow:MESSAGEKEY];
+        }
+        [self.collectionView reloadData];
+        // 回调
+    } faliure:^(NSError * _Nonnull error) {
+        [self endRefresh];
+    }];
+}
+
+- (void)resetAndRefresh {
+    [self configDefaultRefresh];
     self.sourceArray = [NSMutableArray arrayWithArray:self.liveArray];
     [self.sourceArray addObjectsFromArray:self.styleArray];
     [self.collectionView reloadData];
 }
 
+- (void)beginFirstRefresh {
+    if (self.isFirstLoad) {
+        self.isFirstLoad = NO;
+        [self configDefaultRefresh];
+        self.sourceArray = [NSMutableArray arrayWithArray:self.liveArray];
+        [self.sourceArray addObjectsFromArray:self.styleArray];
+    }
+    
+    [self.collectionView reloadData];
+}
+
 - (void)selectCellAtIndexPath:(NSIndexPath *)indexPath {
     
     if (self.lastSelectedIndexPath == indexPath) {
@@ -70,6 +141,8 @@
     self.collectionView.frame = self.bounds;
 }
 
+
+
 #pragma mark ----- collection view
 - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
     return 1;

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini