Commit 133834718f2ec499fe15bce03993e105c0199988

Authored by zhangxiaowen
1 parent cf994e58

no message

CNLiveIntegralModule/Classes/Controller/CNLiveIntegralDetailsController.m
... ... @@ -18,6 +18,7 @@
18 18 #import "CNLiveEnvironment.h"
19 19 #import "CNUserInfoManager.h"
20 20 #import "CNLiveUserAgreementManager.h"
  21 +#import "CNLiveRefreshHeader.h"
21 22 #import "CNLiveRefreshFooter.h"
22 23  
23 24 #import "CNLiveIntegralDetailsTableViewCell.h"
... ... @@ -40,14 +41,16 @@
40 41 #pragma mark - Data
41 42 - (void)loadData{
42 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 46 [CNLiveNetworking setAllowRequestDefaultArgument:YES];
46 47 [CNLiveNetworking setupShowDataResult:NO];
47 48 [QMUITips showLoadingInView:[UIApplication sharedApplication].keyWindow];
48 49 [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNIntegralDetailsUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
49 50 [QMUITips hideAllTipsInView:[UIApplication sharedApplication].keyWindow];
50 51 [self hideEmptyView];
  52 + [self.tableView.mj_header endRefreshing];
  53 + [self.tableView.mj_footer endRefreshing];
51 54  
52 55 if (error) {
53 56 if (self.data.count == 0) {
... ... @@ -61,11 +64,14 @@
61 64 return;
62 65 }
63 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 72 NSArray *arr = [CNLiveScoreModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"list"]];
67 73 [self.data addObjectsFromArray:arr];
68   - if (arr.count < 10) {
  74 + if (arr.count < 15) {
69 75 [self.tableView.mj_footer endRefreshingWithNoMoreData];
70 76  
71 77 } else {
... ... @@ -104,7 +110,7 @@
104 110 _pageNo = 1;
105 111 _isRefreshing = NO;
106 112  
107   - [self loadData];
  113 + [self.tableView.mj_header beginRefreshing];
108 114 [self createUI];
109 115  
110 116 }
... ... @@ -191,14 +197,14 @@
191 197 _tableView.showsHorizontalScrollIndicator = NO;
192 198 [_tableView registerClass:[CNLiveIntegralDetailsTableViewCell class] forCellReuseIdentifier:kCNLiveIntegralDetailsTableViewCell];
193 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 205 CNLiveRefreshFooter *footer = [CNLiveRefreshFooter footerWithRefreshingBlock:^{
199 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 208 _tableView.mj_footer = footer;
203 209 }
204 210 return _tableView;
... ...
Example/CNLiveIntegralModule/CNLIVEAppDelegate.m
... ... @@ -10,6 +10,7 @@
10 10  
11 11 #import <CommonCrypto/CommonDigest.h>
12 12  
  13 +#import "CNUserInfoManager.h"
13 14 #import "CNLiveEnvironment.h"
14 15 #import <CNLiveRequestBastKit/CNLiveNetworking.h>
15 16  
... ... @@ -27,12 +28,32 @@
27 28  
28 29 [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore];
29 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 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 58 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
38 59  
... ...