12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670 |
- //
- // HomeViewController.m
- // KulexiuForTeacher
- //
- // Created by Kyle on 2022/3/17.
- //
- #import "HomeViewController.h"
- #import "HomeNavView.h"
- #import "KSBaseWKWebViewController.h"
- #import "MyMusicViewController.h"
- #import "MyCourseViewController.h"
- #import "HomeworkListViewController.h"
- #import "EvaluateCourseListViewController.h"
- #import "NotiferMessageViewController.h"
- #import "UserInfoManager.h"
- #import "MyIncomeViewController.h"
- #import "ReceiveEvaluateListController.h"
- #import "PublicNoticeView.h"
- #import "SDCycleScrollView.h"
- #import "NoticeSourceModel.h"
- #import "HomeRecentCourseView.h"
- #import "AccompanyDetailViewController.h"
- #import "RecentCourseModel.h"
- #import "AppDelegate.h"
- #import "MusicRoomViewController.h"
- #import "KSScanViewController.h"
- #import "KSPremissionAlert.h"
- #import "RecordCheckManager.h"
- #import "UserSettingViewController.h"
- #import "HomeMessageModel.h"
- #import "HomeButtonView.h"
- #import "KSHomeButton.h"
- #import "HomeNewHeadView.h"
- #import "HomeAlbumView.h"
- #import "HomeAlbumModel.h"
- #import "HomeHotAlbumCell.h"
- #import "HomeHotMusicView.h"
- #import "HomeHotMusicCollectionCell.h"
- #import "HomeBannerView.h"
- #import <UIButton+WebCache.h>
- #import "TYCyclePagerView.h"
- #import "TYPageControl.h"
- #import "HomeBannerCell.h"
- #import "BadgeIntroduceView.h"
- #import "HomeAuthAlertView.h"
- #import "KSAwardAlertView.h"
- #import "HomeNewMusicView.h"
- #import "HomeRecommendMusicView.h"
- #import "HomeMusicModel.h"
- #import "HomeDragButton.h"
- #import "SmallToolViewController.h"
- #import "InstrumentChooseViewController.h"
- #import "HomeTenantView.h"
- #import "HomeTenantPageView.h"
- #define BUTTONWIDTH (65)
- #define BUTTONHEIGHT (70)
- @interface HomeViewController ()<SDCycleScrollViewDelegate,UIScrollViewDelegate,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,TYCyclePagerViewDataSource,TYCyclePagerViewDelegate>
- @property (nonatomic, strong) HomeNavView *navView;
- @property (nonatomic, strong) HomeNewHeadView *headView;
- @property (nonatomic, strong) UserInfo *mineInfo;
- @property (nonatomic, strong) PublicNoticeView *noticeView;
- @property (nonatomic, strong) SDCycleScrollView *noticeScrollView;
- @property (nonatomic, strong) NSMutableArray *noticeArray; // 公告数据
- @property (nonatomic, strong) NSMutableArray *titleArray; // 标题数组
- @property (nonatomic, strong) HomeBannerView *bannerView; // banner
- @property (nonatomic, strong) NSMutableArray *bannerArray; //
- @property (nonatomic, strong) TYPageControl *pageControl;
- @property (nonatomic, strong) TYCyclePagerView *bannerScroll; // 活动
- @property (nonatomic, strong) HomeRecentCourseView *courseView;
- @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, assign) BOOL isFirstLoad;
- @property (nonatomic, strong) HomeAlbumView *albumView;
- @property (nonatomic, strong) NSMutableArray *albumArray; // 热门专辑
- @property (nonatomic, strong) UICollectionView *albumCollectionView; // 专辑容器
- @property (nonatomic, assign) CGFloat albumViewHeight; // album 高度
- @property (nonatomic, strong) dispatch_group_t requestGroup;
- @property (nonatomic, strong) RecentCourseModel *recentCourseModel;
- // 热门曲目
- @property (nonatomic, strong) HomeHotMusicView *hotMusicView;
- @property (nonatomic, strong) UICollectionView *musicCollectionView; // 曲谱容器
- @property (nonatomic, assign) CGFloat hotMusicHeight; // music 高度
- // 推荐曲目
- @property (nonatomic, strong) HomeRecommendMusicView *recommendMusicView;
- @property (nonatomic, strong) UICollectionView *recommendMusicCollectionView; // 曲谱容器
- @property (nonatomic, strong) NSMutableArray *recommendMusicArray; // 曲谱数据
- @property (nonatomic, assign) CGFloat recommendMusicViewHeight; // music 高度
- // 最新曲目
- @property (nonatomic, strong) HomeNewMusicView *newestMusicView;
- @property (nonatomic, strong) UICollectionView *newestMusicCollectionView; // 曲谱容器
- @property (nonatomic, strong) NSMutableArray *newestMusicArray; // 曲谱数据
- @property (nonatomic, assign) CGFloat newestMusicViewHeight; // music 高度
- @property (nonatomic, strong) BadgeIntroduceView *intruduceAlert;
- @property (nonatomic, strong) HomeAuthAlertView *authAlertView;
- @property (nonatomic, assign) BOOL isCheck;
- @property (nonatomic, strong) HomeMessageModel *buttonModel;
- @property (nonatomic, strong) HomeDragButton *suspendButton;
- @property (nonatomic, assign) BOOL isSettingSubject;
- // 机构专辑
- @property (nonatomic, strong) HomeTenantPageView *tenantAlbumView;
- @property (nonatomic, assign) CGFloat tenantAlbumHeight;
- // 机构名称
- @property (nonatomic, strong) HomeTenantView *tenantNameView;
- @end
- @implementation HomeViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.ks_prefersNavigationBarHidden = YES;
- self.isFirstLoad = YES;
- [self configUI];
- }
- - (void)requestUserInfo {
- [USER_MANAGER queryUserInfoCallback:^(UserInfo * _Nonnull userInfo) {
- self.mineInfo = userInfo;
- [self requestData];
- }];
- }
- - (void)requestAwardMessage {
- self.isCheck = NO;
- dispatch_group_enter(self.requestGroup);
- [KSNetworkingManager checkReceiveRewardRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
- dispatch_group_leave(self.requestGroup);
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
- BOOL isCheck = [[dic ks_dictionaryValueForKey:@"data"] ks_boolValueForKey:@"check"];
- self.isCheck = isCheck;
- }
- } 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 ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
- NSArray *sourceArray = [[dic ks_dictionaryValueForKey:@"data"] ks_arrayValueForKey:@"rows"];
- if (sourceArray.count) {
- NSDictionary *parm = [sourceArray firstObject];
- NoticeSourceModel *bannerModel = [[NoticeSourceModel alloc] initWithDictionary:parm];
- [self.noticeArray addObject:bannerModel];
- [self.titleArray addObject:bannerModel.title];
- }
- else {
- self.noticeArray = [NSMutableArray array];
- self.titleArray = [NSMutableArray array];
- }
- }
- else {
- [self MBPShow:MESSAGEKEY];
- }
- } faliure:^(NSError * _Nonnull error) {
- dispatch_group_leave(self.requestGroup);
- }];
- }
- - (void)requestRecentCourse {
- dispatch_group_enter(self.requestGroup);
- [KSNetworkingManager queryRecentLiveAndVideo:KS_GET success:^(NSDictionary * _Nonnull dic) {
- dispatch_group_leave(self.requestGroup);
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
- NSDictionary *parm = [[dic ks_dictionaryValueForKey:@"data"] ks_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)refreshCourseView:(RecentCourseModel *)model {
- if (model) {
- [self.courseView configCourseMessage:model];
- self.courseView.hidden = NO;
- }
- else {
- self.courseView.hidden = YES;
- }
- }
- - (void)refreshNotice {
- if (self.titleArray.count) {
- self.noticeView.hidden = NO;
- }
- else {
- self.noticeView.hidden = YES;
- }
- self.noticeScrollView.titlesGroup = self.titleArray;
- }
- - (void)refreshView {
- [self.navView configMessage:self.mineInfo];
- [self.headView configMessage:self.mineInfo];
- [self refreshTenantNameView];
- [self refreshBannerView];
- [self refreshButtonView];
- [self refreshNotice];
- [self refreshCourseView:self.recentCourseModel];
- [self refreshAlbumView];
- [self refreshMusicView];
-
- // 刷新专辑显示
- [self refreshTenantBanner];
- // 刷新排序
- [self refreshViewLocation];
- if (self.isCheck) {
- [self checkShowAwardAlert];
- }
-
- // 悬浮按钮
- if (self.buttonModel) {
- [self showFloatingWindow];
- }
- else {
- [self removeFloatWindow];
- }
- }
- - (void)refreshTenantNameView {
- CGFloat tenantNameHeight = CGFLOAT_MIN;
- if (self.mineInfo.tenantId > 0) {
- tenantNameHeight = [HomeTenantView getViewHeight];
- self.tenantNameView.hidden = NO;
- }
- else {
- self.tenantNameView.hidden = YES;
- }
- [self.tenantNameView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(tenantNameHeight);
- }];
- [self.tenantNameView configTenantName:self.mineInfo.tenantName];
- }
- - (void)refreshTenantBanner {
-
- if (self.mineInfo.tenantAlbumStatus == 0) {
- self.tenantAlbumHeight = CGFLOAT_MIN;
- self.tenantAlbumView.hidden = YES;
- }
- else {
- self.tenantAlbumHeight = [HomeTenantPageView getViewHeight];
- self.tenantAlbumView.hidden = NO;
- }
-
- [self.tenantAlbumView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(self.tenantAlbumHeight);
- }];
- }
- - (void)removeFloatWindow {
- if ([self.view.subviews containsObject:self.suspendButton]) {
- [self.suspendButton removeFromSuperview];
- }
- }
- // 显示悬浮窗
- - (void)showFloatingWindow {
- if (![self.view.subviews containsObject:self.suspendButton]) {
- [self.view addSubview:self.suspendButton];
- }
- [self.view bringSubviewToFront:self.suspendButton];
- [self.suspendButton.containerView sd_setImageWithURL:[NSURL URLWithString:[self.buttonModel.coverImage getUrlEndcodeString]]];
- }
- - (void)checkShowAwardAlert {
- AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
- if (appDelegate.isShowMemoAlert) {
- return;
- }
- // 如果今日已提示过,就不再提醒
- NSDictionary *awardAlertDic = UserDefaultObjectForKey(@"awardAlertTime");
- NSString *awardAlertTime = [awardAlertDic ks_stringValueForKey:@"time"];
- NSDate *currendDate = [NSDate date];
- NSDateFormatter *dateFormatter = [NSObject getDateformatter];
- [dateFormatter setDateFormat:@"yyyy-MM-dd"];
- NSString *todayString = [dateFormatter stringFromDate:currendDate];
-
- if (![NSString isEmptyString:awardAlertTime]) {
-
- NSString *userId = [awardAlertDic ks_stringValueForKey:@"userId"];
- if ([todayString isEqualToString:awardAlertTime] && [userId isEqualToString:UserDefaultObjectForKey(UIDKey)]) {
- return;
- }
- }
-
- if (![self.navigationController.visibleViewController isKindOfClass:[HomeViewController class]]) {
- return;
- }
-
- KSAwardAlertView *alert = [KSAwardAlertView shareInstance];
- MJWeakSelf;
- [alert awardActionCallback:^(BOOL isSure) {
- if (isSure) {
- [weakSelf displayAwardList];
- }
- }];
-
- [alert showAlert];
- NSDictionary *saveDic = @{@"time" :todayString , @"userId" : UserDefaultObjectForKey(UIDKey)};
- UserDefaultSetObjectForKey(saveDic, @"awardAlertTime");
- }
- - (void)displayAwardList {
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/awardActivity"];
- [self.navigationController pushViewController:webCtrl animated:YES];
- }
- - (void)refreshBannerView {
- if (self.bannerArray.count) {
- self.bannerView.hidden = NO;
- CGFloat bannerViewHeight = [HomeBannerView getViewHeight];
- [self.bannerView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(bannerViewHeight);
- }];
- }
- else {
- self.bannerView.hidden = YES;
- [self.bannerView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(CGFLOAT_MIN);
- }];
- }
- if (self.bannerArray.count > 1) {
- self.bannerScroll.autoScrollInterval = 3.0f;
- [self.bannerScroll addSubview:self.pageControl];
- }
- else {
- self.bannerScroll.autoScrollInterval = 0;
- [self.pageControl removeFromSuperview];
- }
- self.pageControl.numberOfPages = self.bannerArray.count;
- [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 {
- dispatch_group_enter(self.requestGroup);
- [KSNetworkingManager homeButtonList:KS_POST version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
- dispatch_group_leave(self.requestGroup);
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
- NSDictionary *result = [dic ks_dictionaryValueForKey:@"data"];
- // banner
- NSArray *bannerArray = [result ks_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 ks_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];
-
- // 首页悬浮按钮
- NSArray *suspensionArray = [result ks_arrayValueForKey:@"suspension"];
- if (suspensionArray.count) {
- self.buttonModel = [[HomeMessageModel alloc] initWithDictionary:[suspensionArray firstObject]];
- }
- else {
- self.buttonModel = nil;
- }
-
- }
- else {
- [self MBPShow:MESSAGEKEY];
- }
- } faliure:^(NSError * _Nonnull error) {
- dispatch_group_leave(self.requestGroup);
- }];
- }
- - (void)refreshButtonView {
- CGFloat containerWidth = (KPortraitWidth - 28);
-
- if (self.buttonArray.count) {
-
- 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);
- }
- }
- else {
- 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];
- }
- }
- - (void)HomeTopButtonAction:(UIButton *)sender {
- NSInteger index = sender.tag - 3000;
- if ([self checkIsLoginToLoginView:YES]) {
- HomeMessageModel *model = self.buttonArray[index];
- if (![NSString isEmptyString:model.linkUrl]) {
- if ([model.linkUrl isEqualToString:@"native-metronome"]) {
- SmallToolViewController *ctrl = [[SmallToolViewController alloc] init];
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- else {
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = model.linkUrl;
- [self.navigationController pushViewController:webCtrl animated:YES];
- }
-
- }
- }
- }
- - (void)requestAlbumSource {
- dispatch_group_enter(self.requestGroup);
- [KSNetworkingManager HomeHotAlbumRequest:KS_POST version:[USER_MANAGER getCurrentVersion] subjectIds:[NSString stringWithFormat:@"%.0f",self.mineInfo.defaultSubject] success:^(NSDictionary * _Nonnull dic) {
- dispatch_group_leave(self.requestGroup);
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
- NSArray *sourceArray = [[dic ks_dictionaryValueForKey:@"data"] ks_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)refreshAlbumView {
- if (self.albumArray.count) {
- self.albumViewHeight = [HomeAlbumView 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)requestHomeMusicMessage {
- dispatch_group_enter(self.requestGroup);
- [KSNetworkingManager homeAppMusicSheetRequest:KS_POST version:[USER_MANAGER getCurrentVersion] subjectIds:[NSString stringWithFormat:@"%.0f",self.mineInfo.defaultSubject] success:^(NSDictionary * _Nonnull dic) {
- dispatch_group_leave(self.requestGroup);
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
- NSDictionary *result = [dic ks_dictionaryValueForKey:@"data"];
- NSArray *hotMusicSheet = [result ks_arrayValueForKey:@"hotMusicSheet"]; // 最热曲目
- NSMutableArray *hotArray = [NSMutableArray array];
- for (NSDictionary *parm in hotMusicSheet) {
- HomeMusicModel *model = [[HomeMusicModel alloc] initWithDictionary:parm];
- [hotArray addObject:model];
- }
- self.dataArray = [NSMutableArray arrayWithArray:hotArray];
-
- NSArray *newMusicSheet = [result ks_arrayValueForKey:@"newMusicSheet"]; // 最新曲目
- NSMutableArray *newMusicArray = [NSMutableArray array];
- for (NSDictionary *parm in newMusicSheet) {
- HomeMusicModel *model = [[HomeMusicModel alloc] initWithDictionary:parm];
- [newMusicArray addObject:model];
- }
- self.newestMusicArray = [NSMutableArray arrayWithArray:newMusicArray];
-
- NSArray *topMusicSheet = [result ks_arrayValueForKey:@"topMusicSheet"]; // 推荐曲目
- NSMutableArray *topMusicArray = [NSMutableArray array];
- for (NSDictionary *parm in topMusicSheet) {
- HomeMusicModel *model = [[HomeMusicModel alloc] initWithDictionary:parm];
- [topMusicArray addObject:model];
- }
- self.recommendMusicArray = [NSMutableArray arrayWithArray:topMusicArray];
- }
- else {
- [self MBPShow:MESSAGEKEY];
- }
- } faliure:^(NSError * _Nonnull error) {
- dispatch_group_leave(self.requestGroup);
- }];
- }
- - (void)refreshMusicView {
-
- if (self.recommendMusicArray.count) {
- self.recommendMusicViewHeight = [HomeHotMusicView getViewHeight];
- self.recommendMusicView.hidden = NO;
- }
- else {
- self.recommendMusicViewHeight = CGFLOAT_MIN;
- self.recommendMusicView.hidden = YES;
- }
-
- [self.recommendMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(self.recommendMusicViewHeight);
- }];
- [self.recommendMusicCollectionView reloadData];
-
- if (self.newestMusicArray.count) {
- self.newestMusicViewHeight = [HomeHotMusicView getViewHeight];
- self.newestMusicView.hidden = NO;
- }
- else {
- self.newestMusicViewHeight = CGFLOAT_MIN;
- self.newestMusicView.hidden = YES;
- }
-
- [self.newestMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(self.newestMusicViewHeight);
- }];
- [self.newestMusicCollectionView reloadData];
-
- if (self.dataArray.count) {
- self.hotMusicHeight = [HomeHotMusicView getViewHeight];
- self.hotMusicView.hidden = NO;
- }
- else {
- self.hotMusicHeight = CGFLOAT_MIN;
- self.hotMusicView.hidden = YES;
- }
- [self.hotMusicView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(self.hotMusicHeight);
- }];
- [self.musicCollectionView reloadData];
- }
- - (void)configUI {
- CGFloat navHeight = IS_iPhoneX ? 100 : 70;
- [self.view addSubview:self.navView];
- [self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(kScreenWidth);
- make.right.top.mas_equalTo(self.view);
- make.height.mas_equalTo(navHeight);
- }];
- [self.view bringSubviewToFront:self.navView];
-
- // 名称
- [self.view addSubview:self.tenantNameView];
- CGFloat tenantNameHeight = CGFLOAT_MIN;
- [self.tenantNameView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.navView.mas_bottom);
- make.height.mas_equalTo(tenantNameHeight);
- }];
- self.tenantNameView.hidden = YES;
-
- [self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.tenantNameView.mas_bottom);
- make.bottom.mas_equalTo(self.view.mas_bottom);
- }];
- self.scrollView.backgroundColor = [UIColor clearColor];
- MJWeakSelf;
- self.scrollView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
- [weakSelf requestHomeMessage];
- }];
-
- // header
- [self.scrollView addSubview:self.headView];
- CGFloat headHeight = [self.headView getViewHeight];
- [self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.scrollView.mas_top);
- make.height.mas_equalTo(headHeight);
- }];
-
- [self.scrollView addSubview:self.bannerView];
-
- [self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.headView.mas_bottom);
- make.height.mas_equalTo(CGFLOAT_MIN);
- }];
-
- // 按钮
- [self.scrollView addSubview:self.buttonContainer];
- [self.buttonContainer mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.bannerView.mas_bottom);
- make.height.mas_equalTo(CGFLOAT_MIN);
- }];
- self.buttonContainer.hidden = YES;
-
- // 公告
- [self.scrollView addSubview:self.noticeView];
- [self.noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- 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.scrollView addSubview:self.courseView];
- [self.courseView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.noticeView.mas_bottom);
- make.height.mas_equalTo(CGFLOAT_MIN);
- }];
- self.courseView.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.tenantAlbumView.hidden = YES;
- [self.scrollView addSubview:self.albumView];
- self.albumViewHeight = [HomeAlbumView getViewHeight];
- [self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.tenantAlbumView.mas_bottom);
- make.height.mas_equalTo(self.albumViewHeight);
- }];
-
- [self.scrollView addSubview:self.recommendMusicView];
- CGFloat recommendMusicHeadHeight = [HomeRecommendMusicView getViewHeight];
- [self.recommendMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.albumView.mas_bottom);
- make.height.mas_equalTo(recommendMusicHeadHeight);
- }];
-
- [self.scrollView addSubview:self.newestMusicView];
- CGFloat newMusicHeight = [HomeNewMusicView getViewHeight];
- [self.newestMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.recommendMusicView.mas_bottom);
- make.height.mas_equalTo(newMusicHeight);
- }];
-
- [self.scrollView addSubview:self.hotMusicView];
- CGFloat musicHeadHeight = [HomeHotMusicView getViewHeight];
- [self.hotMusicView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.newestMusicView.mas_bottom);
- make.height.mas_equalTo(musicHeadHeight);
- make.bottom.mas_equalTo(self.scrollView.mas_bottom).offset(-10);
- }];
- }
- - (void)requestHomeMessage {
- [self showhud];
- [self requestUserInfo];
- }
- - (void)requestData {
- [self requestUnreadCount];
- [self requestHomeButton];
- [self requestRecentCourse];
- [self requestNotice];
- [self requestAlbumSource];
- [self requestHomeMusicMessage];
- [self requestAwardMessage];
-
- dispatch_group_notify(self.requestGroup, dispatch_get_main_queue(), ^{
- [self removehub];
- [self.scrollView.mj_header endRefreshing];
- [self refreshView];
- });
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- if (self.isFirstLoad == YES) {
- self.isFirstLoad = NO;
- [self requestTrackAuth];
- AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
- [appDelegate handleNotiferSource];
- }
- if (self.isSettingSubject == NO) {
- [self requestHomeMessage];
- }
- self.isSettingSubject = NO;
- }
- // track
- - (void)requestTrackAuth {
-
- AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
- [appDelegate appTrackActionAuth];
- }
- - (void)requestUnreadCount {
- [KSNetworkingManager queryCountOfUnreadRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
- NSArray *countArray = [dic ks_arrayValueForKey:@"data"];
- NSInteger courseCount = 0;
- NSInteger sysCount = 0;
- for (NSDictionary *parm in countArray) {
- if ([[parm ks_stringValueForKey:@"key"] isEqualToString:@"COURSE"]) {
- courseCount = [parm ks_integerValueForKey:@"value"];
- }
- if ([[parm ks_stringValueForKey:@"key"] isEqualToString:@"SYSTEM"]) {
- sysCount = [parm ks_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) {
-
- }];
- }
- #pragma mark ----- SDCycleScrollViewDelegate
- - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
- NoticeSourceModel *bannerModel = self.noticeArray[index];
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = [NSString stringWithFormat:@"%@/#/helpCenterDetail?id=%@",WEBHOST, bannerModel.internalBaseClassIdentifier];
- [self.navigationController pushViewController:webCtrl animated:YES];
-
- }
- #pragma mark ----- lazying
- - (HomeNavView *)navView {
- if (!_navView) {
- _navView = [HomeNavView shareInstance];
- MJWeakSelf;
- [_navView displayMessageCenter:^(HOMENAV_ACTION action) {
- if (action == HOMENAV_ACTION_MESSAGE) {
- [weakSelf toMessageCenter];
- }
- else {
- [weakSelf scanAction];
- }
- }];
- }
- return _navView;
- }
- - (void)scanAction {
- // 判断是否有权限
- 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];
- }
- }
- }
- - (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)toMessageCenter {
- NotiferMessageViewController *messageCenter = [[NotiferMessageViewController alloc] init];
- [self.navigationController pushViewController:messageCenter animated:YES];
- }
- - (HomeNewHeadView *)headView {
- if (!_headView) {
- _headView = [HomeNewHeadView shareInstance];
- MJWeakSelf;
- [_headView authDetailAction:^(HOMEHEADACTION action) {
- [weakSelf headAction:action];
- }];
- }
- return _headView;
- }
- - (void)headAction:(HOMEHEADACTION)type {
- switch (type) {
- case HOMEHEADACTION_DESC:
- {
- [self showDescAlert];
- }
- break;
- case HOMEHEADACTION_AUTH:
- {
- [self toAuthDetail];
- }
- break;
- case HOMEHEADACTION_EDUCATION:
- case HOMEHEADACTION_EDUCATIONFINISH:
- {
- [self showAuthEducationAlert];
- }
- break;
- case HOMEHEADACTION_SUBJECTCHOOSE:
- {
- [self showChooseSubjectView];
- }
- break;
- default:
- break;
- }
- }
- - (void)showChooseSubjectView {
- InstrumentChooseViewController *ctrl = [[InstrumentChooseViewController alloc] init];
- ctrl.isSingleChoose = YES;
- MJWeakSelf;
- [ctrl chooseCallback:^(NSMutableArray * _Nullable chooseArray) {
- NSDictionary *parm = [chooseArray firstObject];
- NSString *subjectId = [parm ks_stringValueForKey:@"subjectId"];
- NSString *subjectName = [parm ks_stringValueForKey:@"subjectName"];
- weakSelf.headView.subjectLabel.text = subjectName;
- [weakSelf setDefaultSubject:subjectId];
- }];
- self.isSettingSubject = YES;
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- - (void)setDefaultSubject:(NSString *)subjectId {
- [self showhud];
- [KSNetworkingManager defaultSubjectRequest:KS_POST subjectId:subjectId success:^(NSDictionary * _Nonnull dic) {
- [self removehub];
- if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
- // 请求数据
- [self requestHomeMessage];
- }
- else {
- [self MBPShow:MESSAGEKEY];
- }
- } faliure:^(NSError * _Nonnull error) {
- [self removehub];
- }];
-
- }
- - (void)toAuthEducation {
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherCertUpdate"];
- [self.navigationController pushViewController:webCtrl animated:YES];
- }
- - (void)showAuthEducationAlert {
- BOOL hasDegreeAuth = self.mineInfo.degreeFlag;
- BOOL hasTeacherAuth = self.mineInfo.teacherFlag;
-
- self.authAlertView = [HomeAuthAlertView shareIntance];
- if (hasDegreeAuth) {
- [self.authAlertView.educationImage setImage:[UIImage imageNamed:@"choose_instrument"]];
- [self.authAlertView.educationStatus setText:@"已认证"];
- [self.authAlertView.educationStatus setTextColor:HexRGB(0x999999)];
- }
- else {
- [self.authAlertView.educationImage setImage:[UIImage imageNamed:@""]];
- [self.authAlertView.educationStatus setText:@"未认证"];
- [self.authAlertView.educationStatus setTextColor:HexRGB(0xff0000)];
- }
-
- if (hasTeacherAuth) {
- [self.authAlertView.qualificationImage setImage:[UIImage imageNamed:@"choose_instrument"]];
- [self.authAlertView.qualificationStatus setText:@"已认证"];
- [self.authAlertView.qualificationStatus setTextColor:HexRGB(0x999999)];
- }
- else {
- [self.authAlertView.qualificationImage setImage:[UIImage imageNamed:@""]];
- [self.authAlertView.qualificationStatus setText:@"未认证"];
- [self.authAlertView.qualificationStatus setTextColor:HexRGB(0xff0000)];
- }
- if (hasDegreeAuth && hasTeacherAuth) {
- self.authAlertView.isFinish = YES;
- self.authAlertView.rate = 1.0f;
- }
- else {
- self.authAlertView.isFinish = NO;
- if (hasDegreeAuth || hasTeacherAuth) {
- self.authAlertView.rate = 0.9f;
- }
- else {
- self.authAlertView.rate = 0.8f;
- }
- }
- MJWeakSelf;
- [self.authAlertView authEducationAction:^{
- [weakSelf toAuthEducation];
- }];
- [self.authAlertView showAlertView];
-
- }
- - (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 {
- UserSettingViewController *ctrl = [[UserSettingViewController alloc] init];
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- - (void)toAuthDetail {
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherCert"];
- [self.navigationController pushViewController:webCtrl animated:YES];
- }
- - (PublicNoticeView *)noticeView {
- if (!_noticeView) {
- _noticeView = [PublicNoticeView shareInstance];
- MJWeakSelf;
- [_noticeView moreCallback:^{
- [weakSelf moreNotice];
- }];
- }
- return _noticeView;
- }
- #pragma mark -- lazying
- - (dispatch_group_t)requestGroup {
- if (!_requestGroup) {
- _requestGroup = dispatch_group_create();
- }
- return _requestGroup;
- }
- - (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 whiteColor];
- _noticeScrollView.titleLabelTextFont = [UIFont systemFontOfSize:14];
- _noticeScrollView.titlesGroup = self.titleArray;
- }
- return _noticeScrollView;
- }
- - (NSMutableArray *)noticeArray {
- if (!_noticeArray) {
- _noticeArray = [NSMutableArray array];
- }
- return _noticeArray;
- }
- - (NSMutableArray *)titleArray {
- if (!_titleArray) {
- _titleArray = [NSMutableArray array];
- }
- return _titleArray;
- }
- - (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];
- }
- }
- - (HomeRecentCourseView *)courseView {
- if (!_courseView) {
- _courseView = [HomeRecentCourseView shareInstance];
- MJWeakSelf;
- [_courseView joinRoom:^(RECENTCOURSE_TYPE type, RecentCourseModel * _Nonnull courseModel) {
- [weakSelf joinRoomAction:type roomId:courseModel];
- }];
- }
- return _courseView;
- }
- - (void)joinRoomAction:(RECENTCOURSE_TYPE)type roomId:(RecentCourseModel *)courseModel {
- if (type == RECENTCOURSE_TYPE_ACCOMPANY) {
- AccompanyDetailViewController *detailVC = [[AccompanyDetailViewController alloc] init];
- detailVC.courseId = courseModel.courseId;
- detailVC.courseGroupId = courseModel.courseGroupId;
- detailVC.studentId = courseModel.studentId;
- [self.navigationController pushViewController:detailVC animated:YES];
- }
- else if (type == RECENTCOURSE_TYPE_MUSICCLASS) { // 琴房课
- MusicRoomViewController *ctrl = [[MusicRoomViewController alloc] init];
- ctrl.courseId = courseModel.courseId;
- ctrl.courseGroupId = courseModel.courseGroupId;
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- else {
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
- ctrl.url = [NSString stringWithFormat:@"%@/#/liveDetail?joinRoom=1&groupId=%@&classId=%@", WEBHOST, courseModel.courseGroupId,courseModel.courseId];
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- }
- - (void)displaySongDetail:(NSString *)songId {
-
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
- ctrl.url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/music-detail?id=",songId];
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- #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 - 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
- - (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.recommendMusicCollectionView) {
- NSInteger lastRowCount = (self.recommendMusicArray.count % 4) > 0 ? 1 : 0;
- NSInteger count = self.recommendMusicArray.count / 4 + lastRowCount;
- return count;
- }
- else if (collectionView == self.newestMusicCollectionView) {
- NSInteger lastRowCount = (self.newestMusicArray.count % 4) > 0 ? 1 : 0;
- NSInteger count = self.newestMusicArray.count / 4 + lastRowCount;
- return count;
- }
- else {
- NSInteger lastRowCount = (self.dataArray.count % 4) > 0 ? 1 : 0;
- NSInteger count = self.dataArray.count / 4 + lastRowCount;
- return 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.recommendMusicCollectionView) {
- NSMutableArray *songArray = [NSMutableArray array];
- NSInteger length = indexPath.item * 4 + 4 > self.recommendMusicArray.count ? self.recommendMusicArray.count - indexPath.item * 4: 4;
- NSRange range = NSMakeRange(indexPath.item * 4, length);
-
- songArray = [NSMutableArray arrayWithArray:[self.recommendMusicArray 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.newestMusicCollectionView) {
- NSMutableArray *songArray = [NSMutableArray array];
- NSInteger length = indexPath.item * 4 + 4 > self.newestMusicArray.count ? self.newestMusicArray.count - indexPath.item * 4: 4;
- NSRange range = NSMakeRange(indexPath.item * 4, length);
-
- songArray = [NSMutableArray arrayWithArray:[self.newestMusicArray subarrayWithRange:range]];
- HomeHotMusicCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotMusicCollectionCell" forIndexPath:indexPath];
- MJWeakSelf;
- [cell configWithSourceArray:songArray callback:^(NSString * _Nonnull songId) {
- [weakSelf displaySongDetail:songId];
- }];
- return cell;
- }
- else {
- NSMutableArray *songArray = [NSMutableArray array];
- NSInteger length = indexPath.item * 4 + 4 > self.dataArray.count ? self.dataArray.count - indexPath.item * 4: 4;
- NSRange range = NSMakeRange(indexPath.item * 4, length);
-
- songArray = [NSMutableArray arrayWithArray:[self.dataArray subarrayWithRange:range]];
- HomeHotMusicCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeHotMusicCollectionCell" forIndexPath:indexPath];
- MJWeakSelf;
- [cell configWithSourceArray:songArray callback:^(NSString * _Nonnull songId) {
- [weakSelf displaySongDetail:songId];
- }];
- return cell;
- }
- }
- - (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];
- }
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
- if (collectionView == self.albumCollectionView) {
- return CGSizeMake(100, 140);
- }
- else {
- return CGSizeMake(KPortraitWidth * 0.83, 320);
- }
- }
- #pragma mark ----- 专辑
- - (HomeAlbumView *)albumView {
- if (!_albumView) {
- _albumView = [HomeAlbumView 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, 11, 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;
- }
- - (NSMutableArray *)albumArray {
- if (!_albumArray) {
- _albumArray = [NSMutableArray array];
- }
- return _albumArray;
- }
- - (void)moreAlbumDetail {
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-album"];
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- #pragma mark --- 推荐曲目
- - (HomeRecommendMusicView *)recommendMusicView {
- if (!_recommendMusicView) {
- _recommendMusicView = [HomeRecommendMusicView shareInstance];
- MJWeakSelf;
- [_recommendMusicView homeMusicMore:^{
- [weakSelf moreRecommendMusic];
- }];
- [_recommendMusicView.musicContentView addSubview:self.recommendMusicCollectionView];
- [self.recommendMusicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.top.mas_equalTo(_recommendMusicView.musicContentView);
- }];
- }
- return _recommendMusicView;
- }
- - (UICollectionView *)recommendMusicCollectionView {
- if (!_recommendMusicCollectionView) {
- UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
- layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
- layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
- _recommendMusicCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
- _recommendMusicCollectionView.backgroundColor = [UIColor clearColor];
- _recommendMusicCollectionView.delegate = self;
- _recommendMusicCollectionView.dataSource = self;
- _recommendMusicCollectionView.showsVerticalScrollIndicator = NO;
- _recommendMusicCollectionView.showsHorizontalScrollIndicator = NO;
- if (@available(iOS 11.0, *)) {
- _recommendMusicCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- } else {
- // Fallback on earlier versions
- if (@available(iOS 13.0, *)) {
- _recommendMusicCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
- } else {
- // Fallback on earlier versions
- }
- }
- [_recommendMusicCollectionView registerNib:[UINib nibWithNibName:@"HomeHotMusicCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotMusicCollectionCell"];
- }
- return _recommendMusicCollectionView;
- }
- - (NSMutableArray *)recommendMusicArray {
- if (!_recommendMusicArray) {
- _recommendMusicArray = [NSMutableArray array];
- }
- return _recommendMusicArray;
- }
- - (void)moreRecommendMusic {
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-list"];
- [self.navigationController pushViewController:ctrl animated:YES];
- }
- #pragma mark ---- 最新曲目
- - (HomeNewMusicView *)newestMusicView {
- if (!_newestMusicView) {
- if (!_newestMusicView) {
- _newestMusicView = [HomeNewMusicView shareInstance];
- MJWeakSelf;
- [_newestMusicView homeMusicMore:^{
- [weakSelf moreNewMusic];
- }];
- [_newestMusicView.musicContentView addSubview:self.newestMusicCollectionView];
- [self.newestMusicCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.top.mas_equalTo(_newestMusicView.musicContentView);
- }];
- }
- return _newestMusicView;
- }
- return _newestMusicView;
- }
- - (UICollectionView *)newestMusicCollectionView {
- if (!_newestMusicCollectionView) {
- UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
- layout.sectionInset = UIEdgeInsetsMake(12, 14, 12, 14);
- layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
- _newestMusicCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
- _newestMusicCollectionView.backgroundColor = [UIColor clearColor];
- _newestMusicCollectionView.delegate = self;
- _newestMusicCollectionView.dataSource = self;
- _newestMusicCollectionView.showsVerticalScrollIndicator = NO;
- _newestMusicCollectionView.showsHorizontalScrollIndicator = NO;
- if (@available(iOS 11.0, *)) {
- _newestMusicCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- } else {
- // Fallback on earlier versions
- if (@available(iOS 13.0, *)) {
- _newestMusicCollectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
- } else {
- // Fallback on earlier versions
- }
- }
- [_newestMusicCollectionView registerNib:[UINib nibWithNibName:@"HomeHotMusicCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeHotMusicCollectionCell"];
- }
- return _newestMusicCollectionView;
- }
- - (NSMutableArray *)newestMusicArray {
- if (!_newestMusicArray) {
- _newestMusicArray = [NSMutableArray array];
- }
- return _newestMusicArray;
- }
- - (void)moreNewMusic {
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
- ctrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-list"];
- [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;
- }
- - (HomeBannerView *)bannerView {
- if (!_bannerView) {
- _bannerView = [HomeBannerView shareInstance];
- [_bannerView.bannerContentView addSubview:self.bannerScroll];
- }
- return _bannerView;
- }
- - (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 - 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]) {
- if ([model.linkType isEqualToString:@"OUT"]) {
- // 外部浏览器打开
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:model.linkUrl] options: @{} completionHandler: nil];
- }
- else {
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = model.linkUrl;
- [self.navigationController pushViewController:webCtrl animated:YES];
- }
- }
- }
- - (HomeDragButton *)suspendButton {
- if (!_suspendButton) {
- _suspendButton = [[HomeDragButton alloc] initWithFrame:CGRectMake(KPortraitWidth - HomeDragButtonWidth - 10, KPortraitHeight - kTabBarHeight - HomeDragButtonHeight - 12 , HomeDragButtonWidth, HomeDragButtonHeight)];
- MJWeakSelf;
- [_suspendButton clickAction:^{
- [weakSelf showDragWindowDetail];
- }];
- }
- return _suspendButton;
- }
- - (void)showDragWindowDetail {
- NSString *linkUrl = self.buttonModel.linkUrl;
- if ([self.buttonModel.linkType isEqualToString:@"OUT"]) {
- // 外部浏览器打开
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:linkUrl] options: @{} completionHandler: nil];
- }
- else {
- if (![NSString isEmptyString:linkUrl]) {
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
- webCtrl.url = linkUrl;
- [self.navigationController pushViewController:webCtrl animated:YES];
- }
- }
- }
- - (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 {
- if (!_tenantNameView) {
- _tenantNameView = [HomeTenantView shareInstance];
- }
- return _tenantNameView;
- }
- /*
- #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
|