Browse Source

约课->直播和视频课

Steven 4 months ago
parent
commit
d1c8a48894
18 changed files with 1345 additions and 21 deletions
  1. 12 0
      KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj
  2. 24 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h
  3. 55 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m
  4. 40 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/Model/ArrangeLiveCourseModel.h
  5. 239 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/Model/ArrangeLiveCourseModel.m
  6. 37 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/Model/ArrangeVideoCourseModel.h
  7. 210 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/Model/ArrangeVideoCourseModel.m
  8. 1 1
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/HomeArrangeAccompanyCourseView.m
  9. 315 1
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/HomeArrangeLiveCourseView.m
  10. 1 1
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/HomeArrangeVIPCourseView.m
  11. 302 1
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/HomeArrangeVideoCourseView.m
  12. 3 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/LiveCourseArrangeCell.h
  13. 33 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/LiveCourseArrangeCell.m
  14. 13 13
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/LiveCourseArrangeCell.xib
  15. 3 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/VideoCourseArrangeCell.h
  16. 52 1
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/VideoCourseArrangeCell.m
  17. 2 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/VideoCourseArrangeCell.xib
  18. 3 3
      KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/HomeViewController.m

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

@@ -883,6 +883,8 @@
 		BCCE95F32AB05F3D00AB6385 /* TenantHotAlbumCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BCCE95F12AB05F3D00AB6385 /* TenantHotAlbumCell.m */; };
 		BCCE95F42AB05F3D00AB6385 /* TenantHotAlbumCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCCE95F22AB05F3D00AB6385 /* TenantHotAlbumCell.xib */; };
 		BCD1603A2CEC808700A78B43 /* ArrangeTeacherModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD160392CEC808700A78B43 /* ArrangeTeacherModel.m */; };
+		BCD160402CEC8CB000A78B43 /* ArrangeLiveCourseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD1603F2CEC8CB000A78B43 /* ArrangeLiveCourseModel.m */; };
+		BCD160432CEC938400A78B43 /* ArrangeVideoCourseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD160422CEC938400A78B43 /* ArrangeVideoCourseModel.m */; };
 		BCD457A1286313D70010B493 /* NotiferNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD4579E286313D70010B493 /* NotiferNavView.m */; };
 		BCD457A2286313D70010B493 /* NotiferNavView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCD457A0286313D70010B493 /* NotiferNavView.xib */; };
 		BCD457AB286469600010B493 /* PublicNoticeView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD457A92864695F0010B493 /* PublicNoticeView.m */; };
@@ -2435,6 +2437,10 @@
 		BCCE95F22AB05F3D00AB6385 /* TenantHotAlbumCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TenantHotAlbumCell.xib; sourceTree = "<group>"; };
 		BCD160382CEC808700A78B43 /* ArrangeTeacherModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArrangeTeacherModel.h; sourceTree = "<group>"; };
 		BCD160392CEC808700A78B43 /* ArrangeTeacherModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArrangeTeacherModel.m; sourceTree = "<group>"; };
+		BCD1603E2CEC8CB000A78B43 /* ArrangeLiveCourseModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArrangeLiveCourseModel.h; sourceTree = "<group>"; };
+		BCD1603F2CEC8CB000A78B43 /* ArrangeLiveCourseModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArrangeLiveCourseModel.m; sourceTree = "<group>"; };
+		BCD160412CEC938400A78B43 /* ArrangeVideoCourseModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArrangeVideoCourseModel.h; sourceTree = "<group>"; };
+		BCD160422CEC938400A78B43 /* ArrangeVideoCourseModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArrangeVideoCourseModel.m; sourceTree = "<group>"; };
 		BCD4579E286313D70010B493 /* NotiferNavView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotiferNavView.m; sourceTree = "<group>"; };
 		BCD4579F286313D70010B493 /* NotiferNavView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotiferNavView.h; sourceTree = "<group>"; };
 		BCD457A0286313D70010B493 /* NotiferNavView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NotiferNavView.xib; sourceTree = "<group>"; };
@@ -4273,6 +4279,10 @@
 			children = (
 				BCD160382CEC808700A78B43 /* ArrangeTeacherModel.h */,
 				BCD160392CEC808700A78B43 /* ArrangeTeacherModel.m */,
+				BCD1603E2CEC8CB000A78B43 /* ArrangeLiveCourseModel.h */,
+				BCD1603F2CEC8CB000A78B43 /* ArrangeLiveCourseModel.m */,
+				BCD160412CEC938400A78B43 /* ArrangeVideoCourseModel.h */,
+				BCD160422CEC938400A78B43 /* ArrangeVideoCourseModel.m */,
 			);
 			path = Model;
 			sourceTree = "<group>";
@@ -6981,6 +6991,7 @@
 				BC27A071280FF56C00F91E27 /* AccompanyEvaluateCell.m in Sources */,
 				BC119241280ED9E000A716F7 /* AccompanyDetailViewController.m in Sources */,
 				BCB6346F27F6D29600ACFDCF /* LiveroomTimeManager.m in Sources */,
+				BCD160402CEC8CB000A78B43 /* ArrangeLiveCourseModel.m in Sources */,
 				BCFB9BA12CE4A07900B66BC0 /* VipCouseDetailViewController.m in Sources */,
 				BC33327B2CEC32AA00649FF9 /* CourseDescAlertView.m in Sources */,
 				27F9033627E87C8B00C08A19 /* MineNavView.m in Sources */,
@@ -7062,6 +7073,7 @@
 				BCC0F6CA2A8CDDFE00C4EFA4 /* ClassroomService.m in Sources */,
 				BCC0F6C52A8CDDEB00C4EFA4 /* Classroom.m in Sources */,
 				BC7DECA02C2D571A00154524 /* AudioEnginePlayer.m in Sources */,
+				BCD160432CEC938400A78B43 /* ArrangeVideoCourseModel.m in Sources */,
 				BC106C502A9351DA000759A9 /* LiveModuleService.m in Sources */,
 				2723B5BB27F157B100E0B90B /* ChatAddressBodyView.m in Sources */,
 				BC71D27F288807680010F14B /* AnimationHelper.m in Sources */,

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

@@ -1078,6 +1078,30 @@ NS_ASSUME_NONNULL_BEGIN
 /// @param success 成功
 /// @param faliure 失败
 + (void)findTeacherList:(NSString *)post courseType:(NSString *)courseType search:(NSString *)search recentFree:(BOOL)recentFree sortField:(NSString *)sortField sortRule:(NSString *)sortRule page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
+
+// api-student/videoLesson/selectGroup
+
+/// 视频课列表查询
+/// @param post post
+/// @param lessonSubject 课程声部
+/// @param search 搜索
+/// @param page 分页
+/// @param rows 条数
+/// @param success 成功
+/// @param faliure 失败
++ (void)videoLessonSelectGroupRequest:(NSString *)post lessonSubject:(NSString *)lessonSubject search:(NSString *)search page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
+
+// /courseGroup/queryPageCourseGroup
+
+/// 查询直播课
+/// @param post post
+/// @param search 搜索
+/// @param subjectId 声部ID
+/// @param page 分页
+/// @param rows 条数
+/// @param success 成功
+/// @param faliure 失败
++ (void)queryLiveCourseGroupRequest:(NSString *)post search:(NSString *)search subjectId:(NSString *)subjectId page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -2051,4 +2051,59 @@
     }
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
 }
+
+// api-student/videoLesson/selectGroup
+
+/// 视频课列表查询
+/// @param post post
+/// @param lessonSubject 课程声部
+/// @param search 搜索
+/// @param page 分页
+/// @param rows 条数
+/// @param success 成功
+/// @param faliure 失败
++ (void)videoLessonSelectGroupRequest:(NSString *)post lessonSubject:(NSString *)lessonSubject search:(NSString *)search page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
+    [self configRequestMethodJSON];
+    NSString *url = [NSString stringWithFormat:@"%@%@",hostURL, @"/api-student/videoLesson/selectGroup"];
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:@(page) forKey:@"page"];
+    [parm setValue:@(rows) forKey:@"rows"];
+    [parm setValue:search forKey:@"search"];
+    [parm setValue:lessonSubject forKey:@"lessonSubject"];
+    
+    [parm setValue:@"ios-student" forKey:@"platform"];
+    NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
+    [parm setValue:currentVersion forKey:@"version"];
+    [parm setValue:@(NO) forKey:@"myself"];
+    [self request:post andWithUrl:url and:parm success:success faliure:faliure];
+}
+
+// /courseGroup/queryPageCourseGroup
+
+/// 查询直播课
+/// @param post post
+/// @param search 搜索
+/// @param subjectId 声部ID
+/// @param page 分页
+/// @param rows 条数
+/// @param success 成功
+/// @param faliure 失败
++ (void)queryLiveCourseGroupRequest:(NSString *)post search:(NSString *)search subjectId:(NSString *)subjectId page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
+    [self configRequestMethodJSON];
+    NSString *url = [NSString stringWithFormat:@"%@%@",hostURL, @"/api-student/courseGroup/queryPageCourseGroup"];
+    
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:search forKey:@"search"];
+    [parm setValue:@(page) forKey:@"page"];
+    [parm setValue:@(rows) forKey:@"rows"];
+    [parm setValue:search forKey:@"search"];
+    [parm setValue:subjectId forKey:@"subjectId"];
+    
+    [parm setValue:@"APPLY" forKey:@"groupStatus"];
+    [parm setValue:@"ios-student" forKey:@"platform"];
+    NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
+    [parm setValue:currentVersion forKey:@"version"];
+    [parm setValue:@(NO) forKey:@"myself"];
+    [self request:post andWithUrl:url and:parm success:success faliure:faliure];
+}
 @end

+ 40 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/Model/ArrangeLiveCourseModel.h

@@ -0,0 +1,40 @@
+//
+//  ArrangeLiveCourseModel.h
+//
+//  Created by Steven  on 2024/11/19
+//  Copyright (c) 2024 __MyCompanyName__. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+
+@interface ArrangeLiveCourseModel : NSObject <NSCoding, NSCopying>
+
+@property (nonatomic, strong) NSString *backgroundPic;
+@property (nonatomic, strong) NSString *courseIntroduce;
+@property (nonatomic, strong) NSString *salesEndDate;
+@property (nonatomic, strong) NSString *status;
+@property (nonatomic, assign) double mixStudentNum;
+@property (nonatomic, strong) NSString *courseGroupName;
+@property (nonatomic, strong) NSString *salesStartDate;
+@property (nonatomic, strong) NSString *teacherName;
+@property (nonatomic, strong) NSString *subjectName;
+@property (nonatomic, strong) NSString *courseStartTime;
+@property (nonatomic, assign) double singleCourseMinutes;
+@property (nonatomic, strong) NSString *imGroupId;
+@property (nonatomic, strong) NSString *teacherId;
+@property (nonatomic, assign) double studentCount;
+@property (nonatomic, strong) NSString *courseGroupId;
+@property (nonatomic, strong) NSString *avatar;
+@property (nonatomic, assign) double courseNum;
+@property (nonatomic, assign) double existBuy;
+@property (nonatomic, strong) NSString *reason;
+@property (nonatomic, strong) NSString *userName;
+@property (nonatomic, assign) double coursePrice;
+
++ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
+- (instancetype)initWithDictionary:(NSDictionary *)dict;
+- (NSDictionary *)dictionaryRepresentation;
+
+@end

+ 239 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/Model/ArrangeLiveCourseModel.m

@@ -0,0 +1,239 @@
+//
+//  ArrangeLiveCourseModel.m
+//
+//  Created by Steven  on 2024/11/19
+//  Copyright (c) 2024 __MyCompanyName__. All rights reserved.
+//
+
+#import "ArrangeLiveCourseModel.h"
+
+
+NSString *const kArrangeLiveCourseModelBackgroundPic = @"backgroundPic";
+NSString *const kArrangeLiveCourseModelCourseIntroduce = @"courseIntroduce";
+NSString *const kArrangeLiveCourseModelSalesEndDate = @"salesEndDate";
+NSString *const kArrangeLiveCourseModelStatus = @"status";
+NSString *const kArrangeLiveCourseModelMixStudentNum = @"mixStudentNum";
+NSString *const kArrangeLiveCourseModelCourseGroupName = @"courseGroupName";
+NSString *const kArrangeLiveCourseModelSalesStartDate = @"salesStartDate";
+NSString *const kArrangeLiveCourseModelTeacherName = @"teacherName";
+NSString *const kArrangeLiveCourseModelSubjectName = @"subjectName";
+NSString *const kArrangeLiveCourseModelCourseStartTime = @"courseStartTime";
+NSString *const kArrangeLiveCourseModelSingleCourseMinutes = @"singleCourseMinutes";
+NSString *const kArrangeLiveCourseModelImGroupId = @"imGroupId";
+NSString *const kArrangeLiveCourseModelTeacherId = @"teacherId";
+NSString *const kArrangeLiveCourseModelStudentCount = @"studentCount";
+NSString *const kArrangeLiveCourseModelCourseGroupId = @"courseGroupId";
+NSString *const kArrangeLiveCourseModelAvatar = @"avatar";
+NSString *const kArrangeLiveCourseModelCourseNum = @"courseNum";
+NSString *const kArrangeLiveCourseModelExistBuy = @"existBuy";
+NSString *const kArrangeLiveCourseModelReason = @"reason";
+NSString *const kArrangeLiveCourseModelUserName = @"userName";
+NSString *const kArrangeLiveCourseModelCoursePrice = @"coursePrice";
+
+
+@interface ArrangeLiveCourseModel ()
+
+- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
+
+@end
+
+@implementation ArrangeLiveCourseModel
+
+@synthesize backgroundPic = _backgroundPic;
+@synthesize courseIntroduce = _courseIntroduce;
+@synthesize salesEndDate = _salesEndDate;
+@synthesize status = _status;
+@synthesize mixStudentNum = _mixStudentNum;
+@synthesize courseGroupName = _courseGroupName;
+@synthesize salesStartDate = _salesStartDate;
+@synthesize teacherName = _teacherName;
+@synthesize subjectName = _subjectName;
+@synthesize courseStartTime = _courseStartTime;
+@synthesize singleCourseMinutes = _singleCourseMinutes;
+@synthesize imGroupId = _imGroupId;
+@synthesize teacherId = _teacherId;
+@synthesize studentCount = _studentCount;
+@synthesize courseGroupId = _courseGroupId;
+@synthesize avatar = _avatar;
+@synthesize courseNum = _courseNum;
+@synthesize existBuy = _existBuy;
+@synthesize reason = _reason;
+@synthesize userName = _userName;
+@synthesize coursePrice = _coursePrice;
+
+
++ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
+{
+    return [[self alloc] initWithDictionary:dict];
+}
+
+- (instancetype)initWithDictionary:(NSDictionary *)dict
+{
+    self = [super init];
+    
+    // This check serves to make sure that a non-NSDictionary object
+    // passed into the model class doesn't break the parsing.
+    if(self && [dict isKindOfClass:[NSDictionary class]]) {
+            self.backgroundPic = [self objectOrNilForKey:kArrangeLiveCourseModelBackgroundPic fromDictionary:dict];
+            self.courseIntroduce = [self objectOrNilForKey:kArrangeLiveCourseModelCourseIntroduce fromDictionary:dict];
+            self.salesEndDate = [self objectOrNilForKey:kArrangeLiveCourseModelSalesEndDate fromDictionary:dict];
+            self.status = [self objectOrNilForKey:kArrangeLiveCourseModelStatus fromDictionary:dict];
+            self.mixStudentNum = [[self objectOrNilForKey:kArrangeLiveCourseModelMixStudentNum fromDictionary:dict] doubleValue];
+            self.courseGroupName = [self objectOrNilForKey:kArrangeLiveCourseModelCourseGroupName fromDictionary:dict];
+            self.salesStartDate = [self objectOrNilForKey:kArrangeLiveCourseModelSalesStartDate fromDictionary:dict];
+            self.teacherName = [self objectOrNilForKey:kArrangeLiveCourseModelTeacherName fromDictionary:dict];
+            self.subjectName = [self objectOrNilForKey:kArrangeLiveCourseModelSubjectName fromDictionary:dict];
+            self.courseStartTime = [self objectOrNilForKey:kArrangeLiveCourseModelCourseStartTime fromDictionary:dict];
+            self.singleCourseMinutes = [[self objectOrNilForKey:kArrangeLiveCourseModelSingleCourseMinutes fromDictionary:dict] doubleValue];
+            self.imGroupId = [self objectOrNilForKey:kArrangeLiveCourseModelImGroupId fromDictionary:dict];
+            self.teacherId = [self objectOrNilForKey:kArrangeLiveCourseModelTeacherId fromDictionary:dict];
+            self.studentCount = [[self objectOrNilForKey:kArrangeLiveCourseModelStudentCount fromDictionary:dict] doubleValue];
+            self.courseGroupId = [self objectOrNilForKey:kArrangeLiveCourseModelCourseGroupId fromDictionary:dict];
+            self.avatar = [self objectOrNilForKey:kArrangeLiveCourseModelAvatar fromDictionary:dict];
+            self.courseNum = [[self objectOrNilForKey:kArrangeLiveCourseModelCourseNum fromDictionary:dict] doubleValue];
+            self.existBuy = [[self objectOrNilForKey:kArrangeLiveCourseModelExistBuy fromDictionary:dict] doubleValue];
+            self.reason = [self objectOrNilForKey:kArrangeLiveCourseModelReason fromDictionary:dict];
+            self.userName = [self objectOrNilForKey:kArrangeLiveCourseModelUserName fromDictionary:dict];
+            self.coursePrice = [[self objectOrNilForKey:kArrangeLiveCourseModelCoursePrice fromDictionary:dict] doubleValue];
+
+    }
+    
+    return self;
+    
+}
+
+- (NSDictionary *)dictionaryRepresentation
+{
+    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
+    [mutableDict setValue:self.backgroundPic forKey:kArrangeLiveCourseModelBackgroundPic];
+    [mutableDict setValue:self.courseIntroduce forKey:kArrangeLiveCourseModelCourseIntroduce];
+    [mutableDict setValue:self.salesEndDate forKey:kArrangeLiveCourseModelSalesEndDate];
+    [mutableDict setValue:self.status forKey:kArrangeLiveCourseModelStatus];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.mixStudentNum] forKey:kArrangeLiveCourseModelMixStudentNum];
+    [mutableDict setValue:self.courseGroupName forKey:kArrangeLiveCourseModelCourseGroupName];
+    [mutableDict setValue:self.salesStartDate forKey:kArrangeLiveCourseModelSalesStartDate];
+    [mutableDict setValue:self.teacherName forKey:kArrangeLiveCourseModelTeacherName];
+    [mutableDict setValue:self.subjectName forKey:kArrangeLiveCourseModelSubjectName];
+    [mutableDict setValue:self.courseStartTime forKey:kArrangeLiveCourseModelCourseStartTime];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.singleCourseMinutes] forKey:kArrangeLiveCourseModelSingleCourseMinutes];
+    [mutableDict setValue:self.imGroupId forKey:kArrangeLiveCourseModelImGroupId];
+    [mutableDict setValue:self.teacherId forKey:kArrangeLiveCourseModelTeacherId];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.studentCount] forKey:kArrangeLiveCourseModelStudentCount];
+    [mutableDict setValue:self.courseGroupId forKey:kArrangeLiveCourseModelCourseGroupId];
+    [mutableDict setValue:self.avatar forKey:kArrangeLiveCourseModelAvatar];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.courseNum] forKey:kArrangeLiveCourseModelCourseNum];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.existBuy] forKey:kArrangeLiveCourseModelExistBuy];
+    [mutableDict setValue:self.reason forKey:kArrangeLiveCourseModelReason];
+    [mutableDict setValue:self.userName forKey:kArrangeLiveCourseModelUserName];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.coursePrice] forKey:kArrangeLiveCourseModelCoursePrice];
+
+    return [NSDictionary dictionaryWithDictionary:mutableDict];
+}
+
+- (NSString *)description 
+{
+    return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
+}
+
+#pragma mark - Helper Method
+- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
+{
+    id object = [dict objectForKey:aKey];
+    if ([object isKindOfClass:[NSNumber class]]) {
+        NSNumber *number = object;
+        object = [number stringValue];
+    }
+    return [object isEqual:[NSNull null]] ? nil : object;
+}
+
+
+#pragma mark - NSCoding Methods
+
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+    self = [super init];
+
+    self.backgroundPic = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelBackgroundPic];
+    self.courseIntroduce = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelCourseIntroduce];
+    self.salesEndDate = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelSalesEndDate];
+    self.status = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelStatus];
+    self.mixStudentNum = [aDecoder decodeDoubleForKey:kArrangeLiveCourseModelMixStudentNum];
+    self.courseGroupName = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelCourseGroupName];
+    self.salesStartDate = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelSalesStartDate];
+    self.teacherName = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelTeacherName];
+    self.subjectName = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelSubjectName];
+    self.courseStartTime = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelCourseStartTime];
+    self.singleCourseMinutes = [aDecoder decodeDoubleForKey:kArrangeLiveCourseModelSingleCourseMinutes];
+    self.imGroupId = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelImGroupId];
+    self.teacherId = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelTeacherId];
+    self.studentCount = [aDecoder decodeDoubleForKey:kArrangeLiveCourseModelStudentCount];
+    self.courseGroupId = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelCourseGroupId];
+    self.avatar = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelAvatar];
+    self.courseNum = [aDecoder decodeDoubleForKey:kArrangeLiveCourseModelCourseNum];
+    self.existBuy = [aDecoder decodeDoubleForKey:kArrangeLiveCourseModelExistBuy];
+    self.reason = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelReason];
+    self.userName = [aDecoder decodeObjectForKey:kArrangeLiveCourseModelUserName];
+    self.coursePrice = [aDecoder decodeDoubleForKey:kArrangeLiveCourseModelCoursePrice];
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)aCoder
+{
+
+    [aCoder encodeObject:_backgroundPic forKey:kArrangeLiveCourseModelBackgroundPic];
+    [aCoder encodeObject:_courseIntroduce forKey:kArrangeLiveCourseModelCourseIntroduce];
+    [aCoder encodeObject:_salesEndDate forKey:kArrangeLiveCourseModelSalesEndDate];
+    [aCoder encodeObject:_status forKey:kArrangeLiveCourseModelStatus];
+    [aCoder encodeDouble:_mixStudentNum forKey:kArrangeLiveCourseModelMixStudentNum];
+    [aCoder encodeObject:_courseGroupName forKey:kArrangeLiveCourseModelCourseGroupName];
+    [aCoder encodeObject:_salesStartDate forKey:kArrangeLiveCourseModelSalesStartDate];
+    [aCoder encodeObject:_teacherName forKey:kArrangeLiveCourseModelTeacherName];
+    [aCoder encodeObject:_subjectName forKey:kArrangeLiveCourseModelSubjectName];
+    [aCoder encodeObject:_courseStartTime forKey:kArrangeLiveCourseModelCourseStartTime];
+    [aCoder encodeDouble:_singleCourseMinutes forKey:kArrangeLiveCourseModelSingleCourseMinutes];
+    [aCoder encodeObject:_imGroupId forKey:kArrangeLiveCourseModelImGroupId];
+    [aCoder encodeObject:_teacherId forKey:kArrangeLiveCourseModelTeacherId];
+    [aCoder encodeDouble:_studentCount forKey:kArrangeLiveCourseModelStudentCount];
+    [aCoder encodeObject:_courseGroupId forKey:kArrangeLiveCourseModelCourseGroupId];
+    [aCoder encodeObject:_avatar forKey:kArrangeLiveCourseModelAvatar];
+    [aCoder encodeDouble:_courseNum forKey:kArrangeLiveCourseModelCourseNum];
+    [aCoder encodeDouble:_existBuy forKey:kArrangeLiveCourseModelExistBuy];
+    [aCoder encodeObject:_reason forKey:kArrangeLiveCourseModelReason];
+    [aCoder encodeObject:_userName forKey:kArrangeLiveCourseModelUserName];
+    [aCoder encodeDouble:_coursePrice forKey:kArrangeLiveCourseModelCoursePrice];
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    ArrangeLiveCourseModel *copy = [[ArrangeLiveCourseModel alloc] init];
+    
+    if (copy) {
+
+        copy.backgroundPic = [self.backgroundPic copyWithZone:zone];
+        copy.courseIntroduce = [self.courseIntroduce copyWithZone:zone];
+        copy.salesEndDate = [self.salesEndDate copyWithZone:zone];
+        copy.status = [self.status copyWithZone:zone];
+        copy.mixStudentNum = self.mixStudentNum;
+        copy.courseGroupName = [self.courseGroupName copyWithZone:zone];
+        copy.salesStartDate = [self.salesStartDate copyWithZone:zone];
+        copy.teacherName = [self.teacherName copyWithZone:zone];
+        copy.subjectName = [self.subjectName copyWithZone:zone];
+        copy.courseStartTime = [self.courseStartTime copyWithZone:zone];
+        copy.singleCourseMinutes = self.singleCourseMinutes;
+        copy.imGroupId = [self.imGroupId copyWithZone:zone];
+        copy.teacherId = [self.teacherId copyWithZone:zone];
+        copy.studentCount = self.studentCount;
+        copy.courseGroupId = [self.courseGroupId copyWithZone:zone];
+        copy.avatar = [self.avatar copyWithZone:zone];
+        copy.courseNum = self.courseNum;
+        copy.existBuy = self.existBuy;
+        copy.reason = [self.reason copyWithZone:zone];
+        copy.userName = [self.userName copyWithZone:zone];
+        copy.coursePrice = self.coursePrice;
+    }
+    
+    return copy;
+}
+
+
+@end

+ 37 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/Model/ArrangeVideoCourseModel.h

@@ -0,0 +1,37 @@
+//
+//  ArrangeVideoCourseModel.h
+//
+//  Created by Steven  on 2024/11/19
+//  Copyright (c) 2024 __MyCompanyName__. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+
+@interface ArrangeVideoCourseModel : NSObject <NSCoding, NSCopying>
+
+@property (nonatomic, strong) NSString *internalBaseClassIdentifier;
+@property (nonatomic, strong) NSString *lessonCoverUrl;
+@property (nonatomic, strong) NSString *realName;
+@property (nonatomic, assign) double lessonCount;
+@property (nonatomic, assign) double virtualNumber;
+@property (nonatomic, assign) double auditVersion;
+@property (nonatomic, strong) NSString *lessonSubjectName;
+@property (nonatomic, strong) NSString *lessonDesc;
+@property (nonatomic, assign) double lessonPrice;
+@property (nonatomic, assign) double countStudent;
+@property (nonatomic, strong) NSString *lessonName;
+@property (nonatomic, strong) NSString *avatar;
+@property (nonatomic, strong) NSString *lessonSubject;
+@property (nonatomic, strong) NSString *payType;
+@property (nonatomic, assign) double teacherId;
+@property (nonatomic, strong) NSString *relationType;
+@property (nonatomic, strong) NSString *userName;
+@property (nonatomic, assign) NSInteger musicNum;
+
++ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
+- (instancetype)initWithDictionary:(NSDictionary *)dict;
+- (NSDictionary *)dictionaryRepresentation;
+
+@end

+ 210 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/Model/ArrangeVideoCourseModel.m

@@ -0,0 +1,210 @@
+//
+//  ArrangeVideoCourseModel.m
+//
+//  Created by Steven  on 2024/11/19
+//  Copyright (c) 2024 __MyCompanyName__. All rights reserved.
+//
+
+#import "ArrangeVideoCourseModel.h"
+
+
+NSString *const kArrangeVideoCourseModelId = @"id";
+NSString *const kArrangeVideoCourseModelLessonCoverUrl = @"lessonCoverUrl";
+NSString *const kArrangeVideoCourseModelRealName = @"realName";
+NSString *const kArrangeVideoCourseModelLessonCount = @"lessonCount";
+NSString *const kArrangeVideoCourseModelVirtualNumber = @"virtualNumber";
+NSString *const kArrangeVideoCourseModelAuditVersion = @"auditVersion";
+NSString *const kArrangeVideoCourseModelLessonSubjectName = @"lessonSubjectName";
+NSString *const kArrangeVideoCourseModelLessonDesc = @"lessonDesc";
+NSString *const kArrangeVideoCourseModelLessonPrice = @"lessonPrice";
+NSString *const kArrangeVideoCourseModelCountStudent = @"countStudent";
+NSString *const kArrangeVideoCourseModelLessonName = @"lessonName";
+NSString *const kArrangeVideoCourseModelAvatar = @"avatar";
+NSString *const kArrangeVideoCourseModelLessonSubject = @"lessonSubject";
+NSString *const kArrangeVideoCourseModelPayType = @"payType";
+NSString *const kArrangeVideoCourseModelTeacherId = @"teacherId";
+NSString *const kArrangeVideoCourseModelRelationType = @"relationType";
+NSString *const kArrangeVideoCourseModelUserName = @"userName";
+NSString *const kArrangeVideoCourseModelMusicNum = @"musicNum";
+
+@interface ArrangeVideoCourseModel ()
+
+- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
+
+@end
+
+@implementation ArrangeVideoCourseModel
+
+@synthesize internalBaseClassIdentifier = _internalBaseClassIdentifier;
+@synthesize lessonCoverUrl = _lessonCoverUrl;
+@synthesize realName = _realName;
+@synthesize lessonCount = _lessonCount;
+@synthesize virtualNumber = _virtualNumber;
+@synthesize auditVersion = _auditVersion;
+@synthesize lessonSubjectName = _lessonSubjectName;
+@synthesize lessonDesc = _lessonDesc;
+@synthesize lessonPrice = _lessonPrice;
+@synthesize countStudent = _countStudent;
+@synthesize lessonName = _lessonName;
+@synthesize avatar = _avatar;
+@synthesize lessonSubject = _lessonSubject;
+@synthesize payType = _payType;
+@synthesize teacherId = _teacherId;
+@synthesize relationType = _relationType;
+@synthesize userName = _userName;
+@synthesize musicNum = _musicNum;
+
++ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
+{
+    return [[self alloc] initWithDictionary:dict];
+}
+
+- (instancetype)initWithDictionary:(NSDictionary *)dict
+{
+    self = [super init];
+    
+    // This check serves to make sure that a non-NSDictionary object
+    // passed into the model class doesn't break the parsing.
+    if(self && [dict isKindOfClass:[NSDictionary class]]) {
+            self.internalBaseClassIdentifier = [self objectOrNilForKey:kArrangeVideoCourseModelId fromDictionary:dict];
+            self.lessonCoverUrl = [self objectOrNilForKey:kArrangeVideoCourseModelLessonCoverUrl fromDictionary:dict];
+            self.realName = [self objectOrNilForKey:kArrangeVideoCourseModelRealName fromDictionary:dict];
+            self.lessonCount = [[self objectOrNilForKey:kArrangeVideoCourseModelLessonCount fromDictionary:dict] doubleValue];
+            self.virtualNumber = [[self objectOrNilForKey:kArrangeVideoCourseModelVirtualNumber fromDictionary:dict] doubleValue];
+            self.auditVersion = [[self objectOrNilForKey:kArrangeVideoCourseModelAuditVersion fromDictionary:dict] doubleValue];
+            self.lessonSubjectName = [self objectOrNilForKey:kArrangeVideoCourseModelLessonSubjectName fromDictionary:dict];
+            self.lessonDesc = [self objectOrNilForKey:kArrangeVideoCourseModelLessonDesc fromDictionary:dict];
+            self.lessonPrice = [[self objectOrNilForKey:kArrangeVideoCourseModelLessonPrice fromDictionary:dict] doubleValue];
+            self.countStudent = [[self objectOrNilForKey:kArrangeVideoCourseModelCountStudent fromDictionary:dict] doubleValue];
+            self.lessonName = [self objectOrNilForKey:kArrangeVideoCourseModelLessonName fromDictionary:dict];
+            self.avatar = [self objectOrNilForKey:kArrangeVideoCourseModelAvatar fromDictionary:dict];
+            self.lessonSubject = [self objectOrNilForKey:kArrangeVideoCourseModelLessonSubject fromDictionary:dict];
+            self.payType = [self objectOrNilForKey:kArrangeVideoCourseModelPayType fromDictionary:dict];
+            self.teacherId = [[self objectOrNilForKey:kArrangeVideoCourseModelTeacherId fromDictionary:dict] doubleValue];
+            self.relationType = [self objectOrNilForKey:kArrangeVideoCourseModelRelationType fromDictionary:dict];
+            self.userName = [self objectOrNilForKey:kArrangeVideoCourseModelUserName fromDictionary:dict];
+            self.musicNum = [[self objectOrNilForKey:kArrangeVideoCourseModelMusicNum fromDictionary:dict] integerValue];
+    }
+    
+    return self;
+    
+}
+
+- (NSDictionary *)dictionaryRepresentation
+{
+    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
+    [mutableDict setValue:self.internalBaseClassIdentifier forKey:kArrangeVideoCourseModelId];
+    [mutableDict setValue:self.lessonCoverUrl forKey:kArrangeVideoCourseModelLessonCoverUrl];
+    [mutableDict setValue:self.realName forKey:kArrangeVideoCourseModelRealName];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.lessonCount] forKey:kArrangeVideoCourseModelLessonCount];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.virtualNumber] forKey:kArrangeVideoCourseModelVirtualNumber];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.auditVersion] forKey:kArrangeVideoCourseModelAuditVersion];
+    [mutableDict setValue:self.lessonSubjectName forKey:kArrangeVideoCourseModelLessonSubjectName];
+    [mutableDict setValue:self.lessonDesc forKey:kArrangeVideoCourseModelLessonDesc];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.lessonPrice] forKey:kArrangeVideoCourseModelLessonPrice];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.countStudent] forKey:kArrangeVideoCourseModelCountStudent];
+    [mutableDict setValue:self.lessonName forKey:kArrangeVideoCourseModelLessonName];
+    [mutableDict setValue:self.avatar forKey:kArrangeVideoCourseModelAvatar];
+    [mutableDict setValue:self.lessonSubject forKey:kArrangeVideoCourseModelLessonSubject];
+    [mutableDict setValue:self.payType forKey:kArrangeVideoCourseModelPayType];
+    [mutableDict setValue:[NSNumber numberWithDouble:self.teacherId] forKey:kArrangeVideoCourseModelTeacherId];
+    [mutableDict setValue:self.relationType forKey:kArrangeVideoCourseModelRelationType];
+    [mutableDict setValue:self.userName forKey:kArrangeVideoCourseModelUserName];
+    [mutableDict setValue:[NSNumber numberWithInteger:self.musicNum] forKey:kArrangeVideoCourseModelMusicNum];
+    return [NSDictionary dictionaryWithDictionary:mutableDict];
+}
+
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
+}
+
+#pragma mark - Helper Method
+- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
+{
+    id object = [dict objectForKey:aKey];
+    return [object isEqual:[NSNull null]] ? nil : object;
+}
+
+
+#pragma mark - NSCoding Methods
+
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+    self = [super init];
+
+    self.internalBaseClassIdentifier = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelId];
+    self.lessonCoverUrl = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelLessonCoverUrl];
+    self.realName = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelRealName];
+    self.lessonCount = [aDecoder decodeDoubleForKey:kArrangeVideoCourseModelLessonCount];
+    self.virtualNumber = [aDecoder decodeDoubleForKey:kArrangeVideoCourseModelVirtualNumber];
+    self.auditVersion = [aDecoder decodeDoubleForKey:kArrangeVideoCourseModelAuditVersion];
+    self.lessonSubjectName = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelLessonSubjectName];
+    self.lessonDesc = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelLessonDesc];
+    self.lessonPrice = [aDecoder decodeDoubleForKey:kArrangeVideoCourseModelLessonPrice];
+    self.countStudent = [aDecoder decodeDoubleForKey:kArrangeVideoCourseModelCountStudent];
+    self.lessonName = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelLessonName];
+    self.avatar = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelAvatar];
+    self.lessonSubject = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelLessonSubject];
+    self.payType = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelPayType];
+    self.teacherId = [aDecoder decodeDoubleForKey:kArrangeVideoCourseModelTeacherId];
+    self.relationType = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelRelationType];
+    self.userName = [aDecoder decodeObjectForKey:kArrangeVideoCourseModelUserName];
+    self.musicNum = [aDecoder decodeIntegerForKey:kArrangeVideoCourseModelMusicNum];
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)aCoder
+{
+
+    [aCoder encodeObject:_internalBaseClassIdentifier forKey:kArrangeVideoCourseModelId];
+    [aCoder encodeObject:_lessonCoverUrl forKey:kArrangeVideoCourseModelLessonCoverUrl];
+    [aCoder encodeObject:_realName forKey:kArrangeVideoCourseModelRealName];
+    [aCoder encodeDouble:_lessonCount forKey:kArrangeVideoCourseModelLessonCount];
+    [aCoder encodeDouble:_virtualNumber forKey:kArrangeVideoCourseModelVirtualNumber];
+    [aCoder encodeDouble:_auditVersion forKey:kArrangeVideoCourseModelAuditVersion];
+    [aCoder encodeObject:_lessonSubjectName forKey:kArrangeVideoCourseModelLessonSubjectName];
+    [aCoder encodeObject:_lessonDesc forKey:kArrangeVideoCourseModelLessonDesc];
+    [aCoder encodeDouble:_lessonPrice forKey:kArrangeVideoCourseModelLessonPrice];
+    [aCoder encodeDouble:_countStudent forKey:kArrangeVideoCourseModelCountStudent];
+    [aCoder encodeObject:_lessonName forKey:kArrangeVideoCourseModelLessonName];
+    [aCoder encodeObject:_avatar forKey:kArrangeVideoCourseModelAvatar];
+    [aCoder encodeObject:_lessonSubject forKey:kArrangeVideoCourseModelLessonSubject];
+    [aCoder encodeObject:_payType forKey:kArrangeVideoCourseModelPayType];
+    [aCoder encodeDouble:_teacherId forKey:kArrangeVideoCourseModelTeacherId];
+    [aCoder encodeObject:_relationType forKey:kArrangeVideoCourseModelRelationType];
+    [aCoder encodeObject:_userName forKey:kArrangeVideoCourseModelUserName];
+    [aCoder encodeInteger:_musicNum forKey:kArrangeVideoCourseModelMusicNum];
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    ArrangeVideoCourseModel *copy = [[ArrangeVideoCourseModel alloc] init];
+    
+    if (copy) {
+
+        copy.internalBaseClassIdentifier = [self.internalBaseClassIdentifier copyWithZone:zone];
+        copy.lessonCoverUrl = [self.lessonCoverUrl copyWithZone:zone];
+        copy.realName = [self.realName copyWithZone:zone];
+        copy.lessonCount = self.lessonCount;
+        copy.virtualNumber = self.virtualNumber;
+        copy.auditVersion = self.auditVersion;
+        copy.lessonSubjectName = [self.lessonSubjectName copyWithZone:zone];
+        copy.lessonDesc = [self.lessonDesc copyWithZone:zone];
+        copy.lessonPrice = self.lessonPrice;
+        copy.countStudent = self.countStudent;
+        copy.lessonName = [self.lessonName copyWithZone:zone];
+        copy.avatar = [self.avatar copyWithZone:zone];
+        copy.lessonSubject = [self.lessonSubject copyWithZone:zone];
+        copy.payType = [self.payType copyWithZone:zone];
+        copy.teacherId = self.teacherId;
+        copy.relationType = [self.relationType copyWithZone:zone];
+        copy.userName = [self.userName copyWithZone:zone];
+        copy.musicNum = self.musicNum;
+    }
+    
+    return copy;
+}
+
+
+@end

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/HomeArrangeAccompanyCourseView.m

@@ -261,7 +261,7 @@
         KSChoosePicker *picker = [[KSChoosePicker alloc] initWithTitle:@"" sourceData:nameArray lastChooseIndex:0 sureButtonColor:THEMECOLOR chooseReturnWithBlock:^(NSString * _Nonnull returnValue, NSInteger chooseIndex) {
             
             weakSelf.searchView.subjectLabel.text = returnValue;
-            NSDictionary *parm = self.subjectList[chooseIndex-1];
+            NSDictionary *parm = self.subjectList[chooseIndex];
             weakSelf.subjectId = [parm ks_stringValueForKey:@"subjectId"];
             [weakSelf refreshAndRequestData];
         } cancel:^{

+ 315 - 1
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/HomeArrangeLiveCourseView.m

@@ -6,16 +6,330 @@
 //
 
 #import "HomeArrangeLiveCourseView.h"
+#import "StateView.h"
+#import "Reachability.h"
 #import "HomeArrangeSortView.h"
 #import "LiveCourseArrangeCell.h"
 #import "HomeArrangeSortView.h"
+#import "ArrangeLiveCourseModel.h"
+#import <KSChoosePicker.h>
+#import "UserInfoManager.h"
 
-@interface HomeArrangeLiveCourseView ()
+@interface HomeArrangeLiveCourseView ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
+
+@property (nonatomic, strong) HomeArrangeSortView *searchView;
+
+@property (nonatomic, strong) NSMutableArray *dataArray;
+
+@property (nonatomic, strong) StateView *promptView;
+@property (nonatomic, strong) UIView *promptPlaceView;
+
+@property (nonatomic, assign) BOOL networkAvaiable; // 网络是否可用
+
+@property (nonatomic, assign) BOOL isLoadMore;
+@property (nonatomic, assign) NSInteger rows;
+@property (nonatomic, assign) NSInteger pages;
+
+@property (nonatomic, strong) NSString *searchKey;
+
+@property (nonatomic, strong) NSString *subjectId;
 
 @end
 
 @implementation HomeArrangeLiveCourseView
 
+- (instancetype)initWithFrame:(CGRect)frame {
+    self = [super initWithFrame:frame];
+    if (self) {
+        self.backgroundColor = [UIColor clearColor];
+        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
+        layout.sectionInset = UIEdgeInsetsMake(0, 14, 12, 14);
+        
+        self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) collectionViewLayout:layout];
+        self.collectionView.backgroundColor = [UIColor clearColor];
+        self.collectionView.delegate = self;
+        self.collectionView.dataSource = self;
+        self.collectionView.showsVerticalScrollIndicator = NO;
+        self.collectionView.showsHorizontalScrollIndicator = NO;
+        [self.collectionView registerNib:[UINib nibWithNibName:@"LiveCourseArrangeCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"LiveCourseArrangeCell"];
+        [self addSubview:self.collectionView];
+        self.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+        MJWeakSelf;
+        self.collectionView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
+            [weakSelf resetParamenter];
+            [weakSelf requestData];
+        }];
+        self.collectionView.mj_footer = [KSGifRefreshFooter footerWithRefreshingBlock:^{
+            if (weakSelf.isLoadMore) {
+                weakSelf.pages += 1;
+                [weakSelf requestData];
+            }
+            else {
+                [weakSelf.collectionView.mj_footer endRefreshingWithNoMoreData];
+            }
+        }];
+        [self defaultSubject];
+    }
+    return self;
+}
+
+- (void)defaultSubject {
+    self.subjectId = USER_MANAGER.userInfo.subjectId;
+    self.searchView.subjectLabel.text = [NSString returnNoNullStringWithString:USER_MANAGER.userInfo.subjectName];
+}
+
+- (void)endRefresh {
+    @weakObj(self);
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        @strongObj(self);
+        [self.collectionView.mj_header endRefreshing];
+        [self.collectionView.mj_footer endRefreshing];
+    });
+}
+
+- (void)refreshAndRequestData {
+    [self resetParamenter];
+    [self requestData];
+}
+
+- (void)resetParamenter {
+    self.isLoadMore = YES;
+    self.pages = 1;
+    self.rows = 10;
+    self.dataArray = [NSMutableArray array];
+    [self.collectionView.mj_footer resetNoMoreData];
+    [self setPromptString:@"暂无内容" imageName:@"empty_course" inView:self.collectionView];
+    [self.collectionView reloadData];
+}
+
+- (void)requestData {
+    [KSNetworkingManager queryLiveCourseGroupRequest:KS_POST search:self.searchKey subjectId:self.subjectId page:self.pages rows:self.rows success:^(NSDictionary * _Nonnull dic) {
+        [self endRefresh];
+        if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            NSArray *sourceArray = [[dic ks_dictionaryValueForKey:@"data"] ks_arrayValueForKey:@"rows"];
+            for (NSDictionary *parm in sourceArray) {
+                ArrangeLiveCourseModel *model = [[ArrangeLiveCourseModel alloc] initWithDictionary:parm];
+                [self.dataArray addObject:model];
+            }
+            
+            if (sourceArray.count < self.rows) {
+                self.isLoadMore = NO;
+            }
+        }
+        else {
+            [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
+        }
+        [self.collectionView reloadData];
+        [self changePromptLabelStateWithArray:self.dataArray];
+    } faliure:^(NSError * _Nonnull error) {
+        [self endRefresh];
+        [self endRefresh];
+        if (self.networkAvaiable == NO) {
+            [self setPromptString:@"暂无网络" imageName:@"no_networking" inView:self.collectionView];
+        }
+        [self.dataArray removeAllObjects];
+        [self.collectionView reloadData];
+        [self changePromptLabelStateWithArray:self.dataArray];
+    }];
+}
+
+- (void)beginRefreshImmediately {
+    [self.collectionView.mj_header beginRefreshing];
+}
+
+- (void)selectCellAtIndexPath:(NSIndexPath *)indexPath {
+    
+    if (self.lastSelectedIndexPath == indexPath) {
+        return;
+    }
+    if (self.lastSelectedIndexPath != nil) {
+        UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:self.lastSelectedIndexPath];
+        [cell setSelected:NO];
+    }
+    UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
+    [cell setSelected:YES];
+    self.lastSelectedIndexPath = indexPath;
+}
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    CGFloat searchViewHeight = [HomeArrangeSortView getViewHeight];
+    if (![self.subviews containsObject:self.searchView]) {
+        [self addSubview:self.searchView];
+        [self.searchView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.right.top.mas_equalTo(self);
+            make.height.mas_equalTo(searchViewHeight);
+        }];
+    }
+
+    [self.collectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.left.right.bottom.mas_equalTo(self);
+        make.top.mas_equalTo(self.searchView.mas_bottom);
+    }];
+}
+
+- (void)beginFirstRefresh {
+    if (!self.isHeaderRefreshed) {
+        [self beginRefreshImmediately];
+    }
+}
+
+#pragma mark ----- collection view
+- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
+    return 1;
+}
+
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
+    return self.dataArray.count;
+//    return 10;
+}
+
+- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
+    LiveCourseArrangeCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"LiveCourseArrangeCell" forIndexPath:indexPath];
+    
+    ArrangeLiveCourseModel *model = [self.dataArray objectAtIndex:indexPath.row];
+    [cell configWithSource:model];
+    return cell;
+}
+
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
+//    LiveCourseModel *model = self.dataArray[indexPath.row];
+//    KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
+//    NSString *url = [NSString stringWithFormat:@"%@%@%.0f", WEBHOST, @"/#/liveDetail?groupId=",model.courseGroupId];
+//    ctrl.url = url;
+//    [self.naviController pushViewController:ctrl animated:YES];
+}
+
+- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
+    CGFloat width = KPortraitWidth - 28;
+    if (IS_IPAD) {
+        width = (KPortraitWidth - 28 - 12 * 2 - 12) / 2.0f;
+    }
+    CGFloat height = (width - 12 * 2) / 16 * 9 + 143;
+    return CGSizeMake(width, height);
+}
+
+/**
+ 设置没有数据时的显示
+ 
+ @param promptString 提示语
+ @param imgName 图片名称
+ @param view 显示在什么地方
+ */
+- (void)setPromptString:(NSString *)promptString imageName:(NSString *)imgName inView:(UIView *)view {
+    if (self.promptView != nil) {
+        [self.promptView removeFromSuperview];
+    }
+    else {
+        self.promptView = [[StateView alloc]init];
+        self.promptView.frame = CGRectMake(0, 0, KPortraitWidth, KPortraitHeight - 300);
+    }
+    _promptPlaceView = view;
+    //当请求不到数据时 ,自定义提示view 将会出现;
+    self.promptView.imageName = imgName;
+    self.promptView.alpha = 0.0f;
+    [self.promptView setText:promptString];
+    [view addSubview:self.promptView];
+}
+
+// 结束刷新后调用方法
+- (void)changePromptLabelStateWithArray:(NSMutableArray *)array {
+    NSInteger count;
+    if (array.count) {
+        count = array.count;
+    } else {
+        count = 0;
+    }
+    
+    [UIView animateWithDuration:0.1 animations:^{
+        [[self promptView] setAlpha:count ? 0.0f :1.0f ] ;
+    }] ;
+    
+}
+
+- (BOOL)networkAvaiable {
+    return [self checkNetworkAvaiable];
+}
+
+- (BOOL)checkNetworkAvaiable {
+    BOOL isExistenceNetwork = YES;
+    Reachability *reach = [Reachability reachabilityWithHostName:@"www.apple.com"];
+    switch ([reach currentReachabilityStatus]) {
+        case NotReachable:
+            isExistenceNetwork = NO;
+            //NSLog(@"notReachable");
+            break;
+        case ReachableViaWiFi:
+            isExistenceNetwork = YES;
+            //NSLog(@"WIFI");
+            break;
+        case ReachableViaWWAN:
+            isExistenceNetwork = YES;
+            //NSLog(@"3G");
+            break;
+    }
+    return isExistenceNetwork;
+}
+
+#pragma mark ----- lazying
+
+- (HomeArrangeSortView *)searchView {
+    if (!_searchView) {
+        _searchView = [HomeArrangeSortView sharedInstance];
+        MJWeakSelf;
+        [_searchView searchActionCallback:^(HOME_ARRANGE_SORT type, NSString * _Nullable searchKey) {
+            [weakSelf courseSortAction:type searchKey:searchKey];
+        }];
+    }
+    return _searchView;
+}
+
+- (void)courseSortAction:(HOME_ARRANGE_SORT)type searchKey:(NSString *)searchKey {
+    switch (type) {
+        case HOME_ARRANGE_SORT_SUBJECT:
+        {
+            [self searchSubject];
+        }
+            break;
+        case HOME_ARRANGE_SORT_SEARCH:
+        {
+            [self evaluateSource:searchKey];
+        }
+            break;
+        default:
+            break;
+    }
+}
+
+
+- (void)evaluateSource:(NSString *)searchKey {
+    self.searchKey = searchKey;
+    [self refreshAndRequestData];
+}
+
+- (void)searchSubject {
+    if (self.subjectList.count) {
+        NSMutableArray *nameArray = [NSMutableArray array];
+        for (NSDictionary *parm in self.subjectList) {
+            [nameArray addObject:[parm ks_stringValueForKey:@"subjectName"]];
+        }
+        MJWeakSelf;
+        KSChoosePicker *picker = [[KSChoosePicker alloc] initWithTitle:@"" sourceData:nameArray lastChooseIndex:0 sureButtonColor:THEMECOLOR chooseReturnWithBlock:^(NSString * _Nonnull returnValue, NSInteger chooseIndex) {
+            
+            weakSelf.searchView.subjectLabel.text = returnValue;
+            NSDictionary *parm = self.subjectList[chooseIndex];
+            weakSelf.subjectId = [parm ks_stringValueForKey:@"subjectId"];
+            [weakSelf refreshAndRequestData];
+        } cancel:^{
+            
+        }];
+        [picker showPicker];
+    }
+    else {
+        [LOADING_MANAGER MBShowAUTOHidingInWindow:@"无声部信息"];
+    }
+}
+
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/HomeArrangeVIPCourseView.m

@@ -261,7 +261,7 @@
         KSChoosePicker *picker = [[KSChoosePicker alloc] initWithTitle:@"" sourceData:nameArray lastChooseIndex:0 sureButtonColor:THEMECOLOR chooseReturnWithBlock:^(NSString * _Nonnull returnValue, NSInteger chooseIndex) {
             
             weakSelf.searchView.subjectLabel.text = returnValue;
-            NSDictionary *parm = self.subjectList[chooseIndex-1];
+            NSDictionary *parm = self.subjectList[chooseIndex];
             weakSelf.subjectId = [parm ks_stringValueForKey:@"subjectId"];
             [weakSelf refreshAndRequestData];
         } cancel:^{

+ 302 - 1
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/HomeArrangeVideoCourseView.m

@@ -9,13 +9,314 @@
 #import "HomeArrangeSortView.h"
 #import "VideoCourseArrangeCell.h"
 #import "HomeArrangeSortView.h"
+#import "StateView.h"
+#import "Reachability.h"
+#import <KSChoosePicker.h>
+#import "UserInfoManager.h"
+#import "ArrangeVideoCourseModel.h"
 
-@interface HomeArrangeVideoCourseView ()
+@interface HomeArrangeVideoCourseView ()<UITableViewDelegate,UITableViewDataSource>
+
+@property (nonatomic, assign) BOOL isLoadMore;
+@property (nonatomic, assign) NSInteger rows;
+@property (nonatomic, assign) NSInteger pages;
+
+@property (nonatomic, strong) NSMutableArray *dataArray;
+
+@property (nonatomic, strong) StateView *promptView;
+@property (nonatomic, strong) UIView *promptPlaceView;
+
+@property (nonatomic, assign) BOOL networkAvaiable; // 网络是否可用
+
+@property (nonatomic, strong) HomeArrangeSortView *searchView;
+
+@property (nonatomic, strong) NSString *searchKey;
+
+@property (nonatomic, strong) NSString *subjectId;
 
 @end
 
 @implementation HomeArrangeVideoCourseView
 
+- (instancetype)initWithFrame:(CGRect)frame {
+    self = [super initWithFrame:frame];
+    if (self) {
+        self.backgroundColor = [UIColor clearColor];
+        self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
+        self.tableView.backgroundColor = [UIColor clearColor];
+        self.tableView.showsVerticalScrollIndicator = NO;
+        self.tableView.dataSource = self;
+        self.tableView.delegate = self;
+        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+        [self addSubview:self.tableView];
+        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+        [self.tableView registerNib:[UINib nibWithNibName:@"VideoCourseArrangeCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"VideoCourseArrangeCell"];
+
+        UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KPortraitWidth, 10)];
+        bottomView.backgroundColor = [UIColor clearColor];
+        self.tableView.tableFooterView = bottomView;
+        
+        MJWeakSelf;
+        self.tableView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
+            [weakSelf resetParamenter];
+            [weakSelf requestData];
+        }];
+        self.tableView.mj_footer = [KSGifRefreshFooter footerWithRefreshingBlock:^{
+            if (weakSelf.isLoadMore) {
+                weakSelf.pages += 1;
+                [weakSelf requestData];
+            }
+            else {
+                [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
+            }
+        }];
+        [self defaultSubject];
+    }
+    return self;
+}
+
+- (void)defaultSubject {
+    self.subjectId = USER_MANAGER.userInfo.subjectId;
+    self.searchView.subjectLabel.text = [NSString returnNoNullStringWithString:USER_MANAGER.userInfo.subjectName];
+}
+
+- (void)refreshAndRequestData {
+    [self resetParamenter];
+    [self requestData];
+}
+
+- (void)resetParamenter {
+    self.isLoadMore = YES;
+    self.pages = 1;
+    self.rows = 10;
+    
+    self.dataArray = [NSMutableArray array];
+    [self.tableView.mj_footer resetNoMoreData];
+    [self setPromptString:@"暂无内容" imageName:@"empty_course" inView:self.tableView];
+    [self.tableView reloadData];
+}
+
+- (void)endRefresh {
+    @weakObj(self);
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        @strongObj(self);
+        [self.tableView.mj_header endRefreshing];
+        [self.tableView.mj_footer endRefreshing];
+    });
+}
+
+- (void)requestData { // VIP课程
+    [KSNetworkingManager videoLessonSelectGroupRequest:KS_POST lessonSubject:self.subjectId search:self.searchKey page:self.pages rows:self.rows success:^(NSDictionary * _Nonnull dic) {
+        [self endRefresh];
+        if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            NSArray *sourceArray = [[dic ks_dictionaryValueForKey:@"data"] ks_arrayValueForKey:@"rows"];
+            for (NSDictionary *parm in sourceArray) {
+                ArrangeVideoCourseModel *model = [[ArrangeVideoCourseModel alloc] initWithDictionary:parm];
+                [self.dataArray addObject:model];
+            }
+            if (sourceArray.count < self.rows) {
+                self.isLoadMore = NO;
+            }
+        }
+        else {
+            [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
+        }
+        [self.tableView reloadData];
+        [self changePromptLabelStateWithArray:self.dataArray];
+    } faliure:^(NSError * _Nonnull error) {
+        [self endRefresh];
+        if (self.networkAvaiable == NO) {
+            [self setPromptString:@"暂无网络" imageName:@"no_networking" inView:self.tableView];
+        }
+        [self.dataArray removeAllObjects];
+        [self.tableView reloadData];
+        [self changePromptLabelStateWithArray:self.dataArray];
+    }];
+}
+
+- (void)beginRefreshImmediately {
+    [self.tableView.mj_header beginRefreshing];
+}
+
+- (void)beginFirstRefresh {
+    if (!self.isHeaderRefreshed) {
+        [self beginRefreshImmediately];
+    }
+}
+- (void)selectCellAtIndexPath:(NSIndexPath *)indexPath {
+    
+    if (self.lastSelectedIndexPath == indexPath) {
+        return;
+    }
+    if (self.lastSelectedIndexPath != nil) {
+        UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:self.lastSelectedIndexPath];
+        [cell setSelected:NO animated:NO];
+    }
+    UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
+    [cell setSelected:YES animated:NO];
+    self.lastSelectedIndexPath = indexPath;
+}
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    CGFloat searchViewHeight = [HomeArrangeSortView getViewHeight];
+    if (![self.subviews containsObject:self.searchView]) {
+        [self addSubview:self.searchView];
+        [self.searchView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.right.top.mas_equalTo(self);
+            make.height.mas_equalTo(searchViewHeight);
+        }];
+    }
+
+    [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.left.right.bottom.mas_equalTo(self);
+        make.top.mas_equalTo(self.searchView.mas_bottom);
+    }];
+}
+
+#pragma mark - UITableViewDataSource
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return self.dataArray.count;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+    return 115.0f;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    VideoCourseArrangeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"VideoCourseArrangeCell"];
+    ArrangeVideoCourseModel *model = [self.dataArray objectAtIndex:indexPath.row];
+    [cell configWithSource:model];
+    return cell;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+//    ArrangeTeacherModel *model = self.dataArray[indexPath.row];
+//    KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
+//    ctrl.url = [NSString stringWithFormat:@"%@%@%@", WEBHOST, @"/#/music-detail?id=",model.internalBaseClassIdentifier];
+//    [self.naviController pushViewController:ctrl animated:YES];
+}
+
+#pragma mark ----- lazying
+
+- (HomeArrangeSortView *)searchView {
+    if (!_searchView) {
+        _searchView = [HomeArrangeSortView sharedInstance];
+        MJWeakSelf;
+        [_searchView searchActionCallback:^(HOME_ARRANGE_SORT type, NSString * _Nullable searchKey) {
+            [weakSelf courseSortAction:type searchKey:searchKey];
+        }];
+    }
+    return _searchView;
+}
+
+- (void)courseSortAction:(HOME_ARRANGE_SORT)type searchKey:(NSString *)searchKey {
+    switch (type) {
+        case HOME_ARRANGE_SORT_SUBJECT:
+        {
+            [self searchSubject];
+        }
+            break;
+        case HOME_ARRANGE_SORT_SEARCH:
+        {
+            [self evaluateSource:searchKey];
+        }
+            break;
+        default:
+            break;
+    }
+}
+
+
+- (void)evaluateSource:(NSString *)searchKey {
+    self.searchKey = searchKey;
+    [self refreshAndRequestData];
+}
+
+- (void)searchSubject {
+    if (self.subjectList.count) {
+        NSMutableArray *nameArray = [NSMutableArray array];
+        for (NSDictionary *parm in self.subjectList) {
+            [nameArray addObject:[parm ks_stringValueForKey:@"subjectName"]];
+        }
+        MJWeakSelf;
+        KSChoosePicker *picker = [[KSChoosePicker alloc] initWithTitle:@"" sourceData:nameArray lastChooseIndex:0 sureButtonColor:THEMECOLOR chooseReturnWithBlock:^(NSString * _Nonnull returnValue, NSInteger chooseIndex) {
+            
+            weakSelf.searchView.subjectLabel.text = returnValue;
+            NSDictionary *parm = self.subjectList[chooseIndex];
+            weakSelf.subjectId = [parm ks_stringValueForKey:@"subjectId"];
+            [weakSelf refreshAndRequestData];
+        } cancel:^{
+            
+        }];
+        [picker showPicker];
+    }
+    else {
+        [LOADING_MANAGER MBShowAUTOHidingInWindow:@"无声部信息"];
+    }
+}
+
+/**
+ 设置没有数据时的显示
+ 
+ @param promptString 提示语
+ @param imgName 图片名称
+ @param view 显示在什么地方
+ */
+- (void)setPromptString:(NSString *)promptString imageName:(NSString *)imgName inView:(UIView *)view {
+    if (self.promptView != nil) {
+        [self.promptView removeFromSuperview];
+    }
+    else {
+        self.promptView = [[StateView alloc]init];
+        self.promptView.frame = CGRectMake(0, 0, KPortraitWidth, KPortraitHeight - 300);
+    }
+    _promptPlaceView = view;
+    //当请求不到数据时 ,自定义提示view 将会出现;
+    self.promptView.imageName = imgName;
+    self.promptView.alpha = 0.0f;
+    [self.promptView setText:promptString];
+    [view addSubview:self.promptView];
+}
+
+// 结束刷新后调用方法
+- (void)changePromptLabelStateWithArray:(NSMutableArray *)array {
+    NSInteger count;
+    if (array.count) {
+        count = array.count;
+    } else {
+        count = 0;
+    }
+    
+    [UIView animateWithDuration:0.1 animations:^{
+        [[self promptView] setAlpha:count ? 0.0f :1.0f ] ;
+    }] ;
+    
+}
+
+- (BOOL)networkAvaiable {
+    return [self checkNetworkAvaiable];
+}
+
+- (BOOL)checkNetworkAvaiable {
+    BOOL isExistenceNetwork = YES;
+    Reachability *reach = [Reachability reachabilityWithHostName:@"www.apple.com"];
+    switch ([reach currentReachabilityStatus]) {
+        case NotReachable:
+            isExistenceNetwork = NO;
+            //NSLog(@"notReachable");
+            break;
+        case ReachableViaWiFi:
+            isExistenceNetwork = YES;
+            //NSLog(@"WIFI");
+            break;
+        case ReachableViaWWAN:
+            isExistenceNetwork = YES;
+            //NSLog(@"3G");
+            break;
+    }
+    return isExistenceNetwork;
+}
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

+ 3 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/LiveCourseArrangeCell.h

@@ -6,11 +6,14 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "ArrangeLiveCourseModel.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface LiveCourseArrangeCell : UICollectionViewCell
 
+- (void)configWithSource:(ArrangeLiveCourseModel *)model;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 33 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/LiveCourseArrangeCell.m

@@ -36,4 +36,37 @@
     // Initialization code
 }
 
+- (void)configWithSource:(ArrangeLiveCourseModel *)model {
+    // time
+    NSDateFormatter *formatter = [NSObject getDateformatter];
+    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
+    NSDate *startDate = [formatter dateFromString:model.courseStartTime];
+    [formatter setDateFormat:@"yyyy-MM-dd HH:mm"];
+    NSString *courseBegin = [formatter stringFromDate:startDate];
+    self.courseStartTime.text = [NSString returnNoNullStringWithString:courseBegin];
+    self.subjectLabel.text = [NSString returnNoNullStringWithString:model.subjectName];
+    
+    [self.courseImage sd_setImageWithURL:[NSURL URLWithString:[model.backgroundPic getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
+    self.courseName.text = [NSString returnNoNullStringWithString:model.courseGroupName];
+    
+    
+    self.courseDesc.text = [NSString returnNoNullStringWithString:model.courseIntroduce];
+    
+    if (model.coursePrice > 0) {
+        NSString *mountMsg = [NSString formatDoubleNum:model.coursePrice];
+        NSString *descMsg = [NSString stringWithFormat:@"¥%@",mountMsg];
+        
+        NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:descMsg attributes:@{NSFontAttributeName:[UIFont fontWithName:@"DIN Alternate Bold" size:14.0f],NSForegroundColorAttributeName:HexRGB(0xF44541)}];
+        [attr addAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"DIN Alternate Bold" size:18.0f]} range:[descMsg rangeOfString:mountMsg]];
+        self.priceLabel.attributedText = attr;
+    }
+    else {
+        self.priceLabel.text = [NSString  stringWithFormat:@"免费"];
+    }
+    
+    self.courseCount.text = [NSString stringWithFormat:@"/%.0f课时",model.courseNum];
+    self.teacherName.text = [NSString returnNoNullStringWithString:model.teacherName];
+    [self.teacherAvatar sd_setImageWithURL:[NSURL URLWithString:[model.avatar getUrlFileName]] placeholderImage:[UIImage imageNamed:TEACHER_AVATAR]];
+}
+
 @end

+ 13 - 13
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/LiveCourseArrangeCell.xib

@@ -36,8 +36,8 @@
                                 <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="2024-11-16 09:30" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dGU-cY-gNI">
-                                <rect key="frame" x="101.66666666666666" y="13" width="122.66666666666666" height="20"/>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dGU-cY-gNI">
+                                <rect key="frame" x="101.66666666666667" y="13" width="0.0" height="20"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="20" id="SuJ-6S-Exl"/>
                                 </constraints>
@@ -57,10 +57,10 @@
                                 </userDefinedRuntimeAttributes>
                             </imageView>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PZN-ZY-dhJ">
-                                <rect key="frame" x="20" y="54" width="36" height="19"/>
+                                <rect key="frame" x="20" y="54" width="12" height="19"/>
                                 <subviews>
-                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="长笛" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PM9-PV-hbP">
-                                        <rect key="frame" x="6" y="3.0000000000000009" width="24" height="13.333333333333336"/>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PM9-PV-hbP">
+                                        <rect key="frame" x="6" y="9.6666666666666643" width="0.0" height="0.0"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="12"/>
                                         <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         <nil key="highlightedColor"/>
@@ -79,7 +79,7 @@
                                     </userDefinedRuntimeAttribute>
                                 </userDefinedRuntimeAttributes>
                             </view>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="从零开始学竖笛直播课" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QcX-ab-zdn">
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QcX-ab-zdn">
                                 <rect key="frame" x="12" y="213.33333333333334" width="283" height="22"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="22" id="ESQ-cU-96G"/>
@@ -88,14 +88,14 @@
                                 <color key="textColor" red="0.074509803920000006" green="0.078431372550000003" blue="0.08235294118" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="国际著名长笛演奏家、教育家张子珊女士为您讲…" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kob-BR-mDx">
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kob-BR-mDx">
                                 <rect key="frame" x="12" y="239.33333333333334" width="283" height="29.666666666666657"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <color key="textColor" red="0.46666666670000001" green="0.46666666670000001" blue="0.46666666670000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="¥120" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FTk-RK-PpI">
-                                <rect key="frame" x="207.33333333333334" y="278" width="49.000000000000028" height="24"/>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FTk-RK-PpI">
+                                <rect key="frame" x="264" y="278" width="0.0" height="24"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="24" id="iJt-Ll-uCa"/>
                                 </constraints>
@@ -103,8 +103,8 @@
                                 <color key="textColor" red="0.95686274510000002" green="0.27058823529999998" blue="0.25490196079999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="/4课时" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7jr-Mq-1qA">
-                                <rect key="frame" x="258.33333333333331" y="283" width="36.666666666666686" height="17"/>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="/课时" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7jr-Mq-1qA">
+                                <rect key="frame" x="266" y="283" width="29" height="17"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="17" id="J0y-D5-fpX"/>
                                 </constraints>
@@ -112,8 +112,8 @@
                                 <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="严琦" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EV0-5G-Zqo">
-                                <rect key="frame" x="44" y="281.66666666666669" width="28" height="17"/>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EV0-5G-Zqo">
+                                <rect key="frame" x="44" y="290" width="0.0" height="0.0"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>

+ 3 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/VideoCourseArrangeCell.h

@@ -6,11 +6,14 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "ArrangeVideoCourseModel.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface VideoCourseArrangeCell : UITableViewCell
 
+- (void)configWithSource:(ArrangeVideoCourseModel *)model;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 52 - 1
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/VideoCourseArrangeCell.m

@@ -27,6 +27,10 @@
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicRight;
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicLabelLeft;
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicLabelRight;
+
+@property (weak, nonatomic) IBOutlet UIImageView *teacherAvatar;
+@property (weak, nonatomic) IBOutlet UILabel *teacherName;
+
 @end
 
 @implementation VideoCourseArrangeCell
@@ -37,7 +41,54 @@
     self.selectionStyle = UITableViewCellSelectionStyleNone;
 }
 
-
+- (void)configWithSource:(ArrangeVideoCourseModel *)model {
+    
+    [self.coverImage sd_setImageWithURL:[NSURL URLWithString:[model.lessonCoverUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
+    self.courseNameLabel.text = [NSString returnNoNullStringWithString:model.lessonName];
+    if ([model.payType isEqualToString:@"VIP"]) {
+        self.courseTag.hidden = YES;
+        self.courseMessage.font = [UIFont systemFontOfSize:15.0f weight:UIFontWeightMedium];
+        self.courseMessage.text = @"会员";
+        self.courseMessage.textColor = HexRGB(0xC76E21);
+    }
+    else if ([model.payType isEqualToString:@"PAY"]) {
+        if (model.lessonPrice > 0) {
+            self.courseTag.hidden = NO;
+            self.courseMessage.textColor = HexRGB(0xF44541);
+            NSString *text = [NSString  stringWithFormat:@"%.2f",model.lessonPrice];
+            self.courseMessage.text = text;
+            self.courseMessage.font = [UIFont fontWithName:@"DIN Alternate Bold" size:18.0f];
+        }
+        else {
+            self.courseTag.hidden = YES;
+            self.courseMessage.text = @"免费";
+            self.courseMessage.font = [UIFont systemFontOfSize:15.0f weight:UIFontWeightMedium];
+            self.courseMessage.textColor = HexRGB(0x18B99A);
+        }
+    }
+    else {
+        self.courseMessage.text = @"";
+    }
+    self.courseCount.text = [NSString stringWithFormat:@"%.0f课时",model.lessonCount];
+    self.subjectLabel.text = [NSString returnNoNullStringWithString:model.lessonSubjectName];
+    // 曲目
+    if (model.musicNum > 0) {
+        self.musicLabel.text = [NSString stringWithFormat:@"%zd首曲目", model.musicNum];
+        self.musicRight.constant = 4.0f;
+        self.musicLabelLeft.constant = 6.0f;
+        self.musicLabelRight.constant = 6.0f;
+    }
+    else {
+        self.musicView.hidden = YES;
+        self.musicLabel.text = @"";
+        self.musicRight.constant = 0.0f;
+        self.musicLabelLeft.constant = 0.0f;
+        self.musicLabelRight.constant = 0.0f;
+    }
+    
+    self.teacherName.text = [NSString returnNoNullStringWithString:model.realName];
+    [self.teacherAvatar sd_setImageWithURL:[NSURL URLWithString:[model.avatar getUrlFileName]] placeholderImage:[UIImage imageNamed:TEACHER_AVATAR]];
+}
 
 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
     [super setSelected:selected animated:animated];

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/ArrangeCourse/View/VideoCourseArrangeCell.xib

@@ -201,6 +201,8 @@
                 <outlet property="musicRight" destination="T4p-AK-vOB" id="w57-s2-o5p"/>
                 <outlet property="musicView" destination="Exy-3P-Utb" id="2qL-64-Ug9"/>
                 <outlet property="subjectLabel" destination="c1P-HO-aD8" id="ncG-kl-VYW"/>
+                <outlet property="teacherAvatar" destination="Dg1-1t-Ytx" id="o9E-cd-llh"/>
+                <outlet property="teacherName" destination="pqK-xI-BUS" id="jQS-nm-fud"/>
             </connections>
             <point key="canvasLocation" x="25.954198473282442" y="54.225352112676056"/>
         </tableViewCell>

+ 3 - 3
KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/HomeViewController.m

@@ -1084,9 +1084,6 @@
 }
 
 - (void)HomeTopButtonAction:(UIButton *)sender {
-    HomeArrangeCourseController *ctrl = [[HomeArrangeCourseController alloc] init];
-    [self.navigationController pushViewController:ctrl animated:YES];
-    return;
     
     NSInteger index = sender.tag - 3000;
     if ([self checkIsLoginToLoginView:YES]) {
@@ -1591,6 +1588,9 @@
             break;
         case HOMENAV_TAG_SEARCH: // 搜索
         {
+            HomeArrangeCourseController *ctrl = [[HomeArrangeCourseController alloc] init];
+            [self.navigationController pushViewController:ctrl animated:YES];
+            return;
             KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
             webCtrl.url = [NSString stringWithFormat:@"%@/#/music-songbook/search", WEBHOST];
             [self.navigationController pushViewController:webCtrl animated:YES];