Commit d9596393a315cf2474fe3381ad10a4657234d4be

Authored by liushiyu
2 parents a9d39e4d 5204c626

Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/CNLiveCMineModule

CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteDetaiListlViewController.m
@@ -48,7 +48,11 @@ @@ -48,7 +48,11 @@
48 self.pageNo = pageNo; 48 self.pageNo = pageNo;
49 self.currentType = currentType; 49 self.currentType = currentType;
50 self.currentMonth = currentMonth; 50 self.currentMonth = currentMonth;
51 - [CNLiveCMineInteViewModel requestWithIntegraDetailWithCurrentMonth:currentMonth currentType:currentType pageNo:pageNo CompleterBlock:^(CNLiveCMineInteDetailModel * _Nonnull listModel, NSArray * _Nonnull dataArray, NSError * _Nonnull error) { 51 + [CNLiveCMineInteViewModel requestWithIntegraDetailWithCurrentMonth:currentMonth currentType:currentType pageNo:pageNo integralBlock:^(CNLiveCMineInteTaskListModel * _Nonnull listModel, NSError * _Nonnull error) {
  52 + weakSelf.currentInte = listModel.integral;
  53 + weakSelf.listModel.currentInte = listModel.integral;
  54 + weakSelf.detailVC.headerView.detailModel = weakSelf.listModel;
  55 + } CompleterBlock:^(CNLiveCMineInteDetailModel * _Nonnull listModel, NSArray * _Nonnull dataArray, NSError * _Nonnull error) {
52 [self addMainRefreshView]; 56 [self addMainRefreshView];
53 if (!error && listModel) { 57 if (!error && listModel) {
54 listModel.currentInte = weakSelf.currentInte; 58 listModel.currentInte = weakSelf.currentInte;
CNLiveCMineModule/Classes/inte/View/CNLiveCMineInteCollectionViewCell.m
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 if ([taskModel.isEmpty isEqualToString:@"1"]) { 61 if ([taskModel.isEmpty isEqualToString:@"1"]) {
62 self.imageView.image = [CNLiveCMineService imageWithMineName:@"c_mine_content_item_task"]; 62 self.imageView.image = [CNLiveCMineService imageWithMineName:@"c_mine_content_item_task"];
63 }else{ 63 }else{
64 - [self.imageView sd_setImageWithURL:[NSURL URLWithString:taskModel.poster] placeholderImage:nil]; 64 + [self.imageView sd_setImageWithURL:[NSURL URLWithString:taskModel.poster] placeholderImage:nil options:SDWebImageRefreshCached];
65 } 65 }
66 self.nameLabel.text = taskModel.title; 66 self.nameLabel.text = taskModel.title;
67 self.descLabel.text = taskModel.subTitle; 67 self.descLabel.text = taskModel.subTitle;
@@ -306,7 +306,7 @@ @@ -306,7 +306,7 @@
306 { 306 {
307 _taskModel = taskModel; 307 _taskModel = taskModel;
308 308
309 - [self.leftImage sd_setImageWithURL:[NSURL URLWithString:taskModel.icon] completed:nil]; 309 + [self.leftImage sd_setImageWithURL:[NSURL URLWithString:taskModel.icon] placeholderImage:nil options:SDWebImageRefreshCached];
310 self.titleLabel.text = taskModel.title; 310 self.titleLabel.text = taskModel.title;
311 self.pointLabel.text = [NSString stringWithFormat:@"积分值+%@",taskModel.score]; 311 self.pointLabel.text = [NSString stringWithFormat:@"积分值+%@",taskModel.score];
312 312
CNLiveCMineModule/Classes/inte/View/CNLiveCMineInteHeaderSignView.m
@@ -23,7 +23,6 @@ @@ -23,7 +23,6 @@
23 @property (nonatomic, strong) UIImageView * moreView; 23 @property (nonatomic, strong) UIImageView * moreView;
24 @property (nonatomic, strong) UIButton * clearButton; 24 @property (nonatomic, strong) UIButton * clearButton;
25 25
26 -@property (nonatomic, strong) UILabel * titleLabel;  
27 @property (nonatomic, strong) NSMutableArray * coinsViews; 26 @property (nonatomic, strong) NSMutableArray * coinsViews;
28 @property (nonatomic, strong) NSMutableArray * numberViews; 27 @property (nonatomic, strong) NSMutableArray * numberViews;
29 @end 28 @end
@@ -38,7 +37,6 @@ @@ -38,7 +37,6 @@
38 self.numberViews = [[NSMutableArray alloc] init]; 37 self.numberViews = [[NSMutableArray alloc] init];
39 [self addSubview:self.bottemView]; 38 [self addSubview:self.bottemView];
40 [self addSubview:self.topView]; 39 [self addSubview:self.topView];
41 - [self addSubview:self.titleLabel];  
42 [self.topView addSubview:self.nameLabel]; 40 [self.topView addSubview:self.nameLabel];
43 41
44 [self.bottemView addSubview:self.annouLabel]; 42 [self.bottemView addSubview:self.annouLabel];
@@ -105,10 +103,6 @@ @@ -105,10 +103,6 @@
105 make.left.right.mas_equalTo(weakSelf); 103 make.left.right.mas_equalTo(weakSelf);
106 make.bottom.mas_equalTo(weakSelf); 104 make.bottom.mas_equalTo(weakSelf);
107 }]; 105 }];
108 - [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {  
109 - make.top.mas_equalTo(weakSelf.bottemView.mas_bottom).offset(10);  
110 - make.left.mas_equalTo(weakSelf.mas_left);  
111 - }];  
112 [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { 106 [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
113 make.top.left.mas_equalTo(weakSelf).offset(15); 107 make.top.left.mas_equalTo(weakSelf).offset(15);
114 }]; 108 }];
@@ -163,7 +157,6 @@ @@ -163,7 +157,6 @@
163 }else{ 157 }else{
164 self.nameLabel.text = @"已连续签到 0天"; 158 self.nameLabel.text = @"已连续签到 0天";
165 } 159 }
166 - self.titleLabel.hidden = activModel == nil;  
167 self.bottemView.hidden = announModel.list.count == 0; 160 self.bottemView.hidden = announModel.list.count == 0;
168 self.iconView.hidden = announModel.list.count == 0; 161 self.iconView.hidden = announModel.list.count == 0;
169 self.moreView.hidden = announModel.list.count == 0; 162 self.moreView.hidden = announModel.list.count == 0;
@@ -179,27 +172,21 @@ @@ -179,27 +172,21 @@
179 [tempString_none appendFormat:@"%@ ",subModel.title]; 172 [tempString_none appendFormat:@"%@ ",subModel.title];
180 } 173 }
181 self.annouLabel.text = !CNLiveStringIsEmpty(tempString_roof) ? tempString_roof : tempString_none; 174 self.annouLabel.text = !CNLiveStringIsEmpty(tempString_roof) ? tempString_roof : tempString_none;
  175 + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_WIDTH - 20, 130) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)];
  176 + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  177 + maskLayer.path = maskPath.CGPath;
  178 + _topView.layer.mask = maskLayer;
  179 + _topMaskLayer = maskLayer;
182 } 180 }
183 181
184 - if (announModel == nil) self.titleLabel.top = CGRectGetMaxY(self.topView.frame) + 10; 182 +// if (announModel == nil) self.titleLabel.top = CGRectGetMaxY(self.topView.frame) + 10;
185 } 183 }
186 -(void)pushAnnouMedthod:(UIButton *)button 184 -(void)pushAnnouMedthod:(UIButton *)button
187 { 185 {
188 if (self.clickActionBlock) self.clickActionBlock(self.scoreModel, self.taskModel, self.announModel,CNLiveCMineInteHeaderClickAnnotation); 186 if (self.clickActionBlock) self.clickActionBlock(self.scoreModel, self.taskModel, self.announModel,CNLiveCMineInteHeaderClickAnnotation);
189 } 187 }
190 #pragma mark = 188 #pragma mark =
191 --(UILabel *)titleLabel  
192 -{  
193 - if (!_titleLabel) {  
194 - _titleLabel = [[UILabel alloc] init];  
195 - _titleLabel.textColor = [UIColor blackColor];  
196 - _titleLabel.font = UIFontCNMake(15);  
197 - _titleLabel.font = UIFontBoldCNMake(15);  
198 - _titleLabel.text = @"积分乐园";  
199 - _titleLabel.hidden = YES;  
200 - }  
201 - return _titleLabel;  
202 -} 189 +
203 -(UILabel *)nameLabel 190 -(UILabel *)nameLabel
204 { 191 {
205 if (!_nameLabel) { 192 if (!_nameLabel) {
@@ -268,7 +255,7 @@ @@ -268,7 +255,7 @@
268 [_topView.layer addSublayer:topGradientLayer]; 255 [_topView.layer addSublayer:topGradientLayer];
269 _topGradientLayer = topGradientLayer; 256 _topGradientLayer = topGradientLayer;
270 257
271 - UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_WIDTH - 20, 130) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)]; 258 + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_WIDTH - 20, 130) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(12, 12)];
272 CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; 259 CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
273 maskLayer.path = maskPath.CGPath; 260 maskLayer.path = maskPath.CGPath;
274 _topView.layer.mask = maskLayer; 261 _topView.layer.mask = maskLayer;
CNLiveCMineModule/Classes/inte/View/CNLiveCMineInteHeaderView.m
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 @property (nonatomic, strong) UILabel * inteLabel; 13 @property (nonatomic, strong) UILabel * inteLabel;
14 @property (nonatomic, strong) UIButton * pushMallBtn; 14 @property (nonatomic, strong) UIButton * pushMallBtn;
15 @property (nonatomic, strong) CNLiveCMineInteHeaderSignView * signView; 15 @property (nonatomic, strong) CNLiveCMineInteHeaderSignView * signView;
  16 +@property (nonatomic, strong) UILabel * titleLabel;
16 17
17 @property (nonatomic, strong) CNLiveCMineInteScoreModel * scoreModel; //签到数据 18 @property (nonatomic, strong) CNLiveCMineInteScoreModel * scoreModel; //签到数据
18 @property (nonatomic, strong) CNLiveCMineInteTaskListModel * taskModel;//任务列表及积分数据 19 @property (nonatomic, strong) CNLiveCMineInteTaskListModel * taskModel;//任务列表及积分数据
@@ -30,6 +31,7 @@ @@ -30,6 +31,7 @@
30 [self addSubview:self.inteLabel]; 31 [self addSubview:self.inteLabel];
31 [self addSubview:self.pushMallBtn]; 32 [self addSubview:self.pushMallBtn];
32 [self addSubview:self.signView]; 33 [self addSubview:self.signView];
  34 + [self addSubview:self.titleLabel];
33 } 35 }
34 return self; 36 return self;
35 } 37 }
@@ -57,6 +59,10 @@ @@ -57,6 +59,10 @@
57 make.top.mas_equalTo(weakSelf.inteLabel.mas_bottom).offset(15); 59 make.top.mas_equalTo(weakSelf.inteLabel.mas_bottom).offset(15);
58 make.height.mas_equalTo(180); 60 make.height.mas_equalTo(180);
59 }]; 61 }];
  62 + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  63 + make.bottom.mas_equalTo(weakSelf.mas_bottom).offset(-10);
  64 + make.left.mas_equalTo(weakSelf.signView.mas_left);
  65 + }];
60 } 66 }
61 -(void)pushMallAction:(UIButton *)btn 67 -(void)pushMallAction:(UIButton *)btn
62 { 68 {
@@ -85,6 +91,7 @@ @@ -85,6 +91,7 @@
85 [coin_string addAttribute:NSFontAttributeName value:UIFontCNMake(12) range:[coin_string.string rangeOfString:@"积分"]]; 91 [coin_string addAttribute:NSFontAttributeName value:UIFontCNMake(12) range:[coin_string.string rangeOfString:@"积分"]];
86 [coin_string addAttribute:NSFontAttributeName value:UIFontBoldCNMake(30) range:NSMakeRange(0, [coin_string.string rangeOfString:@"积分"].location)]; 92 [coin_string addAttribute:NSFontAttributeName value:UIFontBoldCNMake(30) range:NSMakeRange(0, [coin_string.string rangeOfString:@"积分"].location)];
87 self.inteLabel.attributedText = coin_string; 93 self.inteLabel.attributedText = coin_string;
  94 + self.titleLabel.hidden = activModel == nil;
88 } 95 }
89 #pragma mark = 96 #pragma mark =
90 -(CNLiveCMineInteHeaderSignView *)signView 97 -(CNLiveCMineInteHeaderSignView *)signView
@@ -134,4 +141,16 @@ @@ -134,4 +141,16 @@
134 } 141 }
135 return _inteLabel; 142 return _inteLabel;
136 } 143 }
  144 +-(UILabel *)titleLabel
  145 +{
  146 + if (!_titleLabel) {
  147 + _titleLabel = [[UILabel alloc] init];
  148 + _titleLabel.textColor = [UIColor blackColor];
  149 + _titleLabel.font = UIFontCNMake(15);
  150 + _titleLabel.font = UIFontBoldCNMake(15);
  151 + _titleLabel.text = @"积分乐园";
  152 + _titleLabel.hidden = YES;
  153 + }
  154 + return _titleLabel;
  155 +}
137 @end 156 @end
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.h
@@ -46,8 +46,9 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel, @@ -46,8 +46,9 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel,
46 /// @param currentMonth 时间格式 2021-12 46 /// @param currentMonth 时间格式 2021-12
47 /// @param currentType 1-全部 2-获取 3-支出 47 /// @param currentType 1-全部 2-获取 3-支出
48 /// @param pageNo 页码(默认1) 48 /// @param pageNo 页码(默认1)
  49 +/// @param integralBlock返回总积分请求结果
49 /// @param completerBlock 结果返回 50 /// @param completerBlock 结果返回
50 -+(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo CompleterBlock:(void(^)(CNLiveCMineInteDetailModel * listModel,NSArray * dataArray,NSError *error))completerBlock; 51 ++(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo integralBlock:(void(^)(CNLiveCMineInteTaskListModel *listModel,NSError *error)) integralBlock CompleterBlock:(void(^)(CNLiveCMineInteDetailModel * listModel,NSArray * dataArray,NSError *error))completerBlock;
51 52
52 @end 53 @end
53 54
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.m
@@ -11,6 +11,32 @@ @@ -11,6 +11,32 @@
11 11
12 +(void)requestWithIntegraTaskWithSignMedthodForCompleterBlock:(void (^)(NSMutableArray * , NSString *))completerBlock 12 +(void)requestWithIntegraTaskWithSignMedthodForCompleterBlock:(void (^)(NSMutableArray * , NSString *))completerBlock
13 { 13 {
  14 + if (![CNLiveNetworking isNetworking]) {
  15 + NSMutableArray * tempArray01 = [[NSMutableArray alloc] initWithArray:@[@"",@"",@"",@""]];
  16 + CNLiveCMineInteTaskListModel * listModel = (CNLiveCMineInteTaskListModel *)[CNLiveRespCacheManager objectCacheWithFileName:NSStringFromClass(CNLiveCMineInteTaskListModel.class)];
  17 + if (listModel) {
  18 + [tempArray01 replaceObjectAtIndex:1 withObject:listModel];
  19 + }
  20 + CNLiveCMineInteListModel * spListModel = (CNLiveCMineInteListModel *)[CNLiveRespCacheManager objectCacheWithFileName:NSStringFromClass(CNLiveCMineInteListModel.class)];
  21 + if (!spListModel) {
  22 + spListModel = [[CNLiveCMineInteListModel alloc] init];
  23 + NSMutableArray * tempArray = [[NSMutableArray alloc] init];
  24 + CNLiveCMineInteListSubModel * subModel = [[CNLiveCMineInteListSubModel alloc] init];
  25 + subModel.contentId = @"21";
  26 + subModel.poster = @"c_mine_content_item_task";
  27 + subModel.title = @"做任务";
  28 + subModel.subTitle = @"赚取更多积分";
  29 + subModel.isEmpty = @"1";
  30 + [tempArray addObject:subModel];
  31 + spListModel.list = tempArray;
  32 + }
  33 + if (spListModel) {
  34 + [tempArray01 replaceObjectAtIndex:3 withObject:spListModel];
  35 + }
  36 + completerBlock(tempArray01,@"请求失败");
  37 + [QMUITips showWithText:@"无法连接网络" inView:AppKeyWindow hideAfterDelay:1.5];
  38 + return;
  39 + }
14 [[CNLiveCMineService shareMineProtocol] pushCMineInteContentForCMainUMengStatisticaMedthod]; 40 [[CNLiveCMineService shareMineProtocol] pushCMineInteContentForCMainUMengStatisticaMedthod];
15 NSDictionary * param = @{ 41 NSDictionary * param = @{
16 @"sid":[CNUserInfoManager manager].userInfoModel.uid 42 @"sid":[CNUserInfoManager manager].userInfoModel.uid
@@ -87,6 +113,7 @@ @@ -87,6 +113,7 @@
87 [tempArray01 replaceObjectAtIndex:1 withObject:listModel]; 113 [tempArray01 replaceObjectAtIndex:1 withObject:listModel];
88 [CNLiveRespCacheManager cachePathWithObject:listModel FileName:NSStringFromClass(CNLiveCMineInteTaskListModel.class)]; 114 [CNLiveRespCacheManager cachePathWithObject:listModel FileName:NSStringFromClass(CNLiveCMineInteTaskListModel.class)];
89 }else{ 115 }else{
  116 + [QMUITips showWithText:@"接口请求错误" inView:AppKeyWindow hideAfterDelay:1.5];
90 CNLiveCMineInteTaskListModel * listModel = (CNLiveCMineInteTaskListModel *)[CNLiveRespCacheManager objectCacheWithFileName:NSStringFromClass(CNLiveCMineInteTaskListModel.class)]; 117 CNLiveCMineInteTaskListModel * listModel = (CNLiveCMineInteTaskListModel *)[CNLiveRespCacheManager objectCacheWithFileName:NSStringFromClass(CNLiveCMineInteTaskListModel.class)];
91 if (listModel) { 118 if (listModel) {
92 [tempArray01 replaceObjectAtIndex:1 withObject:listModel]; 119 [tempArray01 replaceObjectAtIndex:1 withObject:listModel];
@@ -139,6 +166,7 @@ @@ -139,6 +166,7 @@
139 } @catch (NSException *exception) { 166 } @catch (NSException *exception) {
140 NSLog(@"异常了"); 167 NSLog(@"异常了");
141 if (completerBlock) completerBlock(nil,@"获取失败"); 168 if (completerBlock) completerBlock(nil,@"获取失败");
  169 +
142 } 170 }
143 }]; 171 }];
144 } 172 }
@@ -148,8 +176,11 @@ @@ -148,8 +176,11 @@
148 /// @param currentType 1-全部 2-获取 3-支出 176 /// @param currentType 1-全部 2-获取 3-支出
149 /// @param pageNo 页码(默认1) 177 /// @param pageNo 页码(默认1)
150 /// @param completerBlock 结果返回 178 /// @param completerBlock 结果返回
151 -+(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo CompleterBlock:(void(^)(CNLiveCMineInteDetailModel *, NSArray *,NSError *))completerBlock 179 ++(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo integralBlock:(nonnull void (^)(CNLiveCMineInteTaskListModel * _Nonnull, NSError * _Nonnull))integralBlock CompleterBlock:(void(^)(CNLiveCMineInteDetailModel *, NSArray *,NSError *))completerBlock
152 { 180 {
  181 + NSDictionary * param = @{
  182 + @"sid":[CNUserInfoManager manager].userInfoModel.uid
  183 + };
153 NSDictionary * paramDict = @{ 184 NSDictionary * paramDict = @{
154 @"sid":[CNUserInfoManager manager].userInfoModel.uid, 185 @"sid":[CNUserInfoManager manager].userInfoModel.uid,
155 @"currentMonth":currentMonth, 186 @"currentMonth":currentMonth,
@@ -165,6 +196,17 @@ @@ -165,6 +196,17 @@
165 NSMutableArray * tempArray = listModel.integralList.mutableCopy; 196 NSMutableArray * tempArray = listModel.integralList.mutableCopy;
166 if (completerBlock) completerBlock(listModel,tempArray,error); 197 if (completerBlock) completerBlock(listModel,tempArray,error);
167 }]; 198 }];
  199 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  200 + [CNLiveNetworking setupShowDataResult:YES];
  201 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Host(@"/Daren/integral/getTasks.action") Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  202 + if (!error) {
  203 + CNLiveCMineInteTaskListModel * listModel = [CNLiveCMineInteTaskListModel mj_objectWithKeyValues:responseObject];
  204 + if (integralBlock) {
  205 + integralBlock(listModel,error);
  206 + }
  207 + }
  208 +
  209 + }];
168 } 210 }
169 211
170 @end 212 @end