Commit d9596393a315cf2474fe3381ad10a4657234d4be
Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/CNLiveCMineModule
Showing
6 changed files
with
79 additions
and
26 deletions
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteDetaiListlViewController.m
| ... | ... | @@ -48,7 +48,11 @@ |
| 48 | 48 | self.pageNo = pageNo; |
| 49 | 49 | self.currentType = currentType; |
| 50 | 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 | 56 | [self addMainRefreshView]; |
| 53 | 57 | if (!error && listModel) { |
| 54 | 58 | listModel.currentInte = weakSelf.currentInte; | ... | ... |
CNLiveCMineModule/Classes/inte/View/CNLiveCMineInteCollectionViewCell.m
| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | if ([taskModel.isEmpty isEqualToString:@"1"]) { |
| 62 | 62 | self.imageView.image = [CNLiveCMineService imageWithMineName:@"c_mine_content_item_task"]; |
| 63 | 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 | 66 | self.nameLabel.text = taskModel.title; |
| 67 | 67 | self.descLabel.text = taskModel.subTitle; |
| ... | ... | @@ -306,7 +306,7 @@ |
| 306 | 306 | { |
| 307 | 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 | 310 | self.titleLabel.text = taskModel.title; |
| 311 | 311 | self.pointLabel.text = [NSString stringWithFormat:@"积分值+%@",taskModel.score]; |
| 312 | 312 | ... | ... |
CNLiveCMineModule/Classes/inte/View/CNLiveCMineInteHeaderSignView.m
| ... | ... | @@ -23,7 +23,6 @@ |
| 23 | 23 | @property (nonatomic, strong) UIImageView * moreView; |
| 24 | 24 | @property (nonatomic, strong) UIButton * clearButton; |
| 25 | 25 | |
| 26 | -@property (nonatomic, strong) UILabel * titleLabel; | |
| 27 | 26 | @property (nonatomic, strong) NSMutableArray * coinsViews; |
| 28 | 27 | @property (nonatomic, strong) NSMutableArray * numberViews; |
| 29 | 28 | @end |
| ... | ... | @@ -38,7 +37,6 @@ |
| 38 | 37 | self.numberViews = [[NSMutableArray alloc] init]; |
| 39 | 38 | [self addSubview:self.bottemView]; |
| 40 | 39 | [self addSubview:self.topView]; |
| 41 | - [self addSubview:self.titleLabel]; | |
| 42 | 40 | [self.topView addSubview:self.nameLabel]; |
| 43 | 41 | |
| 44 | 42 | [self.bottemView addSubview:self.annouLabel]; |
| ... | ... | @@ -105,10 +103,6 @@ |
| 105 | 103 | make.left.right.mas_equalTo(weakSelf); |
| 106 | 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 | 106 | [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
| 113 | 107 | make.top.left.mas_equalTo(weakSelf).offset(15); |
| 114 | 108 | }]; |
| ... | ... | @@ -163,7 +157,6 @@ |
| 163 | 157 | }else{ |
| 164 | 158 | self.nameLabel.text = @"已连续签到 0天"; |
| 165 | 159 | } |
| 166 | - self.titleLabel.hidden = activModel == nil; | |
| 167 | 160 | self.bottemView.hidden = announModel.list.count == 0; |
| 168 | 161 | self.iconView.hidden = announModel.list.count == 0; |
| 169 | 162 | self.moreView.hidden = announModel.list.count == 0; |
| ... | ... | @@ -179,27 +172,21 @@ |
| 179 | 172 | [tempString_none appendFormat:@"%@ ",subModel.title]; |
| 180 | 173 | } |
| 181 | 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 | 184 | -(void)pushAnnouMedthod:(UIButton *)button |
| 187 | 185 | { |
| 188 | 186 | if (self.clickActionBlock) self.clickActionBlock(self.scoreModel, self.taskModel, self.announModel,CNLiveCMineInteHeaderClickAnnotation); |
| 189 | 187 | } |
| 190 | 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 | 190 | -(UILabel *)nameLabel |
| 204 | 191 | { |
| 205 | 192 | if (!_nameLabel) { |
| ... | ... | @@ -268,7 +255,7 @@ |
| 268 | 255 | [_topView.layer addSublayer:topGradientLayer]; |
| 269 | 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 | 259 | CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; |
| 273 | 260 | maskLayer.path = maskPath.CGPath; |
| 274 | 261 | _topView.layer.mask = maskLayer; | ... | ... |
CNLiveCMineModule/Classes/inte/View/CNLiveCMineInteHeaderView.m
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | @property (nonatomic, strong) UILabel * inteLabel; |
| 14 | 14 | @property (nonatomic, strong) UIButton * pushMallBtn; |
| 15 | 15 | @property (nonatomic, strong) CNLiveCMineInteHeaderSignView * signView; |
| 16 | +@property (nonatomic, strong) UILabel * titleLabel; | |
| 16 | 17 | |
| 17 | 18 | @property (nonatomic, strong) CNLiveCMineInteScoreModel * scoreModel; //签到数据 |
| 18 | 19 | @property (nonatomic, strong) CNLiveCMineInteTaskListModel * taskModel;//任务列表及积分数据 |
| ... | ... | @@ -30,6 +31,7 @@ |
| 30 | 31 | [self addSubview:self.inteLabel]; |
| 31 | 32 | [self addSubview:self.pushMallBtn]; |
| 32 | 33 | [self addSubview:self.signView]; |
| 34 | + [self addSubview:self.titleLabel]; | |
| 33 | 35 | } |
| 34 | 36 | return self; |
| 35 | 37 | } |
| ... | ... | @@ -57,6 +59,10 @@ |
| 57 | 59 | make.top.mas_equalTo(weakSelf.inteLabel.mas_bottom).offset(15); |
| 58 | 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 | 67 | -(void)pushMallAction:(UIButton *)btn |
| 62 | 68 | { |
| ... | ... | @@ -85,6 +91,7 @@ |
| 85 | 91 | [coin_string addAttribute:NSFontAttributeName value:UIFontCNMake(12) range:[coin_string.string rangeOfString:@"积分"]]; |
| 86 | 92 | [coin_string addAttribute:NSFontAttributeName value:UIFontBoldCNMake(30) range:NSMakeRange(0, [coin_string.string rangeOfString:@"积分"].location)]; |
| 87 | 93 | self.inteLabel.attributedText = coin_string; |
| 94 | + self.titleLabel.hidden = activModel == nil; | |
| 88 | 95 | } |
| 89 | 96 | #pragma mark = |
| 90 | 97 | -(CNLiveCMineInteHeaderSignView *)signView |
| ... | ... | @@ -134,4 +141,16 @@ |
| 134 | 141 | } |
| 135 | 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 | 156 | @end | ... | ... |
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.h
| ... | ... | @@ -46,8 +46,9 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel, |
| 46 | 46 | /// @param currentMonth 时间格式 2021-12 |
| 47 | 47 | /// @param currentType 1-全部 2-获取 3-支出 |
| 48 | 48 | /// @param pageNo 页码(默认1) |
| 49 | +/// @param integralBlock返回总积分请求结果 | |
| 49 | 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 | 53 | @end |
| 53 | 54 | ... | ... |
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.m
| ... | ... | @@ -11,6 +11,32 @@ |
| 11 | 11 | |
| 12 | 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 | 40 | [[CNLiveCMineService shareMineProtocol] pushCMineInteContentForCMainUMengStatisticaMedthod]; |
| 15 | 41 | NSDictionary * param = @{ |
| 16 | 42 | @"sid":[CNUserInfoManager manager].userInfoModel.uid |
| ... | ... | @@ -87,6 +113,7 @@ |
| 87 | 113 | [tempArray01 replaceObjectAtIndex:1 withObject:listModel]; |
| 88 | 114 | [CNLiveRespCacheManager cachePathWithObject:listModel FileName:NSStringFromClass(CNLiveCMineInteTaskListModel.class)]; |
| 89 | 115 | }else{ |
| 116 | + [QMUITips showWithText:@"接口请求错误" inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 90 | 117 | CNLiveCMineInteTaskListModel * listModel = (CNLiveCMineInteTaskListModel *)[CNLiveRespCacheManager objectCacheWithFileName:NSStringFromClass(CNLiveCMineInteTaskListModel.class)]; |
| 91 | 118 | if (listModel) { |
| 92 | 119 | [tempArray01 replaceObjectAtIndex:1 withObject:listModel]; |
| ... | ... | @@ -139,6 +166,7 @@ |
| 139 | 166 | } @catch (NSException *exception) { |
| 140 | 167 | NSLog(@"异常了"); |
| 141 | 168 | if (completerBlock) completerBlock(nil,@"获取失败"); |
| 169 | + | |
| 142 | 170 | } |
| 143 | 171 | }]; |
| 144 | 172 | } |
| ... | ... | @@ -148,8 +176,11 @@ |
| 148 | 176 | /// @param currentType 1-全部 2-获取 3-支出 |
| 149 | 177 | /// @param pageNo 页码(默认1) |
| 150 | 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 | 184 | NSDictionary * paramDict = @{ |
| 154 | 185 | @"sid":[CNUserInfoManager manager].userInfoModel.uid, |
| 155 | 186 | @"currentMonth":currentMonth, |
| ... | ... | @@ -165,6 +196,17 @@ |
| 165 | 196 | NSMutableArray * tempArray = listModel.integralList.mutableCopy; |
| 166 | 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 | 212 | @end | ... | ... |