Commit fedc545b0dd986c87fc4e33ccc8c931ceb30a04d
1 parent
ab24e86d
no message
Showing
2 changed files
with
18 additions
and
17 deletions
CNLiveIntegralModule/Classes/Controller/CNLiveIntegralDetailsController.h
| @@ -6,7 +6,9 @@ | @@ -6,7 +6,9 @@ | ||
| 6 | // Copyright © 2019年 cnlive. All rights reserved. | 6 | // Copyright © 2019年 cnlive. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | -// 积分明细 | 9 | +/** |
| 10 | + * 积分明细 | ||
| 11 | + */ | ||
| 10 | 12 | ||
| 11 | #import <UIKit/UIKit.h> | 13 | #import <UIKit/UIKit.h> |
| 12 | #import "CNCommonViewController.h" | 14 | #import "CNCommonViewController.h" |
CNLiveIntegralModule/Classes/Controller/CNLiveTaskListController.m
| @@ -122,29 +122,32 @@ | @@ -122,29 +122,32 @@ | ||
| 122 | [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | 122 | [CNLiveNetworking setAllowRequestDefaultArgument:YES]; |
| 123 | [CNLiveNetworking setupShowDataResult:NO]; | 123 | [CNLiveNetworking setupShowDataResult:NO]; |
| 124 | [QMUITips showLoadingInView:self.view]; | 124 | [QMUITips showLoadingInView:self.view]; |
| 125 | + __weak typeof(self) weakSelf = self; | ||
| 125 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNIntegralGetTasksUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | 126 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNIntegralGetTasksUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { |
| 126 | - [QMUITips hideAllTipsInView:self.view]; | 127 | + __strong typeof(weakSelf) strongSelf = weakSelf; |
| 128 | + if(!strongSelf) return ; | ||
| 129 | + [QMUITips hideAllTipsInView:strongSelf.view]; | ||
| 127 | 130 | ||
| 128 | if (error) { | 131 | if (error) { |
| 129 | if (error.code == -1001||error.code == -1003||error.code == -1009) { | 132 | if (error.code == -1001||error.code == -1003||error.code == -1009) { |
| 130 | - [self.tableView showEmptyViewWithType:CNLiveCustomTipsTypeNoNet noData:self.data.count == 0 block:^{ | 133 | + [strongSelf.tableView showEmptyViewWithType:CNLiveCustomTipsTypeNoNet noData:strongSelf.data.count == 0 block:^{ |
| 131 | [self loadData]; | 134 | [self loadData]; |
| 132 | }]; | 135 | }]; |
| 133 | }else{ | 136 | }else{ |
| 134 | - [self.tableView showEmptyViewWithType:CNLiveCustomTipsTypeLoadFail noData:self.data.count == 0 block:^{ | ||
| 135 | - [self loadData]; | 137 | + [strongSelf.tableView showEmptyViewWithType:CNLiveCustomTipsTypeLoadFail noData:strongSelf.data.count == 0 block:^{ |
| 138 | + [strongSelf loadData]; | ||
| 136 | }]; | 139 | }]; |
| 137 | } | 140 | } |
| 138 | - self.tableView.emptyView.backgroundColor = [UIColor whiteColor]; | 141 | + strongSelf.tableView.emptyView.backgroundColor = [UIColor whiteColor]; |
| 139 | return; | 142 | return; |
| 140 | } | 143 | } |
| 141 | if(responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]){ | 144 | if(responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]){ |
| 142 | CNLiveTaskListModel *model = [CNLiveTaskListModel mj_objectWithKeyValues:responseObject[@"data"]]; | 145 | CNLiveTaskListModel *model = [CNLiveTaskListModel mj_objectWithKeyValues:responseObject[@"data"]]; |
| 143 | - [self.data addObject:model]; | ||
| 144 | - self.headView.score = model.integral; | ||
| 145 | - [self.tableView reloadData]; | ||
| 146 | - [self.tableView showEmptyViewWithType:CNLiveCustomTipsTypeNoData noData:self.data.count == 0 block:nil]; | ||
| 147 | - self.tableView.emptyView.backgroundColor = [UIColor whiteColor]; | 146 | + [strongSelf.data addObject:model]; |
| 147 | + strongSelf.headView.score = model.integral; | ||
| 148 | + [strongSelf.tableView reloadData]; | ||
| 149 | + [strongSelf.tableView showEmptyViewWithType:CNLiveCustomTipsTypeNoData noData:strongSelf.data.count == 0 block:nil]; | ||
| 150 | + strongSelf.tableView.emptyView.backgroundColor = [UIColor whiteColor]; | ||
| 148 | 151 | ||
| 149 | if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | 152 | if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { |
| 150 | if([responseObject isKindOfClass:[NSDictionary class]]){ | 153 | if([responseObject isKindOfClass:[NSDictionary class]]){ |
| @@ -286,11 +289,11 @@ | @@ -286,11 +289,11 @@ | ||
| 286 | } | 289 | } |
| 287 | 290 | ||
| 288 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ | 291 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ |
| 289 | - return 0.1; // 注意要设置为0.1,不能设置为0 | 292 | + return 0.1; |
| 290 | } | 293 | } |
| 291 | 294 | ||
| 292 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ | 295 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ |
| 293 | - return 45.0; // 注意要设置为0.1,不能设置为0 | 296 | + return 45.0; |
| 294 | } | 297 | } |
| 295 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | 298 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { |
| 296 | return 70; | 299 | return 70; |
| @@ -383,10 +386,6 @@ | @@ -383,10 +386,6 @@ | ||
| 383 | return _headView; | 386 | return _headView; |
| 384 | } | 387 | } |
| 385 | 388 | ||
| 386 | -- (UIImage *)navigationBarBackgroundImage{ | ||
| 387 | - return [UIImage imageWithColor:[UIColor clearColor]]; | ||
| 388 | -} | ||
| 389 | - | ||
| 390 | - (UIStatusBarStyle)preferredStatusBarStyle{ | 389 | - (UIStatusBarStyle)preferredStatusBarStyle{ |
| 391 | return UIStatusBarStyleLightContent; | 390 | return UIStatusBarStyleLightContent; |
| 392 | } | 391 | } |