From 94217b294ccd75a34787eb04d6e273e99536e45b Mon Sep 17 00:00:00 2001
From: 重庆迈尖科技有限公司
Date: 星期三, 30 一月 2019 15:12:32 +0800
Subject: [PATCH] no message

---
 BuWanVideo2.0/CollectionController.m |  167 ++++++++++++++++++++++++-------------------------------
 1 files changed, 72 insertions(+), 95 deletions(-)

diff --git a/BuWanVideo2.0/CollectionController.m b/BuWanVideo2.0/CollectionController.m
index 2dd29db..409ff91 100755
--- a/BuWanVideo2.0/CollectionController.m
+++ b/BuWanVideo2.0/CollectionController.m
@@ -16,7 +16,7 @@
 #import "discoverGoodsDetailViewController.h"
 
 @interface CollectionController ()<UITableViewDataSource,UITableViewDelegate>{
-    HMSegmentedControl *segmentedControl;
+//    HMSegmentedControl *segmentedControl;
     
     UITableView * mytableview;
     
@@ -48,6 +48,13 @@
     
     [self initScene];
 }
+- (void)viewWillAppear:(BOOL)animated{
+//    if (_videoData.count == 0) {
+//        videoPage = 1;
+//    }
+    [self getVideoDataResuse:1];
+
+}
 
 -(void)initScene{
     //璁剧疆鑳屾櫙鑹�
@@ -57,7 +64,7 @@
     [self createNavgationBar];
     
     //鍒涘缓閫夐」
-    [self createSegmentedControl];
+//    [self createSegmentedControl];
     
     //鍒涘缓鍒楄〃
     [self createTableView];
@@ -107,41 +114,49 @@
     self.navigationItem.rightBarButtonItem = deleteBarItem;
 }
 
-/**
- 鍒涘缓閫夐」鏍�
- */
--(void)createSegmentedControl{
-    segmentedControl = [[HMSegmentedControl alloc] initWithSectionTitles:@[@"褰辫鏀惰棌", @"鍟嗗搧鏀惰棌"]];
-    [segmentedControl setFrame:CGRectMake(0, 64, KScreenW, 48)];
-    segmentedControl.selectionIndicatorHeight = 4.0f;
-    segmentedControl.backgroundColor = KGlobalLightGreyColor_255;
-    segmentedControl.titleTextAttributes = @{NSForegroundColorAttributeName : kGlobalDeepGreyColor};
-    segmentedControl.selectionIndicatorColor = kGlobalYellowColor;
-    segmentedControl.selectionStyle = HMSegmentedControlSelectionStyleTextWidthStripe;
-    segmentedControl.selectedSegmentIndex = 0;
-    segmentedControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;
-    segmentedControl.shouldAnimateUserSelection = YES;
-    segmentedControl.titleTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:15]};
-    [segmentedControl addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged];
-    
-    //閫夐」涓嬮潰鐨勬í绾�
-    UILabel *Line = [[UILabel alloc]initWithFrame:CGRectMake(0, 48, KScreenW, 1)];
-    Line.backgroundColor = kGlobaLineColor;
-    [segmentedControl addSubview:Line];
-    
-    //閫夐」涓棿鐨勫垎鍓茬嚎
-    UILabel *Line1 = [[UILabel alloc]initWithFrame:CGRectMake(KScreenW / 2 - 0.5 , 10 ,1, 28)];
-    Line1.backgroundColor = kGlobaLineColor;
-    [segmentedControl addSubview:Line1];
-    
-    [self.view addSubview:segmentedControl];
-}
+///**
+// 鍒涘缓閫夐」鏍�
+// */
+//-(void)createSegmentedControl{
+//    segmentedControl = [[HMSegmentedControl alloc] initWithSectionTitles:@[@"褰辫鏀惰棌", @"鍟嗗搧鏀惰棌"]];
+//    NSInteger height = 64;
+//    if (KIsiPhoneX) {
+//        height = 84;
+//    }
+//    [segmentedControl setFrame:CGRectMake(0, height, KScreenW, 48)];
+//    segmentedControl.selectionIndicatorHeight = 4.0f;
+//    segmentedControl.backgroundColor = KGlobalLightGreyColor_255;
+//    segmentedControl.titleTextAttributes = @{NSForegroundColorAttributeName : kGlobalDeepGreyColor};
+//    segmentedControl.selectionIndicatorColor = kGlobalYellowColor;
+//    segmentedControl.selectionStyle = HMSegmentedControlSelectionStyleTextWidthStripe;
+//    segmentedControl.selectedSegmentIndex = 0;
+//    segmentedControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;
+//    segmentedControl.shouldAnimateUserSelection = YES;
+//    segmentedControl.titleTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:15]};
+//    [segmentedControl addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged];
+//
+//    //閫夐」涓嬮潰鐨勬í绾�
+//    UILabel *Line = [[UILabel alloc]initWithFrame:CGRectMake(0, 48, KScreenW, 1)];
+//    Line.backgroundColor = kGlobaLineColor;
+//    [segmentedControl addSubview:Line];
+//
+//    //閫夐」涓棿鐨勫垎鍓茬嚎
+//    UILabel *Line1 = [[UILabel alloc]initWithFrame:CGRectMake(KScreenW / 2 - 0.5 , 10 ,1, 28)];
+//    Line1.backgroundColor = kGlobaLineColor;
+//    [segmentedControl addSubview:Line1];
+//
+////    [self.view addSubview:segmentedControl];
+//}
 
 /**
  鍒涘缓鍒楄〃
  */
 -(void)createTableView{
-    mytableview = [[UITableView alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(segmentedControl.frame) , KScreenW, KScreenH - 117) style:UITableViewStylePlain];
+    NSInteger height = 117 - 48;
+    if (KIsiPhoneX) {
+        height = 137 - 48 ;
+    }
+    mytableview = [[UITableView alloc]initWithFrame:CGRectMake(0,0 , KScreenW, KScreenH ) style:UITableViewStylePlain];
     mytableview.delegate = self;
     mytableview.dataSource = self;
     mytableview.backgroundColor = kGlobalBackgroundColor;
@@ -164,7 +179,11 @@
  */
 -(void)CreateOperatingView{
     //鐩涙斁鍏ㄩ�夋寜閽拰鍒犻櫎鎸夐挳鐨勮鍥�
-    allSelAndDelView = [[UIView alloc] initWithFrame:CGRectMake(0, KScreenH-40, KScreenW, 40)];
+    CGFloat height = 40;
+    if (KIsiPhoneX) {
+        height = 60;
+    }
+    allSelAndDelView = [[UIView alloc] initWithFrame:CGRectMake(0, KScreenH-height, KScreenW, 40)];
     allSelAndDelView.backgroundColor = [UIColor whiteColor];
     //榛樿闅愯棌锛屽彧鏈夌敤鎴风偣鍑荤紪杈戞寜閽椂锛屾墠浼氬嚭鐜�
     allSelAndDelView.hidden = YES;
@@ -222,28 +241,17 @@
  涓嬫媺鍒锋柊鏂规硶
  */
 - (void)loadNewData{
-    if (WhetherChooseGoodsCollection) {
-        //鏀惰棌鐨勫晢鍝�
-        goodsPage = 1;
-        [self getGoodsDataResuse:goodsPage];
-    }else{
-        //鏀惰棌鐨勮棰�
-        videoPage = 1;
-        [self getVideoDataResuse:videoPage];
-    }
+    videoPage = 1;
+    [self getVideoDataResuse:videoPage];
 }
 
 /**
  涓婃媺鍔犺浇鏇村瑙嗗浘
  */
 - (void)loadMoreData{
-    if (WhetherChooseGoodsCollection) {
-        //鏀惰棌鐨勫晢鍝�
-        [self getGoodsDataResuse:goodsPage];
-    }else{
-        //鏀惰棌鐨勮棰�
-        [self getVideoDataResuse:videoPage];
-    }
+
+    //鏀惰棌鐨勮棰�
+    [self getVideoDataResuse:videoPage];
 }
 
 /**
@@ -299,59 +307,26 @@
             }else{
                 [prompt setHidden:NO];
             }
-            
+                [mytableview.mj_footer endRefreshing];
+            if (_videoData.count < 20) {
+                [mytableview.mj_footer endRefreshingWithNoMoreData];
+            }
+            if (_videoData.count < 3) {
+                mytableview.mj_footer.hidden = YES;
+            }
         }else{
+                [mytableview.mj_footer endRefreshing];
             NSLog(@"%@",error);
+            if ([error compare:@"浼间箮宸叉柇寮�涓庝簰鑱旂綉鐨勮繛鎺ャ��"] == 0) {
+                [self autoDisappearAlertTime:1 msg:@"缃戠粶涓嶅彲鐢紝璇锋鏌ョ綉缁�"];
+            }
         }
         [SVProgressHUD dismiss];
     }];
     [mytableview.mj_header endRefreshing];
-    [mytableview.mj_footer endRefreshing];
+
 }
 
-
-/**
- 鍟嗗搧鏀惰棌鍒楄〃
- 
- @param pageNumber 椤垫暟
- */
--(void)getGoodsDataResuse:(NSInteger)pageNumber{
-    [SVProgressHUD showWithStatus:@"鐤媯鍔犺浇涓�"];
-    [[YTHNetInterface startInterface] getCollectListWithUid:[YTHsharedManger startManger].Uid WithSystem:@"1" withPage:[NSString stringWithFormat:@"%ld",(long)pageNumber] withBlock:^(BOOL isSuccessful, id result, NSString *error) {
-        if (isSuccessful) {
-            NSDictionary *dic =(NSDictionary *)result;
-            if (!_goodsData) {
-                _goodsData = [[NSMutableArray alloc] initWithCapacity:0];
-            }
-            if (pageNumber == 1) {
-                [_goodsData removeAllObjects];
-            }
-            
-            NSArray *arr = [[dic objectForKey:@"Data"] objectForKey:@"data"];
-            for (int i =0; i<arr.count; i++) {
-                [_goodsData addObject:[arr objectAtIndex:i]];
-            }
-            if ([arr count]>0){
-                ++goodsPage;
-            }
-            //鍙栨秷缂栬緫鐘舵��
-            mytableview.editing = NO;
-            [self editNO];
-            
-            [mytableview reloadData];
-            if(_goodsData.count>0){
-                [prompt setHidden:YES];
-            }else{
-                [prompt setHidden:NO];
-            }
-        }else{
-            NSLog(@"%@",error);
-        }
-        [SVProgressHUD dismiss];
-    }];
-    [mytableview.mj_header endRefreshing];
-    [mytableview.mj_footer endRefreshing];
-}
 
 /**
  鍙栨秷缂栬緫鐘舵��
@@ -439,7 +414,7 @@
                 mytableview.editing = NO;
                 [self editNO];
                 goodsPage = 1;
-                [self getGoodsDataResuse:goodsPage];
+//                [self getGoodsDataResuse:goodsPage];
             }else{
                 [SVProgressHUD showErrorWithStatus:@"鍙栨秷鏀惰棌澶辫触锛�"];
             }
@@ -609,6 +584,8 @@
 }
 
 -(void)deletebutton:(id)sender{
+    [deleteBut setTitle:[NSString stringWithFormat:@"鍒犻櫎"] forState:UIControlStateNormal];
+
     if (mytableview.editing) {
         [mytableview setEditing:NO];
         [deleBtn setSelected:NO];

--
Gitblit v1.8.0