Commit 133834718f2ec499fe15bce03993e105c0199988

Authored by zhangxiaowen
1 parent cf994e58

no message

CNLiveIntegralModule/Classes/Controller/CNLiveIntegralDetailsController.m
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
18 #import "CNLiveEnvironment.h" 18 #import "CNLiveEnvironment.h"
19 #import "CNUserInfoManager.h" 19 #import "CNUserInfoManager.h"
20 #import "CNLiveUserAgreementManager.h" 20 #import "CNLiveUserAgreementManager.h"
  21 +#import "CNLiveRefreshHeader.h"
21 #import "CNLiveRefreshFooter.h" 22 #import "CNLiveRefreshFooter.h"
22 23
23 #import "CNLiveIntegralDetailsTableViewCell.h" 24 #import "CNLiveIntegralDetailsTableViewCell.h"
@@ -40,14 +41,16 @@ @@ -40,14 +41,16 @@
40 #pragma mark - Data 41 #pragma mark - Data
41 - (void)loadData{ 42 - (void)loadData{
42 NSDictionary *params = @{@"pageSize":@"15", 43 NSDictionary *params = @{@"pageSize":@"15",
43 - @"pageNo":[NSString stringWithFormat:@"%ld",_pageNo],  
44 - @"sid":CNUserShareModel.uid,@"appId":AppId}; 44 + @"pageNo":[NSString stringWithFormat:@"%ld",_pageNo],
  45 + @"sid":CNUserShareModel.uid,@"appId":AppId};
45 [CNLiveNetworking setAllowRequestDefaultArgument:YES]; 46 [CNLiveNetworking setAllowRequestDefaultArgument:YES];
46 [CNLiveNetworking setupShowDataResult:NO]; 47 [CNLiveNetworking setupShowDataResult:NO];
47 [QMUITips showLoadingInView:[UIApplication sharedApplication].keyWindow]; 48 [QMUITips showLoadingInView:[UIApplication sharedApplication].keyWindow];
48 [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNIntegralDetailsUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { 49 [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNIntegralDetailsUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
49 [QMUITips hideAllTipsInView:[UIApplication sharedApplication].keyWindow]; 50 [QMUITips hideAllTipsInView:[UIApplication sharedApplication].keyWindow];
50 [self hideEmptyView]; 51 [self hideEmptyView];
  52 + [self.tableView.mj_header endRefreshing];
  53 + [self.tableView.mj_footer endRefreshing];
51 54
52 if (error) { 55 if (error) {
53 if (self.data.count == 0) { 56 if (self.data.count == 0) {
@@ -61,11 +64,14 @@ @@ -61,11 +64,14 @@
61 return; 64 return;
62 } 65 }
63 if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { 66 if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
64 - _isRefreshing = NO;  
65 - _pageNo++; 67 + if(self.pageNo == 1 && self.data.count>0){
  68 + [self.data removeAllObjects];
  69 + }
  70 + self.isRefreshing = NO;
  71 + self.pageNo++;
66 NSArray *arr = [CNLiveScoreModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"list"]]; 72 NSArray *arr = [CNLiveScoreModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"list"]];
67 [self.data addObjectsFromArray:arr]; 73 [self.data addObjectsFromArray:arr];
68 - if (arr.count < 10) { 74 + if (arr.count < 15) {
69 [self.tableView.mj_footer endRefreshingWithNoMoreData]; 75 [self.tableView.mj_footer endRefreshingWithNoMoreData];
70 76
71 } else { 77 } else {
@@ -104,7 +110,7 @@ @@ -104,7 +110,7 @@
104 _pageNo = 1; 110 _pageNo = 1;
105 _isRefreshing = NO; 111 _isRefreshing = NO;
106 112
107 - [self loadData]; 113 + [self.tableView.mj_header beginRefreshing];
108 [self createUI]; 114 [self createUI];
109 115
110 } 116 }
@@ -191,14 +197,14 @@ @@ -191,14 +197,14 @@
191 _tableView.showsHorizontalScrollIndicator = NO; 197 _tableView.showsHorizontalScrollIndicator = NO;
192 [_tableView registerClass:[CNLiveIntegralDetailsTableViewCell class] forCellReuseIdentifier:kCNLiveIntegralDetailsTableViewCell]; 198 [_tableView registerClass:[CNLiveIntegralDetailsTableViewCell class] forCellReuseIdentifier:kCNLiveIntegralDetailsTableViewCell];
193 __weak __typeof(self)weakSelf = self; 199 __weak __typeof(self)weakSelf = self;
194 -// MJRefreshAutoNormalFooter *refreshView = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{  
195 -// [weakSelf loadMoreData];  
196 -// }];  
197 -// _tableView.mj_footer = refreshView; 200 + CNLiveRefreshHeader *header = [CNLiveRefreshHeader headerWithRefreshingBlock:^{
  201 + weakSelf.pageNo = 1;
  202 + [weakSelf loadMoreData];
  203 + }];
  204 + _tableView.mj_header = header;
198 CNLiveRefreshFooter *footer = [CNLiveRefreshFooter footerWithRefreshingBlock:^{ 205 CNLiveRefreshFooter *footer = [CNLiveRefreshFooter footerWithRefreshingBlock:^{
199 [weakSelf loadMoreData]; 206 [weakSelf loadMoreData];
200 }]; 207 }];
201 -// footer.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];  
202 _tableView.mj_footer = footer; 208 _tableView.mj_footer = footer;
203 } 209 }
204 return _tableView; 210 return _tableView;
Example/CNLiveIntegralModule/CNLIVEAppDelegate.m
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 10
11 #import <CommonCrypto/CommonDigest.h> 11 #import <CommonCrypto/CommonDigest.h>
12 12
  13 +#import "CNUserInfoManager.h"
13 #import "CNLiveEnvironment.h" 14 #import "CNLiveEnvironment.h"
14 #import <CNLiveRequestBastKit/CNLiveNetworking.h> 15 #import <CNLiveRequestBastKit/CNLiveNetworking.h>
15 16
@@ -27,12 +28,32 @@ @@ -27,12 +28,32 @@
27 28
28 [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore]; 29 [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore];
29 [self networkParamAction]; 30 [self networkParamAction];
30 - 31 + [CNUserInfoManager saveUserinfoDic:@{
  32 + @"bigFaceUrl":@"http://yweb0.cnliveimg.com/images/headImg/2019/1030/1572439148697.jpg",
  33 + @"countryCode":@"86",
  34 + @"email":@"",
  35 + @"extInfo":@"",
  36 + @"faceUrl":@"http://yweb0.cnliveimg.com/images/headImg/2019/1030/1572439148697_small.jpg",
  37 + @"gender":@"f",
  38 + @"hUid":@"",
  39 + @"isNewUser":@"0",
  40 + @"location":@"北京市石景山区鲁谷街道远洋山水南区",
  41 + @"mobile":@"17600922519",
  42 + @"nickName":@"金帝",
  43 + @"platformId":@"769_jetj7bq525",
  44 + @"qqUid":@"",
  45 + @"renrenUid":@"",
  46 + @"sinaUid":@"",
  47 + @"token":@"RkFYeLkl/u5S7tW8UcOkT3rfLTP/Ua8NIkdEsKlcolvl/yxTMNbAYXmmJyhKGpkj",
  48 + @"uid":@"10514405",
  49 + @"wxUid":@""
  50 + }];
  51 + [[NSUserDefaults standardUserDefaults] setObject:@"RkFYeLkl/u5S7tW8UcOkT3rfLTP/Ua8NIkdEsKlcolvl/yxTMNbAYXmmJyhKGpkj" forKey:@"CNLiveAuthToken"];
31 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 52 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
32 53
33 -// CNLiveTaskListController *vc = [[CNLiveTaskListController alloc] init]; 54 + CNLiveTaskListController *vc = [[CNLiveTaskListController alloc] init];
34 55
35 - CNLIVEViewController *vc = [[CNLIVEViewController alloc] init]; 56 +// CNLIVEViewController *vc = [[CNLIVEViewController alloc] init];
36 57
37 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; 58 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
38 59