// // ReviewsTableHearV.m // Asteria // // Created by 王猛 on 2024/1/6. // #import "ReviewsTableHearV.h" #import "HCSStarRatingView.h" #import "GoodsInformationM.h" @interface ReviewsTableHearV () @property (nonatomic, strong) UILabel *customLab; @property (nonatomic, strong) QMUILabel *reviewsLab; @property (nonatomic, strong) HCSStarRatingView *reviews_startV; @property (nonatomic, strong) QMUIButton *writeBtn; @property (nonatomic, strong) QMUILabel *tipsLab; @end @implementation ReviewsTableHearV +(CGFloat)xxx_viewHeight{ return 10+86+10+34+40; } - (void)tt_setupViews{ UIView *topBgV = [[UIView alloc]init]; topBgV.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"]; topBgV.layer.cornerRadius = 8; topBgV.clipsToBounds = YES; [self addSubview:topBgV]; [topBgV addSubview:self.customLab]; [topBgV addSubview:self.reviewsLab]; [topBgV addSubview:self.reviews_startV]; [topBgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.right.mas_equalTo(-10); make.top.mas_equalTo(10); make.height.mas_equalTo(86); }]; [self.customLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.mas_equalTo(20); make.height.mas_equalTo(15); }]; [self.reviewsLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.customLab.mas_right); make.top.mas_equalTo(20); make.height.mas_equalTo(15); }]; [self.reviews_startV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.equalTo(self.reviewsLab.mas_bottom).offset(10); make.height.mas_equalTo(20); make.width.mas_equalTo(120); }]; [self addSubview:self.writeBtn]; [self addSubview:self.tipsLab]; [self.writeBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(topBgV.mas_bottom).offset(10); make.left.mas_equalTo(10); make.height.mas_equalTo(34); make.width.mas_equalTo(105); }]; [self.tipsLab mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.writeBtn.mas_bottom); make.left.mas_equalTo(20); make.right.mas_equalTo(-20); //40; }]; } - (void)tt_confignewdata:(id)data{ GoodsInformationM *model = (GoodsInformationM *)data; self.reviewsLab.text = [NSString stringWithFormat:@"(%@ Reviews)",model.review_nums]; } #pragma mark - **************** handle **************** -(void)handle_writeEvent:(UIButton *)btn{ [self generaltriggermethodType:0 data:@""]; } - (UILabel *)customLab { if (!_customLab) { _customLab = [[UILabel alloc] initWithFrame:CGRectZero]; _customLab.textAlignment = NSTextAlignmentLeft; _customLab.textColor = [UIColor blackColor]; _customLab.font = [UIFont fontWithName:Rob_Bold size:12]; _customLab.text = @"CUSTOMER REVIEWS"; } return _customLab; } - (QMUILabel *)reviewsLab { if (!_reviewsLab) { _reviewsLab = [[QMUILabel alloc] initWithFrame:CGRectZero]; _reviewsLab.textAlignment = NSTextAlignmentLeft; _reviewsLab.textColor = [UIColor colorWithHexString:@"#666666"]; _reviewsLab.font = [UIFont fontWithName:Rob_Regular size:12]; } return _reviewsLab; } -(HCSStarRatingView *)reviews_startV{ if(!_reviews_startV){ _reviews_startV = [[HCSStarRatingView alloc]initWithFrame:CGRectMake(10, 20,100+20, 30)]; _reviews_startV.value =5; _reviews_startV.userInteractionEnabled = NO; _reviews_startV.filledStarImage = IMAGE(@"reviews_full_star"); _reviews_startV.emptyStarImage = IMAGE(@"reviews_empty_star"); _reviews_startV.maximumValue = 5; _reviews_startV.backgroundColor = [UIColor clearColor]; } return _reviews_startV; } - (QMUIButton *)writeBtn { if (!_writeBtn) { _writeBtn = [QMUIButton buttonWithType:UIButtonTypeCustom]; NSMutableAttributedString *atr = [[NSMutableAttributedString alloc]initWithString:@"WRITE A REVIEW"]; atr.underlineStyle = NSUnderlineStyleSingle; [_writeBtn setAttributedTitle:atr forState:UIControlStateNormal]; [_writeBtn addTarget:self action:@selector(handle_writeEvent:) forControlEvents:UIControlEventTouchUpInside]; _writeBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:12]; _writeBtn.titleLabel.textColor = [UIColor colorWithHexString:@"#000000"]; _writeBtn.frame = CGRectMake(10, 0, 105, 40); } return _writeBtn; } - (QMUILabel *)tipsLab { if (!_tipsLab) { _tipsLab = [[QMUILabel alloc] initWithFrame:CGRectZero]; _tipsLab.textAlignment = NSTextAlignmentLeft; _tipsLab.textColor = [UIColor colorWithHexString:@"#666666"]; _tipsLab.font = [UIFont fontWithName:Rob_Regular size:12]; _tipsLab.text = @"Only Registered Users Can Write Reviews.Please,Log In Or Register"; _tipsLab.numberOfLines =2; } return _tipsLab; } @end