HF_Q 4 vuotta sitten
vanhempi
commit
35a72920f5

BIN
smartRhino.xcworkspace/xcuserdata/niuzhen.xcuserdatad/UserInterfaceState.xcuserstate


+ 181 - 32
smartRhino/Project/VCModel/Home/VC/BookStore/VC/BookContentNavVC.m

@@ -43,6 +43,17 @@
 #import "BookNavModel.h"
 #import "HomeSubItemModel.h"
 #import "BookSelectSubModel.h"
+#import "BookTeacherDetailVC.h"
+#import "BookWCDetailVC.h"
+#import "BookListenVC.h"
+#import "BookListDetailVC.h"
+#import "TDSearchBar.h"
+#import "HomeWeiCousreCell.h"
+#import "BookSubArticeCell.h"
+#import "HomeTeacherCell.h"
+#import "HomeMusicCell.h"
+#import "HomeSchoolCell.h"
+#import "IndexGoodBookCell.h"
 
 @interface BookContentNavVC ()<UITableViewDelegate,UITableViewDataSource,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
 @property (weak, nonatomic) IBOutlet UITableView *leftTableV;
@@ -60,8 +71,6 @@
 @property (strong, nonatomic) NSMutableArray            *listArray;
 @property (strong, nonatomic) NSMutableArray            *selectArray;
 @property (strong, nonatomic) NSMutableArray            *topArray;
-@property (assign, nonatomic) NSInteger                  caryID;
-@property (assign, nonatomic) NSInteger                  hotID;
 @property (assign, nonatomic) NSInteger                  leftRow;
 @property (assign, nonatomic) NSInteger                  middleRow;
 @property (assign, nonatomic) BOOL                  leftHidden;
@@ -75,6 +84,10 @@
 @property (strong, nonatomic) UIButton             *endBtn;
 @property (copy, nonatomic) NSString               *beginTime;
 @property (copy, nonatomic) NSString               *endTime;
+@property (assign, nonatomic) NSInteger             type;
+@property (assign, nonatomic) NSInteger             categropId;
+@property (assign, nonatomic) NSInteger             currentPage;
+@property (assign, nonatomic) NSInteger             Total;
 @end
 
 @implementation BookContentNavVC
@@ -162,6 +175,8 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     self.fd_prefersNavigationBarHidden = YES;
+    self.type = 0;
+    self.categropId = 0;
     self.leftTableV.delegate = self;
     self.leftTableV.dataSource = self;
     self.middleTableV.delegate = self;
@@ -193,6 +208,7 @@
     self.leftW.constant = 65.f;
     [self getData];
     [self getSelectData];
+    [self setTableRefresh];
 }
 - (void)getData
 {
@@ -241,7 +257,7 @@
            } failure:^(NSError * _Nonnull error) {
                
            }];
-           [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Content_Navi_List) parameters:@{@"CategoryId":[NSNumber numberWithInteger:0]} responseStyle:JOSN success:^(id  _Nonnull responseObject) {
+           [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Content_Navi_List) parameters:@{@"page":@(self.currentPage),@"PerPage":@(20),@"CategoryId":[NSNumber numberWithInteger:0]} responseStyle:JOSN success:^(id  _Nonnull responseObject) {
                NSLog(@"++++%@",responseObject);
                if ([responseObject isKindOfClass:[NSDictionary class]]) {
                    for (NSDictionary * dict in responseObject[@"Items"]) {
@@ -261,12 +277,41 @@
            });
        });
 }
-- (void)getRightData:(NSInteger)BookId
+- (void)setTableRefresh
 {
     WS(weakSelf);
-    self.caryID = BookId;
+    self.rightTableV.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
+        [weakSelf headRefresh];
+    }];
+    self.rightTableV.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
+        [weakSelf footerRefresh];
+    }];
+}
+
+
+- (void)headRefresh{
+    self.currentPage = 1;
+    self.Total = 1;
     [self.listArray removeAllObjects];
-    [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Content_Navi_List) parameters:@{@"CategoryId":[NSNumber numberWithInteger:BookId]} responseStyle:JOSN success:^(id  _Nonnull responseObject) {
+    self.rightTableV.mj_footer.hidden = NO;
+    [self getRightData];
+}
+
+- (void)footerRefresh{
+    self.currentPage += 1;
+    if (self.Total == self.listArray.count) {
+        self.currentPage --;
+        [self.rightTableV.mj_footer endRefreshingWithNoMoreData];
+        self.rightTableV.mj_footer.hidden = YES;
+        return;
+    }
+    [self getRightData];
+}
+- (void)getRightData
+{
+    WS(weakSelf);
+    [self.listArray removeAllObjects];
+    [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Content_Navi_List) parameters:@{@"page":@(self.currentPage),@"PerPage":@(20),@"CategoryId":@(self.categropId),@"sort":@(self.type)} responseStyle:JOSN success:^(id  _Nonnull responseObject) {
         NSLog(@"++++%@",responseObject);
         if ([responseObject isKindOfClass:[NSDictionary class]]) {
             if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
@@ -274,8 +319,11 @@
                     HomeSubItemModel * model = [HomeSubItemModel modelWithDictionary:dict];
                     [weakSelf.listArray addObject:model];
                 }
+                weakSelf.Total = [responseObject[@"Total"] integerValue];
             }
         }
+        [weakSelf.rightTableV.mj_header endRefreshing];
+        [weakSelf.rightTableV.mj_footer endRefreshing];
         dispatch_async(dispatch_get_main_queue(), ^{
             [weakSelf reloadData];
         });
@@ -473,41 +521,64 @@
         return cell;
     }else if(tableView == self.rightTableV){
         HomeSubItemModel * model = [self.listArray objectAtIndex:indexPath.row];
-        switch (model.MediaType) {
-            case MediaBookType:///书籍
+        switch ((CollectModelType)model.MediaType) {
+            case CollectModel_StoreBook:
             {
-                BookContentCell * cell = [BookContentCell configCell0:tableView indexPath:indexPath];
-                [cell setDataModel:model];
+                IndexGoodBookCell * cell = [IndexGoodBookCell configCell0:tableView indexPath:indexPath];
+                [cell setDataWithModel:model searchText:@""];
+                if (self.dataArray.count == indexPath.row + 1) {
+                    cell.lineV.hidden = YES;
+                }
                 return cell;
             }
                 break;
-            case MediaVideoType:///视频
+            case CollectModel_StoreVideo:
             {
-                BookContentCell * cell = [BookContentCell configCell1:tableView indexPath:indexPath];
-                [cell setDataWithModel:model];
+                HomeWeiCousreCell * cell = [HomeWeiCousreCell configCell0:tableView indexPath:indexPath];
+                [cell setDataWithIndexModel:model searchText:@""];
+                if (self.dataArray.count == indexPath.row + 1) {
+                    cell.lineV.hidden = YES;
+                }
                 return cell;
             }
                 break;
-            case MediaCourseType:///课程
+            case CollectModel_StoreSound:
             {
-                BookContentCell * cell = [BookContentCell configCell1:tableView indexPath:indexPath];
-                cell.playImgV.hidden = YES;
-                [cell setDataWithModel:model];
+                HomeMusicCell * cell = [HomeMusicCell configCell:tableView indexPath:indexPath];
+                [cell setDataWithModel:model searchText:@""];
+                if (self.dataArray.count == indexPath.row + 1) {
+                    cell.lineV.hidden = YES;
+                }
                 return cell;
             }
                 break;
-            case MediaMediaArticeType:///文章
+            case CollectModel_Teacher:
             {
-                BookContentCell * cell = [BookContentCell configCell1:tableView indexPath:indexPath];
-                cell.playImgV.hidden = YES;
-                [cell setDataWithModel:model];
+                HomeTeacherCell * cell = [HomeTeacherCell configCell:tableView indexPath:indexPath];
+                [cell setDataWithModel:model searchText:@""];
+                if (self.dataArray.count == indexPath.row + 1) {
+                    cell.lineV.hidden = YES;
+                }
                 return cell;
             }
                 break;
-            default:///音频
+            case CollectModel_Organization:
             {
-                BookContentCell * cell = [BookContentCell configCell2:tableView indexPath:indexPath];
-                [cell setDataWithModel:model];
+                HomeSchoolCell * cell = [HomeSchoolCell configCell1:tableView indexPath:indexPath];
+                [cell setDataIndexModel:model searchText:@""];
+                if (self.dataArray.count == indexPath.row + 1) {
+                    cell.lineV.hidden = YES;
+                }
+                return cell;
+            }
+                break;
+            default:
+            {
+                IndexGoodBookCell * cell = [IndexGoodBookCell configCell1:tableView indexPath:indexPath];
+                [cell setDataWithModel:model searchText:@""];
+                if (self.dataArray.count == indexPath.row + 1) {
+                    cell.lineV.hidden = YES;
+                }
                 return cell;
             }
                 break;
@@ -537,7 +608,8 @@
             model.isSelect = NO;
         }
         smodel.isSelect = YES;
-        [self getRightData:smodel.Id];
+        self.categropId = smodel.Id;
+        [self headRefresh];
     }else if(tableView == self.middleTableV){
         self.middleRow = indexPath.row;
         BookNavModel * model = [self.dataArray objectAtIndex:self.leftRow];
@@ -549,10 +621,59 @@
             tmodel.isSelect = YES;
             self.leftHidden = YES;
             self.middleHidden = NO;
-            [self getRightData:tmodel.Id];
+            self.categropId = tmodel.Id;
+            [self headRefresh];
         }
-    }else{
-       
+    }else if(tableView == self.rightTableV){
+        HomeSubItemModel * model = [self.listArray objectAtIndex:indexPath.row];
+        [self pushVC:model];
+    }
+}
+- (void)pushVC:(HomeSubItemModel *)model
+{
+    switch ((CollectModelType)model.MediaType) {
+        case CollectModel_StoreBook:
+        {
+            BookListDetailVC * vc = [BookListDetailVC initBookListDetailVC];
+            vc.Id = model.Id;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+            break;
+        case CollectModel_StoreVideo:
+        {
+            BookWCDetailVC * vc = [BookWCDetailVC initBookWCDetailVC];
+            vc.Id = model.Id;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+            break;
+        case CollectModel_StoreSound:
+        {
+            BookListenVC * vc = [BookListenVC initBookListenVC];
+            vc.Id = model.Id;
+            vc.MediaType = MediaMusicType;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+            break;
+        case CollectModel_Teacher:
+        {
+            BookTeacherDetailVC * vc = [BookTeacherDetailVC initBookTeacherDetailVC];
+            vc.Id = model.Id;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+            break;
+        case CollectModel_Organization:
+        {
+            
+        }
+            break;
+        default:
+        {
+            MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
+            vc.type = (CollectModelType)model.MediaType;
+            vc.Id = model.Id;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+            break;
     }
 }
 - (void)reloadData
@@ -620,6 +741,34 @@
         smodel.isSelect = NO;
     }
     model.isSelect = YES;
+    switch (model.Id) {
+        case 4:
+        {
+            self.type = 101;
+        }
+            break;
+        case 5:
+        {
+            self.type = 20;
+        }
+            break;
+        case 6:
+        {
+            self.type = 60;
+        }
+            break;
+        case 7:
+        {
+            self.type = 40;
+        }
+            break;
+        default:
+        {
+            self.type = model.Id;
+        }
+            break;
+    }
+    [self headRefresh];
     [self.collectionView reloadData];
     WS(weakSelf);
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -796,10 +945,10 @@
                     break;
             }
         }
-        paraDict = @{@"CategoryId":[NSNumber numberWithInteger:self.caryID],
+        paraDict = @{@"CategoryId":@(self.categropId),
                      @"BeginTime":self.beginTime,
                      @"EndTime":self.endTime,
-                     @"Sort":[NSNumber numberWithInteger:sortId],
+                     @"Sort":@(self.type),
                      @"TeacherId":teacherArray,
                      @"Unit":@[],
                      @"Press":chuDepArray,
@@ -835,10 +984,10 @@
 - (void)getSelectData
 {
     WS(weakSelf);
-    NSDictionary * paraDict = @{@"CategoryId":[NSNumber numberWithInteger:self.caryID],
+    NSDictionary * paraDict = @{@"CategoryId":@(self.categropId),
                                 @"BeginTime":@"",
                                 @"EndTime":@"",
-                                @"Sort":[NSNumber numberWithInteger:0],
+                                @"Sort":@(self.type),
                                 @"TeacherId":@[],
                                 @"Unit":@[],
                                 @"Press":@[],

+ 1 - 1
smartRhino/Project/VCModel/Home/VC/View/HomeSchoolSubVC/FirstViewController.m

@@ -23,7 +23,7 @@
 }
 
 - (void)creatTableView {
-    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT - NAVH - 10) style:UITableViewStyleGrouped];
+    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT - NAVH - 150) style:UITableViewStyleGrouped];
     _tableView.delegate = self;
     _tableView.dataSource = self;
     _tableView.showsVerticalScrollIndicator = NO;

+ 1 - 1
smartRhino/Project/VCModel/Home/VC/View/HomeSchoolSubVC/SecondViewController.m

@@ -36,7 +36,7 @@ static NSString *const SecondViewControllerTableVIewCellIdentifier = @"SecondVie
     return _dataSource;
 }
 - (void)creatTableView {
-    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT - NAVH - 10)];
+    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT - NAVH - 150)];
     _tableView.delegate = self;
     _tableView.dataSource = self;
     _tableView.showsVerticalScrollIndicator = NO;

+ 1 - 1
smartRhino/Project/VCModel/Home/VC/View/HomeSchoolSubVC/ThirdViewController.m

@@ -37,7 +37,7 @@ static NSString *const ThirdViewControllerCollectionViewCellIdentifier = @"Third
     return _dataSource;
 }
 - (void)creatTableView {
-    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT - NAVH - 10)];
+    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT - NAVH - 150)];
     _tableView.delegate = self;
     _tableView.dataSource = self;
     _tableView.showsVerticalScrollIndicator = NO;