ReviewsTableHearV.m 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. // ReviewsTableHearV.m
  3. // Asteria
  4. //
  5. // Created by 王猛 on 2024/1/6.
  6. //
  7. #import "ReviewsTableHearV.h"
  8. #import "HCSStarRatingView.h"
  9. #import "GoodsInformationM.h"
  10. @interface ReviewsTableHearV ()
  11. @property (nonatomic, strong) UILabel *customLab;
  12. @property (nonatomic, strong) QMUILabel *reviewsLab;
  13. @property (nonatomic, strong) HCSStarRatingView *reviews_startV;
  14. @property (nonatomic, strong) QMUIButton *writeBtn;
  15. @property (nonatomic, strong) QMUILabel *tipsLab;
  16. @end
  17. @implementation ReviewsTableHearV
  18. +(CGFloat)xxx_viewHeight{
  19. return 10+86+10+34+40;
  20. }
  21. - (void)tt_setupViews{
  22. UIView *topBgV = [[UIView alloc]init];
  23. topBgV.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
  24. topBgV.layer.cornerRadius = 8;
  25. topBgV.clipsToBounds = YES;
  26. [self addSubview:topBgV];
  27. [topBgV addSubview:self.customLab];
  28. [topBgV addSubview:self.reviewsLab];
  29. [topBgV addSubview:self.reviews_startV];
  30. [topBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.left.mas_equalTo(10);
  32. make.right.mas_equalTo(-10);
  33. make.top.mas_equalTo(10);
  34. make.height.mas_equalTo(86);
  35. }];
  36. [self.customLab mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.left.mas_equalTo(10);
  38. make.top.mas_equalTo(20);
  39. make.height.mas_equalTo(15);
  40. }];
  41. [self.reviewsLab mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.equalTo(self.customLab.mas_right);
  43. make.top.mas_equalTo(20);
  44. make.height.mas_equalTo(15);
  45. }];
  46. [self.reviews_startV mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.left.mas_equalTo(10);
  48. make.top.equalTo(self.reviewsLab.mas_bottom).offset(10);
  49. make.height.mas_equalTo(20);
  50. make.width.mas_equalTo(120);
  51. }];
  52. [self addSubview:self.writeBtn];
  53. [self addSubview:self.tipsLab];
  54. [self.writeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.top.equalTo(topBgV.mas_bottom).offset(10);
  56. make.left.mas_equalTo(10);
  57. make.height.mas_equalTo(34);
  58. make.width.mas_equalTo(105);
  59. }];
  60. [self.tipsLab mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.top.equalTo(self.writeBtn.mas_bottom);
  62. make.left.mas_equalTo(20);
  63. make.right.mas_equalTo(-20);
  64. //40;
  65. }];
  66. }
  67. - (void)tt_confignewdata:(id)data{
  68. GoodsInformationM *model = (GoodsInformationM *)data;
  69. self.reviewsLab.text = [NSString stringWithFormat:@"(%@ Reviews)",model.review_nums];
  70. }
  71. #pragma mark - **************** handle ****************
  72. -(void)handle_writeEvent:(UIButton *)btn{
  73. [self generaltriggermethodType:0 data:@""];
  74. }
  75. - (UILabel *)customLab {
  76. if (!_customLab) {
  77. _customLab = [[UILabel alloc] initWithFrame:CGRectZero];
  78. _customLab.textAlignment = NSTextAlignmentLeft;
  79. _customLab.textColor = [UIColor blackColor];
  80. _customLab.font = [UIFont fontWithName:Rob_Bold size:12];
  81. _customLab.text = @"CUSTOMER REVIEWS";
  82. }
  83. return _customLab;
  84. }
  85. - (QMUILabel *)reviewsLab {
  86. if (!_reviewsLab) {
  87. _reviewsLab = [[QMUILabel alloc] initWithFrame:CGRectZero];
  88. _reviewsLab.textAlignment = NSTextAlignmentLeft;
  89. _reviewsLab.textColor = [UIColor colorWithHexString:@"#666666"];
  90. _reviewsLab.font = [UIFont fontWithName:Rob_Regular size:12];
  91. }
  92. return _reviewsLab;
  93. }
  94. -(HCSStarRatingView *)reviews_startV{
  95. if(!_reviews_startV){
  96. _reviews_startV = [[HCSStarRatingView alloc]initWithFrame:CGRectMake(10, 20,100+20, 30)];
  97. _reviews_startV.value =5;
  98. _reviews_startV.userInteractionEnabled = NO;
  99. _reviews_startV.filledStarImage = IMAGE(@"reviews_full_star");
  100. _reviews_startV.emptyStarImage = IMAGE(@"reviews_empty_star");
  101. _reviews_startV.maximumValue = 5;
  102. _reviews_startV.backgroundColor = [UIColor clearColor];
  103. }
  104. return _reviews_startV;
  105. }
  106. - (QMUIButton *)writeBtn {
  107. if (!_writeBtn) {
  108. _writeBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  109. NSMutableAttributedString *atr = [[NSMutableAttributedString alloc]initWithString:@"WRITE A REVIEW"];
  110. atr.underlineStyle = NSUnderlineStyleSingle;
  111. [_writeBtn setAttributedTitle:atr forState:UIControlStateNormal];
  112. [_writeBtn addTarget:self action:@selector(handle_writeEvent:) forControlEvents:UIControlEventTouchUpInside];
  113. _writeBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:12];
  114. _writeBtn.titleLabel.textColor = [UIColor colorWithHexString:@"#000000"];
  115. _writeBtn.frame = CGRectMake(10, 0, 105, 40);
  116. }
  117. return _writeBtn;
  118. }
  119. - (QMUILabel *)tipsLab {
  120. if (!_tipsLab) {
  121. _tipsLab = [[QMUILabel alloc] initWithFrame:CGRectZero];
  122. _tipsLab.textAlignment = NSTextAlignmentLeft;
  123. _tipsLab.textColor = [UIColor colorWithHexString:@"#666666"];
  124. _tipsLab.font = [UIFont fontWithName:Rob_Regular size:12];
  125. _tipsLab.text = @"Only Registered Users Can Write Reviews.Please,Log In Or Register";
  126. _tipsLab.numberOfLines =2;
  127. }
  128. return _tipsLab;
  129. }
  130. @end