MinePageCourseView.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. //
  2. // MinePageCourseView.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by Kyle on 2022/3/30.
  6. //
  7. #import "MinePageCourseView.h"
  8. #import "MinePageSubmitView.h"
  9. #import "KSBaseWKWebViewController.h"
  10. #import "MusicMessageModel.h"
  11. #import "AccompanyCourseCell.h"
  12. #import "LiveCourseCell.h"
  13. #import "MinePageMusicCell.h"
  14. #import "AuthDisplayView.h"
  15. #import "AccompanyLessonModel.h"
  16. #import "KSChatConversationViewController.h"
  17. #import "AccompanyDetailViewController.h"
  18. #import "KSFullDatePicker.h"
  19. @interface MinePageCourseView ()<UITableViewDelegate,UITableViewDataSource>
  20. @property (nonatomic, strong) NSMutableArray *dataArray;
  21. @property (nonatomic, strong) StateView *promptView;
  22. @property (nonatomic, strong) UIView *promptPlaceView;
  23. @property (nonatomic, assign) BOOL networkAvaiable; // 网络是否可用
  24. @property (nonatomic, assign) BOOL isLoadMore;
  25. @property (nonatomic, assign) NSInteger rows;
  26. @property (nonatomic, assign) NSInteger pages;
  27. @property (nonatomic, strong) AuthDisplayView *authView;
  28. @property (nonatomic, strong) MinePageSubmitView *uploadView;
  29. @property (nonatomic, assign) BOOL teacherAuthPass; // 是否通过老师审核
  30. @property (nonatomic, assign) BOOL musicianPass; // 是否通过音乐人审核
  31. @end
  32. @implementation MinePageCourseView
  33. - (instancetype)initWithFrame:(CGRect)frame {
  34. self = [super initWithFrame:frame];
  35. if (self) {
  36. self.backgroundColor = HexRGB(0xf6f8f9);
  37. self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) style:UITableViewStylePlain];
  38. self.tableView.backgroundColor = HexRGB(0xf6f8f9);
  39. self.tableView.showsVerticalScrollIndicator = NO;
  40. self.tableView.dataSource = self;
  41. self.tableView.delegate = self;
  42. self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  43. [self addSubview:self.tableView];
  44. UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
  45. headView.backgroundColor = HexRGB(0xf6f8f9);
  46. self.tableView.tableHeaderView = headView;
  47. UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
  48. bottomView.backgroundColor = HexRGB(0xf6f8f9);
  49. self.tableView.tableFooterView = bottomView;
  50. [self.tableView registerNib:[UINib nibWithNibName:@"AccompanyCourseCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"AccompanyCourseCell"];
  51. [self.tableView registerNib:[UINib nibWithNibName:@"LiveCourseCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"LiveCourseCell"];
  52. [self.tableView registerNib:[UINib nibWithNibName:@"MinePageMusicCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"MinePageMusicCell"];
  53. MJWeakSelf;
  54. self.tableView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
  55. [weakSelf resetParamenter];
  56. [weakSelf requestData];
  57. }];
  58. self.tableView.mj_footer = [KSGifRefreshFooter footerWithRefreshingBlock:^{
  59. if (weakSelf.isLoadMore) {
  60. weakSelf.pages += 1;
  61. [weakSelf requestData];
  62. }
  63. else {
  64. [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  65. }
  66. }];
  67. }
  68. return self;
  69. }
  70. - (void)endRefresh {
  71. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  72. [self.tableView.mj_header endRefreshing];
  73. [self.tableView.mj_footer endRefreshing];
  74. });
  75. }
  76. - (void)refreshAndRequestData {
  77. [self resetParamenter];
  78. [self requestData];
  79. }
  80. - (void)resetParamenter {
  81. self.isLoadMore = YES;
  82. self.pages = 1;
  83. self.rows = 10;
  84. self.dataArray = [NSMutableArray array];
  85. [self.tableView.mj_footer resetNoMoreData];
  86. [self setPromptString:@"暂无课程~" imageName:@"empty_course" inView:self.tableView];
  87. [self.tableView reloadData];
  88. }
  89. - (void)requestData {
  90. if (self.selectIndex == 1) { // 陪练课
  91. [KSNetworkingManager accompanyCourseRequest:KS_POST classMonth:nil status:nil subjectId:nil page:self.pages rows:self.rows success:^(NSDictionary * _Nonnull dic) {
  92. [self endRefresh];
  93. if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
  94. NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
  95. for (NSDictionary *parm in sourceArray) {
  96. AccompanyLessonModel *model = [[AccompanyLessonModel alloc] initWithDictionary:parm];
  97. [self.dataArray addObject:model];
  98. }
  99. if (sourceArray.count < self.rows) {
  100. self.isLoadMore = NO;
  101. }
  102. }
  103. else {
  104. [self MBPShow:MESSAGEKEY];
  105. }
  106. [self.tableView reloadData];
  107. [self changePromptLabelStateWithArray:self.dataArray];
  108. } faliure:^(NSError * _Nonnull error) {
  109. [self endRefresh];
  110. if (self.networkAvaiable == NO) {
  111. [self setPromptString:@"暂无网络" imageName:@"no_networking" inView:self.tableView];
  112. }
  113. [self.dataArray removeAllObjects];
  114. [self.tableView reloadData];
  115. [self changePromptLabelStateWithArray:self.dataArray];
  116. }];
  117. }
  118. else if (self.selectIndex == 2) { // 直播课
  119. [KSNetworkingManager LiveCourseGroupRequest:KS_POST groupStatus:@"APPLY" page:self.pages rows:self.rows success:^(NSDictionary * _Nonnull dic) {
  120. [self endRefresh];
  121. if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
  122. NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
  123. for (NSDictionary *parm in sourceArray) {
  124. LiveCourseModel *model = [[LiveCourseModel alloc] initWithDictionary:parm];
  125. [self.dataArray addObject:model];
  126. }
  127. if (sourceArray.count < self.rows) {
  128. self.isLoadMore = NO;
  129. }
  130. }
  131. else {
  132. [self MBPShow:MESSAGEKEY];
  133. }
  134. [self.tableView reloadData];
  135. [self changePromptLabelStateWithArray:self.dataArray];
  136. } faliure:^(NSError * _Nonnull error) {
  137. [self endRefresh];
  138. if (self.networkAvaiable == NO) {
  139. [self setPromptString:@"暂无网络" imageName:@"no_networking" inView:self.tableView];
  140. }
  141. [self.dataArray removeAllObjects];
  142. [self.tableView reloadData];
  143. [self changePromptLabelStateWithArray:self.dataArray];
  144. }];
  145. }
  146. else if (self.selectIndex == 4) { // 乐谱
  147. [KSNetworkingManager musicListRequest:KS_POST auditStatus:@"PASS" pageNo:self.pages pageSize:self.rows success:^(NSDictionary * _Nonnull dic) {
  148. [self endRefresh];
  149. if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
  150. NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
  151. for (NSDictionary *parm in sourceArray) {
  152. MusicMessageModel *model = [[MusicMessageModel alloc] initWithDictionary:parm];
  153. [self.dataArray addObject:model];
  154. }
  155. if (sourceArray.count < self.rows) {
  156. self.isLoadMore = NO;
  157. }
  158. }
  159. else {
  160. [self MBPShow:MESSAGEKEY];
  161. }
  162. [self.tableView reloadData];
  163. [self changePromptLabelStateWithArray:self.dataArray];
  164. } faliure:^(NSError * _Nonnull error) {
  165. [self endRefresh];
  166. if (self.networkAvaiable == NO) {
  167. [self setPromptString:@"暂无网络" imageName:@"no_networking" inView:self.tableView];
  168. }
  169. [self.dataArray removeAllObjects];
  170. [self.tableView reloadData];
  171. [self changePromptLabelStateWithArray:self.dataArray];
  172. }];
  173. }
  174. }
  175. - (void)beginRefreshImmediately {
  176. [self.tableView.mj_header beginRefreshing];
  177. }
  178. - (void)beginFirstRefresh {
  179. if (!self.isHeaderRefreshed) {
  180. [self beginRefreshImmediately];
  181. }
  182. }
  183. - (void)selectCellAtIndexPath:(NSIndexPath *)indexPath {
  184. if (self.lastSelectedIndexPath == indexPath) {
  185. return;
  186. }
  187. if (self.lastSelectedIndexPath != nil) {
  188. UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:self.lastSelectedIndexPath];
  189. [cell setSelected:NO animated:NO];
  190. }
  191. UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
  192. [cell setSelected:YES animated:NO];
  193. self.lastSelectedIndexPath = indexPath;
  194. }
  195. - (void)layoutSubviews {
  196. [super layoutSubviews];
  197. CGFloat topHeight = 60.0f;
  198. self.tableView.frame = CGRectMake(0, topHeight, self.bounds.size.width, self.bounds.size.height - topHeight);
  199. if (![self.subviews containsObject:self.uploadView]) {
  200. [self addSubview:self.uploadView];
  201. if (self.selectIndex == 1 || self.selectIndex == 2) {
  202. if (self.teacherAuthPass == NO) {
  203. [self showAuthView];
  204. }
  205. else {
  206. [self hideAuthView];
  207. }
  208. }
  209. else if (self.selectIndex == 4) {
  210. if (self.musicianPass == NO) {
  211. [self showAuthView];
  212. }
  213. else {
  214. [self hideAuthView];
  215. }
  216. }
  217. }
  218. }
  219. #pragma mark - UITableViewDataSource
  220. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  221. return self.dataArray.count;
  222. }
  223. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  224. if (self.selectIndex == 1) {
  225. return 100;
  226. }
  227. else if (self.selectIndex == 2) {
  228. return 150.0f;
  229. }
  230. else {
  231. return 110.0f;;
  232. }
  233. }
  234. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  235. if (self.selectIndex == 1) {
  236. AccompanyLessonModel *model = self.dataArray[indexPath.row];
  237. AccompanyCourseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AccompanyCourseCell"];
  238. MJWeakSelf;
  239. [cell configWithSource:model actionCallback:^(ACCOMPANY_TYPE type, AccompanyLessonModel * _Nonnull source) {
  240. [weakSelf courseOperation:type sourceModel:source];
  241. }];
  242. return cell;
  243. }
  244. else if (self.selectIndex == 2) {
  245. LiveCourseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LiveCourseCell"];
  246. LiveCourseModel *model = self.dataArray[indexPath.row];
  247. BOOL hiddenInfo = NO;
  248. [cell configCellWithSource:model hideStudentInfo:hiddenInfo];
  249. return cell;
  250. }
  251. else {
  252. MusicMessageModel *model = self.dataArray[indexPath.row];
  253. MinePageMusicCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MinePageMusicCell"];
  254. [cell configWithMessage:model];
  255. return cell;
  256. }
  257. }
  258. - (void)courseOperation:(ACCOMPANY_TYPE)type sourceModel:(AccompanyLessonModel *)model {
  259. switch (type) {
  260. case ACCOMPANY_TYPE_CHAT: // 聊天
  261. {
  262. KSChatConversationViewController *conversationVC = [[KSChatConversationViewController alloc] init];
  263. conversationVC.targetId = model.userId;
  264. conversationVC.conversationType = ConversationType_PRIVATE;
  265. [self.naviController pushViewController:conversationVC animated:YES];
  266. }
  267. break;
  268. case ACCOMPANY_TYPE_ADJUST: // 调整
  269. {
  270. [self showAdjustPicker:model];
  271. }
  272. break;
  273. case ACCOMPANY_DETAIL: // 陪练课详情
  274. {
  275. [self showAccompanyDetail:model];
  276. }
  277. break;
  278. default:
  279. break;
  280. }
  281. }
  282. - (void)showAccompanyDetail:(AccompanyLessonModel *)model {
  283. AccompanyDetailViewController *detailVC = [[AccompanyDetailViewController alloc] init];
  284. detailVC.courseId = model.courseId;
  285. detailVC.courseGroupId = model.courseGoupId;
  286. detailVC.studentId = model.userId;
  287. [self.naviController pushViewController:detailVC animated:YES];
  288. }
  289. - (void)showAdjustPicker:(AccompanyLessonModel *)model {
  290. KSFullDatePicker *picker = [[KSFullDatePicker alloc] initWithTitle:@"课时调整" date:[NSDate date] pickMode:KSDATEPICKER_MODE_DAY_TIME selectDateBlock:^(NSString *date) {
  291. [self courseAdjustAction:model];
  292. } cancleBlock:^{
  293. }];
  294. [picker show];
  295. }
  296. - (void)courseAdjustAction:(AccompanyLessonModel *)model {
  297. }
  298. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  299. if (self.selectIndex == 2) { // 直播课详情
  300. LiveCourseModel *model = self.dataArray[indexPath.row];
  301. KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
  302. NSString *url = [NSString stringWithFormat:@"%@%@%.0f", WEBHOST, @"/#/liveDetail?groupId=",model.courseGroupId];
  303. ctrl.url = url;
  304. [self.naviController pushViewController:ctrl animated:YES];
  305. }
  306. else if (self.selectIndex == 4) { // 曲谱详情
  307. }
  308. }
  309. /**
  310. 设置没有数据时的显示
  311. @param promptString 提示语
  312. @param imgName 图片名称
  313. @param view 显示在什么地方
  314. */
  315. - (void)setPromptString:(NSString *)promptString imageName:(NSString *)imgName inView:(UIView *)view {
  316. if (self.promptView != nil) {
  317. [self.promptView removeFromSuperview];
  318. }
  319. else {
  320. self.promptView = [[StateView alloc]init];
  321. self.promptView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight - 300);
  322. }
  323. _promptPlaceView = view;
  324. //当请求不到数据时 ,自定义提示view 将会出现;
  325. self.promptView.imageName = imgName;
  326. self.promptView.alpha = 0.0f;
  327. [self.promptView setText:promptString];
  328. [view addSubview:self.promptView];
  329. }
  330. // 结束刷新后调用方法
  331. - (void)changePromptLabelStateWithArray:(NSMutableArray *)array {
  332. NSInteger count;
  333. if (array.count) {
  334. count = array.count;
  335. } else {
  336. count = 0;
  337. }
  338. [UIView animateWithDuration:0.1 animations:^{
  339. [[self promptView] setAlpha:count ? 0.0f :1.0f ] ;
  340. }] ;
  341. }
  342. - (BOOL)networkAvaiable {
  343. return [self checkNetworkAvaiable];
  344. }
  345. - (BOOL)checkNetworkAvaiable {
  346. BOOL isExistenceNetwork = YES;
  347. Reachability *reach = [Reachability reachabilityWithHostName:@"www.apple.com"];
  348. switch ([reach currentReachabilityStatus]) {
  349. case NotReachable:
  350. isExistenceNetwork = NO;
  351. //NSLog(@"notReachable");
  352. break;
  353. case ReachableViaWiFi:
  354. isExistenceNetwork = YES;
  355. //NSLog(@"WIFI");
  356. break;
  357. case ReachableViaWWAN:
  358. isExistenceNetwork = YES;
  359. //NSLog(@"3G");
  360. break;
  361. }
  362. return isExistenceNetwork;
  363. }
  364. #pragma mark ----- lazying
  365. - (void)setTeaherStatus:(NSString *)teaherStatus {
  366. _teaherStatus = teaherStatus;
  367. if ([teaherStatus isEqualToString:@"UNPAALY"]) { // 未申请
  368. self.teacherAuthPass = NO;
  369. }
  370. else if ([teaherStatus isEqualToString:@"DOING"]) { // 审核中
  371. self.teacherAuthPass = NO;
  372. }
  373. else if ([teaherStatus isEqualToString:@"UNPASS"]) { // 不通过
  374. self.teacherAuthPass = NO;
  375. }
  376. else {
  377. self.teacherAuthPass = YES;
  378. }
  379. // 如果
  380. if (self.selectIndex == 2) { // 直播课
  381. if (self.liveFlag == NO) { // 无直播权限直接改成未通过
  382. self.teacherAuthPass = NO;
  383. }
  384. }
  385. if (self.selectIndex == 1) {
  386. self.uploadView.type = MINEPAGETYPE_ACCOMPANY;
  387. }
  388. else if (self.selectIndex == 2) {
  389. self.uploadView.type = MINEPAGETYPE_LIVE;
  390. }
  391. if (self.selectIndex == 1 || self.selectIndex == 2) {
  392. if (self.teacherAuthPass == NO) {
  393. [self showAuthView];
  394. }
  395. else {
  396. [self hideAuthView];
  397. }
  398. }
  399. }
  400. - (void)setMusicianStatus:(NSString *)musicianStatus {
  401. _musicianStatus = musicianStatus;
  402. if ([musicianStatus isEqualToString:@"UNPAALY"]) { // 未申请
  403. self.musicianPass = NO;
  404. }
  405. else if ([musicianStatus isEqualToString:@"DOING"]) { // 审核中
  406. self.musicianPass = NO;
  407. }
  408. else if ([musicianStatus isEqualToString:@"UNPASS"]) { // 不通过
  409. self.musicianPass = NO;
  410. }
  411. else {
  412. self.musicianPass = YES;
  413. }
  414. if (self.selectIndex == 4) {
  415. self.uploadView.type = MINEPAGETYPE_MUSIC;
  416. }
  417. if (self.selectIndex == 4) {
  418. if (self.musicianPass == NO) {
  419. [self showAuthView];
  420. }
  421. else {
  422. [self hideAuthView];
  423. }
  424. }
  425. }
  426. - (void)showAuthView {
  427. [self configAuthDisplay];
  428. if ([self.subviews containsObject:self.authView]) {
  429. [self bringSubviewToFront:self.authView];
  430. }
  431. else {
  432. [self addSubview:self.authView];
  433. [self.authView mas_makeConstraints:^(MASConstraintMaker *make) {
  434. make.left.top.bottom.right.mas_equalTo(self);
  435. }];
  436. }
  437. }
  438. - (void)configAuthDisplay {
  439. [self.authView configDisplayMessage:[self getAuthDisplayMessage]];
  440. if (self.selectIndex == 1) { // 陪练课
  441. if ([self.teaherStatus isEqualToString:@"DOING"]) {
  442. self.authView.sureButton.userInteractionEnabled = NO;
  443. self.authView.sureButton.hidden = YES;
  444. }
  445. else {
  446. self.authView.sureButton.userInteractionEnabled = YES;
  447. self.authView.sureButton.hidden = NO;
  448. }
  449. }
  450. else if (self.selectIndex == 2) { // 直播课
  451. if ([self.teaherStatus isEqualToString:@"DOING"]) {
  452. self.authView.sureButton.userInteractionEnabled = NO;
  453. self.authView.sureButton.hidden = YES;
  454. }
  455. else {
  456. if ([self.teaherStatus isEqual:@"PASS"] && self.liveFlag == NO) {
  457. [self.authView.sureButton setTitle:@"立即开通" forState:UIControlStateNormal];
  458. }
  459. else {
  460. [self.authView.sureButton setTitle:@"去认证" forState:UIControlStateNormal];
  461. }
  462. self.authView.sureButton.userInteractionEnabled = YES;
  463. self.authView.sureButton.hidden = NO;
  464. }
  465. }
  466. else { // 曲谱
  467. if ([self.musicianStatus isEqualToString:@"DOING"]) {
  468. self.authView.sureButton.userInteractionEnabled = NO;
  469. self.authView.sureButton.hidden = YES;
  470. }
  471. else {
  472. self.authView.sureButton.userInteractionEnabled = YES;
  473. self.authView.sureButton.hidden = NO;
  474. }
  475. }
  476. }
  477. - (void)hideAuthView {
  478. if ([self.subviews containsObject:self.authView]) {
  479. [self.authView removeFromSuperview];
  480. self.authView = nil;
  481. }
  482. }
  483. - (MinePageSubmitView *)uploadView {
  484. if (!_uploadView) {
  485. _uploadView = [MinePageSubmitView shareInstance];
  486. CGFloat topHeight = 60.0f;
  487. _uploadView.frame = CGRectMake(0, 0, kScreenWidth, topHeight);
  488. MJWeakSelf;
  489. [_uploadView opreationCallback:^(MINEPAGETYPE type) {
  490. [weakSelf uploadAciton:type];
  491. }];
  492. }
  493. return _uploadView;
  494. }
  495. - (void)uploadAciton:(MINEPAGETYPE)type {
  496. switch (type) {
  497. case MINEPAGETYPE_ACCOMPANY: // 陪练课设置
  498. {
  499. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  500. webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/practiceSetting"];
  501. [self.naviController pushViewController:webCtrl animated:YES];
  502. }
  503. break;
  504. case MINEPAGETYPE_LIVE: // 直播课设置
  505. {
  506. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  507. webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/liveCreate"];
  508. [self.naviController pushViewController:webCtrl animated:YES];
  509. }
  510. break;
  511. case MINEPAGETYPE_MUSIC: // 上传曲谱
  512. {
  513. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  514. webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/music-upload"];
  515. [self.naviController pushViewController:webCtrl animated:YES];
  516. }
  517. break;
  518. default:
  519. break;
  520. }
  521. }
  522. - (AuthDisplayView *)authView {
  523. if (!_authView) {
  524. _authView = [AuthDisplayView shareInstance];
  525. [_authView.imageView setImage:[UIImage imageNamed:[self getAuthDisplayImage]]];
  526. MJWeakSelf;
  527. [_authView sureCallback:^{
  528. [weakSelf authAction];
  529. }];
  530. }
  531. return _authView;
  532. }
  533. - (NSString *)getAuthDisplayImage {
  534. if (self.selectIndex == 1) {
  535. return @"authTeacher_accompany";
  536. }
  537. else if (self.selectIndex == 2) {
  538. return @"authTeacher_Live";
  539. }
  540. else {
  541. return @"authMuscian";
  542. }
  543. }
  544. - (NSString *)getAuthDisplayMessage {
  545. if (self.selectIndex == 1) { // 陪练课
  546. if ([self.teaherStatus isEqualToString:@"DOING"]) { // 审核中
  547. return @"您已提交认证申请,请耐心等待审核结果~";
  548. }
  549. else {
  550. return @"您还没有完成老师认证,认证后才可设置陪练课哦~";
  551. }
  552. }
  553. else if (self.selectIndex == 2) { // 直播课
  554. if ([self.teaherStatus isEqualToString:@"DOING"]) { // 审核中
  555. return @"您已提交认证申请,请耐心等待审核结果~";
  556. }
  557. else {
  558. if ([self.teaherStatus isEqualToString:@"PASS"] && self.liveFlag == NO) { // 如果老师认证通过
  559. return @"您尚未开通直播服务,开通后即可创建直播课程~";
  560. }
  561. return @"您还没有完成老师认证,认证后才可创建直播课哦~";
  562. }
  563. }
  564. else { // 曲谱
  565. if ([self.musicianStatus isEqualToString:@"DOING"]) { // 审核中
  566. return @"您已提交认证申请,请耐心等待审核结果~";
  567. }
  568. else {
  569. return @"您还没有完成音乐人认证,认证后才可上传曲谱哦~";
  570. }
  571. }
  572. }
  573. - (void)authAction {
  574. if (self.selectIndex == 1) {
  575. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  576. webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherCert"];
  577. [self.naviController pushViewController:webCtrl animated:YES];
  578. }
  579. else if (self.selectIndex == 2) {
  580. if ([self.teaherStatus isEqual:@"PASS"] && self.liveFlag == NO) { // 开通直播
  581. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  582. webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/openLive"];
  583. [self.naviController pushViewController:webCtrl animated:YES];
  584. }
  585. else {
  586. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  587. webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherCert"];
  588. [self.naviController pushViewController:webCtrl animated:YES];
  589. }
  590. }
  591. else {
  592. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  593. webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/musicCert"];
  594. [self.naviController pushViewController:webCtrl animated:YES];
  595. }
  596. }
  597. /*
  598. // Only override drawRect: if you perform custom drawing.
  599. // An empty implementation adversely affects performance during animation.
  600. - (void)drawRect:(CGRect)rect {
  601. // Drawing code
  602. }
  603. */
  604. @end