Commit 46987641fbc9902b0ae2d30212acc643cda06e2a
1 parent
da606275
0.1.6
Showing
6 changed files
with
43 additions
and
2 deletions
CNLiveCommuntyModule.podspec
CNLiveCommuntyModule/Classes/Model/CNLiveCommuntyHomeModel.h
| ... | ... | @@ -117,6 +117,8 @@ NS_ASSUME_NONNULL_BEGIN |
| 117 | 117 | @property (nonatomic, copy) NSString *totalFee; |
| 118 | 118 | @property (nonatomic, copy) NSString *intentBeginTime; |
| 119 | 119 | @property (nonatomic, copy) NSString *remark; |
| 120 | +@property (nonatomic, copy) NSString *img; | |
| 121 | +@property (nonatomic, strong) NSMutableArray *imgs; | |
| 120 | 122 | @property (nonatomic, strong) NSNumber *createTime; |
| 121 | 123 | @property (nonatomic, copy) NSString *createTimeString; |
| 122 | 124 | @property (nonatomic, copy) NSString *repairName; | ... | ... |
CNLiveCommuntyModule/Classes/Model/CNLiveCommuntyHomeModel.m
| ... | ... | @@ -162,6 +162,11 @@ MJCodingImplementation |
| 162 | 162 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; |
| 163 | 163 | self.createTimeString = [dateFormatter stringFromDate:detaildate]; |
| 164 | 164 | } |
| 165 | + if ([property.name isEqualToString:@"img"] && ![oldValue isKindOfClass:NSNull.class] && [oldValue isNotBlank]) { | |
| 166 | + NSString * img_str = (NSString *)oldValue; | |
| 167 | + self.imgs = [img_str componentsSeparatedByString:@","].mutableCopy; | |
| 168 | + [self.imgs removeObject:@""]; | |
| 169 | + } | |
| 165 | 170 | return oldValue; |
| 166 | 171 | } |
| 167 | 172 | ... | ... |
CNLiveCommuntyModule/Classes/View/CNLiveCommuntSubView.h
| ... | ... | @@ -56,6 +56,7 @@ NS_ASSUME_NONNULL_BEGIN |
| 56 | 56 | @property (nonatomic, strong) QMUIButton * statueButton; |
| 57 | 57 | @property (nonatomic, strong) UILabel * lineLabel; |
| 58 | 58 | @property (nonatomic, strong) UILabel * priceLabel; |
| 59 | +@property (nonatomic, strong) NSMutableArray * tempArray; | |
| 59 | 60 | |
| 60 | 61 | @property (nonatomic, strong) CNLiveCommuntyActivityRepairListModel * repairModel; |
| 61 | 62 | ... | ... |
CNLiveCommuntyModule/Classes/View/CNLiveCommuntSubView.m
| ... | ... | @@ -450,6 +450,25 @@ |
| 450 | 450 | [self.mainView addSubview:self.statueButton]; |
| 451 | 451 | [self.mainView addSubview:self.lineLabel]; |
| 452 | 452 | [self.mainView addSubview:self.priceLabel]; |
| 453 | + | |
| 454 | + self.tempArray = [[NSMutableArray alloc] init]; | |
| 455 | + for (int i = 0; i < 3; i++) { | |
| 456 | + UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectZero]; | |
| 457 | + imageView.backgroundColor = UIColorHex(#f9f9f9); | |
| 458 | + imageView.tag = 1000 + i; | |
| 459 | + imageView.hidden = YES; | |
| 460 | + imageView.layer.cornerRadius = 7; | |
| 461 | + imageView.layer.masksToBounds = YES; | |
| 462 | + imageView.contentMode = UIViewContentModeScaleAspectFill; | |
| 463 | + [imageView setUserInteractionEnabled:YES]; | |
| 464 | + __weak typeof(self) weakSelf = self; | |
| 465 | + [imageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithActionBlock:^(UITapGestureRecognizer * _Nonnull sender) { | |
| 466 | + UIImageView * imageView = (UIImageView *)sender.view; | |
| 467 | + [CNLivePhotoBrowser photoBrowserForDefultWithSourceViews:weakSelf.tempArray MediaURLArray:weakSelf.repairModel.imgs CurrentIndex:imageView.tag - 1000 ShowType:CNLivePhotoBrowserShowTypeImage Sheet:nil CompleterBlock:NULL]; | |
| 468 | + }]]; | |
| 469 | + [self.mainView addSubview:imageView]; | |
| 470 | + [self.tempArray addObject:imageView]; | |
| 471 | + } | |
| 453 | 472 | } |
| 454 | 473 | return self; |
| 455 | 474 | } |
| ... | ... | @@ -488,6 +507,12 @@ |
| 488 | 507 | make.left.mas_equalTo(weakSelf.mainView.mas_left).offset(10); |
| 489 | 508 | make.right.mas_equalTo(weakSelf.mainView.mas_right).offset(-10); |
| 490 | 509 | }]; |
| 510 | + | |
| 511 | + [self.tempArray mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:10 leadSpacing:10 tailSpacing:10]; | |
| 512 | + [self.tempArray mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 513 | + make.bottom.mas_equalTo(weakSelf.mainView.mas_bottom).offset(-10); | |
| 514 | + make.height.mas_equalTo((kScreenWidth - 60)/3); | |
| 515 | + }]; | |
| 491 | 516 | } |
| 492 | 517 | -(void)setRepairModel:(CNLiveCommuntyActivityRepairListModel *)repairModel |
| 493 | 518 | { |
| ... | ... | @@ -499,6 +524,13 @@ |
| 499 | 524 | self.dateLabel.text = [NSString stringWithFormat:@"下单时间:%@",repairModel.createTimeString]; |
| 500 | 525 | [_statueButton setTitle:repairModel.statusString forState:UIControlStateNormal]; |
| 501 | 526 | [_statueButton setTitleColor:![repairModel.status isEqualToString:@"3"]?UIColorHex(#FD862E):UIColorHex(#797979) forState:UIControlStateNormal]; |
| 527 | + | |
| 528 | + for (int i = 0; i < self.repairModel.imgs.count; i++) { | |
| 529 | + NSString * imageUrl = self.repairModel.imgs[i]; | |
| 530 | + UIImageView * imageView = self.tempArray[i]; | |
| 531 | + imageView.hidden = NO; | |
| 532 | + [imageView sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageWithColor:UIColorHex(#f9f9f9)]]; | |
| 533 | + } | |
| 502 | 534 | } |
| 503 | 535 | |
| 504 | 536 | #pragma mark - | ... | ... |
CNLiveCommuntyModule/Classes/ViewController/CNLiveCommuntListViewController.m
| ... | ... | @@ -211,7 +211,8 @@ |
| 211 | 211 | } |
| 212 | 212 | if (self.showType == CNLiveCommuntListShowTypeRepair) { |
| 213 | 213 | CNLiveCommuntyActivityRepairListModel * repairModel = self.dataArray[indexPath.row]; |
| 214 | - return [repairModel.status isEqualToString:@"3"] && [repairModel.totalFee integerValue] > 0?110.0:70.0; | |
| 214 | + CGFloat itemW = repairModel.imgs.count > 0 ? (kScreenWidth - 60)/3 + 20 : 0; | |
| 215 | + return ([repairModel.status isEqualToString:@"3"] && [repairModel.totalFee integerValue] > 0?110.0:70.0) + itemW; | |
| 215 | 216 | } |
| 216 | 217 | return 0.001; |
| 217 | 218 | } | ... | ... |