123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- //
- // YOUPAIZYUserZiLiaoDTCell.m
- // VQU
- //
- // Created by 肖浩然的mac on 2021/7/10.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAIZYUserZiLiaoPJCell.h"
- #import "YOUPAILZLabelCollectionCell.h"
- @interface YOUPAIZYUserZiLiaoPJCell()<UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource>
- @property (nonatomic, strong) UICollectionView *youpaipcollectionView;
- /* countLabel */
- @property (strong, nonatomic) UILabel *youpaipcountLabel;
- @property (strong, nonatomic) UILabel *youpaipcountLabel1;
- /* arrowBtn */
- @property (strong, nonatomic) UIButton *youpaiparrowBtn;
- /* titleView */
- @property (strong, nonatomic) UIView *youpaiptitleView;
- /* goodPJLabel */
- @property (strong, nonatomic) UILabel *youpaipgoodPJLabel;
- @end
- @implementation YOUPAIZYUserZiLiaoPJCell
- -(instancetype)initWithFrame:(CGRect)frame{
-
- if (self = [super initWithFrame:frame]) {
- [self youpaifsetSubView];
- }
- return self;
- }
- -(void)youpaifsetSubView{
-
- UIView *titleView = [UIView new];
- self.youpaiptitleView = titleView;
- [self.contentView addSubview:titleView];
- [titleView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(20);
- }];
- titleView.backgroundColor = LCWhiteColor;
-
- self.youpaiptitleLabel = [[UILabel alloc] init];
- self.youpaiptitleLabel.font = LCBoldFont(14);
- [titleView addSubview:self.youpaiptitleLabel];
- [self.youpaiptitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(0);
- make.left.mas_equalTo(14);
-
- }];
- self.youpaiptitleLabel.textColor = LZ273145Color;
- // //视频接通率
- // UILabel *countLabel = [UILabel new];
- // self.youpaipcountLabel = countLabel;
- // [self.contentView addSubview:countLabel];
- // [countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.mas_equalTo(titleView.mas_bottom).offset(5);
- // make.left.mas_equalTo(14);
- // make.height.mas_equalTo(12);
- // }];
- //
- //
- //// countLabel.text = @"视频接通率:98%(接通365次)";
- //
- // countLabel.font = [UIFont systemFontOfSize:12];
- // //接通次数
- // UILabel *countLabel1 = [UILabel new];
- // self.youpaipcountLabel1 = countLabel1;
- // [self.contentView addSubview:countLabel1];
- // [countLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.mas_equalTo(titleView.mas_bottom).offset(5);
- // make.left.mas_equalTo(countLabel.mas_right);
- // make.height.mas_equalTo(12);
- // }];
- //
- // countLabel1.font = [UIFont systemFontOfSize:12];
- // countLabel1.textColor = HexColorFromRGB(0xFFB800);
- // //好评率
- //
- //
- // UILabel *goodPJLabel = [UILabel new];
- // self.youpaipgoodPJLabel = goodPJLabel;
- // [self.contentView addSubview:goodPJLabel];
- // [goodPJLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.mas_equalTo(countLabel);
- // make.top.mas_equalTo(countLabel.mas_bottom).offset(5);;
- // }];
-
-
-
- UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
- flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
- self.youpaipcollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
- [self.contentView addSubview:self.youpaipcollectionView];
-
- [self.youpaipcollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(titleView.mas_bottom).offset(0);
- make.left.mas_offset(12.f);
- make.right.mas_offset(-12.f);
- make.bottom.mas_offset(0.f);
- }];
-
-
-
- // self.collectionView.userInteractionEnabled = NO;
- self.youpaipcollectionView.backgroundColor = LCWhiteColor;
- self.youpaipcollectionView.showsVerticalScrollIndicator = NO;
- self.youpaipcollectionView.showsHorizontalScrollIndicator = NO;
- self.youpaipcollectionView.bounces = NO;
- self.youpaipcollectionView.scrollEnabled = NO;
- self.youpaipcollectionView.delegate = self;
- self.youpaipcollectionView.dataSource = self;
-
- [self.youpaipcollectionView registerClass:[YOUPAILZLabelCollectionCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAILZLabelCollectionCell class])];
-
-
-
- }
- -(void)setYoupaipmodel:(YOUPAILCUserShowModel *)model{
- _youpaipmodel = model;
-
- // if (model.youpaipskill_list.count>0) {
- // YOUPAILCSkillModel *skillModel = model.youpaipskill_list.firstObject;
- //
- // if (model.youpaiporder_switch == 2) {
- // self.youpaipcountLabel.attributedText = [LCTools setRichTextWithTitle:@"视频接通率:" subTitle:[NSString stringWithFormat:@"%@",skillModel.youpaiprate] titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFB800) titleFontSize:12 subTitleFontSize:12];
- // self.youpaipcountLabel1.text = [NSString stringWithFormat:@"(接通%ld次)",(long)skillModel.youpaipservice_count];
- // }else{
- // self.youpaipcountLabel.attributedText = [LCTools setRichTextWithTitle:@"视频接通率:" subTitle:@"" titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFB800) titleFontSize:12 subTitleFontSize:12];
- // self.youpaipcountLabel1.text = @"";
- // self.youpaipcountLabel.hidden = YES;
- // self.youpaipcountLabel1.hidden = YES;
- //
- //
- //
- // }
- //
- //
- // }
- // if (model.youpaipevaluate&&model.youpaiporder_switch == 2) {
- // self.youpaipgoodPJLabel.attributedText = [LCTools setRichTextWithTitle:@"好评率:" subTitle:model.youpaipevaluate titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFB800) titleFontSize:12 subTitleFontSize:12];
- //
- // [self.youpaipcollectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.top.mas_equalTo(self.youpaipgoodPJLabel.mas_bottom).offset(5);
- // make.left.mas_offset(14.f);
- // make.right.mas_offset(-14.f);
- // make.bottom.mas_offset(0.f);
- // }];
- // }else if(model.youpaipevaluate &&model.youpaiporder_switch != 2){
- // self.youpaipcountLabel.hidden = YES;
- // self.youpaipcountLabel1.hidden = YES;
- // [self.youpaipgoodPJLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.top.mas_equalTo(self.youpaiptitleView.mas_bottom).offset(5);
- // make.left.mas_equalTo(14);
- // make.height.mas_equalTo(12);
- // }];
- // [self.youpaipcollectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.top.mas_equalTo(self.youpaipgoodPJLabel.mas_bottom).offset(5);
- // make.left.mas_offset(14.f);
- // make.right.mas_offset(-14.f);
- // make.bottom.mas_offset(0.f);
- // }];
- // self.youpaipgoodPJLabel.attributedText = [LCTools setRichTextWithTitle:@"好评率:" subTitle:model.youpaipevaluate titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFB800) titleFontSize:12 subTitleFontSize:12];
- //
- // }else if (!model.youpaipevaluate &&model.youpaiporder_switch == 2){
- // self.youpaipgoodPJLabel.hidden = YES;
- // }else{
- // self.youpaipgoodPJLabel.hidden = YES;
- // }
-
- }
- -(void)setYoupaiplabelArray:(NSArray *)labelArray{
- _youpaiplabelArray = labelArray;
-
-
-
- }
- #pragma mark <UICollectionViewDataSource>
- /**
- 返回区数
-
- @param collectionView 集合视图
- @return 返回区数
- */
- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
- return 1;
- }
- /**
- 返回项目数
-
- @param collectionView 集合视图
- @param section 区
- @return 项目数
- */
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
-
-
- return self.youpaiplabelArray.count;
- }
- -(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
-
- YOUPAILZLabelCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAILZLabelCollectionCell class]) forIndexPath:indexPath];
- YOUPAIZYLabelModel *model = _youpaiplabelArray[indexPath.row];
- model.youpaipisSelect = YES;
- [cell youpaifreloadWithModel:model];
- return cell;
- }
- #pragma mark UICollectionViewDelegateFlowLayout
- /**
- 项目大小
-
- @param collectionView 集合视图
- @param collectionViewLayout 布局
- @param indexPath 布局
- @return 大小
- */
- #pragma mark - item宽高
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
- YOUPAIZYLabelModel *model = _youpaiplabelArray[indexPath.row];
- NSString *str = [NSString stringWithFormat:@"%@",model.youpaipname];
- CGRect rect = [str boundingRectWithSize:CGSizeMake(KScreenWidth,20) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName :LCFont(12)} context:nil];
- return CGSizeMake(rect.size.width + 24 ,24.5);
- }
- #pragma mark - X间距
- - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
- return 9.0;
- }
- #pragma mark - Y间距
- - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
- return 9.0;
- }
- //设置段落的内边距
- - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
- {
- return UIEdgeInsetsMake(0,0,0,0);//UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right)
- }
- -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
- {
- YOUPAIZYLabelModel *model = _youpaiplabelArray[indexPath.row];
- [self.youpaipdelegate youpaifclickLabel:model];
- }
- @end
|