|
@@ -1,601 +0,0 @@
|
|
|
-//
|
|
|
-// MyLessonBodyView.m
|
|
|
-// KulexiuForTeacher
|
|
|
-//
|
|
|
-// Created by 王智 on 2022/4/12.
|
|
|
-//
|
|
|
-
|
|
|
-#import "MyLessonBodyView.h"
|
|
|
-#import "KSBaseWKWebViewController.h"
|
|
|
-#import "MyLiveCourseCell.h"
|
|
|
-#import "AccompanyCourseCell.h"
|
|
|
-#import "LiveLessonModel.h"
|
|
|
-#import "AccompanyLessonModel.h"
|
|
|
-#import "KSChatConversationViewController.h"
|
|
|
-#include "KSGroupConversationController.h"
|
|
|
-#import "MyLessonSearchView.h"
|
|
|
-#import "NewClassPopView.h"
|
|
|
-#import <KSFullDatePicker.h>
|
|
|
-#import "AccompanyDetailViewController.h"
|
|
|
-#import <KSChoosePicker.h>
|
|
|
-#import "MusicRoomCourseCell.h"
|
|
|
-#import "MusicRoomListModel.h"
|
|
|
-#import "MusicRoomDetailViewController.h"
|
|
|
-
|
|
|
-@interface MyLessonBodyView ()<UITableViewDelegate,UITableViewDataSource>
|
|
|
-
|
|
|
-@property (nonatomic, strong) NSDateFormatter *dateFormatter;
|
|
|
-
|
|
|
-@property (nonatomic, copy) MyLessonSearchView *sortView;
|
|
|
-
|
|
|
-@property (nonatomic, strong) NewClassPopView *popView;
|
|
|
-
|
|
|
-@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, assign) NSInteger secondChooseIndex;
|
|
|
-
|
|
|
-@property (nonatomic, assign) NSInteger thirdChooseIndex;
|
|
|
-
|
|
|
-@property (nonatomic, strong) NSString *classDate;
|
|
|
-
|
|
|
-@property (nonatomic, strong) NSString *status;
|
|
|
-
|
|
|
-@property (nonatomic, strong) NSString *subjectId;
|
|
|
-
|
|
|
-@property (nonatomic, strong) NSMutableArray *subjectMessageArray;
|
|
|
-
|
|
|
-@end
|
|
|
-
|
|
|
-@implementation MyLessonBodyView
|
|
|
-
|
|
|
-- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
- self = [super initWithFrame:frame];
|
|
|
- if (self) {
|
|
|
-
|
|
|
- self.backgroundColor = HexRGB(0xf6f8f9);
|
|
|
- self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) style:UITableViewStylePlain];
|
|
|
- self.tableView.backgroundColor = HexRGB(0xf6f8f9);
|
|
|
- self.tableView.showsVerticalScrollIndicator = NO;
|
|
|
-
|
|
|
- self.tableView.dataSource = self;
|
|
|
- self.tableView.delegate = self;
|
|
|
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
|
- [self addSubview:self.tableView];
|
|
|
-
|
|
|
-
|
|
|
- UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
|
|
|
- headView.backgroundColor = HexRGB(0xf6f8f9);
|
|
|
- self.tableView.tableHeaderView = headView;
|
|
|
-
|
|
|
- UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
|
|
|
- bottomView.backgroundColor = HexRGB(0xf6f8f9);
|
|
|
- self.tableView.tableFooterView = bottomView;
|
|
|
- [self.tableView registerNib:[UINib nibWithNibName:@"AccompanyCourseCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"AccompanyCourseCell"];
|
|
|
- [self.tableView registerNib:[UINib nibWithNibName:@"MyLiveCourseCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"MyLiveCourseCell"];
|
|
|
- [self.tableView registerNib:[UINib nibWithNibName:@"MusicRoomCourseCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"MusicRoomCourseCell"];
|
|
|
-
|
|
|
- [self.dateFormatter setDateFormat:@"yyyy-MM"];
|
|
|
- NSDate *currentDate = [NSDate date];
|
|
|
- self.classDate = [self.dateFormatter stringFromDate:currentDate];
|
|
|
- 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];
|
|
|
- }
|
|
|
- }];
|
|
|
- }
|
|
|
- return self;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)endRefresh {
|
|
|
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- [self.tableView.mj_header endRefreshing];
|
|
|
- [self.tableView.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.tableView.mj_footer resetNoMoreData];
|
|
|
- [self setPromptString:@"暂无课程" imageName:@"empty_course" inView:self.tableView];
|
|
|
- [self.tableView reloadData];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)requestData {
|
|
|
- if (self.selectIndex == 0) { // 趣纠课
|
|
|
- [KSNetworkingManager queryStudentPracticeCourse:KS_POST classMonth:self.classDate status:self.status 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) {
|
|
|
- AccompanyLessonModel *model = [[AccompanyLessonModel 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];
|
|
|
- }];
|
|
|
- }
|
|
|
- else if (self.selectIndex == 1) { // 直播课
|
|
|
- NSString *searchKey = nil;
|
|
|
- [KSNetworkingManager queryMyLiveCourse:KS_POST courseType:@"LIVE" classDate:self.classDate status:self.status subjectId:self.subjectId search: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) {
|
|
|
- LiveLessonModel *model = [[LiveLessonModel 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];
|
|
|
- }];
|
|
|
- }
|
|
|
- else { // 琴房课
|
|
|
- [KSNetworkingManager queryPianoClassRequest:KS_POST classMonth:self.classDate status:self.status 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) {
|
|
|
- MusicRoomListModel *model = [[MusicRoomListModel 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];
|
|
|
- self.tableView.frame = self.bounds;
|
|
|
- CGFloat topHeight = 55.0f;
|
|
|
- self.tableView.frame = CGRectMake(0, topHeight, self.bounds.size.width, self.bounds.size.height - topHeight);
|
|
|
- if (!_sortView) {
|
|
|
- _sortView = [MyLessonSearchView shareInstance];
|
|
|
- _sortView.frame = CGRectMake(0, 0, kScreenWidth, 55);
|
|
|
- MJWeakSelf;
|
|
|
- [_sortView sortAction:^(SORT_TYPE type) {
|
|
|
- [weakSelf sortWithType:type];
|
|
|
- }];
|
|
|
- [self.dateFormatter setDateFormat:@"yyyy年MM月"];
|
|
|
- NSDate *currentDate = [NSDate date];
|
|
|
- [self.sortView.firstLabel setText:[self.dateFormatter stringFromDate:currentDate]];
|
|
|
- [self addSubview:self.sortView];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)sortWithType:(SORT_TYPE)type {
|
|
|
-
|
|
|
- if (type == SORT_TYPE_TIME) { // time
|
|
|
- [self showPickerView];
|
|
|
- }
|
|
|
- else if (type == SORT_TYPE_STATUS) { // 状态
|
|
|
- [self.popView refreshWithSourceArray:@[@"全部",@"未开始",@"进行中",@"已结束"] preChooseIndex:_secondChooseIndex inView:self actionItem:1];
|
|
|
- }
|
|
|
- else if (type == SORT_TYPE_SUBJECT) {
|
|
|
- if (self.subjectList.count) {
|
|
|
- NSMutableArray *nameArray = [NSMutableArray array];
|
|
|
- [nameArray addObject:@"全部"];
|
|
|
- for (NSDictionary *parm in self.subjectList) {
|
|
|
- [nameArray addObject:[parm ks_stringValueForKey:@"subjectName"]];
|
|
|
- }
|
|
|
- MJWeakSelf;
|
|
|
- KSChoosePicker *picker = [[KSChoosePicker alloc] initWithTitle:@"声部筛选" sourceData:nameArray lastChooseIndex:0 sureButtonColor:CLIENT_THEMECOLOR chooseReturnWithBlock:^(NSString * _Nonnull returnValue, NSInteger chooseIndex) {
|
|
|
- if (chooseIndex == 0) {
|
|
|
- [weakSelf.sortView.thirdLabel setText:@"全部声部"];
|
|
|
- weakSelf.subjectId = nil;
|
|
|
- }
|
|
|
- else {
|
|
|
- [weakSelf.sortView.thirdLabel setText:returnValue];
|
|
|
- NSDictionary *parm = self.subjectList[chooseIndex-1];
|
|
|
- weakSelf.subjectId = [parm ks_stringValueForKey:@"subjectId"];
|
|
|
- }
|
|
|
- self.sortView.thirdArrowUp = NO;
|
|
|
- [weakSelf refreshAndRequestData];
|
|
|
- } cancel:^{
|
|
|
- self.sortView.thirdArrowUp = NO;
|
|
|
- }];
|
|
|
- [picker showPicker];
|
|
|
- }
|
|
|
- else {
|
|
|
- [LOADING_MANAGER MBShowAUTOHidingInWindow:@"无声部信息"];
|
|
|
- self.sortView.thirdArrowUp = NO;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- else {
|
|
|
- [self hiddenPopView];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)showPickerView {
|
|
|
- KSFullDatePicker *picker = [[KSFullDatePicker alloc] initWithTitle:@"" date:[NSDate date] pickMode:KSDATEPICKER_MODE_YEAR_MONTH sureButtonColor:CLIENT_THEMECOLOR selectDateBlock:^(NSString *date) {
|
|
|
-
|
|
|
- self.classDate = date;
|
|
|
- NSString *displayTime = [self getTimeDisplay:date];
|
|
|
- [self.sortView.firstLabel setText:displayTime];
|
|
|
- [self resetPickerStatus];
|
|
|
- // 请求数据
|
|
|
- [self refreshAndRequestData];
|
|
|
- } cancleBlock:^{
|
|
|
- [self resetPickerStatus];
|
|
|
- }];
|
|
|
- [picker show];
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-- (NSString *)getTimeDisplay:(NSString *)chooseMonth {
|
|
|
- [self.dateFormatter setDateFormat:@"yyyy-MM"];
|
|
|
- NSDate *chooseDate = [self.dateFormatter dateFromString:chooseMonth];
|
|
|
- [self.dateFormatter setDateFormat:@"yyyy年MM月"];
|
|
|
- NSString *displayTime = [self.dateFormatter stringFromDate:chooseDate];
|
|
|
- return displayTime;
|
|
|
-}
|
|
|
-- (void)resetPickerStatus {
|
|
|
- self.sortView.firstArrowUp = NO;
|
|
|
-}
|
|
|
-
|
|
|
-- (NewClassPopView *)popView {
|
|
|
- if (!_popView) {
|
|
|
- MJWeakSelf;
|
|
|
- _popView = [[NewClassPopView alloc] initWithFrame:CGRectMake(0, 55, kScreenWidth, kScreenHeight - 55 - kNaviBarHeight - iPhoneXSafeBottomMargin) chooseCallback:^(NSString * _Nonnull sortStr, NSInteger chooseIndex, NSInteger item) {
|
|
|
- if (chooseIndex != 0) {
|
|
|
- // 回调
|
|
|
- [weakSelf sortWithChooseIndex:chooseIndex item:item title:sortStr];
|
|
|
- }
|
|
|
- [weakSelf hiddenPopView];
|
|
|
- }];
|
|
|
- }
|
|
|
- return _popView;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)sortWithChooseIndex:(NSInteger)chooseIndex item:(NSInteger)item title:(NSString *)title {
|
|
|
- if (item == 0) { //
|
|
|
- }
|
|
|
- else if (item == 1) { // 课程状态
|
|
|
- self.secondChooseIndex = chooseIndex;
|
|
|
- self.thirdChooseIndex = 0;
|
|
|
- [self.sortView.secondLabel setText:title];
|
|
|
- switch (chooseIndex) {
|
|
|
- case 1:
|
|
|
- {
|
|
|
- self.status = nil;
|
|
|
- [self.sortView.secondLabel setText:@"课程状态"];
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- {
|
|
|
- self.status = @"NOT_START";
|
|
|
- }
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- {
|
|
|
- self.status = @"ING";
|
|
|
- }
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- {
|
|
|
- self.status = @"COMPLETE";
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (item == 2) { // 声部筛选
|
|
|
- self.thirdChooseIndex = chooseIndex;
|
|
|
- [self.sortView.thirdLabel setText:title];
|
|
|
-
|
|
|
- if (chooseIndex == 1) {
|
|
|
- self.subjectId = nil;
|
|
|
- [self.sortView.thirdLabel setText:@"全部声部"];
|
|
|
- }
|
|
|
- else {
|
|
|
- NSDictionary *parm = self.subjectMessageArray[chooseIndex-1];
|
|
|
- self.subjectId = [parm ks_stringValueForKey:@"subjectId"];
|
|
|
- }
|
|
|
- }
|
|
|
- [self resetParamenter];
|
|
|
- [self requestData];
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-- (void)hiddenPopView {
|
|
|
- self.sortView.firstArrowUp = NO;
|
|
|
- self.sortView.secondArrowUp = NO;
|
|
|
- self.sortView.thirdArrowUp = NO;
|
|
|
- [self.popView hiddenView];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark - UITableViewDataSource
|
|
|
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
- return self.dataArray.count;
|
|
|
-}
|
|
|
-
|
|
|
-- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
- if (self.selectIndex == 0 || self.selectIndex == 3) {
|
|
|
- return 127.0f;
|
|
|
- }
|
|
|
- else {
|
|
|
- return 164.0f;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
-
|
|
|
- if (self.selectIndex == 0) {
|
|
|
- AccompanyLessonModel *model = self.dataArray[indexPath.row];
|
|
|
- AccompanyCourseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AccompanyCourseCell"];
|
|
|
- MJWeakSelf;
|
|
|
- [cell configWithSource:model actionCallback:^(ACCOMPANY_TYPE type, AccompanyLessonModel * _Nonnull source) {
|
|
|
- [weakSelf courseOperation:type sourceModel:source];
|
|
|
- }];
|
|
|
- return cell;
|
|
|
- }
|
|
|
- else if (self.selectIndex == 1) {
|
|
|
- LiveLessonModel *model = self.dataArray[indexPath.row];
|
|
|
- MyLiveCourseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyLiveCourseCell"];
|
|
|
- MJWeakSelf;
|
|
|
- [cell configCellWithSource:model callback:^(NSString *targetId) {
|
|
|
- [weakSelf chatAction:targetId];
|
|
|
- }];
|
|
|
- return cell;
|
|
|
- }
|
|
|
- else {
|
|
|
- MusicRoomListModel *model = self.dataArray[indexPath.row];
|
|
|
- MusicRoomCourseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MusicRoomCourseCell"];
|
|
|
- MJWeakSelf;
|
|
|
- [cell configWithSource:model isGroup:NO beforeTime:0 callback:^(NSString * _Nonnull targetId) {
|
|
|
- [weakSelf chatAction:targetId];
|
|
|
- }];
|
|
|
- return cell;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)courseOperation:(ACCOMPANY_TYPE)type sourceModel:(AccompanyLessonModel *)model {
|
|
|
- switch (type) {
|
|
|
- case ACCOMPANY_TYPE_CHAT: // 聊天
|
|
|
- {
|
|
|
- TUIChatConversationModel *conversation = [[TUIChatConversationModel alloc] init];
|
|
|
- conversation.userID = model.imUserId;
|
|
|
- KSChatConversationViewController *ctrl = [[KSChatConversationViewController alloc] init];
|
|
|
- ctrl.conversation = conversation;
|
|
|
- [self.naviController pushViewController:ctrl animated:YES];
|
|
|
- }
|
|
|
- break;
|
|
|
- case ACCOMPANY_DETAIL: // 趣纠课详情
|
|
|
- {
|
|
|
- [self showAccompanyDetail:model];
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)showAccompanyDetail:(AccompanyLessonModel *)model {
|
|
|
- AccompanyDetailViewController *detailVC = [[AccompanyDetailViewController alloc] init];
|
|
|
- detailVC.courseId = model.courseId;
|
|
|
- detailVC.courseGroupId = model.courseGoupId;
|
|
|
-// detailVC.teacherId = model.userId;
|
|
|
- [self.naviController pushViewController:detailVC animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-- (void)chatAction:(NSString *)targetId {
|
|
|
- if ([NSString isEmptyString:targetId]) {
|
|
|
- [LOADING_MANAGER MBShowAUTOHidingInWindow:@"报名未结束,暂无群组"];
|
|
|
- return;
|
|
|
- }
|
|
|
- TUIChatConversationModel *model = [[TUIChatConversationModel alloc] init];
|
|
|
- model.groupID = targetId;
|
|
|
- KSGroupConversationController *ctrl = [[KSGroupConversationController alloc] init];
|
|
|
- ctrl.conversation = model;
|
|
|
- [self.naviController pushViewController:ctrl animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
- if (self.selectIndex == 0) { // 进入趣纠课详情
|
|
|
- AccompanyLessonModel *model = self.dataArray[indexPath.row];
|
|
|
- [self showAccompanyDetail:model];
|
|
|
- }
|
|
|
- else if (self.selectIndex == 1) { // 直播课程组详情
|
|
|
- LiveLessonModel *model = self.dataArray[indexPath.row];
|
|
|
- KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- NSString *url = [NSString stringWithFormat:@"%@/#/liveDetail?joinRoom=1&groupId=%@&classId=%@", WEBHOST, model.courseGoupId,model.courseId];
|
|
|
- ctrl.url = url;
|
|
|
- [self.naviController pushViewController:ctrl animated:YES];
|
|
|
- }
|
|
|
- else {
|
|
|
- MusicRoomListModel *model = self.dataArray[indexPath.row];
|
|
|
- [self showMusicRoomDetail:model];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)showMusicRoomDetail:(MusicRoomListModel *)model {
|
|
|
- MusicRoomDetailViewController *detailVC = [[MusicRoomDetailViewController alloc] init];
|
|
|
- detailVC.courseId = model.courseId;
|
|
|
- detailVC.courseGroupId = model.courseGroupId;
|
|
|
- [self.naviController pushViewController:detailVC animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- 设置没有数据时的显示
|
|
|
-
|
|
|
- @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, kScreenWidth, kScreenHeight - 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
|
|
|
-- (NSDateFormatter *)dateFormatter {
|
|
|
- if (!_dateFormatter) {
|
|
|
- _dateFormatter = [NSObject getDateformatter];
|
|
|
- }
|
|
|
- return _dateFormatter;
|
|
|
-}
|
|
|
-- (void)setSubjectList:(NSMutableArray *)subjectList {
|
|
|
- _subjectList = subjectList;
|
|
|
- self.thirdChooseIndex = 0;
|
|
|
-}
|
|
|
-/*
|
|
|
-// Only override drawRect: if you perform custom drawing.
|
|
|
-// An empty implementation adversely affects performance during animation.
|
|
|
-- (void)drawRect:(CGRect)rect {
|
|
|
- // Drawing code
|
|
|
-}
|
|
|
-*/
|
|
|
-
|
|
|
-@end
|