|
@@ -47,6 +47,8 @@
|
|
|
#import "WMPlayer.h" // 播放相关
|
|
|
#import "AppDelegate.h"
|
|
|
#import "KSNewsAlert.h"
|
|
|
+#import "RecentCourseModel.h"
|
|
|
+#import "AccompanyDetailViewController.h"
|
|
|
|
|
|
#define BUTTONWIDTH (65)
|
|
|
#define BUTTONHEIGHT (80)
|
|
@@ -121,7 +123,6 @@
|
|
|
[self configNavView];
|
|
|
[self configUI];
|
|
|
[self requestUserInfo]; // 获取声部
|
|
|
-// [self requestData];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -184,24 +185,24 @@
|
|
|
}];
|
|
|
tableHeaderHeight += self.buttonViewHeight;
|
|
|
|
|
|
- NSMutableArray *buttonInfoArray = [NSMutableArray array];
|
|
|
- NSArray *titleArray = @[@"陪练课",@"直播课",@"视频课",@"乐谱库",@"老师风采"];
|
|
|
- NSArray *imageArray = @[@"home_accompany",@"home_live",@"home_video",@"home_music",@"home_style"];
|
|
|
- NSString *accompanyUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/practiceClass"];
|
|
|
- NSString *liveUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/liveClass"];
|
|
|
- NSString *videoUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/videoClass"];
|
|
|
- NSString *musicUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-songbook"];
|
|
|
- NSString *teacherUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherElegant"];
|
|
|
- NSArray *linkUrlArray = @[accompanyUrl,liveUrl,videoUrl,musicUrl,teacherUrl];
|
|
|
- for (NSInteger i = 0; i < titleArray.count; i++) {
|
|
|
- HomeMessageModel *model = [[HomeMessageModel alloc] init];
|
|
|
- model.title = titleArray[i];
|
|
|
- model.coverImage = imageArray[i];
|
|
|
- model.linkUrl = linkUrlArray[i];
|
|
|
- [buttonInfoArray addObject:model];
|
|
|
- }
|
|
|
- self.buttonArray = [NSMutableArray arrayWithArray:buttonInfoArray];
|
|
|
- [self showButtonMessage];
|
|
|
+// NSMutableArray *buttonInfoArray = [NSMutableArray array];
|
|
|
+// NSArray *titleArray = @[@"陪练课",@"直播课",@"视频课",@"乐谱库",@"老师风采"];
|
|
|
+// NSArray *imageArray = @[@"home_accompany",@"home_live",@"home_video",@"home_music",@"home_style"];
|
|
|
+// NSString *accompanyUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/practiceClass"];
|
|
|
+// NSString *liveUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/liveClass"];
|
|
|
+// NSString *videoUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/videoClass"];
|
|
|
+// NSString *musicUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-songbook"];
|
|
|
+// NSString *teacherUrl = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherElegant"];
|
|
|
+// NSArray *linkUrlArray = @[accompanyUrl,liveUrl,videoUrl,musicUrl,teacherUrl];
|
|
|
+// for (NSInteger i = 0; i < titleArray.count; i++) {
|
|
|
+// HomeMessageModel *model = [[HomeMessageModel alloc] init];
|
|
|
+// model.title = titleArray[i];
|
|
|
+// model.coverImage = imageArray[i];
|
|
|
+// model.linkUrl = linkUrlArray[i];
|
|
|
+// [buttonInfoArray addObject:model];
|
|
|
+// }
|
|
|
+// self.buttonArray = [NSMutableArray arrayWithArray:buttonInfoArray];
|
|
|
+// [self showButtonMessage];
|
|
|
|
|
|
// 课程提醒
|
|
|
[self.tableHeaderView addSubview:self.tipsCourseView];
|
|
@@ -297,14 +298,14 @@
|
|
|
[self.bannerScroll reloadData];
|
|
|
|
|
|
// 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];
|
|
|
-// [self showButtonMessage];
|
|
|
+ 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];
|
|
|
+ [self showButtonMessage];
|
|
|
|
|
|
// news
|
|
|
NSArray *flashArray = [result arrayValueForKey:@"flashPage"];
|
|
@@ -392,7 +393,14 @@
|
|
|
self.videoCourseArray = [NSMutableArray arrayWithArray:videoCourse];
|
|
|
|
|
|
// 最近课程
|
|
|
-// [dic dictionaryValueForKey:@"recentCourses"];
|
|
|
+ NSDictionary *parm = [sourceDic dictionaryValueForKey:@"recentCourses"];
|
|
|
+ if (parm == nil) {
|
|
|
+ [self refreshCourseView:nil];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ RecentCourseModel *model = [[RecentCourseModel alloc] initWithDictionary:parm];
|
|
|
+ [self refreshCourseView:model];
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
[self MBPShow:MESSAGEKEY];
|
|
@@ -404,6 +412,25 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+- (void)refreshCourseView:(RecentCourseModel *)model {
|
|
|
+ if (model) {
|
|
|
+ self.tipsViewHeight = 80.0f;
|
|
|
+ [self.tipsCourseView configWithCourseMessage:model];
|
|
|
+ self.tipsCourseView.hidden = NO;
|
|
|
+ [self.tipsCourseView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(80.0f);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ self.tipsViewHeight = CGFLOAT_MIN;
|
|
|
+ self.tipsCourseView.hidden = YES;
|
|
|
+ [self.tipsCourseView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(CGFLOAT_MIN);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ [self refreshTableHeadHeight];
|
|
|
+}
|
|
|
+
|
|
|
- (void)refreshCourseView {
|
|
|
// 课程
|
|
|
if (self.liveCourseArray.count && self.videoCourseArray.count) {
|
|
@@ -481,16 +508,15 @@
|
|
|
}
|
|
|
|
|
|
- (void)refreshNavView {
|
|
|
- NSString *subjectName = @"";
|
|
|
- if ([NSString isEmptyString:self.mineInfo.subjectName]) {
|
|
|
- subjectName = @"请选择乐器";
|
|
|
- [self showInstrumentView:YES];
|
|
|
+ [self.navView.userAvatal sd_setImageWithURL:[NSURL URLWithString:[self.mineInfo.heardUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
|
|
|
+ NSString *userName = @"";
|
|
|
+ if ([NSString isEmptyString:self.mineInfo.username]) {
|
|
|
+ userName = [NSString stringWithFormat:@"游客%@",self.mineInfo.userId];
|
|
|
}
|
|
|
else {
|
|
|
- subjectName = self.mineInfo.subjectName;
|
|
|
- [self requestData];
|
|
|
+ userName = self.mineInfo.username;
|
|
|
}
|
|
|
- self.navView.subjectName.text = subjectName;
|
|
|
+ self.navView.userName.text = userName;
|
|
|
}
|
|
|
|
|
|
- (void)refreshBannaerView {
|
|
@@ -528,8 +554,8 @@
|
|
|
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]];
|
|
|
- [buttonView.buttonImage setImage:[UIImage imageNamed:model.coverImage]];
|
|
|
+
|
|
|
+ [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;
|
|
@@ -795,16 +821,20 @@
|
|
|
if (!_tipsCourseView) {
|
|
|
_tipsCourseView = [HomeCourseTipsView shareInstance];
|
|
|
MJWeakSelf;
|
|
|
- [_tipsCourseView joinRoomCallback:^(COURSETYPE type, NSString * _Nonnull courseId) {
|
|
|
- [weakSelf joinRoomAction:type courseId:courseId];
|
|
|
+ [_tipsCourseView joinRoomCallback:^(COURSETYPE type, RecentCourseModel * _Nonnull courseModel) {
|
|
|
+ [weakSelf joinRoomAction:type courseMessage:courseModel];
|
|
|
}];
|
|
|
}
|
|
|
return _tipsCourseView;
|
|
|
}
|
|
|
|
|
|
-- (void)joinRoomAction:(COURSETYPE)type courseId:(NSString *)courseId {
|
|
|
+- (void)joinRoomAction:(COURSETYPE)type courseMessage:(RecentCourseModel *)courseModel {
|
|
|
if (type == COURSETYPE_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 { // 直播课详情
|
|
|
|