Commit a7828844c1f28d4528e0868e3811bd8c4aeac0dc

Authored by yanglingyu
1 parent 05e4ed9b

增加无公告展示,页面展示紊乱问题修复

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.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 }